Пример #1
0
 private void SetActiveTabStyle()
 {
     // Finally get the current theme default backcolor if possible
     // and set the active document tab color to match and set fore
     // to inverse.
     try
     {
         PresetStyle preStyle = Themes.CurrentPreset.DefaultPreset; // Themes.CurrentPreset.Presets.Where(m => m.Key.Equals("default", StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault().Value;
         if (preStyle != null)
         {
             if (!String.IsNullOrEmpty(preStyle.Back))
             {
                 Color clr = preStyle.Back.ToColor();
                 if (clr != null)
                 {
                     DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.StartColor = clr;
                     DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.EndColor   = clr;
                     DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.TextColor  = clr.Invert();
                     DockingPanel.Refresh();
                 }
             }
         }
     }
     catch { }
 }
        private void AddPane(IDockingPane pane)
        {
            if (pane == null)
            {
                throw new ArgumentNullException(nameof(pane));
            }

            var paneControl = new RadPane {
                Tag = pane
            };

            paneControl.DataContext = new PaneModel(pane);
            paneControl.SetBinding(HeaderedContentControl.HeaderProperty, new Binding(nameof(PaneModel.Header)));


            paneControl.PaneHeaderVisibility = pane.PaneHeaderVisibility;
            paneControl.CanUserClose         = pane.CanUserClose;
            DockingPanel.SetInitialSize(paneControl, new System.Windows.Size(pane.InitialWidth, pane.InitialHeight));

            var content = new ContentControl();

            RegionManager.SetRegionName(content, pane.RegionName);
            paneControl.Content = content;


            VM.Panes.Add(paneControl);
        }
Пример #3
0
        private void SaveDockingSettings()
        {
            ConfigHelper.SaveWindowSettings(this);

            var ms = new MemoryStream();

            DockingPanel.SaveAsXml(ms, Encoding.ASCII);
            Settings.Default.DockingLayout = Encoding.ASCII.GetString(ms.ToArray());
        }
Пример #4
0
        /// <summary>
        /// Handles the Load event of the MainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            toolStripEndSessionButton.Enabled = false;
            toolStripNewSessionButton.Enabled = true;

            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");

            if (File.Exists(configFile))
            {
                DockingPanel.LoadFromXml(configFile, _deserializeDockContent);
            }
        }
Пример #5
0
        /// <summary>
        /// Loads the current Docking Layout if exists, or creates the default layout.
        /// Generates all the Events that we need to watch for.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            m_deserializeDockContent = new DeserializeDockContent(GetDockContentFromPersistString);
            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");

            if (File.Exists(configFile)) // Load DockingPanel Layout.
            {
                try
                {
                    DockingPanel.LoadFromXml(configFile, m_deserializeDockContent);
                }
                catch (Exception ex)
                {
                    if (ConsoleWindow != null)
                    {
                        ConsoleWindow.Log("Error: " + ex.Message);
                    }
                }
            }

            else // Create default layout.
            {
                ConsoleWindow.Show(DockingPanel, DockState.DockBottom);
                FileLoader.Show(DockingPanel, DockState.DockLeft);
                Histogram.Show(DockingPanel, DockState.DockLeft);
                Statistics.Show(DockingPanel, DockState.DockLeft);
                ModificationTypes.Show(DockingPanel, DockState.DockRight);
                ModificationProperties.Show(DockingPanel, DockState.DockRight);
                ImageDisplay.Show(DockingPanel, DockState.DockRight);
                CommandBox.Show(DockingPanel, DockState.DockBottom);
            }



            ImageDisplay.FormClosing           += ImageDisplay_FormClosing;
            ImageDisplay.MediaFailedToLoad     += ImageDisplay_MediaFailedToLoad;
            ImageDisplay.MediaLoaded           += ImageDisplay_MediaLoaded;
            ImageDisplay.MediaPixelColour      += ImageDisplay_MediaPixelColour;
            ImageDisplay.MediaPixelCoordinates += ImageDisplay_MediaPixelCoordinates;
            ImageDisplay.ImageDisplayLog       += ImageDisplay_ImageDisplayLog;
            Histogram.histogramLog             += Histogram_histogramStatus;
            Histogram.histogramCompleted       += Histogram_histogramCompleted;
            Statistics.StatisticsLog           += Statistics_StatisticsLog;
            FileLoader.ThumbnailSelected       += FileLoader_ThumbnailSelected;
            ModificationTypes.SusanSelected    += ModificationTypes_SusanSelected;
            ModificationTypes.HarrisSelected   += ModificationTypes_HarrisSelected;
            ModificationTypes.MoravecSelected  += ModificationTypes_MoravecSelected;
            ModificationTypes.FASTSelected     += ModificationTypes_FASTSelected;
            ModificationProperties.ModificationPropertiesLog += ModificationProperties_ModificationPropertiesLog;
            ModificationProperties.UpdateImage += ModificationProperties_UpdateImage;
            ModificationProperties.CurrentImage = CurrentImage;
        }
