Esempio n. 1
0
        public PhoneNumberNewRange(PhoneNumber EditedNumber)
        {
            InitializeComponent();
            GeneralSettings = new PhoneNumberSetupSettings();
            EditedGUID      = EditedNumber.GetGUID();
            //            if (App.Current != null && App.Current.MainWindow != null)
            //                this.SubscriberExtension.Text = (App.Current.MainWindow as MainWindow).GetPrefix();

            if (EditedNumber.GetExtension().Length != 0)
            {
                string Prefix = EditedNumber.GetPrefixIfShown(true);
                this.SubscriberExtension.Text = Prefix + EditedNumber.GetExtension().ToString();
                this.Servers.Items.Add(EditedNumber.GetServerIPAndPort());
                this.Servers.SelectedIndex = 0;
                this.Servers.IsReadOnly    = true;
            }
            else
            {
                //select a server to show
                if (SelectedServer == null)
                {
                    Servers.Items.Clear();
                    ConcurrentBag <ServerConnectionStatus> Connections = Globals.ConnectionManager.GetConnections();
                    foreach (ServerConnectionStatus sc in Connections)
                    {
                        if (sc.PendingRemove == true)
                        {
                            continue;
                        }

                        Servers.Items.Add(sc.GetServerIPAndPort());
                    }
                    if (Servers.Items.Count != 0)
                    {
                        Servers.SelectedIndex = 0;
                        SelectedServer        = Servers.Items.GetItemAt(Servers.SelectedIndex).ToString();
                    }
                }
                GenerateFilteredExtensionDropdown();
            }

            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;
        }
Esempio n. 2
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;
        }