예제 #1
0
        private void LaunchSearchResultsActivity(bool launchActivity)
        {
            try
            {
                RadListBoxItem selectedItem = lbxSearchResults.SelectedItem as RadListBoxItem;
                if (selectedItem != null && selectedItem.Tag != null)
                {
                    //is Activity
                    Activity activity = selectedItem.Tag as Activity;

                    if (activity != null)
                    {
                        if (launchActivity)
                        {
                            myClientForm.StartActivity(activity);
                        }
                    }

                    NTContact contact = selectedItem.Tag as NTContact;

                    if (contact != null)
                    {
                        DisplaySelectionOptions(contact);
                    }
                }
                ;
            }
            catch (Exception)
            {
                return;
            }
        }
예제 #2
0
        private IQMessage IQMessage_StoreVCard(JabberUser jabberUser, NTContact contact)
        {
            String message = "<iq id=\"" + mTag + "-" + mCounter.ToString() + "\" from=\"" + jabberUser.EscapedJID + "\" type=\"set\"> <vCard xmlns=\"vcard-temp\"> <N> <FAMILY>{NTLastName}</FAMILY> <GIVEN>{NTFirstName}</GIVEN> <MIDDLE>{NTMiddleName}</MIDDLE> </N> <ORG> <ORGNAME/> <ORGUNIT/> </ORG> <FN>{NTFirstName} {NTMiddleName} {NTLastName}</FN> <URL/> <TITLE/> <NICKNAME>{NTNickname}</NICKNAME> <PHOTO> <TYPE>image/jpeg</TYPE> <BINVAL>{NTPicture}</BINVAL> </PHOTO> <EMAIL> <HOME/> <INTERNET/> <PREF/> <USERID>{NTEmail1Address}</USERID> </EMAIL> <TEL> <PAGER/> <WORK/> <NUMBER/> </TEL> <TEL> <CELL/> <WORK/> <NUMBER/> </TEL> <TEL> <VOICE/> <WORK/> <NUMBER>{NTBusinessTelephoneNumber}</NUMBER> </TEL> <TEL> <FAX/> <WORK/> <NUMBER/> </TEL> <TEL> <PAGER/> <HOME/> <NUMBER/> </TEL> <TEL> <CELL/> <HOME/> <NUMBER>{NTMobileTelephoneNumber}</NUMBER> </TEL> <TEL> <VOICE/> <HOME/> <NUMBER>{NTHomeTelephoneNumber}</NUMBER> </TEL> <TEL> <FAX/> <HOME/> <NUMBER/> </TEL> <ADR> <WORK/> <PCODE/> <REGION/> <STREET/> <CTRY/> <LOCALITY/> </ADR> <ADR> <HOME/> <PCODE>{NTHomeAddressPostalCode}</PCODE> <REGION>{NTHomeAddressState}</REGION> <STREET>{NTHomeAddressStreet}</STREET> <CTRY>{NTHomeAddressCountry}</CTRY> <LOCALITY>{NTHomeAddressCity}</LOCALITY> </ADR> </vCard> </iq> ";

            if (contact.NTPicture.Length > 0)
            {
                mPresenceAvatarSHA1 = SHA1_ComputeHexaHash(System.Convert.FromBase64String(contact.NTPicture));
            }

            message = message
                      .Replace("{NTFirstName}", contact.NTFirstName)
                      .Replace("{NTMiddleName}", contact.NTMiddleName)
                      .Replace("{NTLastName}", contact.NTLastName)
                      .Replace("{NTNickname}", contact.NTNickname)
                      .Replace("{NTEmail1Address}", contact.NTEmail1Address)
                      .Replace("{NTBusinessTelephoneNumber}", contact.NTBusinessTelephoneNumber)
                      .Replace("{NTHomeTelephoneNumber}", contact.NTHomeTelephoneNumber)
                      .Replace("{NTMobileTelephoneNumber}", contact.NTMobileTelephoneNumber)
                      .Replace("{NTHomeAddressStreet}", contact.NTHomeAddressStreet)
                      .Replace("{NTHomeAddressCity}", contact.NTHomeAddressCity)
                      .Replace("{NTHomeAddressPostalCode}", contact.NTHomeAddressPostalCode)
                      .Replace("{NTHomeAddressState}", contact.NTHomeAddressState)
                      .Replace("{NTHomeAddressCountry}", contact.NTHomeAddressCountry)
                      .Replace("{NTPicture}", contact.NTPicture);

            return(new IQMessage(jabberUser.Domain, message));
        }
예제 #3
0
        void mContactBook_UpdateCompleted(object sender, EventArgs e)
        {
            try
            {
                if (mProperties == null | mProperties["NTJabberID"] == null)
                {
                    return;
                }
                NTContact   contact     = null;
                ContactList contactList = mContactBook.getCandidatesForJabberID(mProperties["NTJabberID"].ToString());

                for (int i = contactList.Count - 1; i >= 0; i--)
                {
                    if (contactList[i].NTContactStore == NTContactStoreType.vCard)
                    {
                        contact = contactList[i];
                    }
                }

                if (contact != null)
                {
                    LoadContact(contact);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #4
0
        private String GetContactName(NTContact contact)
        {
            //prepare contact name and username from NTContact
            String name = "";
            String nick = "";
            if (contact != null)
            {

                name = contact.FullName().Trim().Length > 64 ? contact.FullName().Trim().Substring(0, 64) : contact.FullName().Trim();
                nick = new JabberUser(contact.NTJabberID).Nick;
            }
            return name + " (" + nick + ")";
        }
예제 #5
0
        private String GetContactName(NTContact contact)
        {
            //prepare contact name and username from NTContact
            String Name     = "";
            String Username = "";

            if (contact != null)
            {
                Name     = contact.FullName().Trim().Length > 64 ? contact.FullName().Trim().Substring(0, 64) : contact.FullName().Trim();
                Username = contact.NTJabberID.Trim().Length != 0 ? " (" + (contact.NTJabberID.Trim().Length > 64 ? contact.NTJabberID.Trim().Substring(0, 64) : contact.NTJabberID.Trim()) + ")" : "";
            }
            return(Name + Username);
        }
예제 #6
0
        private String GetContactName(NTContact contact)
        {
            //prepare contact name and username from NTContact
            String name = "";
            String nick = "";

            if (contact != null)
            {
                name = contact.FullName().Trim().Length > 64 ? contact.FullName().Trim().Substring(0, 64) : contact.FullName().Trim();
                nick = new JabberUser(contact.NTJabberID).Nick;
            }
            return(name + " (" + nick + ")");
        }
예제 #7
0
        private String GetContactPrimaryPhoneNumbers(NTContact contact)
        {
            //prepare and format contact description, numbers, email, etc ...

            String Numbers = "";
            String Email = "";

            if (contact != null)
            {
                Numbers = (contact.PrimaryPhoneNumbers().Length > 64 ? contact.PrimaryPhoneNumbers().Trim().Substring(0, 64) : contact.PrimaryPhoneNumbers().Trim());
                Email = contact.NTEmail1Address.Length > 0 ? Email + contact.NTEmail1Address : "";
            }
            return Numbers + Email;
        }
예제 #8
0
        private String GetContactPrimaryPhoneNumbers(NTContact contact)
        {
            //prepare and format contact description, numbers, email, etc ...

            String Numbers = "";
            String Email   = "";

            if (contact != null)
            {
                Numbers = (contact.PrimaryPhoneNumbers().Length > 64 ? contact.PrimaryPhoneNumbers().Trim().Substring(0, 64) : contact.PrimaryPhoneNumbers().Trim());
                Email   = contact.NTEmail1Address.Length > 0 ? Email + contact.NTEmail1Address : "";
            }
            return(Numbers + Email);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);


        }
예제 #11
0
 private void btnUserAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (dataGridViewSearchResult.SelectedRows.Count > 0)
         {
             UserSearchResult selected = mySearchUserResult[dataGridViewSearchResult.SelectedRows[0].Index];
             selectedContact = new NTContact();
             selectedContact.NTCompanyName        = selected.Company;
             selectedContact.NTJabberID           = selected.Username;
             selectedContact.NTFirstName          = selected.FirstName;
             selectedContact.NTLastName           = selected.LastName;
             selectedContact.NTHomeAddressCity    = selected.Region;
             selectedContact.NTHomeAddressCountry = selected.Country;
         }
     }
     catch (Exception)
     {
     }
     this.Close();
 }
