private void BuildGroentijdenMatrix() { if (GroentijdenSets == null || GroentijdenSets.Count == 0) { SetNames.Clear(); FasenNames.Clear(); GroentijdenMatrix = new GroentijdViewModel[0, 0]; RaisePropertyChanged(nameof(SetNames)); RaisePropertyChanged(nameof(FasenNames)); RaisePropertyChanged(nameof(GroentijdenMatrix)); } foreach (var mgsvm in GroentijdenSets) { mgsvm.Groentijden.BubbleSort(); mgsvm.GroentijdenSet.Groentijden.BubbleSort(); } SetNames.Clear(); FasenNames.Clear(); var fccount = _Controller.Fasen.Count; if (fccount == 0 || GroentijdenSets == null || GroentijdenSets.Count == 0) { return; } GroentijdenMatrix = new GroentijdViewModel[GroentijdenSets.Count, fccount]; int i = 0, j = 0; foreach (var mgsvm in GroentijdenSets) { SetNames.Add(mgsvm.GroentijdenSet.Naam); j = 0; foreach (var mgvm in mgsvm.Groentijden) { // Build fasen list for row headers from first set if (i == 0) { FasenNames.Add(mgvm.FaseCyclus); } // set data in bound matrix if (j < fccount) { GroentijdenMatrix[i, j] = mgvm; } else { throw new IndexOutOfRangeException(); } j++; } i++; } RaisePropertyChanged(nameof(SetNames)); RaisePropertyChanged(nameof(FasenNames)); RaisePropertyChanged(nameof(GroentijdenMatrix)); }
public void BuildGroentijdenMatrix() { if (GroentijdenSets == null || GroentijdenSets.Count == 0) { return; } foreach (GroentijdenSetViewModel mgsvm in GroentijdenSets) { #warning CHECK > why is this needed? It's double, only the first one should be necessary. mgsvm.GroentijdenSetList.BubbleSort(); if (!mgsvm.GroentijdenSet.Groentijden.IsSorted()) { mgsvm.GroentijdenSet.Groentijden.BubbleSort(); } } SetNames.Clear(); FasenNames.Clear(); int fccount = _Controller.Fasen.Count; if (fccount == 0 || GroentijdenSets == null || GroentijdenSets.Count == 0) { return; } GroentijdenMatrix = new GroentijdViewModel[GroentijdenSets.Count, fccount]; int i = 0, j = 0; foreach (GroentijdenSetViewModel mgsvm in GroentijdenSets) { SetNames.Add(mgsvm.GroentijdenSet.Naam); j = 0; foreach (GroentijdViewModel mgvm in mgsvm.GroentijdenSetList) { // Build fasen list for row headers from first set if (i == 0) { FasenNames.Add(mgvm.FaseCyclus.Replace(SettingsProvider.Instance.GetFaseCyclusDefinePrefix(), "")); } // set data in bound matrix if (j < fccount) { GroentijdenMatrix[i, j] = mgvm; } else { throw new NotImplementedException(); } j++; } i++; } OnPropertyChanged("SetNames"); OnPropertyChanged("FasenNames"); OnPropertyChanged("GroentijdenMatrix"); }
public TabItem Create(Dictionary <string, ProgramData> items, out string name, out string path) { var prgName = "Program" + GetProgramNumber(items).ToString() + MainWindowVM.ext; var modName = "Module" + GetModuleNumber(items).ToString() + ".bpm"; var incName = "Include" + GetIncludeNumber(items).ToString() + ".bpi"; string newName = ""; var win = new SetNames(prgName, modName, incName); if (win.ShowDialog() == true) { newName = win.GetName; } else { name = ""; path = ""; return(null); } var tmpExt = newName.Substring(newName.Length - 3); var ext = ""; if (tmpExt == ".bp") { ext = ".bp"; } else { ext = "." + tmpExt; } var saveName = new SaveFile().Save("", newName, ext); if (saveName == "") { name = ""; path = ""; return(null); } var ind = saveName.LastIndexOf(Path.DirectorySeparatorChar) + 1; newName = saveName.Substring(ind); path = saveName.Substring(0, saveName.Length - newName.Length - 1); TabItem tabItem = new TabItem(); tabItem.IsSelected = true; tabItem.Loaded += TextEditorEvents.Editor_Loaded; tabItem.MouseLeftButtonUp += TextEditorEvents.EditorName_MouseLeftButtonUp; EditorHeader header = new EditorHeader(); Editor editor = new Editor(); editor.GetTextEditor.EventsAdd(); editor.GetTextEditor.TextArea.Text = ""; editor.GetTextEditor.Menu = editor.GetTextEditorPopup; editor.GetTextEditor.ToolsWindow = editor.GetTextEditorTools; header.HeaderName = newName; name = header.HeaderName; header.HeaderChange = ""; tabItem.Header = header; tabItem.Content = editor; tabItem.Style = (Style)Application.Current.Resources["FirstTabItem"]; if (items.Count == 0) { var element = new Elements(); element.SetCloseButtonlMargin(tabItem, 1); } return(tabItem); }