Esempio n. 1
0
 void GetNodes()
 {
     try
     {
         m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
         m_activityWindow.Owner = Window.GetWindow(this);
         m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
         m_activityWindow.Show();
         ListBoxNodeList.ItemsSource = CommonFunctions.GetNodeList(null, false);
         if (ListBoxNodeList.Items.Count > 0)
             ListBoxNodeList.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         CommonFunctions.LogException(null, "WPF.GetNodeList", ex);
         SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Failed to Save Node Information", SystemMessage = ex.Message, UserMessageType = MessageType.Error },
                 ButtonType.OkOnly);
         sm.Owner = Window.GetWindow(this);
         sm.ShowPopup();
     }
     finally
     {
         m_activityWindow.Close();
     }
 }
 // Executes when the user navigates to this page.
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     m_statisticMeasurementDataList = new ObservableCollection<StatisticMeasurementData>();
     m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
     m_activityWindow.Show();
     m_client.GetStatisticMeasurementDataAsync(((App)Application.Current).NodeValue);
 }
 void Monitor_Loaded(object sender, RoutedEventArgs e)
 {
     m_activityWindow = new ActivityWindow("Connecting to Windows Service... Please Wait...");
     #if !SILVERLIGHT
     m_activityWindow.Owner = Window.GetWindow(this);
     m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     #endif
     m_activityWindow.Show();
     TextBoxServiceRequest.Focus();
     ReconnectToService();
 }
        void ButtonRequestConfiguration_Click(object sender, RoutedEventArgs e)
        {
            m_activityWindow = new ActivityWindow("Retrieving Configuration Frame... Please Wait...");

            #if !SILVERLIGHT
            m_activityWindow.Owner = Window.GetWindow(this);
            m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            #endif
            m_activityWindow.Show();

            #if SILVERLIGHT
            System.Windows.Media.Animation.Storyboard sb = new System.Windows.Media.Animation.Storyboard();
            sb = Application.Current.Resources["ButtonPressAnimation"] as System.Windows.Media.Animation.Storyboard;
            sb.Completed += new EventHandler(delegate(object obj, EventArgs es)
            {
                sb.Stop();
            });
            System.Windows.Media.Animation.Storyboard.SetTarget(sb, ButtonRequestConfigurationTransform);
            sb.Begin();
            #endif
            if (!string.IsNullOrEmpty(((App)Application.Current).RemoteStatusServiceUrl))
            {
            #if SILVERLIGHT
                RetrieveConfigurationFrame();
            #else
                System.Threading.ThreadPool.QueueUserWorkItem(delegate { RetrieveConfigurationFrame(); });
            #endif
            }
            else
            {
                if (m_activityWindow != null)
                    m_activityWindow.Close();
            }

            //this.Dispatcher.BeginInvoke((Action)delegate() { RetrieveConfigurationFrame(); });
        }
        void ButtonNext_Click(object sender, RoutedEventArgs e)
        {
            ButtonNext.IsEnabled = false;
            #if SILVERLIGHT
            System.Windows.Media.Animation.Storyboard sb = new System.Windows.Media.Animation.Storyboard();
            sb = Application.Current.Resources["ButtonPressAnimation"] as System.Windows.Media.Animation.Storyboard;
            sb.Completed += new EventHandler(delegate(object obj, EventArgs es)
            {
                sb.Stop();
            });
            System.Windows.Media.Animation.Storyboard.SetTarget(sb, ButtonNextTransform);
            sb.Begin();
            #endif
            //here we only handle finish button. Every other Next button click is handled in the Accordian selection changed event.
            if (AccordianWizard.SelectedIndex == AccordianWizard.Items.Count - 1)
            {
                if (!nextButtonClicked)
                {
                    nextButtonClicked = true;
                    m_activityWindow = new ActivityWindow("Processing Request... Please Wait...");
            #if !SILVERLIGHT
                    m_activityWindow.Owner = Window.GetWindow(this);
                    m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            #endif
                    m_activityWindow.Show();

                    App app = (App)Application.Current;
                    int? protocolID = ((KeyValuePair<int, string>)ComboboxProtocol.SelectedItem).Key == 0 ? (int?)null : ((KeyValuePair<int, string>)ComboboxProtocol.SelectedItem).Key;
                    int? companyID = ((KeyValuePair<int, string>)ComboboxCompany.SelectedItem).Key == 0 ? (int?)null : ((KeyValuePair<int, string>)ComboboxCompany.SelectedItem).Key;
                    int? historianID = ((KeyValuePair<int, string>)ComboboxHistorian.SelectedItem).Key == 0 ? (int?)null : ((KeyValuePair<int, string>)ComboboxHistorian.SelectedItem).Key;
                    int? interconnectionID = ((KeyValuePair<int, string>)ComboboxInterconnection.SelectedItem).Key == 0 ? (int?)null : ((KeyValuePair<int, string>)ComboboxInterconnection.SelectedItem).Key;

                    int accessID;
                    if (m_wizardDeviceInfoList.Count == 1)
                        m_wizardDeviceInfoList[0].AccessID = int.TryParse(TextBoxAccessID.Text, out accessID) ? accessID : m_wizardDeviceInfoList[0].ParentAccessID;

                    SaveWizardConfigurationInfo(app.NodeValue, m_wizardDeviceInfoList, this.ConnectionString(), protocolID, companyID, historianID, interconnectionID, m_parentID, m_skipDisableRealTimeData);
                }
                else
                {
                    SystemMessages sm = new SystemMessages(new openPDCManager.Utilities.Message()
                    {
                        UserMessage = "Application is busy processing previous request. Please wait.",
                        SystemMessage = "",
                        UserMessageType = openPDCManager.Utilities.MessageType.Information
                    }, ButtonType.OkOnly);
                    sm.ShowPopup();
                }
            }

            if (AccordianWizard.SelectedIndex < AccordianWizard.Items.Count - 1)
            {
                ChangeAccordianSelection(AccordianWizard.SelectedIndex + 1);
                //AccordionItem item = AccordianWizard.Items[AccordianWizard.SelectedIndex + 1] as AccordionItem;
                //item.IsSelected = true;
            }

            ButtonNext.IsEnabled = true;
        }
        void ButtonBrowseConfigurationFile_Click(object sender, RoutedEventArgs e)
        {
            #if SILVERLIGHT
            System.Windows.Media.Animation.Storyboard sb = new System.Windows.Media.Animation.Storyboard();
            sb = Application.Current.Resources["ButtonPressAnimation"] as System.Windows.Media.Animation.Storyboard;
            sb.Completed += new EventHandler(delegate(object obj, EventArgs es)
            {
                sb.Stop();
            });
            System.Windows.Media.Animation.Storyboard.SetTarget(sb, ButtonBrowseConfigurationFileTransform);
            sb.Begin();
            #endif
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Multiselect = false;
            openFileDialog.Filter = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*";
            bool? result = openFileDialog.ShowDialog();
            if (result != null && result == true)
            {
                m_activityWindow = new ActivityWindow("Validating Configuration File... Please Wait...");

            #if SILVERLIGHT
                m_activityWindow.Show();
                TextBoxConfigurationFile.Text = openFileDialog.File.Name;
                m_configFileData = openFileDialog.File.OpenRead();
            #else
                m_activityWindow.Owner = Window.GetWindow(this);
                m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                m_activityWindow.Show();
                TextBoxConfigurationFile.Text = openFileDialog.FileName;
                m_configFileData = openFileDialog.OpenFile();
            #endif

                if ((((KeyValuePair<int, string>)ComboboxProtocol.SelectedItem).Value.ToUpper().Contains("BPA")) && !string.IsNullOrEmpty(m_iniFileName))
                {
                    string configFileDataString = (new StreamReader(m_configFileData)).ReadToEnd();
                    string leftPart = configFileDataString.Substring(0, configFileDataString.IndexOf("</configurationFileName>"));
                    string rightPart = configFileDataString.Substring(configFileDataString.IndexOf("</configurationFileName>"));
                    leftPart = leftPart.Substring(0, leftPart.LastIndexOf(">") + 1);
            #if SILVERLIGHT
                    configFileDataString = leftPart + m_iniFilePath + "\\" + m_iniFileName + rightPart;
            #else
                    configFileDataString = leftPart + m_iniFileName + rightPart;
            #endif
                    Byte[] fileData = Encoding.UTF8.GetBytes(configFileDataString);
                    MemoryStream ms = new MemoryStream();
                    ms.Write(fileData, 0, fileData.Length);
                    ms.Position = 0;
            #if SILVERLIGHT
                    GetWizardConfigurationInfo(ReadFileBytes(ms));
            #else
                    GetWizardConfigurationInfo(ms);
            #endif
                }
                else
                {
            #if SILVERLIGHT
                    GetWizardConfigurationInfo(ReadFileBytes(m_configFileData));
            #else
                    GetWizardConfigurationInfo(m_configFileData);
                    m_configFileData.Close();
            #endif
                }
            }
        }
