Esempio n. 1
0
        public ContactList getCandidatesForJabberID(string jabberID)
        {
            ContactList candidates = new ContactList();
            IEnumerator ie = GetEnumerator();
            NTContact e;

            while (ie.MoveNext())
            {
                e = (NTContact)ie.Current;
                if (e.NTJabberID.Trim().ToUpper() == jabberID.Trim().ToUpper())
                {
                    candidates.Add(e);
                }
            }
            return candidates;
        }
Esempio n. 2
0
        public ContactList getCandidatesForNumber(string number)
        {
            ContactList candidates = new ContactList();
            IEnumerator ie = GetEnumerator();
            NTContact e;
            number = number.ToUpper();

            while (ie.MoveNext())
            {
                e = (NTContact)ie.Current;
                if (e.NTHomeTelephoneNumber.StartsWith(number))
                {
                    candidates.Add(e);
                }
            }
            return candidates;
        }
Esempio n. 3
0
        public ContactList getCandidatesForName(string[] keys)
        {
            ContactList candidates = new ContactList();
            IEnumerator ie = GetEnumerator();
            NTContact e;

            foreach (string search in keys)
            {

            while (ie.MoveNext())
            {
                e = (NTContact)ie.Current;
                if (e.NTLastName.ToUpper().StartsWith(search.ToUpper()))
                {
                    candidates.Add(e);
                }
            }
            ie.Reset();
        }
            return candidates;
        }
Esempio n. 4
0
        public RPhoneBook(UserAccount userAccount, bool storeOnline)
        {
            _userAccount = userAccount;
            _contactList = Persistence;
            _storeOnline = storeOnline;

        }
Esempio n. 5
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();
                }
            }
        }
Esempio n. 6
0
        private void DisplaySearchResults(ContactList contactList, String searchText, bool showAll)
        {
            int itemsHeight = 0;

            displayingContacts       = true;
            lbxSearchResults.Visible = true;
            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.Regular, 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();

            searchText = searchText.Trim().ToLower();



            if (searchText != "")
            {
                Activity activityCall = new Activity(ActivityType.Call, null, searchText);

                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityCall,
                        Properties.Localization.txtCMenuCall,
                        searchText,
                        ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                        listItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }


            if (contactList != null)
            {
                foreach (NTContact myNTContact in contactList)
                {
                    if (myNTContact.NTDeleted != "true")
                    {
                        bool DisplayRecord = false;

                        if (showAll)
                        {
                            DisplayRecord = true;
                        }
                        else if (searchText.Length > 0 && searchText != defaultSearchText.ToLower())
                        {
                            foreach (string stringKey in searchText.Split(new String[] { " " }, StringSplitOptions.RemoveEmptyEntries))
                            {
                                if
                                (
                                    myNTContact.NTFirstName.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTLastName.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTEmail1Address.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTJabberID.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTUsername.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTNickname.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTHomeTelephoneNumber.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTMobileTelephoneNumber.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTBusinessTelephoneNumber.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTVoIPTelephoneNumber.Trim().ToLower().StartsWith(stringKey)

                                )
                                {
                                    DisplayRecord = true;
                                    break;
                                }
                            }
                        }

                        if (DisplayRecord)
                        {
                            lbxSearchResults.Items.Add(BuildRadMenuContentItem(
                                                           myNTContact,
                                                           GetContactName(myNTContact),
                                                           GetContactPrimaryPhoneNumbers(myNTContact),
                                                           ((System.Drawing.Image)(Properties.Resources.listIconVcard)),
                                                           listItemSize,
                                                           listItemNameFont,
                                                           listItemDescriptionFont,
                                                           Telerik.WinControls.ElementVisibility.Visible
                                                           ));
                            itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
                        }
                    }
                }
            }

            if (lbxSearchResults.Items.Count == 1)
            {
                Activity activityAddContact = new Activity(ActivityType.AddContact, null, searchText);

                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityAddContact,
                        Properties.Localization.txtSDInfoNoRecordsFound,
                        String.Format(Properties.Localization.txtSDInfoNoRecordsFoundDesc, searchText),
                        ((System.Drawing.Image)(Properties.Resources.listIconVcardAdd)),
                        listItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )

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

            //send nikotalkie message
            Activity activityNikotalkieMessage = new Activity(ActivityType.NikotalkieMessage, null, searchText);

            lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                    activityNikotalkieMessage,
                    "Send a nikotalkie",
                    searchText,
                    ((System.Drawing.Image)(Properties.Resources.listIconInstantMessage)),
                    listSubItemSize,
                    listSubItemNameFont,
                    listSubItemDescriptionFont,
                    Telerik.WinControls.ElementVisibility.Hidden
                    )
                );
            itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;


