Esempio n. 1
0
        /// <summary>
        /// Creates the graphbase (e.g. timebase) cursors.
        /// </summary>
        private IEnumerable <BoundCursor> CreateGraphbaseCursors()
        {
            var graphbaseVM = _viewModel.GraphbaseVM;
            var triggerVM   = graphbaseVM.TriggerVM;
            var channelVM   = triggerVM.ChannelVM;

            var cursors = new List <BoundCursor>();

            if (channelVM == null)
            {
                ; // intentionally left blank
            }
            else if (triggerVM is LevelTriggerViewModel)
            {
                cursors.Add(TriggerCursorFactory.CreateTriggerCriteriaCursor(
                                triggerVM as LevelTriggerViewModel, channelVM,
                                () => _referenceLevel));
            }
            // Add more cases for other types of triggers here.
            // ...

            cursors.Add(TriggerCursorFactory.CreateTriggerPointCursor(graphbaseVM));

            bool bothCursorsVisible =
                graphbaseVM.MeasurementCursor1VM.Visible &&
                graphbaseVM.MeasurementCursor2VM.Visible;

            if (graphbaseVM.MeasurementCursor1VM.Visible)
            {
                cursors.Add(MeasurementCursorFactory.CreateTimeMeasurementCursor(
                                graphbaseVM.MeasurementCursor1VM, graphbaseVM, bothCursorsVisible,
                                null,
                                () => _referenceTime));
            }

            if (graphbaseVM.MeasurementCursor2VM.Visible)
            {
                cursors.Add(MeasurementCursorFactory.CreateTimeMeasurementCursor(
                                graphbaseVM.MeasurementCursor2VM, graphbaseVM, false,
                                bothCursorsVisible ? () => graphbaseVM.MeasurementCursor1VM.Value : (Func <double>)null,
                                () => _referenceTime));
            }

            return(cursors);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the cursors for all channels.
        /// </summary>
        private IEnumerable <BoundCursor> CreateChannelCursors()
        {
            var channelConfig = _viewModel.ChannelVMs;

            // Note that the last cursor in the list has the highest priority when
            // searching them after a click.

            var cursors = new List <BoundCursor>();

            cursors.AddRange(channelConfig
                             .Select(channelConf => ChannelCursorFactory.CreateChannelReferenceCursor(channelConf)));

            channelConfig.ForEachDo(chConfig =>
            {
                bool bothCursorsVisible =
                    chConfig.MeasurementCursor1VM.Visible &&
                    chConfig.MeasurementCursor2VM.Visible;

                if (chConfig.MeasurementCursor1VM.Visible)
                {
                    cursors.Add(MeasurementCursorFactory.CreateLevelMeasurementCursor(
                                    chConfig.MeasurementCursor1VM, chConfig, bothCursorsVisible,
                                    null,
                                    () => _referenceLevel));
                }

                if (chConfig.MeasurementCursor2VM.Visible)
                {
                    cursors.Add(MeasurementCursorFactory.CreateLevelMeasurementCursor(
                                    chConfig.MeasurementCursor2VM, chConfig, false,
                                    bothCursorsVisible ? () => chConfig.MeasurementCursor1VM.Value : (Func <double>)null,
                                    () => _referenceLevel));
                }
            });

            return(cursors);
        }