ادامه پست شماره 2:
در مورد ویندوز اپلیکیشن باید به این موارد توجه کرد:
1- در خصوصیات پروژه (Project Properties) و سربرگ Application گزینه Make single instance application باید فعال بشه، تا هر بار پارامترها به همون برنامه اجرا شده ارسال بشه و برنامه با پنجره مجزا اجرا نشه.
2- با استفاده از کلید View Application Events به بخش رویدادهای برنامه رفته و رویداد StartupNextInstance از برنامه رو انتخاب و این کد رو در اون رویداد به کار می گیرید(در سورس برنامه قابل دانلود موجود است.):
Partial Friend Class MyApplication
Dim ci As New Customer
Private Sub MyApplication_StartupNextInstance(sender As Object, e As Microsoft.VisualBasic.ApplicationServices.StartupN extInstanceEventArgs) Handles Me.StartupNextInstance
Dim Params() As String = e.CommandLine.ToArray
Dim Command(-1) As String
For i = 0 To Params.Length - 1
Command = Params(i).Split(":")
Select Case Command(0).ToLower
Case "/n", "/name" : ci.Name = Command(1)
Case "/f", "/family" : ci.Family = Command(1)
Case "/b", "/birthday" : ci.Birthday = Command(1)
Case "/m", "/mobile" : ci.Mobile = Command(1)
Case "/ph", "/phone" : ci.Phone = Command(1)
Case "/i", "/image" : ci.Image = Command(1)
End Select
Next
My.Forms.Form1.SetInfo(ci)
End Sub
End Class
همچنین برنامه ویندوز اپ یک فرم داره که توسط متود setInfo فیلدهای اون از جمله برچسب ها و جعبه تصویر پر می شه.
و برنامه یک کلاس با عنوان customer داره که برای پر کردن فیلدها از اون کلاس کمک گرفته می شه:
Public Class Customer
Private NameValue As String
Public Property Name() As String
Get
Return NameValue
End Get
Set(ByVal value As String)
NameValue = value
End Set
End Property
Private FamilyValue As String
Public Property Family() As String
Get
Return FamilyValue
End Get
Set(ByVal value As String)
FamilyValue = value
End Set
End Property
Private BirthdayValue As String
Public Property Birthday() As String
Get
Return BirthdayValue
End Get
Set(ByVal value As String)
BirthdayValue = value
End Set
End Property
Private MobileValue As String
Public Property Mobile() As String
Get
Return MobileValue
End Get
Set(ByVal value As String)
MobileValue = value
End Set
End Property
Private PhoneValue As String
Public Property Phone() As String
Get
Return PhoneValue
End Get
Set(ByVal value As String)
PhoneValue = value
End Set
End Property
Private ImageValue As String
Public Property Image() As String
Get
Return ImageValue
End Get
Set(ByVal value As String)
ImageValue = value
End Set
End Property
End Class
که همه اینها در سورس برنامه برای دانلود موجود هست:
DestinationApp(SourceCode).zip