예제 #12
0
        public Phone2PhoneWindow(NTContact selectedContact, NTContact meContact)
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Phone2PhoneWindow));

            InitializeComponent();
            LocalizeComponent();
            BrandComponent();
            mySelectedNTContact = selectedContact;
            myMeNTContact       = meContact;

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


            lblPhoneFromName.Text = mySelectedNTContact.FullName() + "'s Phone Number";
            selectedContactComboBox.Items.Clear();
            selectedContactComboBox.Items.Clear();
            meContactComboBox.Items.Clear();
            #region process mySelectedNTContact
            if (mySelectedNTContact.NTHomeTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.selectedContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
                    this.tmplRadComboBoxItem
                });

                //
                // tmplRadComboBoxItem
                //
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus                = true;
                this.tmplRadComboBoxItem.DescriptionText         = Properties.Localization.txtCFormTitlePhoneHome;
                this.tmplRadComboBoxItem.Font                    = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image                   = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text                    = mySelectedNTContact.NTHomeTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText             = null;
                this.tmplRadComboBoxItem.DisplayStyle            = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation       = TextImageRelation.ImageBeforeText;
                this.selectedContactComboBox.SelectedItem        = this.tmplRadComboBoxItem;
            }
            if (mySelectedNTContact.NTMobileTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.selectedContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
                    this.tmplRadComboBoxItem
                });

                //
                // tmplRadComboBoxItem
                //
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus                = true;
                this.tmplRadComboBoxItem.DescriptionText         = Properties.Localization.txtCFormTitlePhoneMobile;
                this.tmplRadComboBoxItem.Font                    = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image                   = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text                    = mySelectedNTContact.NTMobileTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText             = null;
                this.tmplRadComboBoxItem.DisplayStyle            = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation       = TextImageRelation.ImageBeforeText;
                this.selectedContactComboBox.SelectedItem        = this.tmplRadComboBoxItem;
            }
            ;
            if (mySelectedNTContact.NTBusinessTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.selectedContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
                    this.tmplRadComboBoxItem
                });

                //
                // tmplRadComboBoxItem
                //
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus                = true;
                this.tmplRadComboBoxItem.DescriptionText         = Properties.Localization.txtCFormTitlePhoneBusiness;
                this.tmplRadComboBoxItem.Font                    = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image                   = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text                    = mySelectedNTContact.NTBusinessTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText             = null;
                this.tmplRadComboBoxItem.DisplayStyle            = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation       = TextImageRelation.ImageBeforeText;
                this.selectedContactComboBox.SelectedItem        = this.tmplRadComboBoxItem;
            }
            ;
            if (selectedContactComboBox.Items.Count > 0)
            {
                selectedContactComboBox.SelectedIndex = 0;
            }
            #endregion

            #region process myMeNTContact
            if (myMeNTContact.NTHomeTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.meContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
                    this.tmplRadComboBoxItem
                });

                //
                // tmplRadComboBoxItem
                //
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus                = true;
                this.tmplRadComboBoxItem.DescriptionText         = Properties.Localization.txtCFormTitlePhoneHome;
                this.tmplRadComboBoxItem.Font                    = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image                   = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text                    = myMeNTContact.NTHomeTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText             = null;
                this.tmplRadComboBoxItem.DisplayStyle            = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation       = TextImageRelation.ImageBeforeText;
                this.meContactComboBox.SelectedItem              = this.tmplRadComboBoxItem;
            }
            if (myMeNTContact.NTMobileTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.meContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
                    this.tmplRadComboBoxItem
                });

                //
                // tmplRadComboBoxItem
                //
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus                = true;
                this.tmplRadComboBoxItem.DescriptionText         = Properties.Localization.txtCFormTitlePhoneMobile;
                this.tmplRadComboBoxItem.Font                    = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image                   = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text                    = myMeNTContact.NTMobileTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText             = null;
                this.tmplRadComboBoxItem.DisplayStyle            = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation       = TextImageRelation.ImageBeforeText;
                this.meContactComboBox.SelectedItem              = this.tmplRadComboBoxItem;
            }
            ;
            if (myMeNTContact.NTBusinessTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.meContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
                    this.tmplRadComboBoxItem
                });

                //
                // tmplRadComboBoxItem
                //
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus                = true;
                this.tmplRadComboBoxItem.DescriptionText         = Properties.Localization.txtCFormTitlePhoneBusiness;
                this.tmplRadComboBoxItem.Font                    = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image                   = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text                    = myMeNTContact.NTBusinessTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText             = null;
                this.tmplRadComboBoxItem.DisplayStyle            = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation       = TextImageRelation.ImageBeforeText;
                this.meContactComboBox.SelectedItem              = this.tmplRadComboBoxItem;
            }
            ;
            if (meContactComboBox.Items.Count > 0)
            {
                meContactComboBox.SelectedIndex = 0;
            }
            #endregion
        }
예제 #13
0
        public Phone2PhoneWindow(NTContact selectedContact)
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Phone2PhoneWindow));

            InitializeComponent();

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


            myNTContact  = selectedContact;

            label3.Text = myNTContact.FullName() + "'s Phone Number";
            radComboBox1.Items.Clear();
            if (myNTContact.NTHomeTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.radComboBox1.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplRadComboBoxItem});

                // 
                // tmplRadComboBoxItem
                // 
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus = true;
                this.tmplRadComboBoxItem.DescriptionText = "Home";
                this.tmplRadComboBoxItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text = myNTContact.NTHomeTelephoneNumber; 
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText = null;
                this.tmplRadComboBoxItem.DisplayStyle = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation = TextImageRelation.ImageBeforeText;
                this.radComboBox1.SelectedItem = this.tmplRadComboBoxItem;
            }
            if (myNTContact.NTMobileTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.radComboBox1.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplRadComboBoxItem});

                // 
                // tmplRadComboBoxItem
                // 
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus = true;
                this.tmplRadComboBoxItem.DescriptionText = "Mobile";
                this.tmplRadComboBoxItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text = myNTContact.NTMobileTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText = null;
                this.tmplRadComboBoxItem.DisplayStyle = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation = TextImageRelation.ImageBeforeText;
                this.radComboBox1.SelectedItem = this.tmplRadComboBoxItem;
            };
            if (myNTContact.NTBusinessTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.radComboBox1.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplRadComboBoxItem});

                // 
                // tmplRadComboBoxItem
                // 
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus = true;
                this.tmplRadComboBoxItem.DescriptionText = "Work";
                this.tmplRadComboBoxItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text = myNTContact.NTBusinessTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText = null;
                this.tmplRadComboBoxItem.DisplayStyle = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation = TextImageRelation.ImageBeforeText;
                this.radComboBox1.SelectedItem = this.tmplRadComboBoxItem;
            };
        }
예제 #14
0
        public object Clone()
        {
            NTContact copy = new NTContact();
            return (NTContact)this.MemberwiseClone();

        }
예제 #15
0
        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;
            }
            


        }
예제 #16
0
        private NTContact NTTranslator(Outlook.ContactItem oItem)
        {
            NTContact item = new NTContact();
            item.NTContactStore = NTContactStoreType.Outlook;
            //oItem.PropertyChange += new Microsoft.Office.Interop.Outlook.ItemEvents_10_PropertyChangeEventHandler(oItem_PropertyChange);
            item.NTContactStore = NTContactStoreType.Outlook;
            item.NTUsername = oItem.User1;
            item.NTSpeedDial = "";
            item.NTDeleted = "";
            item.NTVoIPTelephoneNumber = "";
            item.NTAccountName = oItem.Account;
            item.NTAnniversary = oItem.Anniversary.ToString();
            item.NTAssistantName = oItem.AssistantName;
            item.NTAssistantTelephoneNumber = oItem.AssistantTelephoneNumber;
            item.NTBirthday = oItem.Birthday.ToString();
            item.NTBody = oItem.Body;
            item.NTBusiness2TelephoneNumber = oItem.Business2TelephoneNumber;
            item.NTBusinessAddressCity = oItem.BusinessAddressCity;
            item.NTBusinessAddressCountry = oItem.BusinessAddressCountry;
            item.NTBusinessAddressPostalCode = oItem.BusinessAddressPostalCode;
            item.NTBusinessAddressState = oItem.BusinessAddressState;
            item.NTBusinessAddressStreet = oItem.BusinessAddressStreet;
            item.NTBusinessFaxNumber = oItem.BusinessFaxNumber;
            item.NTBusinessTelephoneNumber = oItem.BusinessTelephoneNumber;
            item.NTCarTelephoneNumber = oItem.CarTelephoneNumber;
            item.NTCategories = oItem.Categories;
            item.NTChildren = oItem.Children;
            item.NTCompanyName = oItem.CompanyName;
            item.NTCompanyTelephoneNumber = oItem.CompanyMainTelephoneNumber;
            item.NTCustomerId = oItem.CustomerID;
            item.NTDepartment = oItem.Department;
            item.NTEmail1Address = oItem.Email1Address;
            item.NTEmail2Address = oItem.Email2Address;
            item.NTEmail3Address = oItem.Email3Address;
            item.NTFileAs = oItem.FileAs;
            item.NTFirstName = oItem.FirstName;
            item.NTGovernmentId = oItem.GovernmentIDNumber;
            item.NTHome2TelephoneNumber = oItem.Home2TelephoneNumber;
            item.NTHomeAddressCity = oItem.HomeAddressCity;
            item.NTHomeAddressCountry = oItem.HomeAddressCountry;
            item.NTHomeAddressPostalCode = oItem.HomeAddressPostalCode;
            item.NTHomeAddressState = oItem.HomeAddressState;
            item.NTHomeAddressStreet = oItem.HomeAddressStreet;
            item.NTHomeFaxNumber = oItem.HomeFaxNumber;
            item.NTHomeTelephoneNumber = oItem.HomeTelephoneNumber;
            item.NTIM1Address = oItem.IMAddress;
            item.NTIM2Address = "";
            item.NTIM3Address = "";
            item.NTItemId = oItem.EntryID;
            item.NTJobTitle = oItem.JobTitle;
            item.NTLastName = oItem.LastName;
            item.NTManager = oItem.ManagerName;
            item.NTMiddleName = oItem.MiddleName;
            item.NTMobileTelephoneNumber = oItem.MobileTelephoneNumber;
            item.NTNickname = oItem.NickName;
            item.NTOfficeLocation = oItem.OfficeLocation;
            item.NTOtherAddressCity = oItem.OtherAddressCity;
            item.NTOtherAddressCountry = oItem.OtherAddressCountry;
            item.NTOtherAddressPostalCode = oItem.OtherAddressPostalCode;
            item.NTOtherAddressState = oItem.OtherAddressState;
            item.NTOtherAddressStreet = oItem.OtherAddressStreet;
            item.NTPagerNumber = oItem.PagerNumber;
            item.NTPicture = "";
            item.NTProperties = "";
            item.NTRadioTelephoneNumber = oItem.RadioTelephoneNumber;
            item.NTRingTone = "";
            item.NTSpouse = oItem.Spouse;
            item.NTSuffix = oItem.Suffix;
            item.NTTitle = oItem.Title;
            item.NTWebPage = oItem.WebPage;
            item.NTYomiCompanyName = oItem.YomiCompanyName;
            item.NTYomiFirstName = oItem.YomiFirstName;
            item.NTYomiLastName = oItem.YomiLastName;
            item.NTJabberID = oItem.IMAddress;

            return item;
        }
