ا سلام من می خوام یه لیست مخاطبین برای گوشی خودم درست کنم
این کار هم انجام میدم
ولی شماره های مخاطبین رو برام نمیاره فقط اسمشون رو میاره
چیکار کنم
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim myContactMap As Map
Dim myContactList As List
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private sms1 As PhoneSms
Private sms2 As PhoneSms
Dim lvContact As ListView
Dim lvLabel1, lvLabel2 As Label
Dim lblTitel As Label
Dim pnlTitel,pnlStatusleiste As Panel
Dim lblname As Label
'Variablen für Rufnummerauswahl
Dim cd As CustomDialog2
Dim spnRufnummerauswahl As Spinner
Dim lblRufnummerauswahl As Label
Dim pnlRufnummerauswahl As Panel
Dim imgPhoto As ImageView
'Variablen für Kontakte
Dim fgContacts1 As fgContacts
Dim fgContact1 As fgContact
Dim listOfContacts As List
Dim imgDefault As Bitmap
Dim blSortModusOld As Boolean
Dim phone1 As Phone
Type kontakt(Name As String,Nachname As String,IsValidName As Boolean,DisplayName As String,Number As String,foto As Bitmap,index As Int)
Private ETmobile As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("frmMain")
ETmobile.Text = "09395050393"
ETmobile.Visible = False
phone1.SetScreenOrientation(-1)
fgContacts1.Initialize
imgDefault=LoadBitmap(File.DirAssets,"ic_menu_cc.png")
If FirstTime Then
myContactMap.Initialize
myContactList.Initialize
listOfContacts.Initialize
RefreschKontakts("")
End If
End Sub
Sub Setup_lvContactTextSize
SetupListview(lvContact)
Dim kontakts As kontakt
kontakts.Initialize
If myContactMap.IsInitialized Then
Dim bAddContact As Boolean
Dim name As String
For i = 0 To myContactList.Size - 1
kontakts = myContactMap.Get(myContactList.Get(i))
If kontakts.foto=Null Then
lvContact.AddTwoLinesAndBitmap2(kontakts.DisplayName, kontakts.Number, imgDefault, kontakts.index)
Else
lvContact.AddTwoLinesAndBitmap2(kontakts.DisplayName, kontakts.Number, kontakts.foto, kontakts.index)
End If
Next
End If
End Sub
Sub SetupListview(lv As ListView)
lv.Color=Colors.White
lv.FastScrollEnabled = True
lv.ScrollingBackgroundColor= Colors.Transparent
lvLabel1=lv.TwoLinesAndBitmap.Label
lvLabel2=lv.TwoLinesAndBitmap.SecondLabel
lv.TwoLinesAndBitmap.ImageView.Width = 51dip
lv.TwoLinesAndBitmap.ImageView.Height =51dip
lv.TwoLinesAndBitmap.ImageView.Left=2dip
lv.TwoLinesAndBitmap.ImageView.Top=2dip
lv.TwoLinesAndBitmap.ItemHeight=55dip
lvLabel1.Left=60dip
lvLabel2.Left=60dip
lvLabel1.Typeface=Typeface.DEFAULT_BOLD
lvLabel1.Gravity = Gravity.LEFT + Gravity.CENTER_VERTICAL
lvLabel1.TextColor=Colors.Black
lvLabel2.Gravity = Gravity.LEFT + Gravity.CENTER_VERTICAL
lvLabel2.TextColor=Colors.Black
lvLabel1.Top=2dip
lvLabel1.Width= Activity.Width - lvLabel1.Left
lvLabel1.Height=24dip
lvLabel1.TextSize=18
lvLabel2.Top=28dip
lvLabel2.Width= Activity.Width - lvLabel2.Left
lvLabel2.Height=20dip
lvLabel2.TextSize=16
End Sub
Sub Activity_Resume
If myContactMap.Size > 0 And myContactList.Size > 0 Then
Setup_lvContactTextSize
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub RefreschKontakts(Sort As String)
Dim strDisplayName As String
Dim dsplname As String
phone1.SetScreenOrientation(1)
ProgressDialogShow("Bitte warten...")
DoEvents
myContactMap.Clear
myContactList.Clear
listOfContacts=fgContacts1.GetAllContacts(True, False)
Dim IsValid As Boolean
For i = 0 To listOfContacts.Size - 1
fgContact1=listOfContacts.Get(i)
strDisplayName= fgContact1.FamilyName & " " & fgContact1.GivenName
IsValid=True
If strDisplayName.Length<>fgContact1.DisplayName.Replace(",","").Length Then
strDisplayName=fgContact1.DisplayName
IsValid=False
End If
If myContactList.IndexOf(strDisplayName)=-1 Then
Dim kontakts As kontakt
kontakts.Initialize
kontakts.index=fgContact1.Id
kontakts.Name=fgContact1.GivenName
kontakts.Nachname=fgContact1.FamilyName
kontakts.DisplayName=strDisplayName
kontakts.Number=fgContact1.PhoneNumber
kontakts.IsValidName=IsValid
If fgContact1.Photo<>Null Then
kontakts.foto=fgContact1.Photo
'Log("Name: " &strDisplayName & " ; W x H=" & kontakts.foto.Width & "x" & kontakts.foto.Height)
Else
kontakts.foto=imgDefault
End If
myContactList.Add(strDisplayName)
myContactMap.Put(strDisplayName, kontakts)
End If
If (i Mod 20)=0 Then
DoEvents
End If
Next
myContactList.Sort(True)
phone1.SetScreenOrientation(-1)
ProgressDialogHide
End Sub
Sub getKontakt(index As Int) As kontakt
Dim IsValid As Boolean
Dim kontakts As kontakt
kontakts.Initialize
For i = 0 To myContactList.Size - 1
kontakts = myContactMap.Get(myContactList.Get(i))
If kontakts.index=index Then
Exit
End If
Next
Return kontakts
End Sub
Sub lvContact_ItemClick (Position As Int, Value As Object)
Dim p As PhoneCalls
Dim map2 As Map
Dim ret As Int
Dim kontakts As kontakt
kontakts.Initialize
kontakts=getKontakt(Value)
pnlRufnummerauswahl.Initialize("")
lblRufnummerauswahl.Initialize("")
' spnRufnummerauswahl.Initialize("")
lblname.Initialize("")
imgPhoto.Initialize("")
imgPhoto.Gravity=Gravity.FILL
lblRufnummerauswahl.TextSize=26
lblRufnummerauswahl.Gravity=Gravity.CENTER_HORIZONTAL + Gravity.TOP
lblname.TextSize = 26
lblname.Gravity = Gravity.CENTER_HORIZONTAL + Gravity.TOP
' spnRufnummerauswahl.TextSize=24
pnlRufnummerauswahl.AddView(lblRufnummerauswahl,80dip,5dip,195dip,70dip)
pnlRufnummerauswahl.AddView(lblname,5dip,85dip,270dip,50dip)
' pnlRufnummerauswahl.AddView(spnRufnummerauswahl,5dip,85dip,270dip,50dip)
pnlRufnummerauswahl.AddView(imgPhoto,5dip,5dip,70dip,70dip)
' spnRufnummerauswahl.AddAll(GetAllPhoneNumber(kontakts.Nachname))
' spnRufnummerauswahl.SelectedIndex=0
lblRufnummerauswahl.Text=kontakts.DisplayName
lblname.Text = kontakts.Number
imgPhoto.Bitmap=kontakts.foto
cd.AddView(pnlRufnummerauswahl, 280dip,140dip)
ret=cd.Show("آیا از انتخاب این مخاطب مطمئن هستید ؟","بله","خیر","",Null)
If ret = DialogResponse.POSITIVE Then
' StartActivity(p.Call(spnRufnummerauswahl.SelectedItem))
Dim ersal1 As HttpJob
ersal1.Initialize("ersal1", Me)
Dim send As String
send = "mobile=" &ETmobile.Text& "&mobile1=" &lblname.Text
ersal1.PostString("http://app.crmfg.org/poster/ersal5.php",send)
ProgressDialogShow("در حال ثبت اطلاعات...")
End If
End Sub
Sub JobDone (Job As HttpJob)
ProgressDialogHide
If Job.Success = True Then
Msgbox("پوستر ها به زودی ارسال می شوند","پیام سیستم")
If ETmobile.Text <>"" Then
sms1.Send(ETmobile.Text,"یک پوستر از جانب شما ارسال شد")
sms1.Send(ETmobile.Text,Job.GetString)
End If
If lblname.Text <>"" Then
sms2.Send(lblname.Text,Job.GetString)
sms2.Send(lblname.Text,"http://fater.bartar124.ir/app/CRMFG.apk")
End If
Else
Msgbox("خطا در برقراری ارتباط","پیام سیستم")
End If
End Sub
Sub GetAllPhoneNumber(index As Int) As List
Dim lstPhone As List
Dim fgContacts1 As fgContacts
fgContacts1.Initialize
lstPhone= fgContacts1.GetAllPhoneNumberByID(index)
Return lstPhone
End Sub
سوال
rezanaseri 6
ا سلام من می خوام یه لیست مخاطبین برای گوشی خودم درست کنم
این کار هم انجام میدم
ولی شماره های مخاطبین رو برام نمیاره فقط اسمشون رو میاره
چیکار کنم
Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. Dim myContactMap As Map Dim myContactList As List End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Private sms1 As PhoneSms Private sms2 As PhoneSms Dim lvContact As ListView Dim lvLabel1, lvLabel2 As Label Dim lblTitel As Label Dim pnlTitel,pnlStatusleiste As Panel Dim lblname As Label 'Variablen für Rufnummerauswahl Dim cd As CustomDialog2 Dim spnRufnummerauswahl As Spinner Dim lblRufnummerauswahl As Label Dim pnlRufnummerauswahl As Panel Dim imgPhoto As ImageView 'Variablen für Kontakte Dim fgContacts1 As fgContacts Dim fgContact1 As fgContact Dim listOfContacts As List Dim imgDefault As Bitmap Dim blSortModusOld As Boolean Dim phone1 As Phone Type kontakt(Name As String,Nachname As String,IsValidName As Boolean,DisplayName As String,Number As String,foto As Bitmap,index As Int) Private ETmobile As EditText End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("frmMain") ETmobile.Text = "09395050393" ETmobile.Visible = False phone1.SetScreenOrientation(-1) fgContacts1.Initialize imgDefault=LoadBitmap(File.DirAssets,"ic_menu_cc.png") If FirstTime Then myContactMap.Initialize myContactList.Initialize listOfContacts.Initialize RefreschKontakts("") End If End Sub Sub Setup_lvContactTextSize SetupListview(lvContact) Dim kontakts As kontakt kontakts.Initialize If myContactMap.IsInitialized Then Dim bAddContact As Boolean Dim name As String For i = 0 To myContactList.Size - 1 kontakts = myContactMap.Get(myContactList.Get(i)) If kontakts.foto=Null Then lvContact.AddTwoLinesAndBitmap2(kontakts.DisplayName, kontakts.Number, imgDefault, kontakts.index) Else lvContact.AddTwoLinesAndBitmap2(kontakts.DisplayName, kontakts.Number, kontakts.foto, kontakts.index) End If Next End If End Sub Sub SetupListview(lv As ListView) lv.Color=Colors.White lv.FastScrollEnabled = True lv.ScrollingBackgroundColor= Colors.Transparent lvLabel1=lv.TwoLinesAndBitmap.Label lvLabel2=lv.TwoLinesAndBitmap.SecondLabel lv.TwoLinesAndBitmap.ImageView.Width = 51dip lv.TwoLinesAndBitmap.ImageView.Height =51dip lv.TwoLinesAndBitmap.ImageView.Left=2dip lv.TwoLinesAndBitmap.ImageView.Top=2dip lv.TwoLinesAndBitmap.ItemHeight=55dip lvLabel1.Left=60dip lvLabel2.Left=60dip lvLabel1.Typeface=Typeface.DEFAULT_BOLD lvLabel1.Gravity = Gravity.LEFT + Gravity.CENTER_VERTICAL lvLabel1.TextColor=Colors.Black lvLabel2.Gravity = Gravity.LEFT + Gravity.CENTER_VERTICAL lvLabel2.TextColor=Colors.Black lvLabel1.Top=2dip lvLabel1.Width= Activity.Width - lvLabel1.Left lvLabel1.Height=24dip lvLabel1.TextSize=18 lvLabel2.Top=28dip lvLabel2.Width= Activity.Width - lvLabel2.Left lvLabel2.Height=20dip lvLabel2.TextSize=16 End Sub Sub Activity_Resume If myContactMap.Size > 0 And myContactList.Size > 0 Then Setup_lvContactTextSize End If End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub RefreschKontakts(Sort As String) Dim strDisplayName As String Dim dsplname As String phone1.SetScreenOrientation(1) ProgressDialogShow("Bitte warten...") DoEvents myContactMap.Clear myContactList.Clear listOfContacts=fgContacts1.GetAllContacts(True, False) Dim IsValid As Boolean For i = 0 To listOfContacts.Size - 1 fgContact1=listOfContacts.Get(i) strDisplayName= fgContact1.FamilyName & " " & fgContact1.GivenName IsValid=True If strDisplayName.Length<>fgContact1.DisplayName.Replace(",","").Length Then strDisplayName=fgContact1.DisplayName IsValid=False End If If myContactList.IndexOf(strDisplayName)=-1 Then Dim kontakts As kontakt kontakts.Initialize kontakts.index=fgContact1.Id kontakts.Name=fgContact1.GivenName kontakts.Nachname=fgContact1.FamilyName kontakts.DisplayName=strDisplayName kontakts.Number=fgContact1.PhoneNumber kontakts.IsValidName=IsValid If fgContact1.Photo<>Null Then kontakts.foto=fgContact1.Photo 'Log("Name: " &strDisplayName & " ; W x H=" & kontakts.foto.Width & "x" & kontakts.foto.Height) Else kontakts.foto=imgDefault End If myContactList.Add(strDisplayName) myContactMap.Put(strDisplayName, kontakts) End If If (i Mod 20)=0 Then DoEvents End If Next myContactList.Sort(True) phone1.SetScreenOrientation(-1) ProgressDialogHide End Sub Sub getKontakt(index As Int) As kontakt Dim IsValid As Boolean Dim kontakts As kontakt kontakts.Initialize For i = 0 To myContactList.Size - 1 kontakts = myContactMap.Get(myContactList.Get(i)) If kontakts.index=index Then Exit End If Next Return kontakts End Sub Sub lvContact_ItemClick (Position As Int, Value As Object) Dim p As PhoneCalls Dim map2 As Map Dim ret As Int Dim kontakts As kontakt kontakts.Initialize kontakts=getKontakt(Value) pnlRufnummerauswahl.Initialize("") lblRufnummerauswahl.Initialize("") ' spnRufnummerauswahl.Initialize("") lblname.Initialize("") imgPhoto.Initialize("") imgPhoto.Gravity=Gravity.FILL lblRufnummerauswahl.TextSize=26 lblRufnummerauswahl.Gravity=Gravity.CENTER_HORIZONTAL + Gravity.TOP lblname.TextSize = 26 lblname.Gravity = Gravity.CENTER_HORIZONTAL + Gravity.TOP ' spnRufnummerauswahl.TextSize=24 pnlRufnummerauswahl.AddView(lblRufnummerauswahl,80dip,5dip,195dip,70dip) pnlRufnummerauswahl.AddView(lblname,5dip,85dip,270dip,50dip) ' pnlRufnummerauswahl.AddView(spnRufnummerauswahl,5dip,85dip,270dip,50dip) pnlRufnummerauswahl.AddView(imgPhoto,5dip,5dip,70dip,70dip) ' spnRufnummerauswahl.AddAll(GetAllPhoneNumber(kontakts.Nachname)) ' spnRufnummerauswahl.SelectedIndex=0 lblRufnummerauswahl.Text=kontakts.DisplayName lblname.Text = kontakts.Number imgPhoto.Bitmap=kontakts.foto cd.AddView(pnlRufnummerauswahl, 280dip,140dip) ret=cd.Show("آیا از انتخاب این مخاطب مطمئن هستید ؟","بله","خیر","",Null) If ret = DialogResponse.POSITIVE Then ' StartActivity(p.Call(spnRufnummerauswahl.SelectedItem)) Dim ersal1 As HttpJob ersal1.Initialize("ersal1", Me) Dim send As String send = "mobile=" &ETmobile.Text& "&mobile1=" &lblname.Text ersal1.PostString("http://app.crmfg.org/poster/ersal5.php",send) ProgressDialogShow("در حال ثبت اطلاعات...") End If End Sub Sub JobDone (Job As HttpJob) ProgressDialogHide If Job.Success = True Then Msgbox("پوستر ها به زودی ارسال می شوند","پیام سیستم") If ETmobile.Text <>"" Then sms1.Send(ETmobile.Text,"یک پوستر از جانب شما ارسال شد") sms1.Send(ETmobile.Text,Job.GetString) End If If lblname.Text <>"" Then sms2.Send(lblname.Text,Job.GetString) sms2.Send(lblname.Text,"http://fater.bartar124.ir/app/CRMFG.apk") End If Else Msgbox("خطا در برقراری ارتباط","پیام سیستم") End If End Sub Sub GetAllPhoneNumber(index As Int) As List Dim lstPhone As List Dim fgContacts1 As fgContacts fgContacts1.Initialize lstPhone= fgContacts1.GetAllPhoneNumberByID(index) Return lstPhone End Sub
لینک ارسال
به اشتراک گذاری در سایت های دیگر
0 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.