コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();

            Logger.Init();

            EditorKernel.Inject(this);

            ThemeResourceDictionary.ApplyTheme(this, Settings.Theme);

            removeInvalidRecents();

            workspacePanel.Loaded += WorkspacePanel_Loaded;
            Width  = Settings.WindowSize.Width != 0 ? Settings.WindowSize.Width : 800;
            Height = Settings.WindowSize.Height != 0 ? Settings.WindowSize.Height : 600;

            if (Settings.ReopenMostRecentProject && Settings.RecentProjects.Count > 0)
            {
                // TODO: reopen project
                string  path    = Settings.RecentProjects[0];
                Project project = Controls.Workspace.Extensions.ReadFromBinaryFile <Project>(path);
                ProjectExplorer.Project = project;
            }

            AddHandler(ActionPerformedEvent, new RoutedActionPerformedEventHandler(actionPerformedHandler));
            AddHandler(FileOpenedEvent, new RoutedFileOpenedEventHandler(fileOpenedHandler));
            AddHandler(PropertyGrid.ValueEditedEvent, new RoutedValueEditedEventHandler(valueEditedHandler));

            AddHandler(WorkspacePanel.SelectionChangedEvent, new RoutedSelectionChangedEventHandler(selectionChangedHandler));
            AddHandler(WorkspacePanel.PanelFocusedEvent, new PanelActionEventHandler(panelFocused));

            Logger.OnLog += Logger_OnLog;
        }
コード例 #2
0
        public SettingsWindow()
        {
            InitializeComponent();

            EditorKernel.Inject(this);

            propertyGrid.PropertyEditorFactory = new PropertyEditorFactory();
            propertyGrid.SelectedObject        = Settings;

            ThemeResourceDictionary.ApplyTheme(this, Settings.Theme);
        }
コード例 #3
0
ファイル: Theme.cs プロジェクト: leodeg/Ghurund
        public static void ApplyTheme(FrameworkElement targetElement, Theme theme)
        {
            try {
                IEnumerable <ResourceDictionary> dictionaries =
                    targetElement.Resources.MergedDictionaries.Filter(dictionary => dictionary is ThemeResourceDictionary);

                foreach (ResourceDictionary dictionary in dictionaries)
                {
                    targetElement.Resources.MergedDictionaries.Remove(dictionary);
                }

                ThemeResourceDictionary themeDictionary = new ThemeResourceDictionary {
                    Source = themes[theme]
                };

                targetElement.Resources.MergedDictionaries.Insert(0, themeDictionary);
            } finally { }
        }