예제 #17
0
        private NTContact NTTranslator(Outlook.ContactItem oItem)
        {
            NTContact item = new NTContact();

            item.NTContactStore = NTContactStoreType.Outlook;
            //oItem.PropertyChange += new Microsoft.Office.Interop.Outlook.ItemEvents_10_PropertyChangeEventHandler(oItem_PropertyChange);
            item.NTContactStore             = NTContactStoreType.Outlook;
            item.NTUsername                 = oItem.User1;
            item.NTSpeedDial                = "";
            item.NTDeleted                  = "";
            item.NTVoIPTelephoneNumber      = "";
            item.NTAccountName              = oItem.Account;
            item.NTAnniversary              = oItem.Anniversary.ToString();
            item.NTAssistantName            = oItem.AssistantName;
            item.NTAssistantTelephoneNumber = oItem.AssistantTelephoneNumber;
            item.NTBirthday                 = oItem.Birthday.ToString();
            item.NTBody = oItem.Body;
            item.NTBusiness2TelephoneNumber  = oItem.Business2TelephoneNumber;
            item.NTBusinessAddressCity       = oItem.BusinessAddressCity;
            item.NTBusinessAddressCountry    = oItem.BusinessAddressCountry;
            item.NTBusinessAddressPostalCode = oItem.BusinessAddressPostalCode;
            item.NTBusinessAddressState      = oItem.BusinessAddressState;
            item.NTBusinessAddressStreet     = oItem.BusinessAddressStreet;
            item.NTBusinessFaxNumber         = oItem.BusinessFaxNumber;
            item.NTBusinessTelephoneNumber   = oItem.BusinessTelephoneNumber;
            item.NTCarTelephoneNumber        = oItem.CarTelephoneNumber;
            item.NTCategories             = oItem.Categories;
            item.NTChildren               = oItem.Children;
            item.NTCompanyName            = oItem.CompanyName;
            item.NTCompanyTelephoneNumber = oItem.CompanyMainTelephoneNumber;
            item.NTCustomerId             = oItem.CustomerID;
            item.NTDepartment             = oItem.Department;
            item.NTEmail1Address          = oItem.Email1Address;
            item.NTEmail2Address          = oItem.Email2Address;
            item.NTEmail3Address          = oItem.Email3Address;
            item.NTFileAs                 = oItem.FileAs;
            item.NTFirstName              = oItem.FirstName;
            item.NTGovernmentId           = oItem.GovernmentIDNumber;
            item.NTHome2TelephoneNumber   = oItem.Home2TelephoneNumber;
            item.NTHomeAddressCity        = oItem.HomeAddressCity;
            item.NTHomeAddressCountry     = oItem.HomeAddressCountry;
            item.NTHomeAddressPostalCode  = oItem.HomeAddressPostalCode;
            item.NTHomeAddressState       = oItem.HomeAddressState;
            item.NTHomeAddressStreet      = oItem.HomeAddressStreet;
            item.NTHomeFaxNumber          = oItem.HomeFaxNumber;
            item.NTHomeTelephoneNumber    = oItem.HomeTelephoneNumber;
            item.NTIM1Address             = oItem.IMAddress;
            item.NTIM2Address             = "";
            item.NTIM3Address             = "";
            item.NTItemId                 = oItem.EntryID;
            item.NTJobTitle               = oItem.JobTitle;
            item.NTLastName               = oItem.LastName;
            item.NTManager                = oItem.ManagerName;
            item.NTMiddleName             = oItem.MiddleName;
            item.NTMobileTelephoneNumber  = oItem.MobileTelephoneNumber;
            item.NTNickname               = oItem.NickName;
            item.NTOfficeLocation         = oItem.OfficeLocation;
            item.NTOtherAddressCity       = oItem.OtherAddressCity;
            item.NTOtherAddressCountry    = oItem.OtherAddressCountry;
            item.NTOtherAddressPostalCode = oItem.OtherAddressPostalCode;
            item.NTOtherAddressState      = oItem.OtherAddressState;
            item.NTOtherAddressStreet     = oItem.OtherAddressStreet;
            item.NTPagerNumber            = oItem.PagerNumber;
            item.NTPicture                = "";
            item.NTProperties             = "";
            item.NTRadioTelephoneNumber   = oItem.RadioTelephoneNumber;
            item.NTRingTone               = "";
            item.NTSpouse                 = oItem.Spouse;
            item.NTSuffix                 = oItem.Suffix;
            item.NTTitle           = oItem.Title;
            item.NTWebPage         = oItem.WebPage;
            item.NTYomiCompanyName = oItem.YomiCompanyName;
            item.NTYomiFirstName   = oItem.YomiFirstName;
            item.NTYomiLastName    = oItem.YomiLastName;
            item.NTJabberID        = oItem.IMAddress;

            return(item);
        }
예제 #18
0
        public void AddToConversation(String chatJID, String senderJID, string messageText, string messageHTML, DateTime messageDateTime, string messageGUID, bool forceEmpty, bool flashWindow)
        {
            if (InvokeRequired)
            {
                this.Invoke(new AddToConversationDelegate(this.AddToConversation), new object[] { chatJID, senderJID, messageText, messageDateTime, messageGUID, forceEmpty, flashWindow });
                return;
            }

            //IMMessage parameters

            MessageStyle        style            = new MessageStyle(Color.White, new System.Drawing.Font("Trebuchet MS", 8.5F, System.Drawing.FontStyle.Regular), Color.Gray, Color.Gray);
            MessageTemplateType template         = MessageTemplateType.Notification;
            ChatSession         tmplChatSession  = (ChatSession)myChatSessions[chatJID];
            JabberUser          chatJabberUser   = null;
            JabberUser          senderJabberUser = null;

            if (tmplChatSession == null)
            {
                try
                {
                    ContactList contactList = myClientForm.mContactBook.getCandidatesForJabberID(chatJID);
                    if (contactList.Count > 0)
                    {
                        NTContact ntContact = (NTContact)contactList[0];
                        chatJabberUser = new JabberUser(ntContact.NTJabberID, ntContact.NTNickname);
                    }
                    else
                    {
                        chatJabberUser = new JabberUser(chatJID);
                    }

                    NewChat(chatJabberUser, false);
                    tmplChatSession = (ChatSession)myChatSessions[chatJabberUser.JID];
                    if (tmplChatSession == null)
                    {
                        return;
                    }
                }
                catch (Exception)
                {
                    return;
                }
            }
            if (forceEmpty)
            {
                tmplChatSession.ChatBox.ResetHTML();
            }
            if (senderJID == myClientForm.mUserAccount.JabberUser.JID)
            {
                //outgoing message
                senderJabberUser = myClientForm.mUserAccount.JabberUser;
                style            = tmplChatSession.OutgoingStyle;
                template         = MessageTemplateType.Out;
            }
            else
            { //incomming message
                senderJabberUser = tmplChatSession.JabberUser;
                if (flashWindow)
                {
                    FlashWindow(this.Handle, true);
                    myClientForm.mClientEvents.RaiseEvent(Remwave.Client.Events.ClientEvent.IncomingInstantMessage);
                    ShowIt();
                    mMessageInTimeout    = 360;
                    myNotifyIcon.Visible = true;
                }
                style    = tmplChatSession.IncomingStyle;
                template = MessageTemplateType.In;
            }

            //if chat session exist display content in conversation window
            if (tmplChatSession != null)
            {
                if (tmplChatSession.ChatBox.ChatTabConversation != null)
                {
                    SetComposing(false, senderJID);
                    if (messageHTML == "")
                    {
                        messageHTML = messageText;
                    }

                    IMMessage message = new IMMessage(senderJabberUser.Nick, messageHTML, messageGUID, messageDateTime, style, template, myEmoticons);
                    tmplChatSession.ChatBox.ChatTabConversation.Document.Body.InnerHtml += message.HTML;
                    tmplChatSession.ChatBox.ChatTabConversation.Document.Window.ScrollTo(0, tmplChatSession.ChatBox.ChatTabConversation.Document.Body.ScrollRectangle.Height);
                    tmplChatSession.ChatBox.AttachEvents();
                }
            }
        }
예제 #19
0
        private void LoadContact(NTContact selectedMyContact)
        {
            if (selectedMyContact != null)
            {
                mNTContact = selectedMyContact;
            }
            else
            {
                mNTContact = new NTContact();
            }

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

            foreach (NTContactStore store in myClientForm.mContactBook.ContactStores)
            {
                if (store.Enabled)
                {
                    myContactStoreComboBox.Items.Add(store);
                }
                if (mNTContact.NTContactStore == store.StoreType) myContactStoreComboBox.SelectedItem = store;
            }

            myContactJabberIDInput.Text = mNTContact.NTJabberID;

            myContactFirstNameInput.Text = mNTContact.NTFirstName;
            myContactMiddleNameInput.Text = mNTContact.NTMiddleName;
            myContactLastNameInput.Text = mNTContact.NTLastName;
            myContactPhoneHomeInput.Text = mNTContact.NTHomeTelephoneNumber;
            myContactPhoneMobileInput.Text = mNTContact.NTMobileTelephoneNumber;
            myContactPhoneBusinessInput.Text = mNTContact.NTBusinessTelephoneNumber;
            myContactPhoneVoIPInput.Text = mNTContact.NTVoIPTelephoneNumber;

            myContactJabberIDInput.Text = mNTContact.NTJabberID;

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

            myContactAddressEmailInput.Text = mNTContact.NTEmail1Address;

            try
            {
                myContactPicture.Image = myContactPicture.Image = ImageProcessing.FixedSize(ImageProcessing.FromString(mNTContact.NTPicture), 64, 64);
            }
            catch (Exception)
            {

            }


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

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

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

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

            JabberUser jabberUser = null;
            if (myContactJabberIDInput.Text != "")
            {
                jabberUser = new JabberUser(myContactJabberIDInput.Text);
                myContactJabberIDInput.Text = jabberUser.Username;
                myContactJabberIMNetworkListBox.SelectedItem = jabberUser.Network;
                myContactJabberGroupListBox.Text = myClientForm.myBuddyList[jabberUser.JID] != null ? myClientForm.myBuddyList[jabberUser.JID].ToString() : Properties.Localization.txtOtherGroup;
            }





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

                myContactStoreComboBox.Enabled = false;
                myContactStoreComboBox.Visible = false;

                labelStore.Visible = false;
            }

        }
