コード例 #1
0
ファイル: MainVM.cs プロジェクト: rschili/Builder
        private void ShowSettings(object obj)
        {
            if (SettingsVM == null)
            {
                return;
            }

            SettingsDialog dialog = new SettingsDialog();

            dialog.DataContext = SettingsVM.Copy();
            var mainWindow = Application.Current.MainWindow;

            if (mainWindow != null)
            {
                dialog.Owner = mainWindow;
            }

            if (dialog.ShowDialog() == true)
            {
                var result = (SettingsVM)dialog.DataContext;
                if (result == null || !result.IsDirty)
                {
                    return;
                }

                SettingsVM = result;
                ThemeHelper.ApplyTheme(result.Theme);
                AppDataManager.SaveSettings(result.Model);
            }
        }
コード例 #2
0
ファイル: MainVM.cs プロジェクト: rschili/Builder
        public MainVM(SettingsVM settings, ICollection <SourceDirectory> sourceDirectories)
        {
            Guard.NotNull(settings);
            _ts        = TaskScheduler.FromCurrentSynchronizationContext();
            HistoryVM  = new HistoryVM(this);
            OutputVM   = new OutputVM(this);
            SettingsVM = settings;
            WireupCommands();

            if (sourceDirectories != null)
            {
                foreach (var src in sourceDirectories)
                {
                    SourceDirectories.Add(new SourceDirectoryVM(this, src));
                }
            }

            System.Windows.Data.BindingOperations.EnableCollectionSynchronization(SourceDirectories, SourceDirectories);
            ThemeHelper.ApplyTheme(SettingsVM.Theme);
        }