Пример #6
0
        /// <summary>
        /// Saves the current Docking Layout.
        /// TODO: Save unsaved files and other warnings.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");

            if (m_bSaveLayout)
            {
                DockingPanel.SaveAsXml(configFile);
            }
            else if (File.Exists(configFile))
            {
                File.Delete(configFile);
            }
        }
Пример #7
0
        private void standardLayoutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                DockingPanel.SuspendLayout(true);

                //check for null forms - Not working - figure out the disposal of forms.
                if (_videoForm.IsDisposed == true)
                {
                    _videoForm = new VideoForm(_telemetryComms.Data);
                }
                _videoForm.Show(DockingPanel, DockState.Document);
                if (_mapForm.IsDisposed == true)
                {
                    _mapForm = new MapForm();
                }
                _mapForm.Show(DockingPanel, DockState.DockRight);
                if (_settingsForm.IsDisposed == true)
                {
                    _settingsForm = new SettingsForm();
                }
                _settingsForm.Show(DockingPanel, DockState.DockLeft);
                if (_outputForm.IsDisposed == true)
                {
                    _outputForm = new OutputForm();
                }
                _outputForm.Show(DockingPanel, DockState.DockBottom);
                if (_telemetryForm.IsDisposed == true)
                {
                    _telemetryForm = new TelemetryForm(_telemetryComms.Data);
                }
                if (_telemetryForm.IsDisposed == true)
                {
                    _telemetryForm = new TelemetryForm(_telemetryComms.Data);
                }
                _telemetryForm.Show(DockingPanel, DockState.Float);
                //if (_geForm.IsDisposed == true)
                //    _geForm = new GEForm();
                //_geForm.Show(DockingPanel, DockState.Float);

                //save current layout
                _deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

                DockingPanel.ResumeLayout(true, true);
            }
            catch (Exception ex)
            {
                TraceException.WriteLine(ex);
            }
        }
Пример #8
0
        /// <summary>
        /// Handles the FormClosing event of the MainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.FormClosingEventArgs"/> instance containing the event data.</param>
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");

            if (_bSaveLayout)
            {
                DockingPanel.SaveAsXml(configFile);
            }
            else if (File.Exists(configFile))
            {
                File.Delete(configFile);
            }

            QUAVS.GS.Properties.Settings.Default.Save();
        }
Пример #9
0
        /// <summary>
        /// 根据停靠区域实例生成一个<see cref="RadPane"/>
        /// </summary>
        /// <param name="dockingPane"></param>
        /// <returns></returns>
        private static RadPane GenericRadPane(CreatedDockingPane dockingPane)
        {
            var radPane = new RadPane {
                Tag = dockingPane,
                PaneHeaderVisibility = dockingPane.DockingPane.PaneHeaderVisibility,
                CanUserClose         = dockingPane.DockingPaneMetaData.CanUserClose,
                Content  = dockingPane.DockingPane.UIObject,
                CanFloat = dockingPane.DockingPaneMetaData.CanFloat,
                Header   = dockingPane.DockingPane.Header,
                IsHidden = dockingPane.DockingPane.IsHidden
            };

            dockingPane.DockingPane.IsHiddenChanged += delegate {
                radPane.IsHidden = dockingPane.DockingPane.IsHidden;
            };

            DockingPanel.SetInitialSize(radPane, new Size(dockingPane.DockingPaneMetaData.InitialWidth, dockingPane.DockingPaneMetaData.InitialHeight));

            return(radPane);
        }
