Beispiel #1
0
        // Selects the calculator name that was defined in isolated storage.
        private void SelectCalculatorName()
        {
            const string isolatedStorageKey = "AverageFrequency.CalculatorName";
            string       isolatedName       = IsolatedStorageManager.ReadFromIsolatedStorage(isolatedStorageKey).ToNonNullString();

            SelectedCalculatorName = m_calculatorNames.Contains(isolatedName) ? isolatedName : m_calculatorNames.FirstOrDefault();
        }
Beispiel #2
0
        public void Initialize(Device deviceInfo)
        {
            if (deviceInfo != null)
            {
                try
                {
                    m_nodeID = ((App)Application.Current).NodeValue;
                    GridDeviceInfo.DataContext        = deviceInfo;
                    m_deviceStatisticInfoList         = CommonFunctions.GetDeviceStatisticMeasurements(null, deviceInfo.ID);
                    ListBoxStatisticsList.ItemsSource = m_deviceStatisticInfoList;
                    if (m_deviceStatisticInfoList.Count > 0)
                    {
                        GetMaxMinPointIDs();
                        RefreshData();
                    }

                    if (m_refreshTimer == null)
                    {
                        int interval = 10;
                        int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("StatisticsDataRefreshInterval").ToString(), out interval);

                        m_refreshTimer          = new DispatcherTimer();
                        m_refreshTimer.Interval = TimeSpan.FromSeconds(interval);
                        m_refreshTimer.Tick    += new EventHandler(m_refreshTimer_Tick);
                        m_refreshTimer.Start();

                        TextBlockRefreshInterval.Text = " (Refresh Interval: " + interval.ToString() + " sec)";
                    }
                }
                catch (Exception ex)
                {
                    CommonFunctions.LogException(null, "WPF.Initialize", ex);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Loads advanced find settings from isolated storage.
        /// </summary>
        public void LoadSettings()
        {
            string           searchText;
            string           ignoreCase;
            string           useWildcards;
            string           useRegex;
            string           searchCategories;
            HashSet <string> searchCategoriesSet;

            searchText       = (string)IsolatedStorageManager.ReadFromIsolatedStorage("MeasurementSearchText") ?? string.Empty;
            ignoreCase       = (string)IsolatedStorageManager.ReadFromIsolatedStorage("MeasurementSearchIgnoreCase") ?? string.Empty;
            useWildcards     = (string)IsolatedStorageManager.ReadFromIsolatedStorage("MeasurementSearchUseWildcards") ?? string.Empty;
            useRegex         = (string)IsolatedStorageManager.ReadFromIsolatedStorage("MeasurementSearchUseRegex") ?? string.Empty;
            searchCategories = (string)IsolatedStorageManager.ReadFromIsolatedStorage("MeasurementSearchCategories") ?? string.Empty;

            SearchText          = searchText;
            IgnoreCase          = string.IsNullOrEmpty(ignoreCase) || ignoreCase.ParseBoolean();
            UseWildcards        = string.IsNullOrEmpty(useWildcards) || useWildcards.ParseBoolean();
            UseRegex            = !string.IsNullOrEmpty(useRegex) && useRegex.ParseBoolean();
            searchCategoriesSet = new HashSet <string>(searchCategories.Split(','));

            foreach (AdvancedSearchCategory category in SearchCategories)
            {
                if (string.IsNullOrEmpty(searchCategories) || searchCategoriesSet.Contains(category.Name))
                {
                    category.Selected = true;
                }
            }
        }
Beispiel #4
0
        private void ComboBoxMeasurement_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ComboBoxMeasurement.Items.Count > 0)
            {
                DataModelMeasurement selectedMeasurement = (DataModelMeasurement)ComboBoxMeasurement.SelectedItem;
                if (selectedMeasurement != null)
                {
                    m_signalID = selectedMeasurement.SignalID.ToString();

                    if (selectedMeasurement.SignalSuffix == "PA")
                    {
                        ChartPlotterDynamic.Visible = DataRect.Create(0, -180, m_numberOfPointsToPlot, 180);
                    }
                    else if (selectedMeasurement.SignalSuffix == "FQ")
                    {
                        double frequencyMin = Convert.ToDouble(IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMin"));
                        double frequencyMax = Convert.ToDouble(IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMax"));

                        ChartPlotterDynamic.Visible = DataRect.Create(0, Math.Min(frequencyMin, frequencyMax), m_numberOfPointsToPlot, Math.Max(frequencyMin, frequencyMax));
                    }
                }
            }
            else
            {
                m_signalID = string.Empty;
            }

            SubscribeUnsynchronizedData();
        }
Beispiel #5
0
        public override void Initialize()
        {
            base.Initialize();

            m_nodelookupList = Node.GetLookupList(null);

            bool.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("MirrorMode").ToString(), out m_mirrorMode);

            if (m_mirrorMode)
            {
                MirroringSourceLookupList = Device.GetDevicesForMirroringOutputStream(null);
            }

            m_typeLookupList = new Dictionary <int, string>();
            m_typeLookupList.Add(1, "IEEE C37.118-2005");
            m_typeLookupList.Add(2, "BPA PDCstream");
            m_typeLookupList.Add(3, "IEC 61850-90-5");

            m_downSamplingMethodLookupList = new Dictionary <string, string>();
            m_downSamplingMethodLookupList.Add("LastReceived", "LastReceived");
            m_downSamplingMethodLookupList.Add("Closest", "Closest");
            m_downSamplingMethodLookupList.Add("Filtered", "Filtered");
            m_downSamplingMethodLookupList.Add("BestQuality", "BestQuality");

            m_dataFormatLookupList = new Dictionary <string, string>();
            m_dataFormatLookupList.Add("FloatingPoint", "FloatingPoint");
            m_dataFormatLookupList.Add("FixedInteger", "FixedInteger");

            m_coordinateFormatLookupList = new Dictionary <string, string>();
            m_coordinateFormatLookupList.Add("Polar", "Polar");
            m_coordinateFormatLookupList.Add("Rectangular", "Rectangular");
        }
Beispiel #6
0
        /// <summary>
        /// Creates an instance of <see cref="OutputStreamDevices"/> class.
        /// </summary>
        /// <param name="outputStreamID">ID of the output stream to filter data.</param>
        /// <param name="itemsPerPage">Integer value to determine number of items per page.</param>
        /// <param name="autoSave">Boolean value to determine is user changes should be saved automatically.</param>
        public OutputStreamDevices(int outputStreamID, int itemsPerPage, bool autoSave = true)
            : base(0, autoSave)
        {
            ItemsPerPage   = itemsPerPage;
            OutputStreamID = outputStreamID;
            Load();

            m_phasorDataformatLookupList = new Dictionary <string, string>();
            m_phasorDataformatLookupList.Add("", "Select Phasor Data Format");
            m_phasorDataformatLookupList.Add("FloatingPoint", "FloatingPoint");
            m_phasorDataformatLookupList.Add("FixedInteger", "FixedInteger");

            m_frequencyDataformatLookupList = new Dictionary <string, string>();
            m_frequencyDataformatLookupList.Add("", "Select Frequency Data Format");
            m_frequencyDataformatLookupList.Add("FloatingPoint", "FloatingPoint");
            m_frequencyDataformatLookupList.Add("FixedInteger", "FixedInteger");

            m_analogDataformatLookupList = new Dictionary <string, string>();
            m_analogDataformatLookupList.Add("", "Select Frequency Data Format");
            m_analogDataformatLookupList.Add("FloatingPoint", "FloatingPoint");
            m_analogDataformatLookupList.Add("FixedInteger", "FixedInteger");

            m_coordinateDataformatLookupList = new Dictionary <string, string>();
            m_coordinateDataformatLookupList.Add("", "Select Coordinate Format");
            m_coordinateDataformatLookupList.Add("Polar", "Polar");
            m_coordinateDataformatLookupList.Add("Rectangular", "Rectangular");

            bool.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("MirrorMode").ToString(), out m_mirrorMode);
        }
