Exemplo n.º 1
0
        private void ReadDetailed_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            TreeNode Node = this.SelectedNode;

            if (Node == null || !Node.CanReadSensorData)
            {
                return;
            }

            SensorDataClientRequest Request = Node.StartSensorDataFullReadout();

            if (Request == null)
            {
                return;
            }

            TabItem TabItem = new TabItem();

            this.Tabs.Items.Add(TabItem);

            SensorDataView View = new SensorDataView(Request, Node, false);

            TabItem.Header  = Node.Header;
            TabItem.Content = View;

            this.Tabs.SelectedItem = TabItem;
        }
Exemplo n.º 2
0
        private void SubscribeToMomentary_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            TreeNode Node = this.SelectedNode;

            if (Node == null || !Node.CanSubscribeToSensorData)
            {
                return;
            }

            SensorDataClientRequest Request;

            if (Node.CanReadSensorData)
            {
                Request = Node.StartSensorDataMomentaryReadout();
            }
            else
            {
                Request = Node.SubscribeSensorDataMomentaryReadout(new FieldSubscriptionRule[0]);
            }

            if (Request == null)
            {
                return;
            }

            TabItem TabItem = MainWindow.NewTab(Node.Header);

            this.Tabs.Items.Add(TabItem);

            SensorDataView View = new SensorDataView(Request, Node, true);

            TabItem.Content = View;

            this.Tabs.SelectedItem = TabItem;
        }