Exemplo n.º 1
0
        /// <summary>
        /// Deserializes object from isolated storage file.
        /// </summary>
        /// <typeparam name="T">Type of object.</typeparam>
        /// <param name="fileName">Path to isolated storage file.</param>
        /// <returns></returns>
        public static T Deserialize <T>(string subDirectory, string fileName)
        {
            try
            {
                // Open isolated storage.
                using (var storageManager = new IsolatedStorageManager())
                {
                    fileName = Prepare(storageManager, subDirectory, fileName);

                    if (storageManager.FileExists(fileName))
                    {
                        // Open file from storage.
                        using (var stream = storageManager.OpenFile(fileName, IO.OpenFileMode.Open))
                        {
                            XFile file = XFile.LoadBinary(stream, fileName);

                            var serializer = new XSerializer(file);

                            return(serializer.Deserialize <T>("Data"));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            return(default(T));
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 3
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;
                }
            }
        }
Exemplo n.º 4
0
 void Initialize()
 {
     m_duplexClient = ProxyClient.GetDuplexServiceProxyClient();
     m_duplexClient.SendToServiceCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(m_duplexClient_SendToServiceCompleted);
     m_duplexClient.SendToClientReceived   += new EventHandler <SendToClientReceivedEventArgs>(m_duplexClient_SendToClientReceived);
     m_numberOfMessagesOnMonitor            = IsolatedStorageManager.LoadFromIsolatedStorage("NumberOfMessagesOnMonitor") == null ? 50 : Convert.ToInt32(IsolatedStorageManager.LoadFromIsolatedStorage("NumberOfMessagesOnMonitor"));
 }
Exemplo n.º 5
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();
        }
Exemplo n.º 6
0
 public static bool FileExist(string path)
 {
     using (var storageManager = new IsolatedStorageManager())
     {
         return(storageManager.FileExists(path));
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Method to handle window loaded event.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Event arguments.</param>
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // Load Menu
            XmlRootAttribute xmlRootAttribute = new XmlRootAttribute("MenuDataItems");
            XmlSerializer    serializer       = new XmlSerializer(typeof(ObservableCollection <MenuDataItem>), xmlRootAttribute);

            using (XmlReader reader = XmlReader.Create(FilePath.GetAbsolutePath("Menu.xml")))
            {
                m_menuDataItems = (ObservableCollection <MenuDataItem>)serializer.Deserialize(reader);
            }

            MenuMain.DataContext = m_menuDataItems;

            // Populate Node Dropdown
            ComboboxNode.ItemsSource = Node.GetLookupList(null);
            if (ComboboxNode.Items.Count > 0)
            {
                ComboboxNode.SelectedIndex = 0;
            }

            // Create alarm monitor as singleton
            m_alarmMonitor = new AlarmMonitor(true);
            m_alarmMonitor.Start();

            IsolatedStorageManager.InitializeIsolatedStorage(false);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Serializes object to isolated storage file.
        /// </summary>
        /// <param name="fileName">file name.</param>
        /// <param name="obj">Object to serialize.</param>
        public static void Serialize(string subDirectory, string fileName, Object obj)
        {
            // Open isolated storage.
            using (var storageManager = new IsolatedStorageManager())
            {
                fileName = Prepare(storageManager, subDirectory, fileName);

                // Open file from storage.
                using (Stream stream = storageManager.OpenFile(fileName, IO.OpenFileMode.Create))
                {
                    XFile file = XFile.Create(fileName);

                    XNode fileNode = file;

                    var node = new XNode(file, "Serializator");
                    ((XNode)file).Nodes.Add(node);

                    // Create serializer for type.
                    var serializer = new XSerializer(node);
                    serializer.Serialize("Data", obj);

                    file.WriteBinary(stream);
                }
            }
        }
Exemplo n.º 9
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;
                    }
                }
            }
        }
Exemplo n.º 10
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;
                }
            }
        }
Exemplo n.º 11
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");
        }
