/// <summary> /// Load the content of the index card from a file stream ( config file ) /// </summary> public void Load(bool BackgroundLoad = false) { lock (this) // we will load index cards in parallel { //only load once if (GridCells.Count != 0) { return; } long StartTime = Environment.TickCount; //load Index card related data KeyDataCollection IndexCardCollection = Globals.Config.GetConfigSection(GetName()); //load all possible grid cells ( phone numbers ) int PhoneNumberLoading = 0; do { PhoneNumber pn = Globals.ExtensionManager.FactoryNewPhoneNumber(0, 0, GeneralSettings, GetGUID()); //try to load from config having this index // pn.SetConfigIndex(PhoneNumberLoading); //can we load it ? if (pn.Load(GetName(), PhoneNumberLoading) == false) { break; } //if we loaded it, than add it to our visual grid PhoneNumberAdd(pn.GetX(), pn.GetY(), pn); //try to load more PhoneNumberLoading++; } while (true); //load ranges int RangeNumberLoading = 0; do { PhoneNumber pn = Globals.ExtensionManager.FactoryNewPhoneNumber(0, 0, GeneralSettings, GetGUID()); //try to load from config having this index // pn.SetConfigIndex(RangeNumberLoading); //can we load it ? if (pn.LoadRange(GetName(), RangeNumberLoading) == false) { break; } //if we loaded it, than add it to our visual grid PhoneNumberAdd(pn.GetX(), pn.GetY(), pn); //try to load more RangeNumberLoading++; } while (true); //try to place them inside the grid also if (BackgroundLoad == true) { CreateGridBasedOnSize(); } long Endtime = Environment.TickCount; Globals.Logger.LogString(LogManager.LogLevels.LogFlagInfo, "For index card " + GetName() + " we loaded " + PhoneNumberLoading.ToString() + " extensions and " + RangeNumberLoading.ToString() + " ranges in " + (Endtime - StartTime) + " ms"); } }
public void AddPhoneNumber(PhoneNumber tcn) { if (tcn.GetX() > CellsInWidth) { for (int cols = CellsInWidth; cols < (int)tcn.GetX(); cols++) { PaintArea.ColumnDefinitions.Add(new ColumnDefinition()); } CellsInWidth = tcn.GetX(); } if (tcn.GetY() > CellsInHeight) { for (int rows = CellsInHeight; rows < (int)tcn.GetY(); rows++) { PaintArea.RowDefinitions.Add(new RowDefinition()); } CellsInHeight = tcn.GetY(); } if (PaintArea.Children.Contains(tcn) == false) { PaintArea.Children.Add(tcn); } }
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(); 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(); }