Beispiel #7
0
        private void RetrieveSettingsFromIsolatedStorage(bool reloadSelectedMeasurements = true)
        {
            // Retrieve values from IsolatedStorage.
            int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("NumberOfDataPointsToPlot").ToString(), out m_numberOfDataPointsToPlot);
            int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("DataResolution").ToString(), out m_framesPerSecond);
            int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("ChartRefreshInterval").ToString(), out m_chartRefreshInterval);
            int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("StatisticsDataRefreshInterval").ToString(), out m_statisticsDataRefershInterval);
            int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("MeasurementsDataRefreshInterval").ToString(), out m_measurementsDataRefreshInterval);
            double.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("LagTime").ToString(), out m_lagTime);
            double.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("LeadTime").ToString(), out m_leadTime);
            double.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMin").ToString(), out m_frequencyRangeMin);
            double.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMax").ToString(), out m_frequencyRangeMax);
            m_forceIPv4               = IsolatedStorageManager.ReadFromIsolatedStorage("ForceIPv4").ToString().ParseBoolean();
            m_displayXAxis            = IsolatedStorageManager.ReadFromIsolatedStorage("DisplayXAxis").ToString().ParseBoolean();
            m_displayLegend           = IsolatedStorageManager.ReadFromIsolatedStorage("DisplayLegend").ToString().ParseBoolean();
            m_displayFrequencyYAxis   = IsolatedStorageManager.ReadFromIsolatedStorage("DisplayFrequencyYAxis").ToString().ParseBoolean();
            m_displayPhaseAngleYAxis  = IsolatedStorageManager.ReadFromIsolatedStorage("DisplayPhaseAngleYAxis").ToString().ParseBoolean();
            m_displayCurrentYAxis     = IsolatedStorageManager.ReadFromIsolatedStorage("DisplayCurrentYAxis").ToString().ParseBoolean();
            m_displayVoltageYAxis     = IsolatedStorageManager.ReadFromIsolatedStorage("DisplayVoltageYAxis").ToString().ParseBoolean();
            m_useLocalClockAsRealtime = IsolatedStorageManager.ReadFromIsolatedStorage("UseLocalClockAsRealtime").ToString().ParseBoolean();
            m_ignoreBadTimestamps     = IsolatedStorageManager.ReadFromIsolatedStorage("IgnoreBadTimestamps").ToString().ParseBoolean();

            if (reloadSelectedMeasurements)
            {
                m_selectedSignalIDs = IsolatedStorageManager.ReadFromIsolatedStorage("InputMonitoringPoints").ToString();
                string[] signalIDs = m_selectedSignalIDs.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                AutoSelectMeasurements(signalIDs);
            }
        }
