コード例 #1
0
ファイル: default.aspx.cs プロジェクト: membersuite/portal
    private void prepareWidget(Search sMain, List <Search> searchesToRun, HomePageUserControl hpControl)
    {
        foreach (var outputColumn in hpControl.GetFieldsNeededForMainSearch())
        {
            if (!sMain.OutputColumns.Exists(x => x.Name == outputColumn))
            {
                sMain.AddOutputColumn(outputColumn);
            }
        }

        hpControl.GenerateSearchesToBeRun(searchesToRun);
    }
コード例 #2
0
        private void RemotingClient_ConnectionEstablished(object sender, EventArgs e)
        {
            EllipseConnectionState.Dispatcher.BeginInvoke((Action) delegate()
            {
                EllipseConnectionState.Fill = Application.Current.Resources["GreenRadialGradientBrush"] as RadialGradientBrush;
                ToolTipService.SetToolTip(EllipseConnectionState, "Connected to openPDC Service");

                if (ContentFrame.Content.GetType() == typeof(OutputStreamsUserControl))
                {
                    OutputStreamsUserControl outputStreamUserControl    = (OutputStreamsUserControl)ContentFrame.Content;
                    outputStreamUserControl.ButtonInitialize.IsEnabled  = true;
                    outputStreamUserControl.ButtonInitialize.Foreground = new SolidColorBrush(Color.FromArgb(255, 9, 81, 136));
                }
                else if (ContentFrame.Content.GetType() == typeof(HistoriansUserControl))
                {
                    HistoriansUserControl historianUserControl       = (HistoriansUserControl)ContentFrame.Content;
                    historianUserControl.ButtonInitialize.IsEnabled  = true;
                    historianUserControl.ButtonInitialize.Foreground = new SolidColorBrush(Color.FromArgb(255, 9, 81, 136));
                }
                else if (ContentFrame.Content.GetType() == typeof(CalculatedMeasurementsUserControl))
                {
                    CalculatedMeasurementsUserControl calculatedMeasurementsUserControl = (CalculatedMeasurementsUserControl)ContentFrame.Content;
                    calculatedMeasurementsUserControl.ButtonInitialize.IsEnabled        = true;
                    calculatedMeasurementsUserControl.ButtonInitialize.Foreground       = new SolidColorBrush(Color.FromArgb(255, 9, 81, 136));
                }
                else if (ContentFrame.Content.GetType() == typeof(ManageDevicesUserControl))
                {
                    ManageDevicesUserControl manageDevicesUserControl    = (ManageDevicesUserControl)ContentFrame.Content;
                    manageDevicesUserControl.ButtonInitialize.IsEnabled  = true;
                    manageDevicesUserControl.ButtonInitialize.Foreground = new SolidColorBrush(Color.FromArgb(255, 9, 81, 136));
                }
                else if (ContentFrame.Content.GetType() == typeof(AdapterUserControl))
                {
                    AdapterUserControl adapterUserControl          = (AdapterUserControl)ContentFrame.Content;
                    adapterUserControl.ButtonInitialize.IsEnabled  = true;
                    adapterUserControl.ButtonInitialize.Foreground = new SolidColorBrush(Color.FromArgb(255, 9, 81, 136));
                }
                else if (ContentFrame.Content.GetType() == typeof(MonitorUserControl))
                {
                    MonitorUserControl monitorUserControl = (MonitorUserControl)ContentFrame.Content;
                    monitorUserControl.ReconnectToService();
                }
                else if (ContentFrame.Content.GetType() == typeof(HomePageUserControl))
                {
                    HomePageUserControl homePageUserControl = (HomePageUserControl)ContentFrame.Content;
                    //Eventhough connection has been established, check if user is administrator, then only enable it.
                    if (((App)Application.Current).Principal.IsInRole("Administrator"))
                    {
                        homePageUserControl.ButtonRestartOpenPDC.IsEnabled = true;
                    }
                }
            });
        }
コード例 #3
0
        private void ComboboxNode_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (UserControlSelectNode.ComboboxNode.SelectedItem != null)
            {
                TextBlockNode.Text = ((Node)UserControlSelectNode.ComboboxNode.SelectedItem).Name;
            }

            HomePageUserControl home = new HomePageUserControl();

            ContentFrame.Navigate(home);

            if (m_serviceClient == null || m_serviceClient.Helper.RemotingClient.ConnectionString != ((App)Application.Current).RemoteStatusServiceUrl || m_serviceClient.Helper.RemotingClient.CurrentState == TVA.Communication.ClientState.Disconnected)
            {
                ConnectToService();
            }
        }
