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; }
public PhoneNumberNewRange(PhoneNumber EditedNumber) { InitializeComponent(); GeneralSettings = new PhoneNumberSetupSettings(); ParentX = EditedNumber.GetX(); ParentY = EditedNumber.GetY(); GeneralSettings.FontSize = 0; // if (App.Current != null && App.Current.MainWindow != null) // this.SubscriberExtension.Text = (App.Current.MainWindow as MainWindow).GetPrefix(); if (EditedNumber.GetExtension() != 0) { this.SubscriberExtension.Text += EditedNumber.GetExtension().ToString(); } }
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; }
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(); }
private void DoDemoUpdate() { //find this random cell and color it this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { MainWindow MainObject = (MainWindow)App.Current.MainWindow; if (MainObject == null) { return; } GridContentArea grid = this.DrawArea; int Rows = grid.GetCellsInHeight(); int Cols = grid.GetCellsInWidth(); //get a random cell Random rnd = new Random(); int RandRow = rnd.Next(0, Rows); int RandCol = rnd.Next(0, Cols); PhoneNumber RandomElement = RandomElement = grid.PaintArea.Children.Cast <PhoneNumber>().FirstOrDefault(e => Grid.GetRow(e) == RandRow && Grid.GetColumn(e) == RandCol); if (RandomElement != null) { //try to set random look between simple extension and range /* if (rnd.Next(0, 10) < 5) * RandomElement.SetIsRange(true); * else * RandomElement.SetIsRange(false);*/ //set a random status color int RandStatus = rnd.Next(0, (int)PhoneStatusCodes.NumberOfStatusCodes); if (RandomElement.IsSubscriberRange() == false) { RandomElement.SetStatus((PhoneStatusCodes)RandStatus); } else { RandomElement.SetStatus((PhoneStatusCodes)RandStatus, rnd.Next(0, 9).ToString()); } //set a random extension RandomElement.SetExtension(rnd.Next(0, 9999).ToString()); RandomElement.SetName("Name" + RandomElement.GetExtension().ToString()); //can we see name properly ? if (rnd.Next(0, 10) < 5) { RandomElement.OnToggleShowName(); } //note can be seen in the tooltip RandomElement.SetNote("Topcomment" + RandomElement.GetExtension().ToString()); //absence status can be seen in the tooltip if (rnd.Next(0, 10) < 5) { RandomElement.OnAbsenceStatusUpdate(false); } else { RandomElement.OnAbsenceStatusUpdate(true); } //can we see prefix ? RandomElement.SetPrefix(rnd.Next(0, 9999).ToString()); if (rnd.Next(0, 10) < 5) { RandomElement.OnToggleShowCanonical(); } //try to set random forwarding status ForwardStatusStore fss = new ForwardStatusStore(RandomElement.GetExtension()); if (rnd.Next(0, 10) < 5) { fss.ForwardType = CallForwardingTypes.CallForwardDestination; } else { fss.ForwardType = CallForwardingTypes.CallForwardNone; } RandomElement.OnForwardingChange(fss); } })); }