Exemplo n.º 12
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();
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
        private void ButtonSaveSettings_Click(object sender, RoutedEventArgs e)
        {
            IsolatedStorageManager.WriteToIsolatedStorage("InputMonitoringPoints", TextBoxLastSelectedMeasurements.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("ForceIPv4", CheckBoxForceIPv4.IsChecked.GetValueOrDefault());
            IsolatedStorageManager.WriteToIsolatedStorage("NumberOfDataPointsToPlot", TextBoxNumberOFDataPointsToPlot.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("DataResolution", TextBoxDataResolution.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("LagTime", TextBoxLagTime.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("LeadTime", TextBoxLeadTime.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("UseLocalClockAsRealtime", CheckBoxUseLocalClockAsRealTime.IsChecked.GetValueOrDefault());
            IsolatedStorageManager.WriteToIsolatedStorage("IgnoreBadTimestamps", CheckBoxIgnoreBadTimestamps.IsChecked.GetValueOrDefault());
            IsolatedStorageManager.WriteToIsolatedStorage("ChartRefreshInterval", TextBoxChartRefreshInterval.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("StatisticsDataRefreshInterval", TextBoxStatisticDataRefreshInterval.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("MeasurementsDataRefreshInterval", TextBoxMeasurementDataRefreshInterval.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("DisplayXAxis", CheckBoxDisplayXAxis.IsChecked.GetValueOrDefault());
            IsolatedStorageManager.WriteToIsolatedStorage("DisplayFrequencyYAxis", CheckBoxDisplayFrequencyYAxis.IsChecked.GetValueOrDefault());
            IsolatedStorageManager.WriteToIsolatedStorage("DisplayPhaseAngleYAxis", CheckBoxDisplayPhaseAngleYAxis.IsChecked.GetValueOrDefault());
            IsolatedStorageManager.WriteToIsolatedStorage("DisplayVoltageYAxis", CheckBoxDisplayVoltageMagnitudeYAxis.IsChecked.GetValueOrDefault());
            IsolatedStorageManager.WriteToIsolatedStorage("DisplayCurrentYAxis", CheckBoxDisplayCurrentMagnitudeYAxis.IsChecked.GetValueOrDefault());
            IsolatedStorageManager.WriteToIsolatedStorage("FrequencyRangeMin", TextBoxFrequencyRangeMin.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("FrequencyRangeMax", TextBoxFrequencyRangeMax.Text);
            IsolatedStorageManager.WriteToIsolatedStorage("DisplayLegend", CheckBoxDisplayLegend.IsChecked.GetValueOrDefault());
            RetrieveSettingsFromIsolatedStorage();

            PopulateSettings();

            PopupSettings.IsOpen = false;

            CommonFunctions.LoadUserControl(CommonFunctions.GetHeaderText("Graph Real-time Measurements"), typeof(InputStatusMonitorUserControl));
        }
Exemplo n.º 15
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);
            }
        }
Exemplo n.º 16
0
 private void InputStatusMonitorUserControl_Unloaded(object sender, RoutedEventArgs e)
 {
     m_restartConnectionCycle             = false;
     m_dataContext.RestartConnectionCycle = false;
     Unsubscribe();
     m_dataContext.UnsubscribeUnsynchronizedData();
     IsolatedStorageManager.WriteToIsolatedStorage("InputMonitoringPoints", m_selectedSignalIDs);
 }
Exemplo n.º 17
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;
 }
Exemplo n.º 18
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();
     }
 }
Exemplo n.º 19
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));
 }
Exemplo n.º 20
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";
 }
Exemplo n.º 21
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));
 }
Exemplo n.º 22
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();
        }
Exemplo n.º 23
0
 void LoadSettingsFromIsolatedStorage()
 {
     TextBoxDefaultWidth.Text              = IsolatedStorageManager.LoadFromIsolatedStorage("DefaultWidth").ToString();
     TextBoxDefaultHeight.Text             = IsolatedStorageManager.LoadFromIsolatedStorage("DefaultHeight").ToString();
     TextBoxMinimumWidth.Text              = IsolatedStorageManager.LoadFromIsolatedStorage("MinimumWidth").ToString();
     TextBoxMinimumHeight.Text             = IsolatedStorageManager.LoadFromIsolatedStorage("MinimumHeight").ToString();
     TextBoxNumberOfMessagesOnMonitor.Text = IsolatedStorageManager.LoadFromIsolatedStorage("NumberOfMessagesOnMonitor").ToString();
     CheckboxResizeWithBrowser.IsChecked   = (bool)IsolatedStorageManager.LoadFromIsolatedStorage("ResizeWithBrowser");
     CheckboxMaintainAspectRatio.IsChecked = (bool)IsolatedStorageManager.LoadFromIsolatedStorage("MaintainAspectRatio");
     CheckboxForceIPv4.IsChecked           = (bool)IsolatedStorageManager.LoadFromIsolatedStorage("ForceIPv4");
 }
Exemplo n.º 24
0
 private void ButtonRestoreSettings_Click(object sender, RoutedEventArgs e)
 {
     m_restartConnectionCycle             = false;
     m_dataContext.RestartConnectionCycle = false;
     Unsubscribe();
     m_dataContext.UnsubscribeUnsynchronizedData();
     IsolatedStorageManager.InitializeStorageForInputStatusMonitor(true);
     RetrieveSettingsFromIsolatedStorage();
     PopulateSettings();
     PopupSettings.IsOpen = false;
     CommonFunctions.LoadUserControl(CommonFunctions.GetHeaderText("Graph Real-time Measurements"), typeof(InputStatusMonitorUserControl));
 }
Exemplo n.º 25
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"));
            }
        }
Exemplo n.º 26
0
 private void ButtonSave_Click(object sender, RoutedEventArgs e)
 {
     if (int.TryParse(TextBoxNumberOfMessages.Text, out m_numberOfMessages))
     {
         IsolatedStorageManager.WriteToIsolatedStorage("NumberOfMessages", m_numberOfMessages);
         PopupSettings.IsOpen = false;
     }
     else
     {
         MessageBox.Show("Please provide integer value.", "ERROR: Invalid Value", MessageBoxButton.OK);
     }
 }
Exemplo n.º 27
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;
     }
 }
Exemplo n.º 28
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);
            }
        }
Exemplo n.º 29
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();
        }
Exemplo n.º 30
0
        /// <summary>
        /// Attempts to run the PMU Connection Tester from the path given by the user.
        /// </summary>
        private void RunConnectionTesterQuery_OK(object sender, RoutedEventArgs e)
        {
            string connectionTesterPath = ConnectionTesterPathTextBox.Text;

            if (TryRunConnectionTester(connectionTesterPath))
            {
                IsolatedStorageManager.WriteToIsolatedStorage("PMUConnectionTester.exe", connectionTesterPath);
                TraverseDecisionTree("ConnectionFileQuery");
            }
            else
            {
                TraverseDecisionTree("NumberOfChannelsQuery");
            }
        }