Beispiel #8
0
        private void InitializeUserControl()
        {
            m_dataContext    = new RealTimeStreams(1, m_measurementsDataRefreshInterval);
            this.DataContext = m_dataContext;
            //ListBoxCurrentValues.ItemsSource = m_displayedMeasurement;
            DataGridCurrentValues.ItemsSource = m_displayedMeasurement;

            // Initialize Chart Properties.
            InitializeColors();
            InitializeChart();

            m_selectedSignalIDs = IsolatedStorageManager.ReadFromIsolatedStorage("InputMonitoringPoints").ToString();
            string[] signalIDs = m_selectedSignalIDs.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            AutoSelectMeasurements(signalIDs);

            PopulateSettings();

            foreach (RealTimeStream stream in m_dataContext.ItemsSource)
            {
                if (stream.ID > 0)
                {
                    GetStatistics(stream.Acronym);
                    break;
                }

                foreach (RealTimeDevice device in stream.DeviceList)
                {
                    if (device.ID > 0)
                    {
                        GetStatistics(device.Acronym);
                        break;
                    }
                }
            }
        }
Beispiel #9
0
        void ComboBoxMeasurements_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ComboBoxMeasurements.Items.Count > 0 && ComboBoxMeasurements.SelectedIndex >= 0)
            {
                openPDCManager.Data.Entities.Measurement measurement = (openPDCManager.Data.Entities.Measurement)ComboBoxMeasurements.SelectedItem;

                //This was done for WPF to make sure there are measurements available in the dropdown before calling time series data service. Otherwise ComboboxMeasurements.SelectedItem returned NULL.
                m_measurementForSubscription = measurement.HistorianAcronym + ":" + measurement.PointID;
                ReconnectToService();

                m_framesPerSecond = (int)measurement.FramesPerSecond;
                LinearAxis yAxis = (LinearAxis)ChartRealTimeData.Axes[1];
                if (measurement.SignalSuffix == "PA")
                {
                    yAxis.Minimum  = -180;
                    yAxis.Maximum  = 180;
                    yAxis.Interval = 60;
                }
                else
                {
                    yAxis.Minimum  = Convert.ToDouble(IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMin")); // 59.95;
                    yAxis.Maximum  = Convert.ToDouble(IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMax")); // 60.05;
                    yAxis.Interval = (yAxis.Maximum - yAxis.Minimum) / 5.0;                                                 // 0.02;
                }
            }
        }
Beispiel #10
0
 // Selects the virtual device name that was defined in isolated storage.
 private void SelectVirtualDeviceName()
 {
     if (!string.IsNullOrWhiteSpace(m_selectedCalculatorName))
     {
         string isolatedStorageKey = string.Format("AverageFrequency.{0}.VirtualDeviceName", m_selectedCalculatorName);
         string isolatedName       = IsolatedStorageManager.ReadFromIsolatedStorage(isolatedStorageKey).ToNonNullString();
         SelectedVirtualDeviceName = m_virtualDeviceNames.Contains(isolatedName) ? isolatedName : m_virtualDeviceNames.FirstOrDefault();
     }
 }
Beispiel #11
0
 private void ButtonRestore_Click(object sender, RoutedEventArgs e)
 {
     m_dataContext.RestartConnectionCycle = false;
     m_dataContext.UnsubscribeUnsynchronizedData();
     IsolatedStorageManager.InitializeStorageForRealTimeMeasurements(true);
     int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("RealtimeMeasurementsDataRefreshInterval").ToString(), out m_measurementsDataRefreshInterval);
     PopupSettings.IsOpen = false;
     CommonFunctions.LoadUserControl(CommonFunctions.GetHeaderText("Monitor Device Outputs"), typeof(RealTimeMeasurementUserControl));
 }