Esempio n. 7
0
 void GetNodes()
 {
     m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
     m_activityWindow.Show();
     m_client.GetNodeListAsync(false);
 }
 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";
 }
 void OutputStreamMeasurements_Loaded(object sender, RoutedEventArgs e)
 {
     m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
     #if !SILVERLIGHT
     m_activityWindow.Owner = Window.GetWindow(this);
     m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     #endif
     m_activityWindow.Show();
     GetOutputStreamMeasurementList();
 }
Esempio n. 10
0
 void Browse_Loaded(object sender, RoutedEventArgs e)
 {
     m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
     m_activityWindow.Show();
 }
Esempio n. 11
0
        void Measurements_Loaded(object sender, RoutedEventArgs e)
        {
            if (((App)Application.Current).Principal.IsInRole("Administrator, Editor"))
                ButtonSave.IsEnabled = true;
            else
                ButtonSave.IsEnabled = false;

            m_measurementList = new List<Measurement>();
            App app = (App)Application.Current;
            m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
            m_activityWindow.Owner = Window.GetWindow(this);
            m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            m_activityWindow.Show();
            GetSignalTypes();
            GetHistorians();
            GetDevices();
            ClearForm();
            if (m_deviceID > 0)
            {
                GetMeasurementsByDevice();
                GetDeviceByDeviceID();
            }
            else
            {
                GetMeasurementList();
            }
        }
 void AddNew_Loaded(object sender, RoutedEventArgs e)
 {
     #if !SILVERLIGHT
     GetDevices(DeviceType.Concentrator, ((App)Application.Current).NodeValue, true);
     GetCompanies();
     GetNodes();
     GetHistorians();
     GetInterconnections();
     GetVendorDevices();
     GetProtocols();
     GetTimeZones();
     #endif
     if (hasQueryString || m_deviceID > 0)
     {
         m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
     #if SILVERLIGHT
         m_activityWindow.Show();
     #else
         m_activityWindow.Owner = Window.GetWindow(this);
         m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
         m_activityWindow.Show();
         ButtonInitialize.Visibility = System.Windows.Visibility.Visible;
     #endif
         m_inEditMode = true;
         GetDeviceByDeviceID(m_deviceID);
     }
     else if (m_deviceToCopy == null)
         ClearForm();
     else
     {
         PopulateFormFields(m_deviceToCopy);
         //TextBoxAcronym.Focus();
         TextBoxAcronym.SelectAll();
     }
 }
        void InputStatusUserControl_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();

            GetMinMaxPointIDs();
            string statisticServiceUrl = ((App)Application.Current).RealTimeStatisticServiceUrl;
            if (!string.IsNullOrEmpty(statisticServiceUrl))
                m_urlForStatistics = statisticServiceUrl + "/timeseriesdata/read/current/" + m_minMaxPointIDs.Key.ToString() + "-" + m_minMaxPointIDs.Value.ToString() + "/XML";

            InitializeColors();
            GetDeviceMeasurementData();
            m_deviceIDsWithStatusPointIDs = CommonFunctions.GetDeviceIDsWithStatusPointIDs(null, ((App)Application.Current).NodeValue);
            GetTimeTaggedMeasurementsForStatus(m_urlForStatistics);
            InitializeChart();
        }
 void HomePage_Loaded(object sender, RoutedEventArgs e)
 {
     m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
     #if !SILVERLIGHT
     ((MasterLayoutWindow)Window.GetWindow(this)).UserControlSelectNode.ComboboxNode.SelectionChanged += new SelectionChangedEventHandler(ComboboxNode_SelectionChanged);
     m_activityWindow.Owner = Window.GetWindow(this);
     m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     #endif
     m_activityWindow.Show();
     GetDevices();
     #if !SILVERLIGHT
     GetInterconnectionStatus();
     GetDeviceDistributionList();
     //GetTimeSeriesData(((App)Application.Current).TimeSeriesDataServiceUrl + "/timeseriesdata/read/historic/" + ((Measurement)ComboBoxMeasurements.SelectedItem).PointID.ToString() + "/*-30S/*/XML");
     WindowsServiceClient serviceClient = ((App)Application.Current).ServiceClient;
     if (serviceClient == null || serviceClient.Helper.RemotingClient.CurrentState != TVA.Communication.ClientState.Connected || !((App)Application.Current).Principal.IsInRole("Administrator"))
         ButtonRestartOpenPDC.IsEnabled = false;
     #endif
     //if (!string.IsNullOrEmpty(((App)Application.Current).NodeValue))
     //m_client.GetDevicesAsync(DeviceType.NonConcentrator, ((App)Application.Current).NodeValue, false);
     //else
     //{
     //    ReconnectToService();
     //    if (m_activityWindow != null)
     //        m_activityWindow.Close();
     //}
 }