예제 #20
0
        private void DisplaySelectionOptions(NTContact contact)
        {
            int itemsHeight = 0;

            displayingContacts = false;
            //build sub menue

            Font listItemNameFont        = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));;
            Font listItemDescriptionFont = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            Font listSubItemNameFont        = new System.Drawing.Font("Trebuchet MS", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));;
            Font listSubItemDescriptionFont = new System.Drawing.Font("Trebuchet MS", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            Size listItemSize    = new Size(300, 44);
            Size listSubItemSize = new Size(300, 44);

            lbxSearchResults.Items.Clear();

            lbxSearchResults.Items.Add(BuildRadMenuContentItem(
                                           contact,
                                           GetContactName(contact),
                                           GetContactPrimaryPhoneNumbers(contact),
                                           ((System.Drawing.Image)(Properties.Resources.listIconVcard)),
                                           listItemSize,
                                           listItemNameFont,
                                           listItemDescriptionFont,
                                           Telerik.WinControls.ElementVisibility.Visible,
                                           false
                                           ));

            itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

            if (contact.NTJabberID != "")
            {
                JabberUser contactJabberUser = new JabberUser(contact.NTJabberID, contact.NTNickname);

                //Call PC2PC
                Activity activityPC2PCCall = new Activity(ActivityType.Call, contactJabberUser, null);

                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityPC2PCCall,
                        Properties.Localization.txtCMenuCallComputer,
                        contactJabberUser.Nick,
                        ((System.Drawing.Image)(Properties.Resources.listIconComputer)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

                //Send Instant Message
                Activity activityIM = new Activity(ActivityType.IM, contactJabberUser, null);
                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityIM,
                        Properties.Localization.txtCMenuSendMessage,
                        contactJabberUser.Nick,
                        ((System.Drawing.Image)(Properties.Resources.listIconInstantMessage)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

                //Start Video Call
                Activity activityVideoCall = new Activity(ActivityType.VideoCall, contactJabberUser, null);
                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityVideoCall,
                        Properties.Localization.txtCMenuVideoCall,
                        contactJabberUser.Nick,
                        ((System.Drawing.Image)(Properties.Resources.listIconWebcam)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

                //Start Screen Sharing
                Activity activityScreenSharing = new Activity(ActivityType.ScreenSharing, contactJabberUser, null);
                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityScreenSharing,
                        Properties.Localization.txtCMenuScreenSharing,
                        contactJabberUser.Nick,
                        ((System.Drawing.Image)(Properties.Resources.listIconScreenSharing)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }

            if (contact.NTHomeTelephoneNumber != "")
            {
                //Call Home
                Activity activityCallHome = new Activity(ActivityType.Call, null, contact.NTHomeTelephoneNumber);
                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityCallHome,
                        Properties.Localization.txtCMenuCallHome,
                        contact.NTHomeTelephoneNumber,
                        ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }

            if (contact.NTMobileTelephoneNumber != "")
            {
                //Call Mobile
                Activity activityCallMobile = new Activity(ActivityType.Call, null, contact.NTMobileTelephoneNumber);
                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityCallMobile,
                        Properties.Localization.txtCMenuCallMobile,
                        contact.NTMobileTelephoneNumber,
                        ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }

            if (contact.NTBusinessTelephoneNumber != "")
            {
                //Call Business
                Activity activityCallBusiness = new Activity(ActivityType.Call, null, contact.NTBusinessTelephoneNumber);
                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityCallBusiness,
                        Properties.Localization.txtCMenuCallWork,
                        contact.NTBusinessTelephoneNumber,
                        ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }

            if (contact.NTVoIPTelephoneNumber != "")
            {
                //Call VoIP
                Activity activityCallVoIP = new Activity(ActivityType.Call, null, contact.NTVoIPTelephoneNumber);
                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityCallVoIP,
                        Properties.Localization.txtCmenuCallVoIP,
                        contact.NTVoIPTelephoneNumber,
                        ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }

            if (contact.NTEmail1Address != "")
            {
                //Send Email
                Activity activitySendEmail = new Activity(ActivityType.Email, null, contact.NTEmail1Address);
                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activitySendEmail,
                        Properties.Localization.txtCMenuSendEmail,
                        contact.NTEmail1Address,
                        ((System.Drawing.Image)(Properties.Resources.listIconEmail)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }

            if (lbxSearchResults.Items.Count > 1)
            {
                lbxSearchResults.SelectedIndex = 1;
            }
            else if (lbxSearchResults.Items.Count > 0)
            {
                lbxSearchResults.SelectedIndex = 0;
            }

            AdjustFormSize(itemsHeight);
        }
예제 #21
0
 public void Credentials(string username, string password)
 {
     this.Logout();
     _username = username;
     _password = password;
     _jabberUser = new JabberUser(username + @"@" + ConfigIM.IMServer);
     Contact = new NTContact();
     Contact.NTJabberID = _jabberUser.JID;
 }
예제 #22
0
 public void Logout()
 {
     _username = null;
     _password = null;
     _authorized = false;
     _jabberUser = null;
     Contact = null;
 }
예제 #23
0
 private void btnUserAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (dataGridViewSearchResult.SelectedRows.Count > 0)
         {
             UserSearchResult selected = mySearchUserResult[dataGridViewSearchResult.SelectedRows[0].Index];
             selectedContact = new NTContact();
             selectedContact.NTCompanyName = selected.Company;
             selectedContact.NTJabberID = selected.Username;
             selectedContact.NTFirstName = selected.FirstName;
             selectedContact.NTLastName = selected.LastName;
             selectedContact.NTHomeAddressCity = selected.Region;
             selectedContact.NTHomeAddressCountry = selected.Country;
         }
     }
     catch (Exception)
     {
         
     }
     this.Close();
 }
예제 #24
0
 private void myMenuPhone2PhoneCallToolStripButton_Click(object sender, EventArgs e)
 {
     NTContact selectedContact;
     if (myRosterListTreeView.SelectedNode != null)
     {
         if (myRosterListTreeView.SelectedNode.Level == 1)
         {
             NTContact meContact;
             if (mContactBook.getCandidatesForJabberID(mUserAccount.Username).Count > 0)
             {
                 meContact = (NTContact)mContactBook.getCandidatesForJabberID(mUserAccount.Username)[0];
             }
             else
             {
                 meContact = new NTContact();
             }
             ContactList foundContactsList = mContactBook.getCandidatesForJabberID(myRosterListTreeView.SelectedNode.Tag.ToString());
             if (foundContactsList.Count > 0)
             {
                 selectedContact = (NTContact)foundContactsList[0];
             }
             else
             {
                 selectedContact = new NTContact();
             }
             myPhone2PhoneWindow = new Phone2PhoneWindow(selectedContact, meContact);
             myPhone2PhoneWindow.FormClosing += new FormClosingEventHandler(myPhone2PhoneWindow_FormClosing);
             myPhone2PhoneWindow.Show();
         }
     }
 }
예제 #25
0
 private void callPhone2PhoneToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     RadListBoxItem selectedItem = (RadListBoxItem)myContactsListBox.SelectedItem;
     if (selectedItem != null)
     {
         NTContact meContact;
         if (mContactBook.getCandidatesForJabberID(mUserAccount.Username).Count > 0)
         {
             meContact = (NTContact)mContactBook.getCandidatesForJabberID(mUserAccount.Username)[0];
         }
         else
         {
             meContact = new NTContact();
         }
         NTContact selectedContact = (NTContact)selectedItem.Tag;
         myPhone2PhoneWindow = new Phone2PhoneWindow(selectedContact, meContact);
         myPhone2PhoneWindow.FormClosing += new FormClosingEventHandler(myPhone2PhoneWindow_FormClosing);
         myPhone2PhoneWindow.Show();
     }
 }
예제 #26
0
        private Telerik.WinControls.UI.RadListBoxItem BuildContactItem(NTContact contact)
        {
           
                    this.tmplContactListItem = new Telerik.WinControls.UI.RadListBoxItem();

                    JabberUser jabberUser = new JabberUser(contact.NTJabberID);

                    // 
                    // tmplContactListItem
                    // 
                    this.tmplContactListItem.AccessibleDescription = contact.FullName().Length > 64 ? contact.FullName().Trim().Substring(0, 64) : contact.FullName().Trim();
                    this.tmplContactListItem.CanFocus = true;
                    this.tmplContactListItem.DescriptionText = "» " + (contact.PrimaryPhoneNumbers().Length > 64 ? contact.PrimaryPhoneNumbers().Trim().Substring(0, 64) : contact.PrimaryPhoneNumbers().Trim());
                    this.tmplContactListItem.ForeColor = System.Drawing.Color.Black;
                    this.tmplContactListItem.ImageAlignment = ContentAlignment.MiddleCenter;
                    try
                    {
                        if(contact.NTPicture!=null & contact.NTPicture.Length>0) this.tmplContactListItem.Image = ImageProcessing.FixedSize(ImageProcessing.FromString(contact.NTPicture), 60, 60);
                    }
                    catch (Exception)
                    {
                      
                    }

                    if (this.tmplContactListItem.Image == null) this.tmplContactListItem.Image = ((System.Drawing.Image)(Properties.Resources.ContactBlank)); 

                    this.tmplContactListItem.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                    this.tmplContactListItem.Text = "» " + (contact.FullName().Length > 64 ? contact.FullName().Trim().Substring(0, 64) : contact.FullName().Trim());
                    this.tmplContactListItem.Text += jabberUser.Nick.Trim() != "" ? " (" + (jabberUser.Nick.Trim().Length > 64 ? jabberUser.Nick.Trim().Substring(0, 64) : jabberUser.Nick.Trim()) + ")" : "";
                    this.tmplContactListItem.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
                    this.tmplContactListItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                    this.tmplContactListItem.ToolTipText = null;
                    this.tmplContactListItem.Font = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    this.tmplContactListItem.ForeColor = System.Drawing.Color.Black;
                    this.tmplContactListItem.DescriptionFont = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    this.tmplContactListItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                    this.tmplContactListItem.DoubleClick += new EventHandler(tmplContactListItem_DoubleClick);
                    this.tmplContactListItem.Tag = contact;
                
                return tmplContactListItem;
        }
예제 #27
0
        public object Clone()
        {
            NTContact copy = new NTContact();

            return((NTContact)this.MemberwiseClone());
        }
예제 #28
0
        public Phone2PhoneWindow(NTContact selectedContact)
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Phone2PhoneWindow));

            InitializeComponent();

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


            myNTContact = selectedContact;

            label3.Text = myNTContact.FullName() + "'s Phone Number";
            radComboBox1.Items.Clear();
            if (myNTContact.NTHomeTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.radComboBox1.Items.AddRange(new Telerik.WinControls.RadItem[] {
                    this.tmplRadComboBoxItem
                });

                //
                // tmplRadComboBoxItem
                //
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus                = true;
                this.tmplRadComboBoxItem.DescriptionText         = "Home";
                this.tmplRadComboBoxItem.Font                    = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image                   = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text                    = myNTContact.NTHomeTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText             = null;
                this.tmplRadComboBoxItem.DisplayStyle            = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation       = TextImageRelation.ImageBeforeText;
                this.radComboBox1.SelectedItem                   = this.tmplRadComboBoxItem;
            }
            if (myNTContact.NTMobileTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.radComboBox1.Items.AddRange(new Telerik.WinControls.RadItem[] {
                    this.tmplRadComboBoxItem
                });

                //
                // tmplRadComboBoxItem
                //
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus                = true;
                this.tmplRadComboBoxItem.DescriptionText         = "Mobile";
                this.tmplRadComboBoxItem.Font                    = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image                   = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text                    = myNTContact.NTMobileTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText             = null;
                this.tmplRadComboBoxItem.DisplayStyle            = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation       = TextImageRelation.ImageBeforeText;
                this.radComboBox1.SelectedItem                   = this.tmplRadComboBoxItem;
            }
            ;
            if (myNTContact.NTBusinessTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.radComboBox1.Items.AddRange(new Telerik.WinControls.RadItem[] {
                    this.tmplRadComboBoxItem
                });

                //
                // tmplRadComboBoxItem
                //
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus                = true;
                this.tmplRadComboBoxItem.DescriptionText         = "Work";
                this.tmplRadComboBoxItem.Font                    = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image                   = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text                    = myNTContact.NTBusinessTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText             = null;
                this.tmplRadComboBoxItem.DisplayStyle            = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation       = TextImageRelation.ImageBeforeText;
                this.radComboBox1.SelectedItem                   = this.tmplRadComboBoxItem;
            }
            ;
        }
