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;

        }
Exemple #2
0
        public void StartActivity(Activity activity)
        {
            mySpeedDialWindow.Hide();
            switch (activity.ActivityType)
            {
                case ActivityType.None:
                    break;
                case ActivityType.Call:
                    StartNewCall(-1, activity.ActivityOtherData);
                    this.WindowState = FormWindowState.Normal;
                    this.Show();
                    this.Activate();
                    break;
                case ActivityType.IM:
                    StartNewIM(activity.ActivityJabberUser, true);
                    break;
                case ActivityType.VideoCall:
                    StartNewVideoCall(activity.ActivityJabberUser);
                    this.WindowState = FormWindowState.Normal;
                    this.Show();
                    this.Activate();
                    break;
                case ActivityType.ScreenSharing:
                    StartNewVideoCall(activity.ActivityJabberUser);
                    this.WindowState = FormWindowState.Normal;
                    this.Show();
                    this.Activate();
                    break;
                case ActivityType.Email:
                    StartNewEmail(activity.ActivityOtherData);
                    break;
                case ActivityType.AddContact:
                    StartNewContact(activity.ActivityOtherData);
                    break;
                case ActivityType.HostNikomeeting:

                    try
                    {
                        String command = Directory.GetCurrentDirectory() + @"\nikomeeting.exe";
                        String arguments = "\"action=autohost;username="******";password="******"\"";
                        System.Diagnostics.Process.Start(command, arguments);
                        if (this.WindowState != FormWindowState.Minimized) this.WindowState = FormWindowState.Minimized;
                    }
                    catch (Exception ex)
                    {
#if (DEBUG)
                        throw;
#else
                        Console.WriteLine("StartActivity : " + ex.Message);
#endif
                    }
                    break;
                case ActivityType.JoinNikomeeting:

                    try
                    {
                        String command = Directory.GetCurrentDirectory() + @"\nikomeeting.exe";
                        String arguments = "\"action=join;username="******";sessionid=" + activity.ActivityOtherData + "\"";
                        System.Diagnostics.Process.Start(command, arguments);
                        if (this.WindowState != FormWindowState.Minimized) this.WindowState = FormWindowState.Minimized;
                    }
                    catch (Exception ex)
                    {
#if (DEBUG)
                        throw;
#else
                        Console.WriteLine("StartActivity : " + ex.Message);
#endif
                    }
                    break;
                case ActivityType.NikotalkieMessage:
                    myNikotalkieWindow.StartComposing(activity.ActivityJabberUser.Username);
                    break;
                default:
                    break;
            }


        }
        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);
        }
Exemple #4
0
        public void StartActivity(Activity activity)
        {
            mySpeedDialWindow.Hide();
            switch (activity.ActivityType)
            {
                case ActivityType.None:
                    break;
                case ActivityType.Call:
                    StartNewCall(-1, activity.ActivityData);
                    this.WindowState = FormWindowState.Normal;
                    this.Show();
                    this.Activate();
                    break;
                case ActivityType.IM:
                    StartNewIM(activity.ActivityData, true);
                    break;
                case ActivityType.VideoCall:
                    StartNewVideoCall(activity.ActivityData);
                    this.WindowState = FormWindowState.Normal;
                    this.Show();
                    this.Activate();
                    break;
                case ActivityType.ScreenSharing:
                    StartNewVideoCall(activity.ActivityData);
                    this.WindowState = FormWindowState.Normal;
                    this.Show();
                    this.Activate();
                    break;
                case ActivityType.Email:
                    StartNewEmail(activity.ActivityData);
                    break;
                case ActivityType.AddContact:
                    StartNewContact(activity.ActivityData);
                    break;
                default:
                    break;
            }



        }