Esempio n. 15
0
 void SelectMeasurement_Loaded(object sender, RoutedEventArgs e)
 {
     m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
     m_activityWindow.Show();
     m_measurementList = new ObservableCollection<Measurement>();
     m_measurementsToBeAdded = new Dictionary<string, string[]>();
     App app = (App)Application.Current;
     m_client.GetMeasurementsForOutputStreamAsync(app.NodeValue, m_sourceOutputStreamID);
 }
 void RealTimeStatistics_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();
     GetStatisticsMeasurementData();
     GetMinMaxPointIDs();
     App app = (App)Application.Current;
     if (string.IsNullOrEmpty(app.RealTimeStatisticServiceUrl))
         m_url = string.Empty;
     else
         m_url = app.RealTimeStatisticServiceUrl + "/timeseriesdata/read/current/" + m_minMaxPointIDs.Key.ToString() + "-" + m_minMaxPointIDs.Value.ToString() + "/XML";
     GetTimeTaggedMeasurements(m_url);
 }
Esempio n. 17
0
        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            m_measurementList = new ObservableCollection<Measurement>();
            App app = (App)Application.Current;
            m_activityWindow = new ActivityWindow("Loading Data... Please Wait...");
            m_activityWindow.Show();
            m_client.GetHistoriansAsync(true, true, true);
            m_client.GetDevicesAsync(DeviceType.NonConcentrator, app.NodeValue, true);
            m_client.GetSignalTypesAsync(false);

            ClearForm();
            if (this.NavigationContext.QueryString.ContainsKey("did"))
            {
                m_deviceID = Convert.ToInt32(this.NavigationContext.QueryString["did"]);
                m_client.GetMeasurementsByDeviceAsync(m_deviceID);
                m_client.GetDeviceByDeviceIDAsync(m_deviceID);
            }
            else
            {
                m_client.GetMeasurementListAsync(app.NodeValue);
            }
        }
 void Browse_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();
     RefreshDeviceList();
 }