예제 #29
0
        private IQMessage IQMessage_StoreVCard(JabberUser jabberUser, NTContact contact)
        {
            String message = "<iq id=\"" + mTag + "-" + mCounter.ToString() + "\" from=\"" + jabberUser.EscapedJID + "\" type=\"set\"> <vCard xmlns=\"vcard-temp\"> <N> <FAMILY>{NTLastName}</FAMILY> <GIVEN>{NTFirstName}</GIVEN> <MIDDLE>{NTMiddleName}</MIDDLE> </N> <ORG> <ORGNAME/> <ORGUNIT/> </ORG> <FN>{NTFirstName} {NTMiddleName} {NTLastName}</FN> <URL/> <TITLE/> <NICKNAME>{NTNickname}</NICKNAME> <PHOTO> <TYPE>image/jpeg</TYPE> <BINVAL>{NTPicture}</BINVAL> </PHOTO> <EMAIL> <HOME/> <INTERNET/> <PREF/> <USERID>{NTEmail1Address}</USERID> </EMAIL> <TEL> <PAGER/> <WORK/> <NUMBER/> </TEL> <TEL> <CELL/> <WORK/> <NUMBER/> </TEL> <TEL> <VOICE/> <WORK/> <NUMBER>{NTBusinessTelephoneNumber}</NUMBER> </TEL> <TEL> <FAX/> <WORK/> <NUMBER/> </TEL> <TEL> <PAGER/> <HOME/> <NUMBER/> </TEL> <TEL> <CELL/> <HOME/> <NUMBER>{NTMobileTelephoneNumber}</NUMBER> </TEL> <TEL> <VOICE/> <HOME/> <NUMBER>{NTHomeTelephoneNumber}</NUMBER> </TEL> <TEL> <FAX/> <HOME/> <NUMBER/> </TEL> <ADR> <WORK/> <PCODE/> <REGION/> <STREET/> <CTRY/> <LOCALITY/> </ADR> <ADR> <HOME/> <PCODE>{NTHomeAddressPostalCode}</PCODE> <REGION>{NTHomeAddressState}</REGION> <STREET>{NTHomeAddressStreet}</STREET> <CTRY>{NTHomeAddressCountry}</CTRY> <LOCALITY>{NTHomeAddressCity}</LOCALITY> </ADR> </vCard> </iq> ";

            if (contact.NTPicture.Length > 0) mPresenceAvatarSHA1 = SHA1_ComputeHexaHash(System.Convert.FromBase64String(contact.NTPicture));

            message = message
                .Replace("{NTFirstName}", contact.NTFirstName)
                .Replace("{NTMiddleName}", contact.NTMiddleName)
                .Replace("{NTLastName}", contact.NTLastName)
                .Replace("{NTNickname}", contact.NTNickname)
                .Replace("{NTEmail1Address}", contact.NTEmail1Address)
                .Replace("{NTBusinessTelephoneNumber}", contact.NTBusinessTelephoneNumber)
                .Replace("{NTHomeTelephoneNumber}", contact.NTHomeTelephoneNumber)
                .Replace("{NTMobileTelephoneNumber}", contact.NTMobileTelephoneNumber)
                .Replace("{NTHomeAddressStreet}", contact.NTHomeAddressStreet)
                .Replace("{NTHomeAddressCity}", contact.NTHomeAddressCity)
                .Replace("{NTHomeAddressPostalCode}", contact.NTHomeAddressPostalCode)
                .Replace("{NTHomeAddressState}", contact.NTHomeAddressState)
                .Replace("{NTHomeAddressCountry}", contact.NTHomeAddressCountry)
                .Replace("{NTPicture}", contact.NTPicture);

            return new IQMessage(jabberUser.Domain, message);
        }
예제 #30
0
        private Outlook.ContactItem NTTranslator(NTContact item)
        {
            Outlook.Application outlookApp      = new Outlook.Application();
            Outlook.NameSpace   oNS             = outlookApp.GetNamespace("MAPI");
            Outlook.MAPIFolder  oContactsFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
            Outlook.ContactItem oItem           = null;

            try
            {
                oItem = (Outlook.ContactItem)oNS.GetItemFromID(item.NTItemId, oContactsFolder.StoreID);
            }
            catch (Exception)
            {
            }
            if (oItem == null)
            {
                oItem = (Outlook.ContactItem)outlookApp.CreateItem(Outlook.OlItemType.olContactItem);
            }

            oItem.User1 = item.NTUsername;

            oItem.Account = item.NTAccountName;
            //item.NTAnniversary = oItem.Anniversary.ToString();
            //item.NTAssistantName = oItem.AssistantName;
            //item.NTAssistantTelephoneNumber = oItem.AssistantTelephoneNumber;
            //item.NTBirthday = oItem.Birthday.ToString();
            //item.NTBody = oItem.Body;
            //item.NTBusiness2TelephoneNumber = oItem.Business2TelephoneNumber;
            //item.NTBusinessAddressCity = oItem.BusinessAddressCity;
            //item.NTBusinessAddressCountry = oItem.BusinessAddressCountry;
            //item.NTBusinessAddressPostalCode = oItem.BusinessAddressPostalCode;
            //item.NTBusinessAddressState = oItem.BusinessAddressState;
            //item.NTBusinessAddressStreet = oItem.BusinessAddressStreet;
            //item.NTBusinessFaxNumber = oItem.BusinessFaxNumber;
            //item.NTBusinessTelephoneNumber = oItem.BusinessTelephoneNumber;
            //item.NTCarTelephoneNumber = oItem.CarTelephoneNumber;
            //item.NTCategories = oItem.Categories;
            //item.NTChildren = oItem.Children;
            //item.NTCompanyName = oItem.CompanyName;
            oItem.CompanyMainTelephoneNumber = item.NTCompanyTelephoneNumber;
            //item.NTCustomerId = oItem.CustomerID;
            //item.NTDepartment = oItem.Department;
            oItem.Email1Address = item.NTEmail1Address;
            //item.NTEmail2Address = oItem.Email2Address;
            //item.NTEmail3Address = oItem.Email3Address;
            //item.NTFileAs = oItem.FileAs;
            oItem.FirstName = item.NTFirstName;
            //item.NTGovernmentId = oItem.GovernmentIDNumber;
            //item.NTHome2TelephoneNumber = oItem.Home2TelephoneNumber;
            oItem.HomeAddressCity       = item.NTHomeAddressCity;
            oItem.HomeAddressCountry    = item.NTHomeAddressCountry;
            oItem.HomeAddressPostalCode = item.NTHomeAddressPostalCode;
            oItem.HomeAddressState      = item.NTHomeAddressState;
            oItem.HomeAddressStreet     = item.NTHomeAddressStreet;
            oItem.HomeFaxNumber         = item.NTHomeFaxNumber;
            oItem.HomeTelephoneNumber   = item.NTHomeTelephoneNumber;
            //item.NTIM2Address = "";
            //item.NTIM3Address = "";
            //oItem.EntryID =item.NTItemId;
            //item.NTJobTitle = oItem.JobTitle;
            oItem.LastName = item.NTLastName;
            //item.NTManager = oItem.ManagerName;
            oItem.MiddleName            = item.NTMiddleName;
            oItem.MobileTelephoneNumber = item.NTMobileTelephoneNumber;
            //Item.NickName = item.NTNickname
            //item.NTOfficeLocation = oItem.OfficeLocation;
            //item.NTOtherAddressCity = oItem.OtherAddressCity;
            //item.NTOtherAddressCountry = oItem.OtherAddressCountry;
            //item.NTOtherAddressPostalCode = oItem.OtherAddressPostalCode;
            //item.NTOtherAddressState = oItem.OtherAddressState;
            //item.NTOtherAddressStreet = oItem.OtherAddressStreet;
            //item.NTPagerNumber = oItem.PagerNumber;
            //item.NTPicture = "";
            //item.NTProperties = "";
            //item.NTRadioTelephoneNumber = oItem.RadioTelephoneNumber;
            //item.NTRingTone = "";
            //item.NTSpouse = oItem.Spouse;
            //item.NTSuffix = oItem.Suffix;
            //item.NTTitle = oItem.Title;
            //item.NTWebPage = oItem.WebPage;
            //item.NTYomiCompanyName = oItem.YomiCompanyName;
            //item.NTYomiFirstName = oItem.YomiFirstName;
            //item.NTYomiLastName = oItem.YomiLastName;
            oItem.IMAddress = item.NTJabberID;

            return(oItem);
        }
예제 #31
0
        public void Save()
        {
            #region Local Store
            if (UseLocalStore)
            {
                try
                {
                    if (!Directory.Exists(mStoreUserDirectory))
                    {
                        Directory.CreateDirectory(mStoreUserDirectory);
                    }

                    NTContact[] contacts = new NTContact[this.Count];
                    int         j        = 0;
                    lock (this)
                    {
                        for (int i = this.Count - 1; i >= 0; i--)
                        {
                            if (this[i].NTContactStore == NTContactStoreType.Local && this[i].NTDeleted != "true")
                            {
                                contacts[j] = this[i];
                                j++;
                            }
                        }
                    }

                    try
                    {
                        Array.Resize(ref contacts, j);

                        XmlSerializer xser = new XmlSerializer(typeof(NTContact[]));
                        StreamWriter  sw   = new StreamWriter(mStoreUserDirectory + mStoreFilename);
                        xser.Serialize(sw, contacts);
                        sw.Close();
                    }
                    catch (Exception ex)
                    {
#if (TRACE)
                        Console.WriteLine("Save Contacts Book | Local Store : Failed - " + ex.Message);
#endif
                    }
                }
                catch (Exception)
                {
#if (DEBUG)
                    throw;
#endif
                }
            }
            #endregion
#if !(REMWAVE_LITE)
            #region Server Store
            if (UseServerStore)
            {
                try
                {
                    NTContact[] contacts = new NTContact[this.Count];
                    int         j        = 0;
                    lock (this)
                    {
                        for (int i = this.Count - 1; i >= 0; i--)
                        {
                            if (this[i].NTContactStore == NTContactStoreType.Server & (this[i].NTContactChanged | this[i].NTDeleted == "true"))
                            {
                                contacts[j] = this[i];
                                contacts[j].NTContactChanged = false;
                                j++;
                            }
                        }
                    }

                    Array.Resize(ref contacts, j);

                    Remwave.Client.RSIFeaturesWS.RSIService ss = new Remwave.Client.RSIFeaturesWS.RSIService();
                    XmlSerializer xser = new XmlSerializer(typeof(NTContact[]));
                    StringWriter  sw   = new StringWriter();
                    xser.Serialize(sw, contacts);
                    ss.servicePhonebookPutAsync(mUserAccount.Username, mUserAccount.Password, mProperties, sw.ToString());
                    sw.Close();
                }
                catch (Exception ex)
                {
#if (TRACE)
                    Console.WriteLine("Save Contacts Book | Server Store : Failed - " + ex.Message);
#endif
                }
            }
            #endregion

            #region Outlook Store
            if (UseOutlookStore)
            {
                try
                {
                    //TODO CREATE OR UPDATE
                    lock (this)
                    {
                        for (int i = this.Count - 1; i >= 0; i--)
                        {
                            if (this[i].NTContactStore == NTContactStoreType.Outlook && (this[i].NTContactChanged || this[i].NTDeleted == "true"))
                            {
                                try
                                {
                                    Outlook.ContactItem oItem = NTTranslator(this[i]);
                                    if (this[i].NTDeleted == "true")
                                    {
                                        oItem.Delete();
                                    }
                                    else
                                    {
                                        oItem.Save();
                                    }
                                }
                                catch (Exception ex)
                                {
#if (TRACE)
                                    Console.WriteLine("Save Contacts Book | Outlook Store : Failed - " + ex.Message);
#endif
                                }
                                this[i].NTContactChanged = false;
                            }
                        }
                    }
                }
                catch (Exception)
                {
#if (DEBUG)
                    throw;
#endif
                }
            }
            #endregion
#endif
        }
