Example #1
0
 private void OnChangeData( )
 {
     DashboardView.Refresh( );
     SequenceView.Refresh( );
     SignalView.Refresh( );
     SetControls( );
 }
        public void SetWorkingSignalView(IDataSource dataSource, int dataSourceComponentIndex)
        {
            if (dataSource == null)
            {
                throw new ArgumentNullException(nameof(dataSource));
            }
            if (dataSourceComponentIndex < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(dataSourceComponentIndex));
            }

            if (SignalView != null)
            {
                if (SignalView.DataSource != dataSource || SignalView.SignalView.ComponentIndex != dataSourceComponentIndex)
                {
                    SignalView.Dispose();
                    SignalView = null;
                }
            }

            if (SignalView == null)
            {
                int index = dataSourceComponentIndex;
                SignalView = CreateSignalView(dataSource, new SignalView(dataSource.ComponentNames[index], index));
            }

            CurrentPane = PaneType.SignalView;
        }
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            SignalView signalView = new SignalView();

            signalView.Show();
            this.Hide();
        }
Example #4
0
        /// <summary>
        /// Обновить список сигналов
        /// </summary>
        private void UpdateSignalsList()
        {
            List <SignalView> dataSource = new List <SignalView>();
            List <SignalUnit> signals    = _configuration.ListSignalUnits.GetItems();

            foreach (SignalUnit signal in signals)
            {
                SignalView view = new SignalView();
                view.Uid  = signal.Uid.ToString();
                view.Name = signal.Name;
                view.Type = signal.Type.ToString();
                DataBlockUnit dataBlock = _configuration.FindDataBlock(signal.DataBlockUid);
                string        dbName    = "";
                if (dataBlock != null)
                {
                    dbName = dataBlock.Name;
                }
                view.DataBlockName = dbName;
                view.Byte          = signal.Byte.ToString();

                dataSource.Add(view);
            }

            dataThreadSignals.DataSource            = dataSource;
            dataThreadSignals.Columns[0].HeaderText = "UID";
            dataThreadSignals.Columns[0].Width      = 50;
            dataThreadSignals.Columns[1].HeaderText = "Наименование";
            dataThreadSignals.Columns[1].Width      = 200;
            dataThreadSignals.Columns[2].HeaderText = "Тип";
            dataThreadSignals.Columns[2].Width      = 50;
            dataThreadSignals.Columns[3].HeaderText = "Блок данных";
            dataThreadSignals.Columns[3].Width      = 150;
            dataThreadSignals.Columns[4].HeaderText = "Байт";
            dataThreadSignals.Columns[4].Width      = 50;
        }
        private void Remove()
        {
            onRemove();

            if (SignalView != null)
            {
                SignalView.Remove();
            }
        }
        internal void Cleanup()
        {
            if (SignalFiltersPipeline != null)
            {
                SignalFiltersPipeline.Cleanup();
            }

            if (SignalView != null)
            {
                SignalView.Cleanup();
            }
        }
Example #7
0
 private void OnCloseMenuItem(object sender, EventArgs e)
 {
     //Document = null;
     DashboardView.Instance( ).Hide( );
     SequenceView.Instance( ).Hide( );
     SignalView.Instance( ).Hide( );
     if (Program.Document != null)
     {
         Program.Document.Close( );
     }
     Program.Document = null;
     SetControls( );
 }
Example #8
0
 private void OnDataSourceValue(double[] value)
 {
     try
     {
         SignalView.OnNext(value);
     }
     catch (Exception ex)
     {
         Error = ex;
         if (sourceSubscription != null)
         {
             sourceSubscription.Dispose();
             sourceSubscription = null;
         }
     }
 }
Example #9
0
 public void UpdateGridSignals()
 {
     SignalView.constructGridSignals(dataGridViewListSign, comboBoxSecSign.Text, () =>
     {
         LastIndexSelectRow = LastIndexSelectRow < 0 ? 0 : LastIndexSelectRow;
         LastIndexSelectRow = LastIndexSelectRow >= dataGridViewListSign.Rows.Count ? dataGridViewListSign.Rows.Count - 1 : LastIndexSelectRow;
         foreach (DataGridViewRow row in dataGridViewListSign.Rows)
         {
             if (row.Index == LastIndexSelectRow)
             {
                 row.Selected = true;
                 dataGridViewListSign.FirstDisplayedScrollingRowIndex = LastIndexSelectRow;
             }
         }
     });
 }
