public void AddCommand()
        {
            var theme = Themes.Count == 0 || CurrentTheme == null?DefaultTheme.Clone() : CurrentTheme.Clone();

            if (Themes.Count > 0 && Themes.Count(x => x.Name == theme.Name) > 0)
            {
                theme.Name += "-copy";
            }
            Add(theme);
        }
示例#2
0
        public void AddTheme()
        {
            if (Themes != null)
            {
                var theme = Themes.Count == 0 || CurrentTheme == null?DefaultTheme?.Clone() : CurrentTheme?.Clone();

                if (theme != null)
                {
                    if (Themes.Count > 0 && Themes.Count(x => x.Name == theme.Name) > 0)
                    {
                        theme.Name += "-copy";
                    }
                    AddTheme(theme);
                }
            }
        }
示例#3
0
        private void Configure()
        {
            Compose();

            if (Themes.Count() == 0)
            {
                MessageBox.Show("No theme is present. Application is shutting down");
                Shutdown();
                return;
            }

            string themeName = IncEditor.Properties.Settings.Default["ThemeName"] as string;

            SelectedTheme = Themes.SingleOrDefault(x => x.Name.Equals(themeName, StringComparison.OrdinalIgnoreCase));

            SelectedTheme.MainView.DataContext = new MainViewModel();
            MainWindow = SelectedTheme.MainView;
            SelectedTheme.MainView.Show();
        }
        /// <summary>
        /// Called when [activated].
        /// </summary>
        /// <param name="disposables">The disposables.</param>
        protected override void OnActivated(CompositeDisposable disposables)
        {
            Bind();

            var changed = this.WhenAnyValue(p => p.SelectedTheme).Where(p => p != null && Themes?.Count() > 0).Subscribe(p =>
            {
                if (themeService.SetSelected(Themes, p))
                {
                    if (previousTheme != p)
                    {
                        var args = new ThemeChangedEventArgs()
                        {
                            Theme = p
                        };
                        ReactiveUI.MessageBus.Current.SendMessage(args);
                        previousTheme = p;
                    }
                }
            }).DisposeWith(disposables);

            base.OnActivated(disposables);
        }