#if BRAND_NIKOTEL
            int dummy = 0;
            if (searchText.Length == 0)
            {
                //Host nikomeeting session
                Activity activityHostNikomeeting = new Activity(ActivityType.HostNikomeeting, null, "");

                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityHostNikomeeting,
                        "Host a online meeting",
                        "Screen sharing, audio conference and video chat",
                        ((System.Drawing.Image)(Properties.Resources.listIconScreenSharing)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }
            else if (searchText.Replace("-", "").Length == 9 && Int32.TryParse(searchText.Replace("-", ""), out dummy))
            {
                //Join nikomeeting session
                Activity activityJoinNikomeeting = new Activity(ActivityType.JoinNikomeeting, null, tbxSearchText.Text);

                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityJoinNikomeeting,
                        "Join a online meeting :",
                        searchText,
                        ((System.Drawing.Image)(Properties.Resources.listIconScreenSharing)),
                        listSubItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }
#endif
            AdjustFormSize(itemsHeight);


            if (lbxSearchResults.Items.Count > 0)
            {
                lbxSearchResults.SelectedIndex = 0;
            }
        }
Esempio n. 7
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();
                }
            }
        }
Esempio n. 8
0
        public WEBPhoneBook(UserAccount myUserAccount)
        {
            userAccount = myUserAccount;
            contactList = Persistence;

        }
Esempio n. 9
0
        private void DisplaySearchResults(ContactList contactList, String searchText, bool showAll)
        {

            int itemsHeight = 0;
            displayingContacts = true;
            lbxSearchResults.Visible = true;
            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.Regular, 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();

            searchText = searchText.Trim().ToLower();



            if (searchText != "")
            {
                Activity activityCall = new Activity(ActivityType.Call, null, searchText);

                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityCall,
                Properties.Localization.txtCMenuCall,
                searchText,
                ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                listItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }


            if (contactList != null)
            {
                foreach (NTContact myNTContact in contactList)
                {
                    if (myNTContact.NTDeleted != "true")
                    {
                        bool DisplayRecord = false;

                        if (showAll)
                        {
                            DisplayRecord = true;
                        }
                        else if (searchText.Length > 0 && searchText != defaultSearchText.ToLower())
                        {
                            foreach (string stringKey in searchText.Split(new String[] { " " }, StringSplitOptions.RemoveEmptyEntries))
                            {
                                if
                                (
                                myNTContact.NTFirstName.Trim().ToLower().StartsWith(stringKey)
                                ||
                                myNTContact.NTLastName.Trim().ToLower().StartsWith(stringKey)
                                ||
                                myNTContact.NTEmail1Address.Trim().ToLower().StartsWith(stringKey)
                                ||
                                myNTContact.NTJabberID.Trim().ToLower().StartsWith(stringKey)
                                ||
                                myNTContact.NTUsername.Trim().ToLower().StartsWith(stringKey)
                                 ||
                                myNTContact.NTNickname.Trim().ToLower().StartsWith(stringKey)
                                ||
                                myNTContact.NTHomeTelephoneNumber.Trim().ToLower().StartsWith(stringKey)
                                ||
                                myNTContact.NTMobileTelephoneNumber.Trim().ToLower().StartsWith(stringKey)
                                ||
                                myNTContact.NTBusinessTelephoneNumber.Trim().ToLower().StartsWith(stringKey)
                                ||
                                myNTContact.NTVoIPTelephoneNumber.Trim().ToLower().StartsWith(stringKey)

                                )
                                {
                                    DisplayRecord = true;
                                    break;
                                }
                            }
                        }

                        if (DisplayRecord)
                        {
                            lbxSearchResults.Items.Add(BuildRadMenuContentItem(
                            myNTContact,
                            GetContactName(myNTContact),
                            GetContactPrimaryPhoneNumbers(myNTContact),
                            ((System.Drawing.Image)(Properties.Resources.listIconVcard)),
                            listItemSize,
                            listItemNameFont,
                            listItemDescriptionFont,
                            Telerik.WinControls.ElementVisibility.Visible
                            ));
                            itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
                        }
                    }
                }
            }

            if (lbxSearchResults.Items.Count == 1)
            {
                Activity activityAddContact = new Activity(ActivityType.AddContact, null, searchText);

                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityAddContact,
                Properties.Localization.txtSDInfoNoRecordsFound,
                String.Format(Properties.Localization.txtSDInfoNoRecordsFoundDesc,searchText),
                ((System.Drawing.Image)(Properties.Resources.listIconVcardAdd)),
                listItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )

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



            }

            //send nikotalkie message
            Activity activityNikotalkieMessage = new Activity(ActivityType.NikotalkieMessage, null, searchText);

            lbxSearchResults.Items.Add(
            BuildRadMenuContentItem(
            activityNikotalkieMessage,
            "Send a nikotalkie",
             searchText,
            ((System.Drawing.Image)(Properties.Resources.listIconInstantMessage)),
            listSubItemSize,
            listSubItemNameFont,
            listSubItemDescriptionFont,
            Telerik.WinControls.ElementVisibility.Hidden
            )
            );
            itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;