예제 #32
0
        public void AddNotification(String jid, String senderEvent, string messageText, DateTime messageDateTime, string messageGUID, bool flashWindow, bool forceChat)
        {
            if (InvokeRequired)
            {
                this.Invoke(new AddNotificationDelegate(this.AddNotification), new object[] { jid, senderEvent, messageText, messageDateTime, messageGUID, flashWindow });
                return;
            }

            //IMMessage parameters
            MessageStyle        style           = new MessageStyle(Color.White, new System.Drawing.Font("Trebuchet MS", 8.5F, System.Drawing.FontStyle.Regular), Color.Gray, Color.Gray);
            MessageTemplateType template        = MessageTemplateType.Notification;
            ChatSession         tmplChatSession = (ChatSession)myChatSessions[jid];
            JabberUser          jabberUser      = new JabberUser(jid);

            switch (senderEvent)
            {
            case "INFO":
                senderEvent = "";
                if (flashWindow)
                {
                    myClientForm.myNotifyIcon.ShowBalloonTip(10, jabberUser.Nick, messageText, ToolTipIcon.Info);
                }
                break;

            case "CLIENT":
            case "SERVER":
            case "PRESENCE":
            case "BUDDYUPDATE":
                senderEvent = Properties.Localization.txtChatInfoSenderSystem;
                break;

            case "NUDGE":
                senderEvent = "";
                myClientForm.mClientEvents.RaiseEvent(Remwave.Client.Events.ClientEvent.IncomingNudge);
                FlashWindow(this.Handle, true);
                #region Shake Window
                Random rand = new Random();
                int    left = this.Left;
                int    top  = this.Top;
                for (int i = 0; i < 30; i++)
                {
                    int randLeft = rand.Next(-10, 10);
                    int randTop  = rand.Next(-10, 10);
                    this.Left = (left + randLeft) > 0 ? left + randLeft : 0;
                    this.Top  = (top + randTop) > 0 ? left + randLeft : 0;
                    Thread.Sleep(50);
                }
                this.Left = left;
                this.Top  = top;
                #endregion
                break;

            case "INVITE":
                senderEvent = Properties.Localization.txtChatInfoSenderUser;
                myClientForm.mClientEvents.RaiseEvent(Remwave.Client.Events.ClientEvent.IncomingInstantMessage);
                break;
            }

            if (forceChat && tmplChatSession == null)
            {
                try
                {
                    JabberUser  chatJabberUser;
                    ContactList contactList = myClientForm.mContactBook.getCandidatesForJabberID(jid);
                    if (contactList.Count > 0)
                    {
                        NTContact ntContact = (NTContact)contactList[0];
                        chatJabberUser = new JabberUser(ntContact.NTJabberID, ntContact.NTNickname);
                    }
                    else
                    {
                        chatJabberUser = new JabberUser(jid);
                    }

                    NewChat(chatJabberUser, false);
                    tmplChatSession = (ChatSession)myChatSessions[chatJabberUser.JID];
                    if (tmplChatSession == null)
                    {
                        return;
                    }
                }
                catch (Exception)
                {
                    return;
                }
            }

            //if chat session exist display content in conversation window
            if (tmplChatSession != null)
            {
                if (tmplChatSession.ChatBox.ChatTabConversation != null)
                {
                    IMMessage message = new IMMessage(senderEvent, messageText, messageGUID, messageDateTime, style, template, myEmoticons);
                    tmplChatSession.ChatBox.ChatTabConversation.Document.Body.InnerHtml += message.HTML;
                    tmplChatSession.ChatBox.ChatTabConversation.Document.Window.ScrollTo(0, tmplChatSession.ChatBox.ChatTabConversation.Document.Body.ScrollRectangle.Height);
                    tmplChatSession.ChatBox.AttachEvents();
                }
            }
        }