コード例 #4
0
        private void RemotingClient_ConnectionTerminated(object sender, EventArgs e)
        {
            if (!m_applicationClosing)
            {
                EllipseConnectionState.Dispatcher.BeginInvoke((Action) delegate()
                {
                    EllipseConnectionState.Fill = Application.Current.Resources["RedRadialGradientBrush"] as RadialGradientBrush;
                    ToolTipService.SetToolTip(EllipseConnectionState, "Disconnected from openPDC Service");

                    if (ContentFrame.Content.GetType() == typeof(OutputStreamsUserControl))
                    {
                        OutputStreamsUserControl osuc    = (OutputStreamsUserControl)ContentFrame.Content;
                        osuc.ButtonInitialize.IsEnabled  = false;
                        osuc.ButtonInitialize.Foreground = new SolidColorBrush(Color.FromArgb(255, 100, 100, 100));
                    }
                    else if (ContentFrame.Content.GetType() == typeof(HistoriansUserControl))
                    {
                        HistoriansUserControl historianUserControl       = (HistoriansUserControl)ContentFrame.Content;
                        historianUserControl.ButtonInitialize.IsEnabled  = false;
                        historianUserControl.ButtonInitialize.Foreground = new SolidColorBrush(Color.FromArgb(255, 100, 100, 100));
                    }
                    else if (ContentFrame.Content.GetType() == typeof(CalculatedMeasurementsUserControl))
                    {
                        CalculatedMeasurementsUserControl calculatedMeasurementsUserControl = (CalculatedMeasurementsUserControl)ContentFrame.Content;
                        calculatedMeasurementsUserControl.ButtonInitialize.IsEnabled        = false;
                        calculatedMeasurementsUserControl.ButtonInitialize.Foreground       = new SolidColorBrush(Color.FromArgb(255, 100, 100, 100));
                    }
                    else if (ContentFrame.Content.GetType() == typeof(ManageDevicesUserControl))
                    {
                        ManageDevicesUserControl manageDevicesUserControl    = (ManageDevicesUserControl)ContentFrame.Content;
                        manageDevicesUserControl.ButtonInitialize.IsEnabled  = false;
                        manageDevicesUserControl.ButtonInitialize.Foreground = new SolidColorBrush(Color.FromArgb(255, 100, 100, 100));
                    }
                    else if (ContentFrame.Content.GetType() == typeof(AdapterUserControl))
                    {
                        AdapterUserControl adapterUserControl          = (AdapterUserControl)ContentFrame.Content;
                        adapterUserControl.ButtonInitialize.IsEnabled  = false;
                        adapterUserControl.ButtonInitialize.Foreground = new SolidColorBrush(Color.FromArgb(255, 100, 100, 100));
                    }
                    else if (ContentFrame.Content.GetType() == typeof(HomePageUserControl))
                    {
                        HomePageUserControl homePageUserControl            = (HomePageUserControl)ContentFrame.Content;
                        homePageUserControl.ButtonRestartOpenPDC.IsEnabled = false;
                    }
                });
            }
        }
コード例 #5
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            ((App)Application.Current).Principal = Thread.CurrentPrincipal;

            if (((App)Application.Current).Principal.IsInRole("Administrator"))
            {
                Nodes.Visibility = Security.Visibility = Visibility.Visible;
            }
            else
            {
                Nodes.Visibility = Security.Visibility = Visibility.Collapsed;
            }

            if (((App)Application.Current).Principal.IsInRole("Administrator, Editor"))
            {
                ConfigurationWizard.Visibility = Visibility.Visible;
                AddNew.Visibility         = Visibility.Visible;
                AddOtherDevice.Visibility = Visibility.Visible;
            }
            else
            {
                ConfigurationWizard.Visibility = Visibility.Collapsed;
                AddNew.Visibility         = Visibility.Collapsed;
                AddOtherDevice.Visibility = Visibility.Collapsed;
            }

            IsolatedStorageManager.SetDefaultStorage(false);

            if (UserControlSelectNode.ComboboxNode.Items.Count > 0)
            {
                HomePageUserControl home = new HomePageUserControl();
                ContentFrame.Navigate(home);
            }
            else
            {
                NodesUserControl nodesUserControl = new NodesUserControl();
                ContentFrame.Navigate(nodesUserControl);
            }

            TextBlockCurrentUser.Text     = "Current User: " + SecurityProviderCache.CurrentProvider.UserData.LoginID;
            CommonFunctions.s_currentUser = SecurityProviderCache.CurrentProvider.UserData.LoginID;
        }
コード例 #6
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");
                }
            }
        }