コード例 #1
0
        private void ButtonMeasurement_Click(object sender, RoutedEventArgs e)
        {
            DependencyObject obj = sender as DependencyObject;

            TreeViewItem        item;
            RealTimeMeasurement realTimeMeasurement;
            Measurement         measurement;

            PhasorMeasurementUserControl phasorMeasurementUserControl;

            while ((object)obj != null && obj.GetType() != typeof(TreeViewItem))
            {
                obj = VisualTreeHelper.GetParent(obj);
            }

            item = (TreeViewItem)obj;
            realTimeMeasurement = (RealTimeMeasurement)item?.DataContext;
            measurement         = Measurement.GetMeasurement(null, $"WHERE SignalReference = '{realTimeMeasurement?.SignalReference}'");

            if ((object)measurement != null && measurement.DeviceID.HasValue)
            {
                phasorMeasurementUserControl = CommonFunctions.LoadUserControl("Manage Measurements for " + measurement.DeviceAcronym, typeof(PhasorMeasurementUserControl), (int)measurement.DeviceID) as PhasorMeasurementUserControl;

                if (phasorMeasurementUserControl != null)
                {
                    ((PhasorMeasurements)phasorMeasurementUserControl.DataContext).CurrentItem = measurement;
                }
            }
        }
コード例 #2
0
ファイル: Subscribers.cs プロジェクト: xj0229/gsf
        // Attempt to get measurement name from signal ID
        private string GetMeasurementName(Guid signalID)
        {
            DataModelMeasurement measurement = DataModelMeasurement.GetMeasurement(null, signalID);

            if ((object)measurement != null)
            {
                return(string.Format("{0} [{1}:{2}]", measurement.PointTag, measurement.HistorianAcronym, measurement.PointID));
            }

            return(signalID.ToString());
        }
コード例 #3
0
        private void ButtonMeasurement_Click(object sender, RoutedEventArgs e)
        {
            Measurement measurement = Measurement.GetMeasurement(null, "WHERE SignalReference = '" + ((Button)sender).Content + "'");

            if (measurement.DeviceID.HasValue)
            {
                PhasorMeasurementUserControl phasorMeasurementUserControl = CommonFunctions.LoadUserControl("Manage Measurements for " + measurement.DeviceAcronym, typeof(PhasorMeasurementUserControl), (int)measurement.DeviceID) as PhasorMeasurementUserControl;

                if (phasorMeasurementUserControl != null)
                {
                    ((PhasorMeasurements)phasorMeasurementUserControl.DataContext).CurrentItem = measurement;
                }
            }
        }