Beispiel #12
0
 private void ButtonRestore_Click(object sender, RoutedEventArgs e)
 {
     IsolatedStorageManager.InitializeStorageForRemoteConsole(true);
     if (int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("NumberOfMessages").ToString(), out m_numberOfMessages))
     {
         TextBoxNumberOfMessages.Text = m_numberOfMessages.ToString();
     }
     PopupSettings.IsOpen = false;
 }
Beispiel #13
0
 void DeviceMeasurementsUserControl_Loaded(object sender, RoutedEventArgs e)
 {
     m_activityWindow       = new ActivityWindow("Loading Data... Please Wait...");
     m_activityWindow.Owner = Window.GetWindow(this);
     m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     m_activityWindow.Show();
     GetDeviceMeasurementData();
     int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("MeasurementsDataRefreshInterval").ToString(), out m_refreshInterval);
     TextBlockRefreshInterval.Text = "Refresh Interval: " + m_refreshInterval.ToString() + " sec";
 }
Beispiel #14
0
 private void ButtonRestore_Click(object sender, RoutedEventArgs e)
 {
     m_dataContext.Stop();
     IsolatedStorageManager.InitializeStorageForStreamStatistics(true);
     int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("StreamStatisticsDataRefreshInterval").ToString(), out m_statisticDataRefreshInterval);
     TextBlockMeasurementRefreshInterval.Text = m_statisticDataRefreshInterval.ToString();
     TextBoxRefreshInterval.Text = m_statisticDataRefreshInterval.ToString();
     PopupSettings.IsOpen        = false;
     CommonFunctions.LoadUserControl(CommonFunctions.GetHeaderText("Stream Statistics"), typeof(RealTimeStatisticUserControl));
 }
Beispiel #15
0
        /// <summary>
        /// Hanldes loaded event.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Event arguments.</param>
        private void MonitoringUserControl_Loaded(object sender, RoutedEventArgs e)
        {
            TextBoxServiceRequest.Focus();
            SetupServiceConnection();
            if (!int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("NumberOfMessages").ToString(), out m_numberOfMessages))
            {
                m_numberOfMessages = 75;
            }

            TextBoxNumberOfMessages.Text = m_numberOfMessages.ToString();
        }
Beispiel #16
0
        /// <summary>
        /// Startup steps, when the page is loaded.
        /// </summary>
        private void InputWizardWalkthrough_Loaded(object sender, RoutedEventArgs e)
        {
            m_history = new List <string>()
            {
                "Welcome"
            };

            if (IsolatedStorageManager.SettingExists("ShowWalkthroughAtStartup"))
            {
                DoNotShowCheckBox.IsChecked = !Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("ShowWalkthroughAtStartup"));
            }
        }
Beispiel #17
0
 void Initialize()
 {
     m_numberOfMessagesOnMonitor = IsolatedStorageManager.ReadFromIsolatedStorage("NumberOfMessages") == null ? 50 : Convert.ToInt32(IsolatedStorageManager.ReadFromIsolatedStorage("NumberOfMessages"));
     this.Unloaded += new RoutedEventHandler(MonitorUserControl_Unloaded);
     if (((App)Application.Current).Principal.IsInRole("Administrator"))
     {
         ButtonSendServiceRequest.IsEnabled = true;
     }
     else
     {
         ButtonSendServiceRequest.IsEnabled = false;
     }
 }
Beispiel #18
0
        /// <summary>
        /// Creates an instance of <see cref="RealTimeStreams"/>.
        /// </summary>
        /// <param name="itemsPerPage"></param>
        /// <param name="refreshInterval">Interval to refresh measurement in a tree.</param>
        /// <param name="autoSave"></param>
        public RealTimeStreams(int itemsPerPage, int refreshInterval, bool autoSave = false)
            : base(itemsPerPage, autoSave)
        {
            // Perform initialization here.
            m_refreshInterval = refreshInterval;
            InitializeUnsynchronizedSubscription();
            m_restartConnectionCycle = true;
            StatisticMeasurements    = new ObservableCollection <StatisticMeasurement>();

            int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("StatisticsDataRefreshInterval").ToString(), out m_statisticRefreshInterval);
            Statistics = new RealTimeStatistics(1, m_statisticRefreshInterval);

            CheckTemporalSupport();
        }
