internal void OnUpdateCompleted(ContactBook sender, EventArgs args)
 {
     if (UpdateCompleted != null)
     {
         UpdateCompleted(sender, args);
     }
 }
        public ContactsWindow(ClientForm clientForm, NTContact selectedMyContact, Hashtable properties)
        {
            myClientForm = clientForm;
            mContactBook = myClientForm.mContactBook;
            mContactBook.UpdateCompleted += new EventHandler(mContactBook_UpdateCompleted);
            mProperties = properties;

            InitializeComponent();
            LocalizeComponent();
            BrandComponent();

            this.ClientSize  = this.Size;
            this.MaximizeBox = false;
            this.MaximumSize = this.Size;


            LoadContact(selectedMyContact);
        }
        public ContactsWindow(ClientForm clientForm, NTContact selectedMyContact, Hashtable properties)
        {
            myClientForm = clientForm;
            mContactBook = myClientForm.mContactBook;
            mContactBook.UpdateCompleted += new EventHandler(mContactBook_UpdateCompleted);
            mProperties = properties;

            InitializeComponent();
            LocalizeComponent();
            BrandComponent();

            this.ClientSize = this.Size;
            this.MaximizeBox = false;
            this.MaximumSize = this.Size;


            LoadContact(selectedMyContact);


        }
 internal void OnUpdateCompleted(ContactBook sender, EventArgs args)
 {
     if (UpdateCompleted != null)
         UpdateCompleted(sender, args);
 }
        public ContactsWindow(ClientForm clientForm, NTContact selectedMyContact, Hashtable properties)
        {
            InitializeComponent();
            LocalizeComponent();
            this.ClientSize = this.Size;
            this.MaximizeBox = false;
            this.MaximumSize = this.Size;

            myClientForm = clientForm;
            mContactBook = myClientForm.mContactBook;
            if (selectedMyContact != null)
            {
                myNTContact = selectedMyContact;
            }
            else
            {
                myNTContact = new NTContact();
            }

            myContactJabberGroupListBox.Items.Clear();
            myContactJabberIMNetworkListBox.DataSource = Enum.GetValues(typeof(ConfigXMPPNetwork));
            myContactJabberIMNetworkListBox.SelectedIndex = 0;

            comboBox1.DataSource = Enum.GetValues(typeof(NTContactStore));

            myContactJabberIDInput.Text = myNTContact.NTJabberID;
			
			
			myContactJabberGroupListBox.Items.Clear();
            myContactJabberGroupListBox.Items.Add("");         
            myContactFirstNameInput.Text = myNTContact.NTFirstName;
            myContactMiddleNameInput.Text = myNTContact.NTMiddleName;
            myContactLastNameInput.Text = myNTContact.NTLastName;
            myContactPhoneHomeInput.Text = myNTContact.NTHomeTelephoneNumber;
            myContactPhoneMobileInput.Text = myNTContact.NTMobileTelephoneNumber;
            myContactPhoneBusinessInput.Text = myNTContact.NTBusinessTelephoneNumber;
            myContactPhoneVoIPInput.Text = myNTContact.NTVoIPTelephoneNumber;

            myContactJabberIDInput.Text = myNTContact.NTJabberID;

            myContactAddressStreetInput.Text = myNTContact.NTHomeAddressStreet;
            myContactAddressCityInput.Text = myNTContact.NTHomeAddressCity;
            myContactAddressZipCodeInput.Text = myNTContact.NTHomeAddressPostalCode;
            myContactAddressStateInput.Text = myNTContact.NTHomeAddressState;
            myContactAddressCountryInput.Text = myNTContact.NTHomeAddressCountry;

            myContactAddressEmailInput.Text = myNTContact.NTEmail1Address;

            try
            {
                myContactPicture.Image = ImageProcessing.FromString(myNTContact.NTPicture);
            }
            catch (Exception)
            {
                
            }
                

            if (properties != null)
            {
                myContactFirstNameInput.Text = properties["NTFirstName"] != null ? properties["NTFirstName"].ToString() : myNTContact.NTFirstName;
                myContactMiddleNameInput.Text = properties["NTMiddleName"] != null ? properties["NTMiddleName"].ToString() : myNTContact.NTMiddleName;
                myContactLastNameInput.Text = properties["NTLastName"] != null ? properties["NTLastName"].ToString() : myNTContact.NTLastName;
                myContactPhoneHomeInput.Text = properties["NTHomeTelephoneNumber"] != null ? properties["NTHomeTelephoneNumber"].ToString() : myNTContact.NTHomeTelephoneNumber;
                myContactPhoneMobileInput.Text = properties["NTMobileTelephoneNumber"] != null ? properties["NTMobileTelephoneNumber"].ToString() : myNTContact.NTMobileTelephoneNumber;
                myContactPhoneBusinessInput.Text = properties["NTBusinessTelephoneNumber"] != null ? properties["NTBusinessTelephoneNumber"].ToString() : myNTContact.NTBusinessTelephoneNumber;
                myContactPhoneVoIPInput.Text = properties["NTVoIPTelephoneNumber"] != null ? properties["NTVoIPTelephoneNumber"].ToString() : myNTContact.NTVoIPTelephoneNumber;
                myContactJabberIDInput.Text = properties["NTJabberID"] != null ? properties["NTJabberID"].ToString() : myNTContact.NTJabberID;

                myContactAddressStreetInput.Text = properties["NTHomeAddressStreet"] != null ? properties["NTHomeAddressStreet"].ToString() : myNTContact.NTHomeAddressStreet;
                myContactAddressCityInput.Text = properties["NTHomeAddressCity"] != null ? properties["NTHomeAddressCity"].ToString() : myNTContact.NTHomeAddressCity;
                myContactAddressZipCodeInput.Text = properties["NTHomeAddressPostalCode"] != null ? properties["NTHomeAddressPostalCode"].ToString() : myNTContact.NTHomeAddressPostalCode;
                myContactAddressStateInput.Text = properties["NTHomeAddressState"] != null ? properties["NTHomeAddressState"].ToString() : myNTContact.NTHomeAddressState;
                myContactAddressCountryInput.Text = properties["NTHomeAddressCountry"] != null ? properties["NTHomeAddressCountry"].ToString() : myNTContact.NTHomeAddressCountry;

                myContactAddressEmailInput.Text = properties["NTEmail1Address"] != null ? properties["NTEmail1Address"].ToString() : myNTContact.NTEmail1Address;
            }

            JabberUser jabberUser = null;
            if (myContactJabberIDInput.Text != "")
            {
                jabberUser = new JabberUser(myContactJabberIDInput.Text);
                myContactJabberIDInput.Text = jabberUser.Username;
                myContactJabberIMNetworkListBox.SelectedItem = jabberUser.Network;
            }

            comboBox1.SelectedItem = myNTContact.NTContactStore;

            foreach (DictionaryEntry group in myClientForm.myBuddyGroups)
            {


                if (group.Value.ToString() != "" && !myContactJabberGroupListBox.Items.Contains(group.Value.ToString()))
                    myContactJabberGroupListBox.Items.Add(group.Value.ToString());



                if (jabberUser != null && jabberUser.Username == group.Key.ToString())
                {
                    myContactJabberGroupListBox.SelectedIndex = myContactJabberGroupListBox.Items.Count - 1;
                }
            }



            if (myClientForm.mUserAccount.Username == myContactJabberIDInput.Text)
            {
                myContactJabberGroupBox.Visible = false;
            }
            


        }
        public ContactsWindow(ClientForm clientForm, NTContact selectedMyContact, Hashtable properties)
        {
            InitializeComponent();
            LocalizeComponent();
            this.ClientSize  = this.Size;
            this.MaximizeBox = false;
            this.MaximumSize = this.Size;

            myClientForm = clientForm;
            mContactBook = myClientForm.mContactBook;
            if (selectedMyContact != null)
            {
                myNTContact = selectedMyContact;
            }
            else
            {
                myNTContact = new NTContact();
            }

            myContactJabberGroupListBox.Items.Clear();
            myContactJabberIMNetworkListBox.DataSource    = Enum.GetValues(typeof(ConfigXMPPNetwork));
            myContactJabberIMNetworkListBox.SelectedIndex = 0;

            comboBox1.DataSource = Enum.GetValues(typeof(NTContactStore));

            myContactJabberIDInput.Text = myNTContact.NTJabberID;


            myContactJabberGroupListBox.Items.Clear();
            myContactJabberGroupListBox.Items.Add("");
            myContactFirstNameInput.Text     = myNTContact.NTFirstName;
            myContactMiddleNameInput.Text    = myNTContact.NTMiddleName;
            myContactLastNameInput.Text      = myNTContact.NTLastName;
            myContactPhoneHomeInput.Text     = myNTContact.NTHomeTelephoneNumber;
            myContactPhoneMobileInput.Text   = myNTContact.NTMobileTelephoneNumber;
            myContactPhoneBusinessInput.Text = myNTContact.NTBusinessTelephoneNumber;
            myContactPhoneVoIPInput.Text     = myNTContact.NTVoIPTelephoneNumber;

            myContactJabberIDInput.Text = myNTContact.NTJabberID;

            myContactAddressStreetInput.Text  = myNTContact.NTHomeAddressStreet;
            myContactAddressCityInput.Text    = myNTContact.NTHomeAddressCity;
            myContactAddressZipCodeInput.Text = myNTContact.NTHomeAddressPostalCode;
            myContactAddressStateInput.Text   = myNTContact.NTHomeAddressState;
            myContactAddressCountryInput.Text = myNTContact.NTHomeAddressCountry;

            myContactAddressEmailInput.Text = myNTContact.NTEmail1Address;

            try
            {
                myContactPicture.Image = ImageProcessing.FromString(myNTContact.NTPicture);
            }
            catch (Exception)
            {
            }


            if (properties != null)
            {
                myContactFirstNameInput.Text     = properties["NTFirstName"] != null ? properties["NTFirstName"].ToString() : myNTContact.NTFirstName;
                myContactMiddleNameInput.Text    = properties["NTMiddleName"] != null ? properties["NTMiddleName"].ToString() : myNTContact.NTMiddleName;
                myContactLastNameInput.Text      = properties["NTLastName"] != null ? properties["NTLastName"].ToString() : myNTContact.NTLastName;
                myContactPhoneHomeInput.Text     = properties["NTHomeTelephoneNumber"] != null ? properties["NTHomeTelephoneNumber"].ToString() : myNTContact.NTHomeTelephoneNumber;
                myContactPhoneMobileInput.Text   = properties["NTMobileTelephoneNumber"] != null ? properties["NTMobileTelephoneNumber"].ToString() : myNTContact.NTMobileTelephoneNumber;
                myContactPhoneBusinessInput.Text = properties["NTBusinessTelephoneNumber"] != null ? properties["NTBusinessTelephoneNumber"].ToString() : myNTContact.NTBusinessTelephoneNumber;
                myContactPhoneVoIPInput.Text     = properties["NTVoIPTelephoneNumber"] != null ? properties["NTVoIPTelephoneNumber"].ToString() : myNTContact.NTVoIPTelephoneNumber;
                myContactJabberIDInput.Text      = properties["NTJabberID"] != null ? properties["NTJabberID"].ToString() : myNTContact.NTJabberID;

                myContactAddressStreetInput.Text  = properties["NTHomeAddressStreet"] != null ? properties["NTHomeAddressStreet"].ToString() : myNTContact.NTHomeAddressStreet;
                myContactAddressCityInput.Text    = properties["NTHomeAddressCity"] != null ? properties["NTHomeAddressCity"].ToString() : myNTContact.NTHomeAddressCity;
                myContactAddressZipCodeInput.Text = properties["NTHomeAddressPostalCode"] != null ? properties["NTHomeAddressPostalCode"].ToString() : myNTContact.NTHomeAddressPostalCode;
                myContactAddressStateInput.Text   = properties["NTHomeAddressState"] != null ? properties["NTHomeAddressState"].ToString() : myNTContact.NTHomeAddressState;
                myContactAddressCountryInput.Text = properties["NTHomeAddressCountry"] != null ? properties["NTHomeAddressCountry"].ToString() : myNTContact.NTHomeAddressCountry;

                myContactAddressEmailInput.Text = properties["NTEmail1Address"] != null ? properties["NTEmail1Address"].ToString() : myNTContact.NTEmail1Address;
            }

            JabberUser jabberUser = null;

            if (myContactJabberIDInput.Text != "")
            {
                jabberUser = new JabberUser(myContactJabberIDInput.Text);
                myContactJabberIDInput.Text = jabberUser.Username;
                myContactJabberIMNetworkListBox.SelectedItem = jabberUser.Network;
            }

            comboBox1.SelectedItem = myNTContact.NTContactStore;

            foreach (DictionaryEntry group in myClientForm.myBuddyGroups)
            {
                if (group.Value.ToString() != "" && !myContactJabberGroupListBox.Items.Contains(group.Value.ToString()))
                {
                    myContactJabberGroupListBox.Items.Add(group.Value.ToString());
                }



                if (jabberUser != null && jabberUser.Username == group.Key.ToString())
                {
                    myContactJabberGroupListBox.SelectedIndex = myContactJabberGroupListBox.Items.Count - 1;
                }
            }



            if (myClientForm.mUserAccount.Username == myContactJabberIDInput.Text)
            {
                myContactJabberGroupBox.Visible = false;
            }
        }