Beispiel #1
0
        private bool ShouldSerializeControls()
        {
            TableLayoutControlCollection collection = this.Controls;

            return(collection != null && collection.Count > 0);
        }
        private bool ShouldSerializeControls()
        {
            TableLayoutControlCollection controls = this.Controls;

            return((controls != null) && (controls.Count > 0));
        }
Beispiel #3
0
        /// <summary>
        /// Update the <c>BackColor</c> and <c>ForeColor</c> properties  of each flag to reflect the current state.
        /// </summary>
        /// <param name="flagStateList">The list defining the current flag states.</param>
        /// <param name="controlCollection">The collection of label controls used to display the flag states.</param>
        protected void UpdateFlagStates(TableLayoutControlCollection controlCollection, List<FlagState_t> flagStateList)
        {
            byte bit;
            bool logicState;
            for (int index = 0; index < flagStateList.Count; index++)
            {
                bit = flagStateList[index].Bit;

                // Get the flag state associated with the bit.
                logicState = flagStateList.Find(delegate(FlagState_t flagState) { return flagState.Bit == bit; }).State;

                if (logicState == true)
                {
                    controlCollection[index].ForeColor = m_ForeColorAssertedState;
                    controlCollection[index].BackColor = m_BackColorAssertedState;
                }
                else
                {
                    controlCollection[index].ForeColor = m_ForeColorClearState;
                    controlCollection[index].BackColor = m_BackColorClearState;
                }
            }
        }
 public DesignerTableLayoutControlCollection(TableLayoutPanel owner) : base(owner)
 {
     this.realCollection = owner.Controls;
 }
        /// <summary>
        /// Check whether there were any breaks in communication with the VCU and set the breakpoint values of each plotter controls accordingly. This allows the plot 
        /// to be drawn using a transparent pen for periods where there was a break in transmission.
        /// </summary>
        /// <param name="controlCollection">Reference to the <c>TableLayoutControlCollection</c> containing the <c>IPlotterWatch</c> derived user controls.</param>
        /// <param name="startTime">The start time of the plot.</param>
        /// <param name="historicDataManager">Reference to the <c>HistoricDataManager</c> class containing the data that is to be plotted.</param>
        public void SetBreakpoints(TableLayoutControlCollection controlCollection, DateTime startTime, IHistoricDataManager historicDataManager)
        {
            // Skip, if the Dispose() method has been called.
            if (m_IsDisposed)
            {
                return;
            }

            // Skip, if there are no plotter controls associated with the TableLayoutPanel.
            if (controlCollection.Count == 0)
            {
                return;
            }
            
            // The time, in ms since the start of the plot, where a break in the sequence was detected.
            long breakpoint;

            // The DateTime corresponding to the previous entry, used to determine a break in the log sequence for running logs.
            DateTime previousEntryDateTime = new DateTime();

            // The interval between concurrent frames above which the plot is considered to have been interrupted i.e a new breakpoint has been triggered.
            TimeSpan breakpointTriggerInterval = new TimeSpan(0, 0, 0, 0, BreakpointTriggerIntervalAsMultiple * Parameter.IntervalWatchMs);

            long adjust;
            for (int frame = 0; frame < m_HistoricDataManager.FramesToDisplay.Count; frame++)
            {
                // Don't perform comparison on the first entry.
                if (frame != 0)
                {
                    if (historicDataManager.FramesToDisplay[frame].CurrentDateTime.Subtract(previousEntryDateTime) > breakpointTriggerInterval)
                    {
                        // Detected a break in the log sequence, record the previous entry as a breakpoint, round down to the nearest 10ms.
                        breakpoint = (long)previousEntryDateTime.Subtract(startTime).TotalMilliseconds;
                        adjust = breakpoint % BreakpointResolutionMs;
                        breakpoint -= adjust;
                        
                        // Record the breakPoint for each plotter.
                        for (int index = 0; index < controlCollection.Count; index++)
                        {
                            // Skip, if the plotter user control has not been configured.
                            if ((controlCollection[index] as IPlotterWatch) == null)
                            {
                                continue;
                            }

                            (controlCollection[index] as IPlotterWatch).Channels[0].SetBreakPoint(breakpoint);
                        }
                    }
                }
                previousEntryDateTime = m_HistoricDataManager.FramesToDisplay[frame].CurrentDateTime;
            }
        }
 /// <summary>
 /// Reset the channel of each <c>IPlotterWatch</c> derived plotter control associated with the specified <c>TableLayoutControlCollection</c>.
 /// </summary>
 /// <param name="controlCollection">Reference to the <c>TableLayoutControlCollection</c> containing the <c>IPlotterWatch</c> derived user controls.</param>
 public void ResetChannel(TableLayoutControlCollection controlCollection)
 {
     for (int index = 0; index < controlCollection.Count; index++)
     {
         if ((controlCollection[index] as IPlotterWatch) != null)
         {
             (controlCollection[index] as IPlotterWatch).Channels[0].Reset();
         }
     }
 }
        /// <summary>
        /// Plot the historic watch values stored within <paramref name="historicDataManager"/> using the <c>IPlotterWatch</c> derived plotter user controls associated
        /// with the specified <c>TableLayoutControlCollection</c>.
        /// </summary>
        /// <param name="controlCollection">Reference to the <c>TableLayoutControlCollection</c> containing the <c>IPlotterWatch</c> derived plotter controls used 
        /// to plot the historic data.</param>
        /// <param name="historicDataManager">Reference to the <c>HistoricDataManager</c> class containing the data that is to be plotted.</param>
        /// <param name="elapsedTime">The elapsed time, in ms, since the start of the plot for each frame that is to be plotted.</param>
        public void PlotWatchValues(TableLayoutControlCollection controlCollection, IHistoricDataManager historicDataManager, long[] elapsedTime)
        {
            // Skip, if the Dispose() method has been called.
            if (m_IsDisposed)
            {
                return;
            }

            // Skip, if there are no plotter controls associated with the TableLayoutPanel.
            if (controlCollection.Count == 0)
            {
                return;
            }

            short oldIdentifier, watchElementIndex;
            IPlotterWatch plotterWatch;
            WatchVariable watchVariable;
            for (int index = 0; index < controlCollection.Count; index++)
            {
                plotterWatch = controlCollection[index] as IPlotterWatch;

                // Skip, if the plotter user control has not been configured.
                if (plotterWatch == null)
                {
                    continue;
                }

                oldIdentifier = plotterWatch.Identifier;

                try
                {
                    watchVariable = Lookup.WatchVariableTableByOldIdentifier.Items[oldIdentifier];

                    // Check whether the watch variable exists.
                    if (watchVariable == null)
                    {
                        // No, skip this entry.
                        continue;
                    }
                }
                catch (Exception)
                {
                    continue;
                }

                // Get the watch element index associated with the old identifier identifier.
                watchElementIndex = m_HistoricDataManager.GetWatchElementIndex(oldIdentifier);

                // Check whether the old watch file contains watch values associated with this old identifier.
                if (watchElementIndex == CommonConstants.NotDefined)
                {
                    continue;
                }

                if (watchElementIndex > historicDataManager.Workset.CountMax)
                {
                    throw new ArgumentOutOfRangeException("watchElementIndex", "PlotterControlLayout.PlotWatchValues()");
                }

                plotterWatch.Start();

                if ((plotterWatch as IPlotterScalar) != null)
                {
                    double engineeringValue;
                    for (int frame = 0; frame < historicDataManager.FramesToDisplay.Count; frame++)
                    {
                        engineeringValue = watchVariable.ScaleFactor * historicDataManager.FramesToDisplay[frame].WatchElements[watchElementIndex].Value;
                        plotterWatch.Channels[0].SetYTValue((float)engineeringValue, elapsedTime[frame]);
                    }
                }
                else if ((plotterWatch as IPlotterEnumerator) != null)
                {
                    double engineeringValue;
                    for (int frame = 0; frame < historicDataManager.FramesToDisplay.Count; frame++)
                    {
                        engineeringValue = watchVariable.ScaleFactor * historicDataManager.FramesToDisplay[frame].WatchElements[watchElementIndex].Value;
                        plotterWatch.Channels[0].SetYTValue((float)engineeringValue, elapsedTime[frame]);
                    }
                }
                else if ((plotterWatch as IPlotterBitmask) != null)
                {
                    IPlotterBitmask plotterBitmask = plotterWatch as IPlotterBitmask;
                    byte bit = plotterBitmask.Bit;
                    ulong bitmask = (ulong)0x01 << bit;
                    bool logicState;
                    for (int frame = 0; frame < historicDataManager.FramesToDisplay.Count; frame++)
                    {
                        if (((ulong)historicDataManager.FramesToDisplay[frame].WatchElements[watchElementIndex].Value & bitmask) == bitmask)
                        {
                            logicState = true;
                        }
                        else
                        {
                            logicState = false;
                        }

                        plotterBitmask.Channels[0].SetState(logicState, elapsedTime[frame]);
                    }
                }
                plotterWatch.Stop();
                plotterWatch.UpdateDisplay();
            }
        }
        private void SubscribeTileEvents(TableLayoutControlCollection controls)
        {
            foreach (Control c in controls)
            {
                c.Click += layoutControlClick;

                PictureBox pBox = c as PictureBox;
                pBox.Margin = new System.Windows.Forms.Padding(1);
            }
        }