Beispiel #19
0
        private void InputWizardUserControl_Loaded(object sender, RoutedEventArgs e)
        {
            bool showWalkthrough = true;

            if (IsolatedStorageManager.SettingExists("ShowWalkthroughAtStartup"))
            {
                showWalkthrough = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("ShowWalkthroughAtStartup"));
            }

            if (showWalkthrough)
            {
                m_dataContext.LaunchWalkthroughCommand.Execute(null);
            }
        }
Beispiel #20
0
        public void SubscribeUnsynchronizedData(bool historical)
        {
            UnsynchronizedSubscriptionInfo info;

            if (m_unsynchronizedSubscriber == null)
            {
                InitializeUnsynchronizedSubscription();
            }

            if (m_subscribedUnsynchronized && !string.IsNullOrEmpty(m_allSignalIDs))
            {
                double lagTime;
                double leadTime;

                if (!double.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("LagTime")?.ToString(), out lagTime))
                {
                    lagTime = 60.0D;
                }

                if (!double.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("LeadTime")?.ToString(), out leadTime))
                {
                    leadTime = 60.0D;
                }

                info = new UnsynchronizedSubscriptionInfo(true);

                info.UseCompactMeasurementFormat = true;
                info.FilterExpression            = m_allSignalIDs;
                info.IncludeTime             = true;
                info.UseLocalClockAsRealTime = IsolatedStorageManager.ReadFromIsolatedStorage("UseLocalClockAsRealTime").ToNonNullString("true").ParseBoolean();
                info.LagTime         = lagTime;
                info.LeadTime        = leadTime;
                info.PublishInterval = m_refreshInterval;

                if (historical)
                {
                    info.StartTime          = StartTime;
                    info.StopTime           = StopTime;
                    info.ProcessingInterval = m_refreshInterval * 1000;
                }

                m_unsynchronizedSubscriber.Subscribe(info);
            }

            if (m_statistics == null)
            {
                Application.Current.Dispatcher.BeginInvoke(new Action(() => Statistics = new RealTimeStatistics(1, m_statisticRefreshInterval)));
            }
        }
        /// <summary>
        /// Creates an instance of <see cref="OutputStreamCurrentDeviceUserControl"/>.
        /// <param name="outputStreamID">ID of the output stream to filter data.</param>
        /// </summary>
        public OutputStreamCurrentDeviceUserControl(int outputStreamID)
        {
            InitializeComponent();

            m_outputStreamID = outputStreamID;
            m_currentDevices = new ObservableCollection <OutputStreamDevice>();
            m_newDevices     = new ObservableCollection <Device>();

            Loaded += OutputStreamCurrentDeviceUserControl_Loaded;
            KeyUp  += OutputStreamCurrentDeviceUserControl_KeyUp;

            string phaseFilter = IsolatedStorageManager.ReadFromIsolatedStorage(PhaseFilterSetting).ToNonNullString("*");

            TextBoxPhaseFilter.Text = string.IsNullOrWhiteSpace(phaseFilter) ? "*" : phaseFilter;
        }
        // Restores original setting based on what is stored in the isolated storage manager.
        private void ButtonRestore_Click(object sender, RoutedEventArgs e)
        {
            int refreshInterval;

            IsolatedStorageManager.InitializeStorageForAlarmStatus(true);

            if (!int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("AlarmStatusRefreshInterval").ToString(), out refreshInterval) || refreshInterval < 0)
            {
                refreshInterval = AlarmMonitor.DefaultRefreshInterval;
            }

            TextBlockAlarmRefreshInterval.Text    = refreshInterval.ToString();
            TextBoxRefreshInterval.Text           = refreshInterval.ToString();
            m_dataContext.Monitor.RefreshInterval = refreshInterval;
            PopupSettings.IsOpen = false;
        }
Beispiel #23
0
        private void RealTimeStatisticUserControl_Loaded(object sender, RoutedEventArgs e)
        {
            int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("StreamStatisticsDataRefreshInterval").ToString(), out m_statisticDataRefreshInterval);

            if (m_statisticDataRefreshInterval == 0)
            {
                m_statisticDataRefreshInterval = 5;
                IsolatedStorageManager.InitializeStorageForStreamStatistics(true);
            }

            TextBlockMeasurementRefreshInterval.Text = m_statisticDataRefreshInterval.ToString() + " sec";
            TextBoxRefreshInterval.Text = m_statisticDataRefreshInterval.ToString();
            m_dataContext = CreateDataContext();
            DataContext   = m_dataContext;
            KeyUp        += RealTimeStatisticUserControl_KeyUp;
        }