#if BRAND_NIKOTEL
            int dummy = 0;
            if (searchText.Length == 0)
            {
                //Host nikomeeting session
                Activity activityHostNikomeeting = new Activity(ActivityType.HostNikomeeting, null, "");

                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityHostNikomeeting,
                "Host a online meeting",
                "Screen sharing, audio conference and video chat",
                ((System.Drawing.Image)(Properties.Resources.listIconScreenSharing)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;

            }
            else if(searchText.Replace("-","").Length==9 && Int32.TryParse(searchText.Replace("-",""),out dummy))
          {
                //Join nikomeeting session
                Activity activityJoinNikomeeting = new Activity(ActivityType.JoinNikomeeting, null, tbxSearchText.Text);

                lbxSearchResults.Items.Add(
                BuildRadMenuContentItem(
                activityJoinNikomeeting,
                "Join a online meeting :",
                searchText,
                ((System.Drawing.Image)(Properties.Resources.listIconScreenSharing)),
                listSubItemSize,
                listSubItemNameFont,
                listSubItemDescriptionFont,
                Telerik.WinControls.ElementVisibility.Hidden
                )
                );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }
#endif
            AdjustFormSize(itemsHeight);


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

        }
Esempio n. 10
0
 public RPhoneBook(UserAccount userAccount, bool storeOnline)
 {
     _userAccount = userAccount;
     _contactList = Persistence;
     _storeOnline = storeOnline;
 }
Esempio n. 11
0
 public XMLPhoneBook()
 {
     contactList = Persistence;
 }
Esempio n. 12
0
 private void LoadContactsBook(ContactList contactList)
 {
     myContactsListBox.Items.Clear();
   
         
     
     foreach (NTContact contact in contactList)
     {
         if (contact.NTDeleted != "true" && contact.NTJabberID != mUserAccount.Username)
         {
             this.myContactsListBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
             BuildContactItem(contact)});
         }
     }
     if (myContactsListBox.Items.Count > 0) myContactsListBox.SelectedIndex = 0;
     
 }
