Ejemplo n.º 1
0
        public PhoneNumberNew(PhoneNumber EditedNumber)
        {
            InitializeComponent();
            EditedGUID = EditedNumber.GetGUID();

            if (EditedNumber.GetExtension().Length != 0)
            {
                string Prefix = EditedNumber.GetPrefixIfShown(true);
                this.SubscriberExtension.Text = Prefix + EditedNumber.GetExtension().ToString();
                this.TB_UserName.Text         = EditedNumber.GetUserName();
                this.SubscriberEmail.Text     = EditedNumber.GetEmail();
                this.SubscriberNote.Text      = EditedNumber.GetNote();
                this.Servers.Items.Add(EditedNumber.GetServerIPAndPort());
                this.Servers.SelectedIndex = 0;
            }
            else
            {
                if (App.Current != null && App.Current.MainWindow != null && (App.Current.MainWindow as MainWindow).ShowCannonical() == true)
                {
                    ShowCannonical = true;
                    Prefix         = (App.Current.MainWindow as MainWindow).GetPrefix();
                    if (Prefix.Length > 0)
                    {
                        Prefix = Prefix + "-";
                    }
                }
                //check if we have data in persport.txt
                possibleNames = Globals.persPortManager.GetServerExtensions();
                GenerateFilteredExtensionDropdown();
            }

            //focus on first text field
            this.SubscriberExtension.Focus();

            //if we push enter we presume we pushed button "ok"
            RoutedCommand firstSettings = new RoutedCommand();

            firstSettings.InputGestures.Add(new KeyGesture(Key.Enter, ModifierKeys.None));
            CommandBindings.Add(new CommandBinding(firstSettings, Button_Click_Ok));
            RoutedCommand SecondSettings = new RoutedCommand();

            SecondSettings.InputGestures.Add(new KeyGesture(Key.Escape, ModifierKeys.None));
            CommandBindings.Add(new CommandBinding(SecondSettings, Button_Click_Cancel));

            Globals.MultilangManager.TranslateUIComponent(this);
            this.Owner = App.Current.MainWindow;
            this.Left  = this.Owner.Left + this.Owner.Width / 2 - this.Width / 2;
            this.Top   = this.Owner.Top + this.Owner.Height / 2 - this.Height / 2;
        }
Ejemplo n.º 2
0
 public PhoneNumberNew(PhoneNumber EditedNumber)
 {
     InitializeComponent();
     GeneralSettings          = new PhoneNumberSetupSettings();
     ParentX                  = EditedNumber.GetX();
     ParentY                  = EditedNumber.GetY();
     GeneralSettings.FontSize = 0;
     if (EditedNumber.GetExtension() != 0)
     {
         this.SubscriberExtension.Text += EditedNumber.GetExtension().ToString();
     }
     else if (App.Current != null && App.Current.MainWindow != null)
     {
         Prefix = (App.Current.MainWindow as MainWindow).GetPrefix();
         this.SubscriberExtension.Text = Prefix;
     }
     this.SubscriberEmail.Text = EditedNumber.GetEmail();
     this.SubscriberNote.Text  = EditedNumber.GetNote();
     this.TB_UserName.Text     = EditedNumber.GetUserName();
 }