예제 #33
0
        private void DisplaySelectionOptions(NTContact contact)
        {
            int itemsHeight = 0;
            displayingContacts = false;
            //build sub menue

            Font listItemNameFont = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ;
            Font listItemDescriptionFont = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            Font listSubItemNameFont = new System.Drawing.Font("Trebuchet MS", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ;
            Font listSubItemDescriptionFont = new System.Drawing.Font("Trebuchet MS", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            Size listItemSize = new Size(300, 44);
            Size listSubItemSize = new Size(300, 44);

            lbxSearchResults.Items.Clear();

            lbxSearchResults.Items.Add(BuildRadMenuContentItem(
            contact,
            GetContactName(contact),
            GetContactPrimaryPhoneNumbers(contact),
            ((System.Drawing.Image)(Properties.Resources.listIconVcard)),
            listItemSize,
            listItemNameFont,
            listItemDescriptionFont,
            Telerik.WinControls.ElementVisibility.Visible,
            false
            ));

            itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

            if (contact.NTJabberID != "")
            {
                JabberUser contactJabberUser = new JabberUser(contact.NTJabberID, contact.NTNickname);

                //Call PC2PC
                Activity activityPC2PCCall = new Activity(ActivityType.Call, contactJabberUser, null);

                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityPC2PCCall,
                Properties.Localization.txtCMenuCallComputer,
                contactJabberUser.Nick,
                ((System.Drawing.Image)(Properties.Resources.listIconComputer)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

                //Send Instant Message
                Activity activityIM = new Activity(ActivityType.IM, contactJabberUser, null);
                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityIM,
                Properties.Localization.txtCMenuSendMessage,
                contactJabberUser.Nick,
                ((System.Drawing.Image)(Properties.Resources.listIconInstantMessage)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

                //Start Video Call
                Activity activityVideoCall = new Activity(ActivityType.VideoCall, contactJabberUser, null);
                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityVideoCall,
                Properties.Localization.txtCMenuVideoCall,
                contactJabberUser.Nick,
                ((System.Drawing.Image)(Properties.Resources.listIconWebcam)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

                //Start Screen Sharing
                Activity activityScreenSharing = new Activity(ActivityType.ScreenSharing, contactJabberUser, null);
                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityScreenSharing,
                Properties.Localization.txtCMenuScreenSharing,
                contactJabberUser.Nick,
                ((System.Drawing.Image)(Properties.Resources.listIconScreenSharing)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

            }

            if (contact.NTHomeTelephoneNumber != "")
            {
                //Call Home
                Activity activityCallHome = new Activity(ActivityType.Call, null, contact.NTHomeTelephoneNumber);
                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityCallHome,
              Properties.Localization.txtCMenuCallHome,
                contact.NTHomeTelephoneNumber,
                ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

            }

            if (contact.NTMobileTelephoneNumber != "")
            {
                //Call Mobile
                Activity activityCallMobile = new Activity(ActivityType.Call, null, contact.NTMobileTelephoneNumber);
                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityCallMobile,
                Properties.Localization.txtCMenuCallMobile,
                contact.NTMobileTelephoneNumber,
                ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;


            }

            if (contact.NTBusinessTelephoneNumber != "")
            {
                //Call Business
                Activity activityCallBusiness = new Activity(ActivityType.Call, null, contact.NTBusinessTelephoneNumber);
                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityCallBusiness,
                Properties.Localization.txtCMenuCallWork,
                contact.NTBusinessTelephoneNumber,
                ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

            }

            if (contact.NTVoIPTelephoneNumber != "")
            {
                //Call VoIP
                Activity activityCallVoIP = new Activity(ActivityType.Call, null, contact.NTVoIPTelephoneNumber);
                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityCallVoIP,
                 Properties.Localization.txtCmenuCallVoIP,
                contact.NTVoIPTelephoneNumber,
                ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

            }

            if (contact.NTEmail1Address != "")
            {
                //Send Email
                Activity activitySendEmail = new Activity(ActivityType.Email, null, contact.NTEmail1Address);
                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activitySendEmail,
                Properties.Localization.txtCMenuSendEmail,
                contact.NTEmail1Address,
                ((System.Drawing.Image)(Properties.Resources.listIconEmail)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

            }

            if (lbxSearchResults.Items.Count > 1) lbxSearchResults.SelectedIndex = 1;
            else if (lbxSearchResults.Items.Count > 0) lbxSearchResults.SelectedIndex = 0;

            AdjustFormSize(itemsHeight);
        }
예제 #34
0
        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;
            }
        }
예제 #35
0
        public ContactsWindow(ClientForm clientForm, NTContact selectedMyContact, Hashtable properties)
        {
            InitializeComponent();

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

            myClientForm = clientForm;
            myRPhoneBook = myClientForm.myContactsBook;


            try
            {
                if (selectedMyContact != null)
                {
                    myNTContact = selectedMyContact;
                }
                else
                {
                    myNTContact = new NTContact();
                }

                myContactJabberIDListBox.Items.Clear();
                myContactJabberIDListBox.Items.Add("");

                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;

                myContactJabberIDListBox.SelectedText = 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;

                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;
                    myContactJabberIDListBox.SelectedText = 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;
                }

                foreach (DictionaryEntry buddy in myClientForm.myBuddyList)
                {
                    myContactJabberIDListBox.Items.Add(buddy.Key.ToString());
                    myContactJabberGroupListBox.Items.Add(buddy.Value.ToString());
                    if (myContactJabberIDListBox.Text == buddy.Key.ToString())
                    {
                        myContactJabberIDListBox.SelectedIndex    = myContactJabberIDListBox.Items.Count - 1;
                        myContactJabberGroupListBox.SelectedIndex = myContactJabberGroupListBox.Items.Count - 1;
                    }
                }
            }
            catch (Exception)
            {
                //  throw;
            }
        }
예제 #36
0
        public void Save()
        {
            #region Local Store
            if (UseLocalStore)
            {
                try
                {
                    if (!Directory.Exists(mStoreUserDirectory))
                    {
                        Directory.CreateDirectory(mStoreUserDirectory);
                    }

                    NTContact[] contacts = new NTContact[this.Count];
                    int j = 0;
                    lock (this)
                    {
                        for (int i = this.Count - 1; i >= 0; i--)
                        {
                            if (this[i].NTContactStore == NTContactStoreType.Local && this[i].NTDeleted != "true")
                            {
                                contacts[j] = this[i];
                                j++;
                            }
                        }
                    }

                    try
                    {
                        Array.Resize(ref contacts, j);

                        XmlSerializer xser = new XmlSerializer(typeof(NTContact[]));
                        StreamWriter sw = new StreamWriter(mStoreUserDirectory + mStoreFilename);
                        xser.Serialize(sw, contacts);
                        sw.Close();
                    }
                    catch (Exception ex)
                    {

#if (TRACE)
                        Console.WriteLine("Save Contacts Book | Local Store : Failed - " + ex.Message);
#endif
                    }
                }
                catch (Exception)
                {
#if (DEBUG)
                    throw;
#endif
                }


            }
            #endregion
#if !(REMWAVE_LITE)
            #region Server Store
            if (UseServerStore)
            {
                try
                {
                    NTContact[] contacts = new NTContact[this.Count];
                    int j = 0;
                    lock (this)
                    {
                        for (int i = this.Count - 1; i >= 0; i--)
                        {
                            if (this[i].NTContactStore == NTContactStoreType.Server & (this[i].NTContactChanged | this[i].NTDeleted == "true"))
                            {
                                contacts[j] = this[i];
                                contacts[j].NTContactChanged = false;
                                j++;
                            }
                        }
                    }

                    Array.Resize(ref contacts, j);

                    Remwave.Client.RSIFeaturesWS.RSIService ss = new Remwave.Client.RSIFeaturesWS.RSIService();
                    XmlSerializer xser = new XmlSerializer(typeof(NTContact[]));
                    StringWriter sw = new StringWriter();
                    xser.Serialize(sw, contacts);
                    ss.servicePhonebookPutAsync(mUserAccount.Username, mUserAccount.Password, mProperties, sw.ToString());
                    sw.Close();
                }
                catch (Exception ex)
                {
#if (TRACE)
                    Console.WriteLine("Save Contacts Book | Server Store : Failed - " + ex.Message);
#endif
                }
            }
            #endregion

            #region Outlook Store
            if (UseOutlookStore)
            {
                try
                {
                    //TODO CREATE OR UPDATE
                    lock (this)
                    {
                        for (int i = this.Count - 1; i >= 0; i--)
                        {
                            if (this[i].NTContactStore == NTContactStoreType.Outlook && (this[i].NTContactChanged || this[i].NTDeleted == "true"))
                            {
                                try
                                {
                                    Outlook.ContactItem oItem = NTTranslator(this[i]);
                                    if (this[i].NTDeleted == "true")
                                    {
                                        oItem.Delete();
                                    }
                                    else
                                    {
                                        oItem.Save();
                                    }
                                }
                                catch (Exception ex)
                                {

#if (TRACE)
                                    Console.WriteLine("Save Contacts Book | Outlook Store : Failed - " + ex.Message);
#endif
                                }
                                this[i].NTContactChanged = false;
                            }

                        }
                    }


                }
                catch (Exception)
                {
#if (DEBUG)
                    throw;
#endif
                }


            }
            #endregion
#endif
        }
예제 #37
0
        public ContactsWindow(ClientForm clientForm, NTContact selectedMyContact, Hashtable properties)
        {
            InitializeComponent();

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

            myClientForm = clientForm;
            myRPhoneBook = myClientForm.myContactsBook;


            try
            {

            
            if (selectedMyContact != null)
            {
                myNTContact = selectedMyContact;
            }
            else
            {
                myNTContact = new NTContact();
            }

            myContactJabberIDListBox.Items.Clear();
            myContactJabberIDListBox.Items.Add("");

            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;
            
                myContactJabberIDListBox.SelectedText = 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;

            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;
                myContactJabberIDListBox.SelectedText = 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;
            }

            foreach (DictionaryEntry buddy in myClientForm.myBuddyList)
            {
                myContactJabberIDListBox.Items.Add(buddy.Key.ToString());
                myContactJabberGroupListBox.Items.Add(buddy.Value.ToString());
                if (myContactJabberIDListBox.Text == buddy.Key.ToString())
                {
                    myContactJabberIDListBox.SelectedIndex = myContactJabberIDListBox.Items.Count - 1;
                    myContactJabberGroupListBox.SelectedIndex = myContactJabberGroupListBox.Items.Count - 1;
                }
            }
        }
        catch (Exception)
        {

          //  throw;
        }
        }
예제 #38
0
        private Outlook.ContactItem NTTranslator(NTContact item)
        {
            Outlook.Application outlookApp = new Outlook.Application();
            Outlook.NameSpace oNS = outlookApp.GetNamespace("MAPI");
            Outlook.MAPIFolder oContactsFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
            Outlook.ContactItem oItem = null;

            try
            {
                oItem = (Outlook.ContactItem)oNS.GetItemFromID(item.NTItemId, oContactsFolder.StoreID);
            }
            catch (Exception)
            {

            }
            if (oItem == null) oItem = (Outlook.ContactItem)outlookApp.CreateItem(Outlook.OlItemType.olContactItem);

            oItem.User1 = item.NTUsername;

            oItem.Account = item.NTAccountName;
            //item.NTAnniversary = oItem.Anniversary.ToString();
            //item.NTAssistantName = oItem.AssistantName;
            //item.NTAssistantTelephoneNumber = oItem.AssistantTelephoneNumber;
            //item.NTBirthday = oItem.Birthday.ToString();
            //item.NTBody = oItem.Body;
            //item.NTBusiness2TelephoneNumber = oItem.Business2TelephoneNumber;
            //item.NTBusinessAddressCity = oItem.BusinessAddressCity;
            //item.NTBusinessAddressCountry = oItem.BusinessAddressCountry;
            //item.NTBusinessAddressPostalCode = oItem.BusinessAddressPostalCode;
            //item.NTBusinessAddressState = oItem.BusinessAddressState;
            //item.NTBusinessAddressStreet = oItem.BusinessAddressStreet;
            //item.NTBusinessFaxNumber = oItem.BusinessFaxNumber;
            //item.NTBusinessTelephoneNumber = oItem.BusinessTelephoneNumber;
            //item.NTCarTelephoneNumber = oItem.CarTelephoneNumber;
            //item.NTCategories = oItem.Categories;
            //item.NTChildren = oItem.Children;
            //item.NTCompanyName = oItem.CompanyName;
            oItem.CompanyMainTelephoneNumber = item.NTCompanyTelephoneNumber;
            //item.NTCustomerId = oItem.CustomerID;
            //item.NTDepartment = oItem.Department;
            oItem.Email1Address = item.NTEmail1Address;
            //item.NTEmail2Address = oItem.Email2Address;
            //item.NTEmail3Address = oItem.Email3Address;
            //item.NTFileAs = oItem.FileAs;
            oItem.FirstName = item.NTFirstName;
            //item.NTGovernmentId = oItem.GovernmentIDNumber;
            //item.NTHome2TelephoneNumber = oItem.Home2TelephoneNumber;
            oItem.HomeAddressCity = item.NTHomeAddressCity;
            oItem.HomeAddressCountry = item.NTHomeAddressCountry;
            oItem.HomeAddressPostalCode = item.NTHomeAddressPostalCode;
            oItem.HomeAddressState = item.NTHomeAddressState;
            oItem.HomeAddressStreet = item.NTHomeAddressStreet;
            oItem.HomeFaxNumber = item.NTHomeFaxNumber;
            oItem.HomeTelephoneNumber = item.NTHomeTelephoneNumber;
            //item.NTIM2Address = "";
            //item.NTIM3Address = "";
            //oItem.EntryID =item.NTItemId;
            //item.NTJobTitle = oItem.JobTitle;
            oItem.LastName = item.NTLastName;
            //item.NTManager = oItem.ManagerName;
            oItem.MiddleName = item.NTMiddleName;
            oItem.MobileTelephoneNumber = item.NTMobileTelephoneNumber;
            //Item.NickName = item.NTNickname
            //item.NTOfficeLocation = oItem.OfficeLocation;
            //item.NTOtherAddressCity = oItem.OtherAddressCity;
            //item.NTOtherAddressCountry = oItem.OtherAddressCountry;
            //item.NTOtherAddressPostalCode = oItem.OtherAddressPostalCode;
            //item.NTOtherAddressState = oItem.OtherAddressState;
            //item.NTOtherAddressStreet = oItem.OtherAddressStreet;
            //item.NTPagerNumber = oItem.PagerNumber;
            //item.NTPicture = "";
            //item.NTProperties = "";
            //item.NTRadioTelephoneNumber = oItem.RadioTelephoneNumber;
            //item.NTRingTone = "";
            //item.NTSpouse = oItem.Spouse;
            //item.NTSuffix = oItem.Suffix;
            //item.NTTitle = oItem.Title;
            //item.NTWebPage = oItem.WebPage;
            //item.NTYomiCompanyName = oItem.YomiCompanyName;
            //item.NTYomiFirstName = oItem.YomiFirstName;
            //item.NTYomiLastName = oItem.YomiLastName;
            oItem.IMAddress = item.NTJabberID;

            return oItem;
        }
예제 #39
0
 internal void StoreVCard(JabberUser jabberUser, NTContact contact)
 {
     this.OnSendIQMessage(IQMessage_StoreVCard(jabberUser, contact), new EventArgs());
 }
예제 #40
0
        public Phone2PhoneWindow(NTContact selectedContact, NTContact meContact)
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Phone2PhoneWindow));

            InitializeComponent();
            LocalizeComponent();
            BrandComponent();
            mySelectedNTContact = selectedContact;
            myMeNTContact = meContact;

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


           lblPhoneFromName.Text = mySelectedNTContact.FullName() + "'s Phone Number";
            selectedContactComboBox.Items.Clear();
            selectedContactComboBox.Items.Clear();
            meContactComboBox.Items.Clear();
#region process mySelectedNTContact
            if (mySelectedNTContact.NTHomeTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.selectedContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplRadComboBoxItem});

                // 
                // tmplRadComboBoxItem
                // 
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus = true;
                this.tmplRadComboBoxItem.DescriptionText = Properties.Localization.txtCFormTitlePhoneHome;
                this.tmplRadComboBoxItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text = mySelectedNTContact.NTHomeTelephoneNumber; 
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText = null;
                this.tmplRadComboBoxItem.DisplayStyle = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation = TextImageRelation.ImageBeforeText;
                this.selectedContactComboBox.SelectedItem = this.tmplRadComboBoxItem;
            }
            if (mySelectedNTContact.NTMobileTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.selectedContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplRadComboBoxItem});

                // 
                // tmplRadComboBoxItem
                // 
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus = true;
                this.tmplRadComboBoxItem.DescriptionText = Properties.Localization.txtCFormTitlePhoneMobile;
                this.tmplRadComboBoxItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text = mySelectedNTContact.NTMobileTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText = null;
                this.tmplRadComboBoxItem.DisplayStyle = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation = TextImageRelation.ImageBeforeText;
                this.selectedContactComboBox.SelectedItem = this.tmplRadComboBoxItem;
            };
            if (mySelectedNTContact.NTBusinessTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.selectedContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplRadComboBoxItem});

                // 
                // tmplRadComboBoxItem
                // 
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus = true;
                this.tmplRadComboBoxItem.DescriptionText = Properties.Localization.txtCFormTitlePhoneBusiness;
                this.tmplRadComboBoxItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text = mySelectedNTContact.NTBusinessTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText = null;
                this.tmplRadComboBoxItem.DisplayStyle = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation = TextImageRelation.ImageBeforeText;
                this.selectedContactComboBox.SelectedItem = this.tmplRadComboBoxItem;
            };
            if (selectedContactComboBox.Items.Count > 0) selectedContactComboBox.SelectedIndex = 0;