Beispiel #24
0
        /// <summary>
        /// Attempts to run the PMU Connection Tester from a number of different locations.
        /// </summary>
        private void RunConnectionTesterQuery_Yes(object sender, RoutedEventArgs e)
        {
            const string Executable = "PMUConnectionTester.exe";

            string currentDirectory             = FilePath.GetAbsolutePath("");
            string openPDCDirectory             = FilePath.GetAbsolutePath(@"..\openPDC");
            string pmuConnectionTesterDirectory = FilePath.GetAbsolutePath(@"..\PMU Connection Tester");
            string fullPath = null;
            bool   failed   = false;

            if (IsolatedStorageManager.SettingExists("PMUConnectionTester.exe"))
            {
                fullPath = IsolatedStorageManager.ReadFromIsolatedStorage("PMUConnectionTester.exe").ToNonNullString();
            }

            if (!TryRunConnectionTester(fullPath))
            {
                fullPath = Path.Combine(currentDirectory, Executable);

                if (!TryRunConnectionTester(fullPath))
                {
                    fullPath = Path.Combine(openPDCDirectory, Executable);

                    if (!TryRunConnectionTester(fullPath))
                    {
                        fullPath = Path.Combine(pmuConnectionTesterDirectory, Executable);

                        if (!TryRunConnectionTester(fullPath))
                        {
                            failed = true;
                        }
                    }
                }
            }

            if (failed)
            {
                TraverseDecisionTree("ConnectionTesterPathInput");
            }
            else
            {
                TraverseDecisionTree("ConnectionFileQuery");
            }
        }
Beispiel #25
0
        public RealTimeStatisticsUserControl()
        {
            InitializeComponent();
            this.Loaded     += new RoutedEventHandler(RealTimeStatistics_Loaded);
            this.Unloaded   += new RoutedEventHandler(RealTimeStatisticsUserControl_Unloaded);
            m_dataForBinding = new StatisticMeasurementDataForBinding();
            m_statisticMeasurementDataList = new ObservableCollection <StatisticMeasurementData>();
            m_minMaxPointIDs = new KeyValuePair <int, int>();
            m_nodeID         = ((App)Application.Current).NodeValue;

            int interval = 10;

            int.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("StatisticsDataRefreshInterval").ToString(), out interval);

            m_thirtySecondsTimer          = new DispatcherTimer();
            m_thirtySecondsTimer.Interval = TimeSpan.FromSeconds(interval);
            TextBlockRefreshInterval.Text = "Refresh Interval: " + interval.ToString() + " sec";
            m_thirtySecondsTimer.Tick    += new EventHandler(thirtySecondsTimer_Tick);
            m_thirtySecondsTimer.Start();
        }