Esempio n. 13
0
        private void LoadContactsBook(ContactList myContactList)
        {
            myContactsListBox.Items.Clear();
            foreach (NTContact myNTContact in myContactList)
            {
                if (myNTContact.NTDeleted != "true")
                {
                    this.tmplContactListItem = new Telerik.WinControls.UI.RadListBoxItem();

                    this.myContactsListBox.Items.AddRange(new Telerik.WinControls.RadItem[] {
            this.tmplContactListItem});

                    // 
                    // tmplContactListItem
                    // 
                    this.tmplContactListItem.AccessibleDescription = myNTContact.FullName().Length > 64 ? myNTContact.FullName().Trim().Substring(0, 64) : myNTContact.FullName().Trim();
                    this.tmplContactListItem.CanFocus = true;
                    this.tmplContactListItem.DescriptionText = "» " + (myNTContact.PrimaryPhoneNumbers().Length > 64 ? myNTContact.PrimaryPhoneNumbers().Trim().Substring(0, 64) : myNTContact.PrimaryPhoneNumbers().Trim());
                    this.tmplContactListItem.ForeColor = System.Drawing.Color.White;
                    //this.tmplContactListItem.Image = ((System.Drawing.Image)(Properties.Resources.ContactBlank));
                    this.tmplContactListItem.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                    this.tmplContactListItem.Text = "» " + (myNTContact.FullName().Length > 64 ? myNTContact.FullName().Trim().Substring(0, 64) : myNTContact.FullName().Trim());
                    this.tmplContactListItem.Text += myNTContact.NTJabberID.Trim() != "" ? " (" + (myNTContact.NTJabberID.Trim().Length > 64 ? myNTContact.NTJabberID.Trim().Substring(0, 64) : myNTContact.NTJabberID.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.White;
                    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 = myNTContact;
                }
            }
            if (myContactsListBox.Items.Count > 0) myContactsListBox.SelectedIndex = 0;


        }
Esempio n. 14
0
 public WEBPhoneBook(UserAccount myUserAccount)
 {
     userAccount = myUserAccount;
     contactList = Persistence;
 }
Esempio n. 15
0
 public XMLPhoneBook()
 {
     contactList = Persistence;
 }
Esempio n. 16
0
        private void DisplaySearchResults(ContactList contactList, String searchText, bool showAll)
        {
            int itemsHeight = 0;

            displayingContacts       = true;
            lbxSearchResults.Visible = true;
            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.Regular, 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();

            searchText = searchText.Trim().ToLower();



            if (searchText != "")
            {
                Activity activityCall = new Activity(ActivityType.Call, searchText);

                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityCall,
                        "Call",
                        searchText,
                        ((System.Drawing.Image)(Properties.Resources.listIconPhone)),
                        listItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )
                    );
                itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
            }


            if (contactList != null)
            {
                foreach (NTContact myNTContact in contactList)
                {
                    if (myNTContact.NTDeleted != "true")
                    {
                        bool DisplayRecord = false;

                        if (showAll)
                        {
                            DisplayRecord = true;
                        }
                        else if (searchText.Length > 0 && searchText != defaultSearchText.ToLower())
                        {
                            foreach (string stringKey in searchText.Split(new String[] { " " }, StringSplitOptions.RemoveEmptyEntries))
                            {
                                if
                                (
                                    myNTContact.NTFirstName.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTLastName.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTEmail1Address.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTJabberID.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTHomeTelephoneNumber.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTMobileTelephoneNumber.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTBusinessTelephoneNumber.Trim().ToLower().StartsWith(stringKey)
                                    ||
                                    myNTContact.NTVoIPTelephoneNumber.Trim().ToLower().StartsWith(stringKey)

                                )
                                {
                                    DisplayRecord = true;
                                    break;
                                }
                            }
                        }

                        if (DisplayRecord)
                        {
                            lbxSearchResults.Items.Add(BuildRadMenuContentItem(
                                                           myNTContact,
                                                           GetContactName(myNTContact),
                                                           GetContactPrimaryPhoneNumbers(myNTContact),
                                                           ((System.Drawing.Image)(Properties.Resources.listIconVcard)),
                                                           listItemSize,
                                                           listItemNameFont,
                                                           listItemDescriptionFont,
                                                           Telerik.WinControls.ElementVisibility.Visible
                                                           ));
                            itemsHeight += lbxSearchResults.Items[lbxSearchResults.Items.Count - 1].Size.Height;
                        }
                    }
                }
            }

            if (lbxSearchResults.Items.Count == 1)
            {
                Activity activityAddContact = new Activity(ActivityType.AddContact, searchText);

                lbxSearchResults.Items.Add(
                    BuildRadMenuContentItem(
                        activityAddContact,
                        "No record found", "Add " + searchText + " to your contacts.",
                        ((System.Drawing.Image)(Properties.Resources.listIconVcardAdd)),
                        listItemSize,
                        listSubItemNameFont,
                        listSubItemDescriptionFont,
                        Telerik.WinControls.ElementVisibility.Hidden
                        )

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

            AdjustFormSize(itemsHeight);


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