#endregion

            #region process myMeNTContact
            if (myMeNTContact.NTHomeTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.meContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplRadComboBoxItem});

                // 
                // tmplRadComboBoxItem
                // 
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus = true;
                this.tmplRadComboBoxItem.DescriptionText = Properties.Localization.txtCFormTitlePhoneHome;
                this.tmplRadComboBoxItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text = myMeNTContact.NTHomeTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText = null;
                this.tmplRadComboBoxItem.DisplayStyle = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation = TextImageRelation.ImageBeforeText;
                this.meContactComboBox.SelectedItem = this.tmplRadComboBoxItem;
            }
            if (myMeNTContact.NTMobileTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.meContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplRadComboBoxItem});

                // 
                // tmplRadComboBoxItem
                // 
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus = true;
                this.tmplRadComboBoxItem.DescriptionText = Properties.Localization.txtCFormTitlePhoneMobile;
                this.tmplRadComboBoxItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text = myMeNTContact.NTMobileTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText = null;
                this.tmplRadComboBoxItem.DisplayStyle = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation = TextImageRelation.ImageBeforeText;
                this.meContactComboBox.SelectedItem = this.tmplRadComboBoxItem;
            };
            if (myMeNTContact.NTBusinessTelephoneNumber != "")
            {
                this.tmplRadComboBoxItem = new Telerik.WinControls.UI.RadComboBoxItem();

                this.meContactComboBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplRadComboBoxItem});

                // 
                // tmplRadComboBoxItem
                // 
                this.tmplRadComboBoxItem.AccessibleDescription = "";
                this.tmplRadComboBoxItem.CanFocus = true;
                this.tmplRadComboBoxItem.DescriptionText = Properties.Localization.txtCFormTitlePhoneBusiness;
                this.tmplRadComboBoxItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.tmplRadComboBoxItem.Image = ((System.Drawing.Image)(resources.GetObject("tmpRadComboBoxItem.Image")));
                this.tmplRadComboBoxItem.Text = myMeNTContact.NTBusinessTelephoneNumber;
                this.tmplRadComboBoxItem.TextSeparatorVisibility = Telerik.WinControls.ElementVisibility.Visible;
                this.tmplRadComboBoxItem.ToolTipText = null;
                this.tmplRadComboBoxItem.DisplayStyle = DisplayStyle.ImageAndText;
                this.tmplRadComboBoxItem.TextImageRelation = TextImageRelation.ImageBeforeText;
                this.meContactComboBox.SelectedItem = this.tmplRadComboBoxItem;
            };
            if (meContactComboBox.Items.Count > 0) meContactComboBox.SelectedIndex = 0;
            #endregion

        }
예제 #41
0
        private void LoadContact(NTContact selectedMyContact)
        {
            if (selectedMyContact != null)
            {
                mNTContact = selectedMyContact;
            }
            else
            {
                mNTContact = new NTContact();
            }

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

            foreach (NTContactStore store in myClientForm.mContactBook.ContactStores)
            {
                if (store.Enabled)
                {
                    myContactStoreComboBox.Items.Add(store);
                }
                if (mNTContact.NTContactStore == store.StoreType)
                {
                    myContactStoreComboBox.SelectedItem = store;
                }
            }

            myContactJabberIDInput.Text = mNTContact.NTJabberID;

            myContactFirstNameInput.Text     = mNTContact.NTFirstName;
            myContactMiddleNameInput.Text    = mNTContact.NTMiddleName;
            myContactLastNameInput.Text      = mNTContact.NTLastName;
            myContactPhoneHomeInput.Text     = mNTContact.NTHomeTelephoneNumber;
            myContactPhoneMobileInput.Text   = mNTContact.NTMobileTelephoneNumber;
            myContactPhoneBusinessInput.Text = mNTContact.NTBusinessTelephoneNumber;
            myContactPhoneVoIPInput.Text     = mNTContact.NTVoIPTelephoneNumber;

            myContactJabberIDInput.Text = mNTContact.NTJabberID;

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

            myContactAddressEmailInput.Text = mNTContact.NTEmail1Address;

            try
            {
                myContactPicture.Image = myContactPicture.Image = ImageProcessing.FixedSize(ImageProcessing.FromString(mNTContact.NTPicture), 64, 64);
            }
            catch (Exception)
            {
            }


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

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

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

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

            JabberUser jabberUser = null;

            if (myContactJabberIDInput.Text != "")
            {
                jabberUser = new JabberUser(myContactJabberIDInput.Text);
                myContactJabberIDInput.Text = jabberUser.Username;
                myContactJabberIMNetworkListBox.SelectedItem = jabberUser.Network;
                myContactJabberGroupListBox.Text             = myClientForm.myBuddyList[jabberUser.JID] != null ? myClientForm.myBuddyList[jabberUser.JID].ToString() : Properties.Localization.txtOtherGroup;
            }



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

                myContactStoreComboBox.Enabled = false;
                myContactStoreComboBox.Visible = false;

                labelStore.Visible = false;
            }
        }
예제 #42
0
 internal void StoreVCard(JabberUser jabberUser, NTContact contact)
 {
     this.OnSendIQMessage(IQMessage_StoreVCard(jabberUser, contact), new EventArgs());
 }
예제 #43
0
        public void Load(UserAccount userAccount)
        {
            mUserAccount = userAccount;

            #region Local Store
            if (UseLocalStore)
            {
                try
                {
                    XmlSerializer xser     = new XmlSerializer(typeof(NTContact[]));
                    StreamReader  sr       = new StreamReader(mStoreUserDirectory + mStoreFilename);
                    NTContact[]   contacts = (NTContact[])xser.Deserialize(sr);
                    sr.Close();
                    lock (this)
                    {
                        foreach (NTContact contact in contacts)
                        {
                            contact.NTContactStore = NTContactStoreType.Local;
                            if (!this.Contains(contact) && contact.NTDeleted != "true")
                            {
                                this.Add(contact);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
#if (TRACE)
                    Console.WriteLine("Load Contacts Book | Local Store : Failed - " + ex.Message);
#endif
                }
            }
            #endregion

#if !(REMWAVE_LITE)
            #region Server Store
            if (UseServerStore)
            {
                try
                {
                    Remwave.Client.RSIFeaturesWS.RSIService ss = new Remwave.Client.RSIFeaturesWS.RSIService();
                    XmlSerializer xser = new XmlSerializer(typeof(NTContact[]));

                    string sout = ss.servicePhonebookGet(mUserAccount.Username, mUserAccount.Password, mProperties, null);
#if (TRACE)
                    Console.WriteLine("PHONEBOOK-GET: " + userAccount.Username + " Done");
#endif

                    StringReader sr  = new StringReader(sout);
                    NTContact[]  ntc = (NTContact[])xser.Deserialize(sr);
                    sr.Close();
                    lock (this)
                    {
                        foreach (NTContact contact in ntc)
                        {
                            contact.NTContactStore = NTContactStoreType.Server;
                            if (!this.Contains(contact))
                            {
                                this.Add(contact);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
#if (TRACE)
                    Console.WriteLine("Load Contacts Book | Server Store : Failed - " + ex.Message);
#endif
                }
            }
            #endregion

            #region Outlook Store
            if (UseOutlookStore)
            {
                Outlook.Application oApp            = new Outlook.Application();
                Outlook.NameSpace   oNS             = oApp.GetNamespace("MAPI");
                Outlook.MAPIFolder  oContactsFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);

                try
                {
                    string        filter        = "[MessageClass] = \"IPM.Contact\"";
                    Outlook.Items oContactItems = oContactsFolder.Items.Restrict(filter);
                    lock (this)
                    {
                        foreach (Outlook.ContactItem item in oContactItems)
                        {
                            try
                            {
                                NTContact contact = NTTranslator((Outlook.ContactItem)item);
                                contact.NTContactStore = NTContactStoreType.Outlook;
                                if (!this.Contains(contact))
                                {
                                    this.Add(contact);
                                }
                            }
                            catch (Exception ex)
                            {
#if (TRACE)
                                Console.WriteLine("Load : UseOutlookStore - " + ex.Message);
#endif
                            }
                        }
                    }
                    oContactItems = null;
                }
                catch (Exception ex)
                {
#if (TRACE)
                    Console.WriteLine("Load Contacts Book | Outlook Store : Failed - " + ex.Message);
#endif
                }

                oApp = null;
                oNS  = null;
            }
            #endregion
#endif
            OnUpdateCompleted(this, new EventArgs());
        }