Пример #1
0
        void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            string deviceId = ((Button)sender).Tag.ToString();

#if SILVERLIGHT
            System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("/Default.aspx#/Pages/Devices/AddNew.xaml?did=" + deviceId, UriKind.Relative));
#else
            ManageDevicesUserControl manageDevicesUserControl = new ManageDevicesUserControl();
            manageDevicesUserControl.m_deviceID = Convert.ToInt32(deviceId);
            ((MasterLayoutWindow)Window.GetWindow(this)).ContentFrame.Navigate(manageDevicesUserControl);
#endif
        }
Пример #2
0
        void ButtonView_Click(object sender, RoutedEventArgs e)
        {
            if (((KeyValuePair <int, string>)ComboboxParent.SelectedItem).Key != 0)
            {
#if SILVERLIGHT
                System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("/Default.aspx#/Pages/Devices/AddNew.xaml?did=" + ((KeyValuePair <int, string>)ComboboxParent.SelectedItem).Key.ToString(), UriKind.Relative));
#else
                ManageDevicesUserControl manageDevicesUserControl = new ManageDevicesUserControl();
                manageDevicesUserControl.m_deviceID = Convert.ToInt32(((KeyValuePair <int, string>)ComboboxParent.SelectedItem).Key);
                ((MasterLayoutWindow)Window.GetWindow(this)).ContentFrame.Navigate(manageDevicesUserControl);
#endif
            }
        }
