public UtilityWindow(FontHelper.WPFFont monoFont) { Interlocked.Increment(ref UtilityWindow.Count); m = new UtilityViewModel(monoFont); InitializeComponent(); DataContext = m; Application.Current.Dispatcher.Invoke(() => { MainWindow w = (Application.Current.MainWindow as MainWindow); List <Project> projList = w.Projects.Projects; for (int i = 0; i < projList.Count; i++) { Project proj = projList[i]; m.CodeBox_Projects.Add(new Tuple <string, Project>(proj.ProjectName, proj)); if (proj.ProjectName.Equals(w.CurMainTree.Script.Project.ProjectName, StringComparison.Ordinal)) { m.CodeBox_SelectedProjectIndex = i; } } }); }
public UtilityWindow(FontHelper.FontInfo monoFont) { Interlocked.Increment(ref Count); _m = new UtilityViewModel(monoFont); InitializeComponent(); DataContext = _m; // Populate projects List <Project> projects = Global.Projects.ProjectList; for (int i = 0; i < projects.Count; i++) { Project p = projects[i]; _m.Projects.Add(new Tuple <string, Project>(p.ProjectName, p)); if (p.ProjectName.Equals(Global.MainViewModel.CurMainTree.Script.Project.ProjectName, StringComparison.Ordinal)) { _m.SelectedProjectIndex = i; } } }