Ejemplo n.º 1
0
 private static void EnsureInspectPaneModify(ThemeOption option)
 {
     if ((bool)option.Object)
     {
         InspectPaneTabModify.Value = true;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OptionsWindow"/> class.
        /// </summary>
        /// <param name="optionPageIndex">The index of the page to display.</param>
        /// <param name="theme">The theme to use.</param>
        /// <param name="saveBeforeCompiling">True if documents must be saved before compiling.</param>
        /// <param name="optionPages">The list of controls for each option category.</param>
        public OptionsWindow(int optionPageIndex, ThemeOption theme, bool saveBeforeCompiling, ICollection <TabItem> optionPages)
        {
            OptionPageIndex     = optionPageIndex;
            Theme               = theme;
            SaveBeforeCompiling = saveBeforeCompiling;

            InitializeComponent();
            DataContext = this;

            Loaded  += OnLoaded;
            Closing += OnClosing;

            List <TabItem> TemplateList = new List <TabItem>();

            BackupTable = new Dictionary <IOptionPageDataContext, IOptionPageDataContext>();

            TemplateList.Add((TabItem)FindResource("PageTheme"));
            TemplateList.Add((TabItem)FindResource("PageCompiler"));
            if (optionPages != null)
            {
                foreach (TabItem Page in optionPages)
                {
                    if (Page.DataContext is IOptionPageDataContext AsOptionPageDataContext)
                    {
                        BackupTable.Add(AsOptionPageDataContext, AsOptionPageDataContext.Backup());
                    }

                    TemplateList.Add(Page);
                }
            }

            Pages = TemplateList;
        }
Ejemplo n.º 3
0
        public OptionsWindow(int optionPageIndex, ThemeOption theme, bool saveBeforeCompiling, ICollection <TabItem> optionPages)
        {
            this.OptionPageIndex     = optionPageIndex;
            this.Theme               = theme;
            this.SaveBeforeCompiling = saveBeforeCompiling;
            this.UnusedCtrl          = null;

            InitializeComponent();
            DataContext = this;

            Loaded += OnLoaded;

            List <TabItem> TemplateList = new List <TabItem>();

            BackupTable = new Dictionary <IOptionPageDataContext, IOptionPageDataContext>();

            TemplateList.Add(FindResource("PageTheme") as TabItem);
            TemplateList.Add(FindResource("PageCompiler") as TabItem);
            if (optionPages != null)
            {
                foreach (TabItem Page in optionPages)
                {
                    IOptionPageDataContext AsOptionPageDataContext;
                    if ((AsOptionPageDataContext = Page.DataContext as IOptionPageDataContext) != null)
                    {
                        BackupTable.Add(AsOptionPageDataContext, AsOptionPageDataContext.Backup());
                    }

                    TemplateList.Add(Page);
                }
            }

            Pages = TemplateList;
        }
Ejemplo n.º 4
0
 private static void EnsureHudNotHidden(ThemeOption option)
 {
     if (!(option is BoolOption inspectPaneModify))
     {
         throw new Mod.Exception("InspectPaneModify is not a BoolOption");
     }
     if (HudDocked.Value && !inspectPaneModify.Value)
     {
         HudDocked.Value = false;
     }
 }
        public ThemePageViewModel()
        {
            ThemeColors = new ObservableCollection <Color>(ThemeOption.GetThemeColors());

            SetColorCommand = new RelayParameterizedCommand <Color>(SetColor);
        }