Example #10
0
 private void OnLoad(object sender, EventArgs e)
 {
     if (File.Exists(Program.DockPanelConfig))
     {
         try
         {
             dockPanel.LoadFromXml(Program.DockPanelConfig, _deserializeDockContent);
             DashboardView.Hide( );
             SequenceView.Hide( );
             SignalView.Hide( );
         }
         catch
         {
             File.Delete(Program.DockPanelConfig);
         }
     }
     SetControls( );
 }
        public void SaveLayout(XmlTextWriter writer)
        {
            writer.WriteStartElement("Container");

            if (SignalView != null)
            {
                SignalView.SaveLayout(writer);

                writer.WriteStartElement("Filters");
                foreach (SignalFilterViewModel filter in SignalFiltersPipeline.SignalFilters)
                {
                    filter.SaveLayout(writer);
                }
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
Example #12
0
        public UI()
        {
            InitializeComponent();

            Ctrl     = new UIController(this);
            VUMeters = new List <VUMeter>();
            VULabels = new List <Label>();

            InputView  = new InputView();
            SignalView = new SignalView();
            OutputView = new OutputView();

            Controls.Add(InputView);
            Controls.Add(SignalView);
            Controls.Add(OutputView);

            InputView.Anchor  = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
            SignalView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
            OutputView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;

            InputView.Top     = 80;
            InputView.Left    = 15;
            InputView.Width   = ClientSize.Width - 2 * 15;
            InputView.Height  = ClientSize.Height - 80 - 30 - panelMeters.Height;
            InputView.Visible = true;
            InputView.Hide();

            SignalView.Top     = 80;
            SignalView.Left    = 15;
            SignalView.Width   = ClientSize.Width - 2 * 15;
            SignalView.Height  = ClientSize.Height - 80 - 30 - panelMeters.Height;
            SignalView.Visible = true;
            SignalView.Hide();

            OutputView.Top     = 80;
            OutputView.Left    = 15;
            OutputView.Width   = ClientSize.Width - 2 * 15;
            OutputView.Height  = ClientSize.Height - 80 - 30 - panelMeters.Height;
            OutputView.Visible = true;
            OutputView.Hide();

            ChangePage(LabelInputs, null);
        }
        private void LoadSignalView(XmlElement viewNode)
        {
            XmlAttribute attr = viewNode.Attributes["Source"];

            if (attr == null)
            {
                return;
            }

            Guid sourceGuid = XmlConvert.ToGuid(attr.Value);

            IDataSource dataSource = Root.DataSources.FirstOrDefault(s => s.UniqueIdentifier == sourceGuid);

            if (dataSource == null)
            {
                return;
            }

            attr = viewNode.Attributes["ComponentIndex"];
            if (attr == null)
            {
                return;
            }

            int componentIndex;

            if (int.TryParse(attr.Value, out componentIndex) == false)
            {
                return;
            }

            SetWorkingSignalView(dataSource, componentIndex);

            SignalViewSelector.SelectedDataSource = SignalViewSelector.AvailableDataSources.FirstOrDefault(vm => vm.DataSource.UniqueIdentifier == sourceGuid);
            if (SignalViewSelector.SelectedDataSource != null)
            {
                SignalViewSelector.SelectedDataSource.SelectedComponentIndex = componentIndex;
            }

            SignalView.LoadLayout(viewNode);
        }
Example #14
0
        private void UpdateChart(object sender, ChartDataEventArgs e)
        {
            if (e.LeftRawInputYs != null)
            {
                var leftRawInputPlot = (SignalPlot)SignalView.Plot.GetPlottables()[0];
                leftRawInputPlot.Ys = e.LeftRawInputYs;
            }
            if (e.LeftDebouncedInputYs != null)
            {
                var leftDebouncedInputPlot = (SignalPlot)SignalView.Plot.GetPlottables()[1];
                leftDebouncedInputPlot.Ys = e.LeftDebouncedInputYs;
            }

            if (e.RightRawInputYs != null)
            {
                var rightRawInputPlot = (SignalPlot)SignalView.Plot.GetPlottables()[2];
                rightRawInputPlot.Ys = e.RightRawInputYs;
            }
            if (e.RightDebouncedInputYs != null)
            {
                var rightDebouncedInputPlot = (SignalPlot)SignalView.Plot.GetPlottables()[3];
                rightDebouncedInputPlot.Ys = e.RightDebouncedInputYs;
            }

            countersPlotted = new bool[5000];
            // clear all text
            var allText = SignalView.Plot.GetPlottables().Where((plot) => plot.GetType() == typeof(Text));

            foreach (IPlottable text in allText)
            {
                SignalView.Plot.Remove(text);
            }
            countersPlotted = new bool[5000];
            if (SignalView.Plot.GetAxisLimits().XSpan < COUNTER_VISIBLE_THRESHOLD)
            {
                PlotCounters();
            }

            SignalView.Render();
        }
        /// <summary>
        ///
        /// </summary>
        private void UpdateGridSignals()
        {
            SignalView.constructGridSignals(dataGridViewSignal, Securities.ToString(), () =>
            {
                LastIndexSelectRow = LastIndexSelectRow < 0 ? 0 : LastIndexSelectRow;
                LastIndexSelectRow = LastIndexSelectRow >= dataGridViewSignal.Rows.Count ? dataGridViewSignal.Rows.Count - 1 : LastIndexSelectRow;
                dataGridViewSignal.Rows.ForEach <DataGridViewRow>((row) =>
                {
                    row.Selected = false;
                    if (row.Index == LastIndexSelectRow)
                    {
                        row.Selected = true;
                        dataGridViewSignal.FirstDisplayedScrollingRowIndex = LastIndexSelectRow;
                    }
                });

                /*foreach (DataGridViewRow row in dataGridViewSignal.Rows)
                 * {
                 *
                 * }*/
            });
        }
Example #16
0
 public SignalController(SignalView form)
 {
     this.ui  = form;
     Channels = new List <SignalChannel>();
 }
Example #17
0
 private void OnSignalMenuItem(object sender, EventArgs e)
 {
     SignalView.Instance( ).Show( );
 }