public void addContactTest() { // ContactsStore.getInstance().addContact("dummyMac",new Contact(){mac = "dummyMac",name = "Dummy name dummer"}); ContactsStore.getInstance().addContact("dummyMac2", new Contact() { mac = "dummyMac2", name = "Dummy name dummer 2nd" }); }
public UserSettings(MainForm mf) { InitializeComponent(); myProfile = ContactsStore.getInstance().getMyProfile(); loadExistingProfile(); loadExistingHotspotSettings(); loadExistingKeySettings(); mainForm = mf; }
public static void updateMyContactsFile(ContactsStore cs) { System.IO.Directory.CreateDirectory("Contacts"); IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(contactsFileLocation, FileMode.Create, FileAccess.Write, FileShare.None); formatter.Serialize(stream, cs); stream.Close(); }
private void saveChangesBtn_Click_1(object sender, EventArgs e) { string name = nameText.Text; string displayProfile = dp; ContactsStore.getInstance().updateMyProfile(ContactBuilder.GetMacAddress(), name, dp); mainForm.setMyProfileDetails(); mainForm.backPic_Click(sender, e); }
public void updateMyContactsFileTest() { var cs = ContactsStore.getInstance(); cs.addContact("testMac", new Contact() { mac = "testMac", name = "siripala serializer" }); StorageHandler.updateMyContactsFile(cs); }
private MainForm() { InitializeComponent(); serverRunningPic.Visible = false; setDependentObjects(); setMyIp(); myIpLabel.Focus(); myProfile = ContactsStore.getInstance().getMyProfile(); setMyProfileDetails(); }
public void getContactTest() { var cont = ContactsStore.getInstance().getContact("dummyMac2"); Console.WriteLine(""); if (cont == null) { Console.WriteLine("No contact found"); } else { Console.WriteLine("mac: " + cont.mac + "\nname: " + cont.name); } }
public void setMyProfileDetails() { myProfile = ContactsStore.getInstance().getMyProfile(); if (File.Exists(myProfile.displayProfile)) { userPic.Image = Image.FromFile(myProfile.displayProfile); } userNameLabel.Text = myProfile.name; userNameLabel.Left = 795 - userNameLabel.Size.Width; userPic.Left = 795 - userNameLabel.Size.Width - 36 - 7; serverRunningPic.Left = userPic.Left - (36 + 14); }
public static ContactsStore getContactsStore() { if (doesContactsFileExistInDerectory()) { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(contactsFileLocation, FileMode.Open, FileAccess.Read, FileShare.Read); ContactsStore cs = (ContactsStore)formatter.Deserialize(stream); stream.Close(); return(cs); } Console.WriteLine("Contacts file not found"); return(null); }
private void pictureBox1_Click(object sender, EventArgs e) { ContactsStore.getInstance().renameAndSendMyPic(); }
public ContactsController() { this.store = new ContactsStore(); }