public void OpenGitGenerationWindow(GitGenerationSettings settings, List <IProjectData> selectedProjects, Action onConfirm) { if (!GitGenerationWindow.IsVisible) { onGitGenerationConfirmed = onConfirm; if (gitGenerationWindow == null) { gitGenerationWindow = new GitGenerationWindow(); } if (selectedProjects != null && selectedProjects.Count > 0) { Controller.Data.LockScreenVisibility = Visibility.Visible; gitGenerationWindow.Init(this, settings, selectedProjects); gitGenerationWindow.Owner = this; gitGenerationWindow.Show(); } else { if (gitGenerationWindow.IsVisible) { gitGenerationWindow.Hide(); } } if (settings.TemplateSettings.Count <= 0) { Log.Here().Error("Template settings are empty!"); } } }
public MainWindow() { InitializeComponent(); _instance = this; Start(); LogWindow = new LogWindow(this); AboutWindow = new AboutWindow(this); MarkdownConverterWindow = new MarkdownConverterWindow(); TextGeneratorWindow = new TextGenerator(); GitGenerationWindow = new GitGenerationWindow(); TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Normal; SubWindows = new List <Window>() { LogWindow, AboutWindow, MarkdownConverterWindow, TextGeneratorWindow, GitGenerationWindow, }; foreach (var window in SubWindows) { window.Hide(); } Controller = new AppController(this); this.WhenAnyValue(v => v.Controller.Data).Subscribe((vm) => { ViewModel = vm; DataContext = ViewModel; }); Controller.LoadAppSettings(); Controller.InitModules(); if (String.IsNullOrWhiteSpace(ViewModel.AppSettings.GitInstallPath)) { var gitPath = GitGenerator.GetGitInstallPath(); if (!String.IsNullOrEmpty(gitPath)) { ViewModel.AppSettings.GitInstallPath = gitPath; Log.Here().Important($"Git install location found at {gitPath}."); } else { Log.Here().Error($"Git install location not found."); } } AutoUpdater.ApplicationExitEvent += AutoUpdater_ApplicationExitEvent; AutoUpdater.HttpUserAgent = "SourceControlGeneratorUser"; this.WhenActivated((disposables) => { this.OneWayBind(ViewModel, vm => vm.ProgressValueTaskBar, v => v.TaskbarItemInfo.ProgressValue).DisposeWith(disposables); Controller.CheckForUpdates(); }); this.Loaded += MainWindow_Loaded; }