Example #1
0
 public void SetUpThemeList(params string[] names)
 {
     foreach (var name in names)
     {
         var itme = themeMI.DropDownItems.Add(name);
         itme.Click += (a, b) =>
         {
             ThemeEngine.SetTheme((Themes)Enum.Parse(typeof(Themes), itme.Text), new Action(() =>
             {
                 if (File.Exists(settings.XML))
                 {
                     dockPanel.LoadFromXml(settings.XML, m_deserializeDockContent);
                 }
             }));
         };
     }
     foreach (var name in names)
     {
         var itme = themeMB.DropDownItems.Add(name);
         itme.Click += (a, b) =>
         {
             ThemeEngine.SetTheme((Themes)Enum.Parse(typeof(Themes), itme.Text), new Action(() =>
             {
                 if (File.Exists(settings.XML))
                 {
                     dockPanel.LoadFromXml(settings.XML, m_deserializeDockContent);
                 }
             }));
         };
     }
 }
Example #2
0
 internal void Reload()
 {
     ThemeEngine.SetTheme(settings.Theme, new Action(() =>
     {
         if (File.Exists(settings.XML))
         {
             dockPanel.LoadFromXml(settings.XML, m_deserializeDockContent);
         }
         else
         {
             LoadDefaultLayout();
         }
     }));
 }
Example #3
0
        public MainForm()
        {
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            InitializeComponent();
            AutoScaleMode = AutoScaleMode.Dpi;
            SetUpThemeList(Enum.GetNames(typeof(Themes)));

            SetSplashScreen(new Action(() =>
            {
                settings = AssetDatabase.Load <WindowSettings>();
                if (settings != null)
                {
                    this.StartPosition = settings.StartPosition;
                    Location           = settings.Location;
                    Size             = settings.Size;
                    this.WindowState = settings.WindowState;
                }
                else
                {
                    settings           = new WindowSettings();
                    this.StartPosition = settings.StartPosition;
                    this.WindowState   = settings.WindowState;
                    Location           = settings.Location;
                    Size = settings.Size;
                }

                ThemeEngine.SetTheme(settings.Theme, new Action(() =>
                {
                    if (File.Exists(settings.XML))
                    {
                        dockPanel.LoadFromXml(settings.XML, m_deserializeDockContent);
                    }
                    else
                    {
                        LoadDefaultLayout();
                    }
                }));

                saveTimer          = new Timer();
                saveTimer.Tick    += SaveInterval;
                saveTimer.Interval = 1000;
                saveTimer.Start();
            }));
        }