Пример #10
0
        private bool SetupSavedDocking()
        {
            try
            {
                if (File.Exists(Paths.DockingPath))
                {
                    FormProject  formProject  = new FormProject();
                    FormOpenDocs formOpenDOcs = new FormOpenDocs();
                    FormOutline  formOutline  = new FormOutline();

                    FormFindInFiles formFindInFiles = new FormFindInFiles();
                    _DeserializeDockContent = new DeserializeDockContent(DockingManager.GetContentFromPersistString);

                    DockingPanel.LoadFromXml(Paths.DockingPath, _DeserializeDockContent);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Log.Write(ex);
            }
            return(false);
        }
Пример #11
0
 private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     DockingPanel.SaveAsXml(Paths.DockingPath);
 }
Пример #12
0
        private void UpdateGUI(Theme pre)
        {
            try
            {
                if (!String.IsNullOrEmpty(pre.UITheme.TabBackGradientStart))
                {
                    DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.StartColor = pre.UITheme.TabBackGradientStart.ToColor();
                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.EndColor = pre.UITheme.TabBackGradientEnd.ToColor();
                }
                if (!String.IsNullOrEmpty(pre.UITheme.TabBackGradientStart))
                {
                    DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.EndColor     = pre.UITheme.TabBackGradientEnd.ToColor();
                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.StartColor = pre.UITheme.TabBackGradientEnd.ToColor();
                }

                if (!String.IsNullOrEmpty(pre.UITheme.TabStart))
                {
                    DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.StartColor = pre.UITheme.TabStart.ToColor();
                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.EndColor = pre.UITheme.TabStart.ToColor();
                }

                if (!String.IsNullOrEmpty(pre.UITheme.TabEnd))
                {
                    DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.InactiveTabGradient.EndColor     = pre.UITheme.TabEnd.ToColor();
                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.StartColor = pre.UITheme.TabEnd.ToColor();
                }

                if (!String.IsNullOrEmpty(pre.UITheme.ActiveTabStart))
                {
                    DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.StartColor = pre.UITheme.ActiveTabStart.ToColor();


                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.EndColor = pre.UITheme.ActiveTabStart.ToColor();
                }

                if (!String.IsNullOrEmpty(pre.UITheme.ActiveTabEnd))
                {
                    DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.EndColor = pre.UITheme.ActiveTabEnd.ToColor();

                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.StartColor = pre.UITheme.ActiveTabEnd.ToColor();
                }

                if (!String.IsNullOrEmpty(pre.UITheme.TabFore))
                {
                    DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.TextColor   = pre.UITheme.TabFore.ToColor();
                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.TextColor = pre.UITheme.TabFore.ToColor();
                }

                if (!String.IsNullOrEmpty(pre.UITheme.ActiveTabFore))
                {
                    DockingPanel.Skin.DockPaneStripSkin.DocumentGradient.ActiveTabGradient.TextColor   = pre.UITheme.ActiveTabFore.ToColor();
                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.TextColor = pre.UITheme.ActiveTabFore.ToColor();
                }

                if (!String.IsNullOrEmpty(pre.UITheme.TitleStart))
                {
                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.StartColor = pre.UITheme.TitleStart.ToColor();
                }

                if (!String.IsNullOrEmpty(pre.UITheme.TitleEnd))
                {
                    DockingPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveCaptionGradient.EndColor = pre.UITheme.TitleEnd.ToColor();
                }

                if (!String.IsNullOrEmpty(pre.UITheme.MainBG))
                {
                    DockingPanel.DockBackColor = pre.UITheme.MainBG.ToColor();
                    DockingPanel.BackColor     = pre.UITheme.MainBG.ToColor();
                }

                DockingPanel.Refresh();
            }

            catch { }
        }
Пример #13
0
 private void ButtonAddBottom_Click(object sender, RoutedEventArgs e)
 {
     DockingPanel.Add(new Grid(), "bottom", DockingWindowsPanel.AddingDirections.Bottom);
 }
Пример #14
0
 private void ButtonAddRight_Click(object sender, RoutedEventArgs e)
 {
     DockingPanel.Add(new Grid(), "right", DockingWindowsPanel.AddingDirections.Right);
 }
Пример #15
0
 private void ButtonAddTopt_Click(object sender, RoutedEventArgs e)
 {
     DockingPanel.Add(new Grid(), "top", DockingWindowsPanel.AddingDirections.Top);
 }