Esempio n. 1
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);
        }