/// <summary> /// Shows the tool window when the menu item is clicked. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event args.</param> private void ShowWindow(object sender, EventArgs e) { if (!EntitasVsPackage.IsSolutionLoaded) { MessageBox.Show("Solution not loaded. Load a solution to see settings."); return; } string solutionDirectory = DTE.Solution.GetDirectory(); string[] uniqueProjectNames = DTE.Solution.GetAllProjects().UniqueNames().ToArray(); ConfigData configData = Config.Load(solutionDirectory); var settingsViewModel = new SettingsViewModel(configData, solutionDirectory); var generalTab = new GeneralTabViewModel(settingsViewModel, solutionDirectory); var triggersTab = new TriggersTabViewModel(settingsViewModel, solutionDirectory, uniqueProjectNames); settingsViewModel.AddChild(generalTab); settingsViewModel.AddChild(triggersTab); settingsViewModel.CurrentTabViewModel = generalTab; var settingsView = new SettingsView { DataContext = settingsViewModel, Title = "Entitas VS Settings" }; settingsViewModel.PropertyChanged += (self, args) => { if ((self as SettingsViewModel).WindowClosed) { settingsView.Close(); } }; settingsView.ShowDialog(); }
static void Main(string[] arguments) { string solutionDirectory = @"D:\GitHub\entitas-vs\Entitas-vs.View\bin\Debug"; string[] uniqueProjectNames = { "adwd/awda.csproj", "awidjqqwe.csproj" }; ConfigData configData = Config.Load(solutionDirectory); var settingsViewModel = new SettingsViewModel(configData, solutionDirectory); var generalTab = new GeneralTabViewModel(settingsViewModel, solutionDirectory); var triggersTab = new TriggersTabViewModel(settingsViewModel, solutionDirectory, uniqueProjectNames); settingsViewModel.AddChild(generalTab); settingsViewModel.AddChild(triggersTab); settingsViewModel.CurrentTabViewModel = generalTab; var settingsView = new SettingsView { DataContext = settingsViewModel, Title = "Entitas VS Settings" }; settingsViewModel.PropertyChanged += (self, args) => { if ((self as SettingsViewModel).WindowClosed) { settingsView.Close(); } }; settingsView.ShowDialog(); }