Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="watchFile">The structure containing the data stream that is to be plotted.</param>
        public FormDataStreamPlot(WatchFile_t watchFile)
        {
            InitializeComponent();

            // Make the file accessible to all members methods.
            WatchFile = watchFile;
            Debug.Assert(watchFile.DataStream.FrameIntervalMs > 0, "FormDataStreamPlot.Ctor() - [watchFile.DataStream.FrameIntervalMs > 0");

            m_HistoricDataManager = new HistoricDataManager(WatchFile);

            // Instantiate the class that supports the plotting of historic data.
            m_PlotterControlLayout = new PlotterControlLayout(this, m_HistoricDataManager);

            #region - [UserControl Event Handlers] -
            m_PlotterControlLayout.RangeChanged += new EventHandler(RangeChanged);
            m_PlotterControlLayout.RangeReset += new EventHandler(RangeReset);
            m_PlotterControlLayout.ZoomSelected += new EventHandler(ZoomSelected);
            m_PlotterControlLayout.RemoveSelected += new EventHandler(RemoveSelected);
            #endregion - [Event Handlers] -

            ConfigureTabControl(m_TabControl, WatchFile);

            #region - [Function Keys] -
            // Escape - Exit
            // F1 - Help
            // F2 - Print
            // F4 - Replay
            // F5 - Configure Plot
			// F6 - MultiCursor
            DisplayFunctionKey(F4, Resources.FunctionKeyTextReplay, Resources.FunctionKeyToolTipReplay, Resources.Replay);
            DisplayFunctionKey(F5, Resources.FunctionKeyTextEdit, Resources.FunctionKeyToolTipEditPlotLayout, Resources.Modify);
			DisplayFunctionKey(F6, Resources.FunctionKeyTextMultiCursor, Resources.FunctionKeyToolTipMultiCursor, Resources.MultiCursor);
            #endregion - [Function Keys] -

            #region - [InformationLabels/Legend] -
            // InformationLabel 1  - Date
            // InformationLabel 2  - Start Time
            // InformationLabel 3  - Stop Time
            // InformationLabel 4  - Duration
            DisplayLabel(InformationLabel1, Resources.InformationLegendDate, Color.MintCream);
            DisplayLabel(InformationLabel2, Resources.InformationLegendStartTime, Color.LightGreen);
            DisplayLabel(InformationLabel3, Resources.InformationLegendStopTime, Color.Red);
            DisplayLabel(InformationLabel4, Resources.InformationLegendDuration, Color.Khaki);
            #endregion - [InformationLabels/Legend] -

            // Ensure that the single cursor option is used as the default.
            Plotter.MultiCursor = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Clean up the resources used by the form.
        /// </summary>
        /// <param name="disposing">True to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        protected override void Cleanup(bool disposing)
        {
            try
            {

                // Method called by consumer code. Call the Dispose method of any managed data members that implement the dispose method.
                // Cleanup managed objects by calling their Dispose() methods.
                if (disposing)
                {
                    if (components != null)
                    {
                        components.Dispose();
                    }
                }
				
				// Whether called by consumer code or the garbage collector free all unmanaged resources and set the value of managed data 
                // members to null.
                m_PlotterControlLayout = null;
                m_HistoricDataManager = null;
                m_FormDataStreamReplay = null;

                #region - [Detach the event handler methods.] -
                this.Shown -= new EventHandler(this.FormDataStreamPlot_Shown);
                #endregion - [Detach the event handler methods.] -

                #region - [Component Designer Variables] -
                this.m_PanelSupplementalInformation = null;
                this.m_LabelSupplementalInformation = null;
                this.m_LegendSupplementalInformation = null;
                #endregion - [Component Designer Variables] -
            }
            catch (Exception)
            {
                // Don't do anything, just ensure that an exception isn't thrown.
            }
            finally
            {
                base.Cleanup(disposing);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Dispose of the user control associated with each <c>TabPage</c> of the <c>TabControl</c>.
        /// </summary>
        private void DisposeOfUserControls()
        {
            if (m_PlotterControlLayout != null)
            {
                m_PlotterControlLayout.RangeChanged -= new EventHandler(RangeChanged);
                m_PlotterControlLayout.RangeReset -= new EventHandler(RangeReset);
                m_PlotterControlLayout.ZoomSelected -= new EventHandler(ZoomSelected);
                m_PlotterControlLayout.RemoveSelected -= new EventHandler(RemoveSelected);
                m_PlotterControlLayout = null;
            }

            // Detatch the event handler methods associated with each iPlotterWatch control.
            foreach (TabPage tabPage in m_TabControl.TabPages)
            {
                // There should only be one panel per TabPage.
                foreach (Panel panel in tabPage.Controls)
                {
                    // Dispose of each iPlotter control.
                    int count = panel.Controls.Count;
                    for (int controlIndex = 0; controlIndex < count; controlIndex++)
                    {
                        IPlotterWatch iPlotterWatch = (IPlotterWatch)panel.Controls[0];
                        iPlotterWatch.Dispose();
                    }
                }
            }

            m_TabControl.TabPages.Clear();
        }