Beispiel #26
0
        private void ComboBoxMeasurement_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ComboBoxMeasurement.Items.Count > 0)
            {
                m_selectedMeasurement = (Measurement)ComboBoxMeasurement.SelectedItem;

                // Capture's the Selected index of measurement Combo Box
                if (Application.Current.Resources.Contains("SelectedMeasurement_Home"))
                {
                    Application.Current.Resources.Remove("SelectedMeasurement_Home");
                    Application.Current.Resources.Add("SelectedMeasurement_Home", ComboBoxMeasurement.SelectedIndex);
                }
                else
                {
                    Application.Current.Resources.Add("SelectedMeasurement_Home", ComboBoxMeasurement.SelectedIndex);
                }

                if (m_selectedMeasurement != null)
                {
                    m_signalID = m_selectedMeasurement.SignalID.ToString();

                    if (m_selectedMeasurement.SignalSuffix == "PA")
                    {
                        ChartPlotterDynamic.Visible = DataRect.Create(0, -180, m_numberOfPointsToPlot, 180);
                    }
                    else if (m_selectedMeasurement.SignalSuffix == "FQ")
                    {
                        double frequencyMin = Convert.ToDouble(IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMin"));
                        double frequencyMax = Convert.ToDouble(IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMax"));

                        ChartPlotterDynamic.Visible = DataRect.Create(0, Math.Min(frequencyMin, frequencyMax), m_numberOfPointsToPlot, Math.Max(frequencyMin, frequencyMax));
                    }
                }
            }
            else
            {
                m_signalID = string.Empty;
            }

            SubscribeUnsynchronizedData();
        }
Beispiel #27
0
        public override void Initialize()
        {
            m_configFrameSizeCalculation = new LongSynchronizedOperation(UpdateConfigFrameSize, UpdateConfigFrameSizeError)
            {
                IsBackground = true
            };

            base.Initialize();

            m_nodelookupList = Node.GetLookupList(null);

            bool.TryParse(IsolatedStorageManager.ReadFromIsolatedStorage("MirrorMode").ToString(), out m_mirrorMode);

            if (m_mirrorMode)
            {
                MirroringSourceLookupList = Device.GetDevicesForMirroringOutputStream(null);
            }

            ConfigFrameSizeColor = new SolidColorBrush(Colors.Black);
            ConfigFrameSizeText  = "Calculating...";

            m_typeLookupList = new Dictionary <int, string>();
            m_typeLookupList.Add(1, "IEEE C37.118-2005");
            m_typeLookupList.Add(2, "BPA PDCstream");
            m_typeLookupList.Add(3, "IEC 61850-90-5");

            m_downSamplingMethodLookupList = new Dictionary <string, string>();
            m_downSamplingMethodLookupList.Add("LastReceived", "LastReceived");
            m_downSamplingMethodLookupList.Add("Closest", "Closest");
            m_downSamplingMethodLookupList.Add("Filtered", "Filtered");
            m_downSamplingMethodLookupList.Add("BestQuality", "BestQuality");

            m_dataFormatLookupList = new Dictionary <string, string>();
            m_dataFormatLookupList.Add("FloatingPoint", "FloatingPoint");
            m_dataFormatLookupList.Add("FixedInteger", "FixedInteger");

            m_coordinateFormatLookupList = new Dictionary <string, string>();
            m_coordinateFormatLookupList.Add("Polar", "Polar");
            m_coordinateFormatLookupList.Add("Rectangular", "Rectangular");
        }
Beispiel #28
0
        /// <summary>
        /// Handles loaded event for select measurement user control.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SelectMeasurementUserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (IsolatedStorageManager.ReadFromIsolatedStorage("DisplayInternal") == null)
            {
                IsolatedStorageManager.WriteToIsolatedStorage("DisplayInternal", false);
            }

            if (FilterByInternal)
            {
                CheckboxDisplayInternal.Visibility = Visibility.Visible;
                CheckboxDisplayInternal.IsChecked  = IsolatedStorageManager.ReadFromIsolatedStorage("DisplayInternal").ToString().ParseBoolean();
            }
            else
            {
                CheckboxDisplayInternal.Visibility = Visibility.Collapsed;
            }

            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                Refresh();
            }
        }