Пример #3
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = (MenuItem)e.OriginalSource;
            //if no node is defined then force user to add node.
            if (UserControlSelectNode.ComboboxNode.Items.Count == 0)
            {
                NodesUserControl nodesUserControl = new NodesUserControl();
                ContentFrame.Navigate(nodesUserControl);
            }
            else if (item.Name == "CustomInputs")
            {
                AdapterUserControl adapter = new AdapterUserControl();
                adapter.TypeOfAdapter = AdapterType.Input;
                ContentFrame.Navigate(adapter);
            }
            else if (item.Name == "CustomActions")
            {
                AdapterUserControl adapter = new AdapterUserControl();
                adapter.TypeOfAdapter = AdapterType.Action;
                ContentFrame.Navigate(adapter);
            }
            else if (item.Name == "CustomOutputs")
            {
                AdapterUserControl adapter = new AdapterUserControl();
                adapter.TypeOfAdapter = AdapterType.Output;
                ContentFrame.Navigate(adapter);
            }
            else if (item.Name == "CalculatedMeasurements")
            {
                CalculatedMeasurementsUserControl calculatedMeasurementsUserControl = new CalculatedMeasurementsUserControl();
                ContentFrame.Navigate(calculatedMeasurementsUserControl);
            }
            else if (item.Name == "Historians")
            {
                HistoriansUserControl historiansUserControl = new HistoriansUserControl();
                ContentFrame.Navigate(historiansUserControl);
            }
            else if (item.Name == "Nodes")
            {
                NodesUserControl nodesUserControl = new NodesUserControl();
                ContentFrame.Navigate(nodesUserControl);
            }
            else if (item.Name == "Companies")
            {
                CompaniesUserControl companiesUserControl = new CompaniesUserControl();
                ContentFrame.Navigate(companiesUserControl);
            }
            else if (item.Name == "Vendors")
            {
                VendorUserControl vendorUserControl = new VendorUserControl();
                ContentFrame.Navigate(vendorUserControl);
            }
            else if (item.Name == "VendorDevices")
            {
                VendorDevicesUserControl vendorDevicesUserControl = new VendorDevicesUserControl();
                ContentFrame.Navigate(vendorDevicesUserControl);
            }
            else if (item.Name == "AddOtherDevice")
            {
                ManageOtherDevicesUserControl manageOtherDeviceUserControl = new ManageOtherDevicesUserControl();
                ContentFrame.Navigate(manageOtherDeviceUserControl);
            }
            else if (item.Name == "OtherDevices")
            {
                OtherDevicesUserControl otherDevicesUserControl = new OtherDevicesUserControl();
                ContentFrame.Navigate(otherDevicesUserControl);
            }
            else if (item.Name == "AddNew")
            {
                ManageDevicesUserControl manageDevicesUserControl = new ManageDevicesUserControl();
                ContentFrame.Navigate(manageDevicesUserControl);
            }
            else if (item.Name == "BrowseDevices")
            {
                BrowseDevicesUserControl browse = new openPDCManager.Pages.Devices.BrowseDevicesUserControl();
                ContentFrame.Navigate(browse);
            }
            else if (item.Name == "Measurements")
            {
                Measurements measurements = new Measurements(0);
                ContentFrame.Navigate(measurements);
            }
            else if (item.Name == "Home")
            {
                HomePageUserControl home = new HomePageUserControl();
                ContentFrame.Navigate(home);
            }
            else if (item.Name == "IaonTree")
            {
                IaonTreeUserControl iaonTree = new IaonTreeUserControl();
                ContentFrame.Navigate(iaonTree);
            }
            else if (item.Name == "RealTimeMeasurements")
            {
                DeviceMeasurementsUserControl deviceMeasurements = new DeviceMeasurementsUserControl();
                ContentFrame.Navigate(deviceMeasurements);
            }
            else if (item.Name == "RealTimeStatistics")
            {
                RealTimeStatisticsUserControl realTimeStatistics = new RealTimeStatisticsUserControl();
                ContentFrame.Navigate(realTimeStatistics);
            }
            else if (item.Name == "RemoteConsole")
            {
                MonitorUserControl monitorControl = new MonitorUserControl();
                ContentFrame.Navigate(monitorControl);
            }
            else if (item.Name == "OutputStreams")
            {
                OutputStreamsUserControl outputStreams = new OutputStreamsUserControl();
                ContentFrame.Navigate(outputStreams);
            }
            else if (item.Name == "InputMonitor")
            {
                //SubscriptionTest inputMonitor = new SubscriptionTest();
                InputStatusUserControl inputMonitor = new InputStatusUserControl();

                //InputMonitoringUserControl inputMonitor = new InputMonitoringUserControl();
                ContentFrame.Navigate(inputMonitor);
            }
            else if (item.Name == "ConfigurationWizard")
            {
                InputWizardUserControl wizardControl = new InputWizardUserControl();
                ContentFrame.Navigate(wizardControl);
            }
            else if (item.Name == "Settings")
            {
                SystemSettings systemSettings = new SystemSettings();
                ContentFrame.Navigate(systemSettings);
            }
            else if (item.Name == "Security")
            {
                ApplicationSecurity security = new ApplicationSecurity();
                ContentFrame.Navigate(security);
            }
            else if (item.Name == "Help")
            {
                try
                {
                    // Check for internet connectivity.
                    Dns.GetHostEntry("openpdc.codeplex.com");

                    // Launch the help page available on web.
                    Process.Start("http://openpdc.codeplex.com/wikipage?title=Manager%20Configuration");
                }
                catch
                {
                    // Launch the offline copy of the help page.
                    Process.Start("openPDCManagerHelp.mht");
                }
            }
        }
 void HyperlinkButton_Click(object sender, RoutedEventArgs e)
 {
     string deviceId = ((Button)sender).Tag.ToString();
     #if SILVERLIGHT
     System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("/Default.aspx#/Pages/Devices/AddNew.xaml?did=" + deviceId, UriKind.Relative));
     #else
     ManageDevicesUserControl manageDevicesUserControl = new ManageDevicesUserControl();
     manageDevicesUserControl.m_deviceID = Convert.ToInt32(deviceId);
     ((MasterLayoutWindow)Window.GetWindow(this)).ContentFrame.Navigate(manageDevicesUserControl);
     #endif
 }
 void ButtonView_Click(object sender, RoutedEventArgs e)
 {
     if (((KeyValuePair<int, string>)ComboboxParent.SelectedItem).Key != 0)
     {
     #if SILVERLIGHT
         System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("/Default.aspx#/Pages/Devices/AddNew.xaml?did=" +  ((KeyValuePair<int, string>)ComboboxParent.SelectedItem).Key.ToString(), UriKind.Relative));
     #else
         ManageDevicesUserControl manageDevicesUserControl = new ManageDevicesUserControl();
         manageDevicesUserControl.m_deviceID = Convert.ToInt32(((KeyValuePair<int, string>)ComboboxParent.SelectedItem).Key);
         ((MasterLayoutWindow)Window.GetWindow(this)).ContentFrame.Navigate(manageDevicesUserControl);
     #endif
     }
 }
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (((Button)sender).Tag != null)
                {
                    int deviceId = Convert.ToInt32(((Button)sender).Tag);
                    if (deviceId > 0)
                    {
                        ManageDevicesUserControl manageDevicesUserControl = new ManageDevicesUserControl();
                        manageDevicesUserControl.m_deviceID = deviceId;
                        ((MasterLayoutWindow)Window.GetWindow(this)).ContentFrame.Navigate(manageDevicesUserControl);
                    }
                    else
                    {
                        SystemMessages sm = new SystemMessages(new openPDCManager.Utilities.Message()
                        {
                            UserMessage = "Invalid or Dummy Device Selected", SystemMessage = string.Empty, UserMessageType = openPDCManager.Utilities.MessageType.Information
                        },
                            ButtonType.OkOnly);
                        sm.Owner = Window.GetWindow(this);
                        sm.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                        sm.ShowPopup();
                    }
                }
                else
                {
                    SystemMessages sm = new SystemMessages(new openPDCManager.Utilities.Message()
                    {
                        UserMessage = "Invalid or Dummy Device Selected", SystemMessage = string.Empty, UserMessageType = openPDCManager.Utilities.MessageType.Information
                    },
                            ButtonType.OkOnly);
                    sm.Owner = Window.GetWindow(this);
                    sm.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                    sm.ShowPopup();
                }
            }
            catch (Exception)
            {

                //stem.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
        void ButtonCopy_Click(object sender, RoutedEventArgs e)
        {
            SystemMessages sm;
            try
            {
                Device device = new Device();
                device = ((Button)sender).DataContext as Device;
                sm = new SystemMessages(new Message()
                {
                    UserMessage = "Do you want to make a copy of " + device.Acronym + " device?", SystemMessage = "This will copy device configuration and generate new measurements.", UserMessageType = MessageType.Confirmation
                }, ButtonType.YesNo);
                sm.Closed += new EventHandler(delegate(object popupWindow, EventArgs eargs)
                {
                    if ((bool)sm.DialogResult)
                    {
                        try
                        {
                            string originalAcronym = device.Acronym;
                            int i = 1;
                            do
                            {
                                if (originalAcronym.Length > 15 && i < 10)
                                    device.Acronym = originalAcronym.Substring(0, 14) + i.ToString();
                                else if (originalAcronym.Length > 15 && i >= 10)
                                    device.Acronym = originalAcronym.Substring(0, 13) + i.ToString();
                                else
                                    device.Acronym = originalAcronym + i.ToString();

                                i++;
                            } while (CommonFunctions.GetDeviceByAcronym(null, device.Acronym) != null);

                            device.Name = "Copy of " + device.Name;
                            device.Enabled = false;
                            ManageDevicesUserControl manageDevice = new ManageDevicesUserControl(device);
                            ((MasterLayoutWindow)Window.GetWindow(this)).ContentFrame.Navigate(manageDevice);
                        }
                        catch (Exception ex)
                        {
                            SystemMessages sm1 = new SystemMessages(new Message()
                            {
                                UserMessage = "Failed to Create Copy of Device", SystemMessage = ex.Message, UserMessageType = MessageType.Error
                            },
                                ButtonType.OkOnly);
                            sm1.Owner = Window.GetWindow(this);
                            sm1.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                            sm1.ShowPopup();
                            CommonFunctions.LogException(null, "ButtonCopy_Click", ex);
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                CommonFunctions.LogException(null, "WPF.CopyDevice", ex);
                sm = new SystemMessages(new Message()
                {
                    UserMessage = "Failed to Create Copy of Device", SystemMessage = ex.Message, UserMessageType = MessageType.Error
                },
                        ButtonType.OkOnly);
            }
            sm.Owner = Window.GetWindow(this);
            sm.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            sm.ShowPopup();
        }
        void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            Device device = ((Button)sender).DataContext as Device;

            ManageDevicesUserControl manageDevicesUserControl = new ManageDevicesUserControl();
            manageDevicesUserControl.m_deviceID = device.ID;
            manageDevicesUserControl.m_oldAcronym = device.Acronym;
            ((MasterLayoutWindow)Window.GetWindow(this)).ContentFrame.Navigate(manageDevicesUserControl);
        }