Exemplo n.º 1
0
 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"
     });
 }
Exemplo n.º 2
0
 public UserSettings(MainForm mf)
 {
     InitializeComponent();
     myProfile = ContactsStore.getInstance().getMyProfile();
     loadExistingProfile();
     loadExistingHotspotSettings();
     loadExistingKeySettings();
     mainForm = mf;
 }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        public void updateMyContactsFileTest()
        {
            var cs = ContactsStore.getInstance();

            cs.addContact("testMac", new Contact()
            {
                mac = "testMac", name = "siripala serializer"
            });


            StorageHandler.updateMyContactsFile(cs);
        }
Exemplo n.º 6
0
        private MainForm()
        {
            InitializeComponent();
            serverRunningPic.Visible = false;
            setDependentObjects();

            setMyIp();
            myIpLabel.Focus();


            myProfile = ContactsStore.getInstance().getMyProfile();
            setMyProfileDetails();
        }
Exemplo n.º 7
0
        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);
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     ContactsStore.getInstance().renameAndSendMyPic();
 }
Exemplo n.º 11
0
 public ContactsController()
 {
     this.store = new ContactsStore();
 }