Esempio n. 1
0
        private void Button_Click_Ok(object sender, RoutedEventArgs e)
        {
            if (App.Current != null && App.Current.MainWindow != null)
            {
                PhoneNumber EditedPhoneNumber = (App.Current.MainWindow as MainWindow).PhoneNumberGet(ParentX, ParentY);
                EditedPhoneNumber.SetName(this.TB_UserName.Text);
                try
                {
                    string sExtension = this.SubscriberExtension.Text;
                    //does the number still have the prefix we set earlier ?
                    try {
                        if (sExtension.StartsWith(Prefix))
                        {
                            sExtension = sExtension.Substring(Prefix.Length);
                            EditedPhoneNumber.SetPrefix(Prefix);
                        }
                    } catch (Exception) { };
                    int Extension = Int32.Parse(sExtension);
                    EditedPhoneNumber.SetExtension(Extension);
                }catch (Exception) { };
                EditedPhoneNumber.SetEmail(this.SubscriberEmail.Text);
                EditedPhoneNumber.SetNote(this.SubscriberNote.Text);
                EditedPhoneNumber.OnFontSettingChanged(GeneralSettings);
            }

            //all done. close it
            this.Close();
        }
Esempio n. 2
0
        private void Button_Click_Ok(object sender, RoutedEventArgs e)
        {
            PhoneNumber EditedPhoneNumber = Globals.ExtensionManager.PhoneNumberGet(EditedGUID);

            if (EditedPhoneNumber != null)
            {
                // editing should be based on a UID to avoid switching tab in the background
                EditedPhoneNumber.SetName(this.TB_UserName.Text);
                EditedPhoneNumber.SetEmail(this.SubscriberEmail.Text);
                EditedPhoneNumber.SetNote(this.SubscriberNote.Text);
                if (Servers.SelectedIndex >= 0)
                {
                    EditedPhoneNumber.SetServerIPAndPort(Servers.Items.GetItemAt(Servers.SelectedIndex).ToString());
                }
                try
                {
                    string sExtension = this.SubscriberExtension.Text;
                    if (sExtension.Contains("-"))
                    {
                        string[] FullNumberParts = sExtension.Split('-');
                        string   lPrefix         = FullNumberParts[0];
                        EditedPhoneNumber.SetPrefix(lPrefix);
                        sExtension = FullNumberParts[1];
                    }
                    else
                    {
                        EditedPhoneNumber.SetPrefix(Globals.persPortManager.GetServerExtensionPrefix(sExtension));
                    }
                    EditedPhoneNumber.SetExtension(sExtension);
                }
                catch (Exception) { };
                if (FontSetting != null)
                {
                    EditedPhoneNumber.OnFontSettingChanged(FontSetting);
                }
                // queue up a query for tooltip absence status
                if (SubscriberEmail.Text != null && SubscriberEmail.Text.Length > 0)
                {
                    Globals.AbsenceManage.UpdateExtensionTooltipAsync(this.SubscriberEmail.Text);
                }
            }

            //all done. close it
            this.Close();
        }