示例#1
0
        void OpenProperties()
        {
            FRMWinClassicAddressBookNewContact abnc = new FRMWinClassicAddressBookNewContact();

            // Finds the selected contact
            if (treeView1.SelectedNode != null)
            {
                foreach (AddressBookContactList ContactList in AddressBookObjects)
                {
                    if (ContactList.AttachedNode == treeView1.SelectedNode.Text)
                    {
                        foreach (AddressBookContact Contact in ContactList.Contacts)
                        {
                            if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text)
                            {
                                abnc.toSet = Contact;
                            }
                        }
                    }
                }
                WinClassic app = wm.StartWin95(abnc, "Address Book - Contact Properties", Properties.Resources.Win95IconWordpad, true, true, true);

                if (treeView1.SelectedNode != null)
                {
                    if (Program.AddressBookSelectedContact != null)
                    {
                        foreach (AddressBookContactList ContactList in AddressBookObjects)
                        {
                            if (ContactList.AttachedNode == treeView1.SelectedNode.Text)
                            {
                                foreach (AddressBookContact Contact in ContactList.Contacts)
                                {
                                    if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text)
                                    {
                                        ContactList.Contacts.Remove(Contact);
                                        ContactList.Contacts.Add(Program.AddressBookSelectedContact);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        void NewContact()
        {
            FRMWinClassicAddressBookNewContact abnc = new FRMWinClassicAddressBookNewContact();
            WinClassic app = wm.StartWin95(abnc, "Address Book - New Contact", Properties.Resources.Win95IconWordpad, true, true, true);

            if (treeView1.SelectedNode != null)
            {
                if (Program.AddressBookSelectedContact != null)
                {
                    foreach (AddressBookContactList ContactList in AddressBookObjects)
                    {
                        if (ContactList.AttachedNode == treeView1.SelectedNode.Text)
                        {
                            ContactList.Contacts.Add(Program.AddressBookSelectedContact);
                            contactsView.Items.Add(Program.AddressBookSelectedContact.FirstName + " " + Program.AddressBookSelectedContact.MiddleName + " " + Program.AddressBookSelectedContact.LastName);
                        }
                    }
                }
            }
        }