windows mobile - Help me C# code backup/recover & Search contacts on WindowsMobile? -
hi studying programming on windows mobile. , build mini program "manage contacts" functions: add, edit, delete, search , sort group. don't know how complete function : search , backup/recovery contacts! can me?
description search function: create textbox , listbox, when press word on textbox, name of contacts containing word display on listbox! can me?
this demo, convert , repair example of windows mobile 5.0
this form main, , picture main form here : http://3.bp.blogspot.com/-lmmkcf6-req/tcqwnk9kgdi/aaaaaaaaab4/-eis3mimhy0/s320/main.jpg
using system; using system.drawing; using system.collections; using system.windows.forms; using system.data; using microsoft.windowsmobile.pocketoutlook; using microsoft.windowsmobile.telephony; namespace managercontacts { /// <summary> /// summary description form1. /// </summary> public class contactselector : system.windows.forms.form { private system.windows.forms.listbox listbox1; private outlooksession outlooksession; private system.windows.forms.textbox smstext; //private system.windows.forms.button btncallwork; private system.windows.forms.button btnedit; private system.windows.forms.button btnnew; private system.windows.forms.button btnsendsms; private button bntdel; private textbox textbox1; private picturebox picturebox1; private button button2; private button bntbackup; private picturebox picturebox; private contact contacttoselect; // // constructor // public contactselector() { this.outlooksession = new outlooksession(); this.initializecomponent(); this.initializelistbox(); } /// <summary> /// function displays dialog lets user pick contact list or /// create new contact. /// </summary> /// <returns>the function returns contact chosen or new contact object if user pressed "new" on dialog.</returns> public contact select() { this.showdialog(); return this.contacttoselect; } // clean resources being used. protected override void dispose( bool disposing ) { base.dispose( disposing ); } #region windows form designer generated code private void initializecomponent() { system.componentmodel.componentresourcemanager resources = new system.componentmodel.componentresourcemanager(typeof(contactselector)); this.btnedit = new system.windows.forms.button(); this.listbox1 = new system.windows.forms.listbox(); this.btnnew = new system.windows.forms.button(); this.btnsendsms = new system.windows.forms.button(); this.smstext = new system.windows.forms.textbox(); this.bntdel = new system.windows.forms.button(); this.textbox1 = new system.windows.forms.textbox(); this.picturebox1 = new system.windows.forms.picturebox(); this.button2 = new system.windows.forms.button(); this.bntbackup = new system.windows.forms.button(); this.picturebox = new system.windows.forms.picturebox(); this.suspendlayout(); // // btnedit // this.btnedit.location = new system.drawing.point(152, 70); this.btnedit.name = "btnedit"; this.btnedit.size = new system.drawing.size(79, 24); this.btnedit.tabindex = 7; this.btnedit.text = "edit contact"; this.btnedit.click += new system.eventhandler(this.editbutton_click); // // listbox1 // this.listbox1.location = new system.drawing.point(10, 32); this.listbox1.name = "listbox1"; this.listbox1.size = new system.drawing.size(136, 198); this.listbox1.tabindex = 6; // // btnnew // this.btnnew.location = new system.drawing.point(152, 40); this.btnnew.name = "btnnew"; this.btnnew.size = new system.drawing.size(79, 24); this.btnnew.tabindex = 5; this.btnnew.text = "add contact"; this.btnnew.click += new system.eventhandler(this.newbutton_click); // // btnsendsms // this.btnsendsms.location = new system.drawing.point(201, 240); this.btnsendsms.name = "btnsendsms"; this.btnsendsms.size = new system.drawing.size(36, 24); this.btnsendsms.tabindex = 4; this.btnsendsms.text = "sms"; this.btnsendsms.click += new system.eventhandler(this.sendsmsbutton_click); // // smstext // this.smstext.location = new system.drawing.point(10, 240); this.smstext.name = "smstext"; this.smstext.size = new system.drawing.size(188, 21); this.smstext.tabindex = 3; this.smstext.text = "write sms text here."; // // bntdel // this.bntdel.location = new system.drawing.point(152, 100); this.bntdel.name = "bntdel"; this.bntdel.size = new system.drawing.size(79, 24); this.bntdel.tabindex = 8; this.bntdel.text = "del contact"; this.bntdel.click += new system.eventhandler(this.bntdel_click); // // textbox1 // this.textbox1.location = new system.drawing.point(43, 5); this.textbox1.name = "textbox1"; this.textbox1.size = new system.drawing.size(188, 21); this.textbox1.tabindex = 9; this.textbox1.text = "search"; // // picturebox1 // this.picturebox1.image = ((system.drawing.image)(resources.getobject("picturebox1.image"))); this.picturebox1.location = new system.drawing.point(10, 5); this.picturebox1.name = "picturebox1"; this.picturebox1.size = new system.drawing.size(24, 24); this.picturebox1.sizemode = system.windows.forms.pictureboxsizemode.centerimage; // // button2 // this.button2.location = new system.drawing.point(158, 267); this.button2.name = "button2"; this.button2.size = new system.drawing.size(79, 24); this.button2.tabindex = 13; this.button2.text = "exit"; this.button2.click += new system.eventhandler(this.button2_click); // // bntbackup // this.bntbackup.location = new system.drawing.point(10, 266); this.bntbackup.name = "bntbackup"; this.bntbackup.size = new system.drawing.size(142, 27); this.bntbackup.tabindex = 15; this.bntbackup.text = "backup , recovery"; this.bntbackup.click += new system.eventhandler(this.bntbackup_click); // // picturebox // this.picturebox.image = ((system.drawing.image)(resources.getobject("picturebox.image"))); this.picturebox.location = new system.drawing.point(152, 130); this.picturebox.name = "picturebox"; this.picturebox.size = new system.drawing.size(85, 83); this.picturebox.click += new system.eventhandler(this.picturebox_click); // // contactselector // this.autoscalemode = system.windows.forms.autoscalemode.inherit; this.backcolor = system.drawing.color.fromargb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.clientsize = new system.drawing.size(240, 296); this.controls.add(this.picturebox); this.controls.add(this.bntbackup); this.controls.add(this.button2); this.controls.add(this.picturebox1); this.controls.add(this.textbox1); this.controls.add(this.bntdel); this.controls.add(this.smstext); this.controls.add(this.btnsendsms); this.controls.add(this.btnnew); this.controls.add(this.listbox1); this.controls.add(this.btnedit); this.keypreview = true; this.name = "contactselector"; this.text = "contact selector"; this.resumelayout(false); } private void initializelistbox() { this.listbox1.datasource = null; this.listbox1.datasource = this.outlooksession.contacts.items; this.listbox1.displaymember = "fileas"; this.listbox1.valuemember = "itemid"; } #endregion static void main() { application.run(new contactselector()); } private void newbutton_click(object sender, system.eventargs e) { // add contact contacts folder. // update once information has been entered. contacttoselect = new contact(); this.outlooksession.contacts.items.add(contacttoselect); // edit newly created contact. contacteditor contactdialog = new contacteditor(); contactdialog.edit(ref contacttoselect); this.initializelistbox(); } private void editbutton_click(object sender, system.eventargs e) { if (this.listbox1.selecteditem != null) { contacttoselect = (contact)this.listbox1.selecteditem; } contacteditor contactdialog = new contacteditor(); contactdialog.edit(ref contacttoselect); } private void sendsmsbutton_click(object sender, system.eventargs e) { try { contacttoselect = (contact)this.listbox1.selecteditem; if (outlooksession.smsaccount == null) throw new argumentexception("the account not initialized"); messagebox.show("transport:"+outlooksession.smsaccount.name); smsmessage s = new smsmessage(contacttoselect.mobiletelephonenumber, this.smstext.text); s.body = this.smstext.text; //create input. s.send(); } catch (nullreferenceexception except) { messagebox.show(except.tostring()); } } private void bntdel_click(object sender, eventargs e) { contacttoselect = (contact)this.listbox1.selecteditem; contacttoselect.delete(); } private void button2_click(object sender, eventargs e) { application.exit(); } private void bntbackup_click(object sender, eventargs e) { mainform br = new mainform(); br.show(); } private void picturebox_click(object sender, eventargs e) { /* * contacttoselect = (contact)this.listbox1.selecteditem; phone p = new phone(); p.talk(contacttoselect.mobiletelephonenumber); */ } } }
thank much!
your statement broad, , agree iabstract, not download .rar file.
you may able search having user enter query textbox , click button. compare textbox string dictionary created on application load. dictionary contain name , data let navigate selected contact.
private void button_click(object sender, eventargs e) { if (mydict.containskey(textbox1.text)) { string contact = mydict[textbox1.text]; //i dont know how store //the navigation info. here string // //navigate relevant contact // } else { // //return no contacts found // }
i didn't compile code, if sees got wrong, comment , fix.
Comments
Post a Comment