Beispiel #29
0
 void LoadSettingsFromIsolatedStorage()
 {
     TextBoxNumberOfMessagesOnMonitor.Text = IsolatedStorageManager.ReadFromIsolatedStorage("NumberOfMessages").ToString();
     CheckboxForceIPv4.IsChecked           = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("ForceIPv4"));
     TextBoxLastSettings.Text                    = IsolatedStorageManager.ReadFromIsolatedStorage("InputMonitoringPoints").ToString();
     TextBoxNumberOfDataPoints.Text              = IsolatedStorageManager.ReadFromIsolatedStorage("NumberOfDataPointsToPlot").ToString();
     TextBoxFramesPerSecond.Text                 = IsolatedStorageManager.ReadFromIsolatedStorage("DataResolution").ToString();
     TextBoxLagTime.Text                         = IsolatedStorageManager.ReadFromIsolatedStorage("LagTime").ToString();
     TextBoxLeadTime.Text                        = IsolatedStorageManager.ReadFromIsolatedStorage("LeadTime").ToString();
     CheckboxUseLocalClockAsRealtime.IsChecked   = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("UseLocalClockAsRealtime"));
     CheckboxIngnoreBadTimestamps.IsChecked      = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("IgnoreBadTimestamps"));
     TextBoxChartRefreshInterval.Text            = IsolatedStorageManager.ReadFromIsolatedStorage("ChartRefreshInterval").ToString();
     TextBoxStatisticsDataRefreshInterval.Text   = IsolatedStorageManager.ReadFromIsolatedStorage("StatisticsDataRefreshInterval").ToString();
     TextBoxMeasurementsDataRefreshInterval.Text = IsolatedStorageManager.ReadFromIsolatedStorage("MeasurementsDataRefreshInterval").ToString();
     CheckboxDisplayXAxis.IsChecked              = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("DisplayXAxis"));
     CheckboxDisplayFrequencyAxis.IsChecked      = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("DisplayFrequencyYAxis"));
     CheckboxDisplayPhaseAngleAxis.IsChecked     = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("DisplayPhaseAngleYAxis"));
     CheckboxDisplayVoltageAxis.IsChecked        = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("DisplayVoltageYAxis"));
     CheckboxDisplayCurrentAxis.IsChecked        = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("DisplayCurrentYAxis"));
     CheckboxDisplayLegend.IsChecked             = Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("DisplayLegend"));
     TextBoxFrequencyRangeMin.Text               = IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMin").ToString();
     TextBoxFrequencyRangeMax.Text               = IsolatedStorageManager.ReadFromIsolatedStorage("FrequencyRangeMax").ToString();
 }
        /// <summary>
        /// Handles loaded event of the window.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Event arguments.</param>
        private void ConnectionStringBuilder_Loaded(object sender, RoutedEventArgs e)
        {
            if (m_connectionType == ConnectionType.CommandChannel)
            {
                TabItemTCP.Visibility              = Visibility.Visible;
                TabItemUDP.Visibility              = Visibility.Collapsed;
                TabItemSerial.Visibility           = Visibility.Collapsed;
                TabItemFile.Visibility             = Visibility.Collapsed;
                TabItemUdpServer.Visibility        = Visibility.Collapsed;
                TextBoxHostIP.Visibility           = Visibility.Collapsed;
                CheckboxEstablishServer.Visibility = Visibility.Collapsed;
            }
            else if (m_connectionType == ConnectionType.AlternateCommandChannel)
            {
                TabItemTCP.Visibility = Visibility.Visible;
                TabItemUDP.Visibility = Visibility.Collapsed;
                if (PgConnection)
                {
                    TabItemSerial.Visibility = Visibility.Collapsed;
                }
                else
                {
                    TabItemSerial.Visibility = Visibility.Visible;
                }
                TabItemFile.Visibility      = Visibility.Collapsed;
                TabItemUdpServer.Visibility = Visibility.Collapsed;
            }
            else if (m_connectionType == ConnectionType.DataChannel)
            {
                TabControlOptions.SelectedIndex = 4;
                TabItemTCP.Visibility           = Visibility.Collapsed;
                TabItemUDP.Visibility           = Visibility.Collapsed;
                TabItemSerial.Visibility        = Visibility.Collapsed;
                TabItemFile.Visibility          = Visibility.Collapsed;
                TabItemUdpServer.Visibility     = Visibility.Visible;
            }
            else
            {
                TabItemTCP.Visibility       = Visibility.Visible;
                TabItemUDP.Visibility       = Visibility.Visible;
                TabItemSerial.Visibility    = Visibility.Visible;
                TabItemFile.Visibility      = Visibility.Visible;
                TabItemUdpServer.Visibility = Visibility.Collapsed;
            }

            m_keyvaluepairs = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            ComboboxParity.ItemsSource   = CommonFunctions.GetParities();
            ComboboxStopBits.ItemsSource = CommonFunctions.GetStopBits();

            if (ComboboxParity.Items.Count > 0)
            {
                ComboboxParity.SelectedIndex = 0;
            }
            if (ComboboxStopBits.Items.Count > 1)
            {
                ComboboxStopBits.SelectedIndex = 1;
            }
            else
            {
                ComboboxStopBits.SelectedIndex = 0;
            }

            ComboboxPort.Items.Add("COM1");
            ComboboxPort.Items.Add("COM2");
            ComboboxPort.Items.Add("COM3");
            ComboboxPort.Items.Add("COM4");
            ComboboxPort.Items.Add("COM5");
            ComboboxPort.Items.Add("COM6");
            ComboboxPort.Items.Add("COM7");
            ComboboxPort.Items.Add("COM8");
            ComboboxPort.Items.Add("COM9");
            ComboboxPort.Items.Add("COM10");
            ComboboxPort.SelectedIndex = 0;

            // Populate Baud Rate Dropdown in Serial Tab
            ComboboxBaudRate.Items.Add(115200);
            ComboboxBaudRate.Items.Add(57600);
            ComboboxBaudRate.Items.Add(38400);
            ComboboxBaudRate.Items.Add(19200);
            ComboboxBaudRate.Items.Add(9600);
            ComboboxBaudRate.Items.Add(4800);
            ComboboxBaudRate.Items.Add(2400);
            ComboboxBaudRate.Items.Add(1200);
            ComboboxBaudRate.SelectedIndex = 0;

            CheckboxForceIPv4.IsChecked = IsolatedStorageManager.ReadFromIsolatedStorage("ForceIPv4") == null ? true : Convert.ToBoolean(IsolatedStorageManager.ReadFromIsolatedStorage("ForceIPv4"));

            // populate connection info	if already provided from the parent window
            ParseConnectionString();
        }