Exemple #1
0
        /// <summary>
        /// Creates a form which uses the specified client configuration.
        /// </summary>
        /// <param name="configuration">The configuration to use.</param>
        public MainForm(ApplicationConfiguration configuration)
        {
            InitializeComponent();
            var appSettings = System.Configuration.ConfigurationManager.AppSettings;

            Boolean.TryParse(appSettings["ColumnAutoAdjust"], out this.ColumnAutoAdjust);
            ServerURL = appSettings["ServerURL"];
            Int32.TryParse(appSettings["MaximumItems"], out MaximumItems);
            if (MaximumItems < MIN_ITEMS)
            {
                MaximumItems = MIN_ITEMS;
            }

            this.Icon = ClientUtils.GetAppIcon();

            ConnectServerCTRL.Configuration = m_configuration = configuration;
            if (ServerURL.Length > 0)
            {
                ConnectServerCTRL.ServerUrl = ServerURL;
            }
            else
            {
                ConnectServerCTRL.ServerUrl = "opc.tcp://localhost:62544/Quickstarts/AlarmConditionServer";
            }

            this.Text = m_configuration.ApplicationName;

            // a table used to track event types.
            m_eventTypeMappings = new Dictionary <NodeId, NodeId>();

            // the filter to use.
            m_filter = new FilterDefinition();

            m_filter.AreaId   = ObjectIds.Server;
            m_filter.Severity = EventSeverity.Min;
            m_filter.IgnoreSuppressedOrShelved = true;
            m_filter.EventTypes = new NodeId[] { ObjectTypeIds.ConditionType };

            // declare callback.
            m_MonitoredItem_Notification = new MonitoredItemNotificationEventHandler(MonitoredItem_Notification);

            // initialize controls.
            Conditions_Severity_AllMI.Checked = true;
            Conditions_Severity_AllMI.Tag     = EventSeverity.Min;
            Conditions_Severity_LowMI.Tag     = EventSeverity.Low;
            Conditions_Severity_MediumMI.Tag  = EventSeverity.Medium;
            Conditions_Severity_HighMI.Tag    = EventSeverity.High;

            Condition_Type_AllMI.Checked            = true;
            Condition_Type_DialogsMI.Checked        = false;
            Condition_Type_AlarmsMI.Checked         = false;
            Condition_Type_LimitAlarmsMI.Checked    = false;
            Condition_Type_DiscreteAlarmsMI.Checked = false;
        }
        public BrowseFiltersDlg()
        {
            // Required for Windows Form Designer support
            InitializeComponent();
            Icon = ClientUtils.GetAppIcon();

            browseFiltersLv_.SmallImageList = Resources.Instance.ImageList;

            browseFiltersLv_.Columns.Add("Attribute", -2, HorizontalAlignment.Left);
            browseFiltersLv_.Columns.Add("Operator", -2, HorizontalAlignment.Left);
            browseFiltersLv_.Columns.Add("Value", -2, HorizontalAlignment.Left);
        }
Exemple #3
0
        public BrowseOptionsDlg()
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            foreach (object value in Enum.GetValues(typeof(BrowseDirection)))
            {
                BrowseDirectionCB.Items.Add(value);
            }

            BrowseDirectionCB.SelectedIndex = 0;
        }
Exemple #4
0
        public ReadItemsDlg()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            Icon = ClientUtils.GetAppIcon();

            itemsCtrl_.IsReadItem = true;

            browseCtrl_.ItemPicked += new ItemPickedEventHandler(OnItemPicked);
        }
        /// <summary>
        /// Creates a form which uses the specified client configuration.
        /// </summary>
        /// <param name="configuration">The configuration to use.</param>
        public MainForm(ApplicationConfiguration configuration)
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            ConnectServerCTRL.Configuration = m_configuration = configuration;
            ConnectServerCTRL.ServerUrl     = "opc.tcp://localhost:62548/Quickstarts/DataAccessServer";
            this.Text = m_configuration.ApplicationName;

            // create the callback.
            m_monitoredItem_Notification = new MonitoredItemNotificationEventHandler(MonitoredItem_Notification);
        }
Exemple #6
0
        public ServerForm(StandardServer server, ApplicationConfiguration configuration)
        {
            InitializeComponent();
            this.Icon = this.TrayIcon.Icon = ClientUtils.GetAppIcon();

            GuiUtils.DisplayUaTcpImplementation(this, configuration);

            m_server = server;

            if (!configuration.SecurityConfiguration.AutoAcceptUntrustedCertificates)
            {
                m_server.CertificateValidator.CertificateValidation += new CertificateValidationEventHandler(CertificateValidator_CertificateValidation);
            }
        }
Exemple #7
0
        public SelectServerDlg()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            Icon = ClientUtils.GetAppIcon();

            specificationCb_.Items.Add(OpcSpecification.OPC_DA_20);
            specificationCb_.Items.Add(OpcSpecification.OPC_DA_30);
            specificationCb_.SelectedItem = null;

            serversCtrl_.ServerPicked += new ServerPickedEventHandler(OnServerPicked);
        }
Exemple #8
0
        public MainForm(ApplicationInstance application)
        {
            InitializeComponent();
            Icon = ClientUtils.GetAppIcon();

            m_application = application;

            // get the configuration.
            m_configuration = m_application.ApplicationConfiguration.ParseExtension <GlobalDiscoveryClientConfiguration>();

            // use suitable defaults if no configuration exists.
            if (m_configuration == null)
            {
                m_configuration = new GlobalDiscoveryClientConfiguration()
                {
                    GlobalDiscoveryServerUrl = "opc.tcp://localhost:58810/GlobalDiscoveryServer",
                    ExternalEditor           = "notepad.exe"
                };
            }

            m_filters                          = new QueryServersFilter();
            m_identity                         = new UserIdentity();
            m_gds                              = new GlobalDiscoveryServerClient(m_application, m_configuration.GlobalDiscoveryServerUrl);
            m_gds.KeepAlive                   += GdsServer_KeepAlive;
            m_gds.ServerStatusChanged         += GdsServer_StatusNotification;
            m_lds                              = new LocalDiscoveryServerClient(m_application.ApplicationConfiguration);
            m_server                           = new ServerPushConfigurationClient(m_application);
            m_server.AdminCredentialsRequired += Server_AdminCredentialsRequired;
            m_server.KeepAlive                += Server_KeepAlive;
            m_server.ServerStatusChanged      += Server_StatusNotification;
            m_server.ConnectionStatusChanged  += Server_ConnectionStatusChanged;

            RegistrationPanel.Initialize(m_gds, m_server, null, m_configuration);

            m_application.ApplicationConfiguration.CertificateValidator.CertificateValidation += CertificateValidator_CertificateValidation;
            UpdateStatus(true, DateTime.MinValue, "---");
            UpdateGdsStatus(true, DateTime.MinValue, "---");
            UpdateMainFormHeader();

            ShowPanel(Panel.None);


            SelectServerButton.Enabled     = false;
            ServerStatusButton.Enabled     = false;
            CertificateButton.Enabled      = false;
            HttpsCertificateButton.Visible = false;
            TrustListButton.Enabled        = false;
            HttpsTrustListButton.Visible   = false;
        }
        public SecuritySettingsDlg()
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            foreach (MessageSecurityMode value in Enum.GetValues(typeof(MessageSecurityMode)))
            {
                SecurityModeCB.Items.Add(value);
            }

            foreach (string value in SecurityPolicies.GetDisplayNames())
            {
                SecurityPolicyUriCB.Items.Add(value);
            }
        }
Exemple #10
0
        public SelectNodeDlg()
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            foreach (IdType idType in Enum.GetValues(typeof(IdType)))
            {
                IdentifierTypeCB.Items.Add(idType);
            }

            foreach (NodeClass nodeClass in Enum.GetValues(typeof(NodeClass)))
            {
                NodeClassCB.Items.Add(nodeClass);
            }
        }
        public ItemIDsViewDlg()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            Icon = ClientUtils.GetAppIcon();

            // add columns.
            AddHeader("Attribute");
            AddHeader("ItemID");
            AddHeader("URL");

            // adjust column widths.
            AdjustColumns();
        }
        public GetEnabledStateDlg()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            Icon = ClientUtils.GetAppIcon();

            AddHeader(ResultsLV, "Name", false);
            AddHeader(ResultsLV, "Enabled", true);
            AddHeader(ResultsLV, "Effectively Enabled", true);
            AddHeader(ResultsLV, "Result", false);

            AdjustColumns(ResultsLV);

            ResultsLV.SmallImageList = Resources.Instance.ImageList;
        }
        public MonitoredItemEditDlg()
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            AttributeIdCB.Items.AddRange(Attributes.GetBrowseNames());

            foreach (MonitoringMode value in Enum.GetValues(typeof(MonitoringMode)))
            {
                MonitoringModeCB.Items.Add(value);
            }

            foreach (NodeClass value in Enum.GetValues(typeof(NodeClass)))
            {
                NodeClassCB.Items.Add(value);
            }
        }
Exemple #14
0
        public FilterOperandEditDlg()
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            OperandTypeCB.Items.Clear();
            OperandTypeCB.Items.Add(typeof(LiteralOperand).Name);
            OperandTypeCB.Items.Add(typeof(AttributeOperand).Name);
            OperandTypeCB.Items.Add(typeof(ElementOperand).Name);

            foreach (BuiltInType datatype in Enum.GetValues(typeof(BuiltInType)))
            {
                DataTypeCB.Items.Add(datatype);
            }

            AttributeIdCB.Items.AddRange(Attributes.GetBrowseNames());
        }
Exemple #15
0
        public ClientForm(
            ServiceMessageContext context,
            ApplicationInstance application,
            ClientForm masterForm,
            ApplicationConfiguration configuration)
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            // Create the NotifyIcon.
            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);

            // The Icon property sets the icon that will appear
            // in the systray for this application.
            notifyIcon1.Icon = ClientUtils.GetAppIcon();

            // The Text property sets the text that will be displayed,
            // in a tooltip, when the mouse hovers over the systray icon.
            notifyIcon1.Text    = "OPCUA-MQTT Interface";
            notifyIcon1.Visible = true;

            // Handle the DoubleClick event to activate the form.
            notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);

            m_masterForm  = masterForm;
            m_context     = context;
            m_application = application;
            m_server      = application.Server as Opc.Ua.Server.StandardServer;

            if (m_masterForm == null)
            {
                m_forms = new List <ClientForm>();
            }

            SessionsCTRL.Configuration  = m_configuration = configuration;
            SessionsCTRL.MessageContext = context;

            // get list of cached endpoints.
            m_endpoints = m_configuration.LoadCachedEndpoints(true);
            m_endpoints.DiscoveryUrls = configuration.ClientConfiguration.WellKnownDiscoveryUrls;
            EndpointSelectorCTRL.Initialize(m_endpoints, m_configuration);

            // initialize control state.
            Disconnect();
        }
Exemple #16
0
        public ReadHistoryDlg()
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            ReadTypeCB.Items.Add(ReadType.Raw);
            ReadTypeCB.Items.Add(ReadType.Processed);
            ReadTypeCB.Items.Add(ReadType.Modified);
            ReadTypeCB.Items.Add(ReadType.AtTime);

            AggregateCB.Items.Add(BrowseNames.AggregateFunction_Interpolative);
            AggregateCB.Items.Add(BrowseNames.AggregateFunction_Average);
            AggregateCB.Items.Add(BrowseNames.AggregateFunction_TimeAverage);
            AggregateCB.Items.Add(BrowseNames.AggregateFunction_Count);
            AggregateCB.Items.Add(BrowseNames.AggregateFunction_Maximum);
            AggregateCB.Items.Add(BrowseNames.AggregateFunction_Minimum);
            AggregateCB.Items.Add(BrowseNames.AggregateFunction_Total);
        }
Exemple #17
0
        public ViewServersOnNetworkDialog(GlobalDiscoveryServer gds)
        {
            InitializeComponent();
            Icon = ClientUtils.GetAppIcon();
            ServersDataGridView.AutoGenerateColumns = false;

            m_gds = gds;

            m_dataset = new DataSet();
            m_dataset.Tables.Add("Servers");

            m_dataset.Tables[0].Columns.Add("RecordId", typeof(uint));
            m_dataset.Tables[0].Columns.Add("ServerName", typeof(string));
            m_dataset.Tables[0].Columns.Add("DiscoveryUrl", typeof(string));
            m_dataset.Tables[0].Columns.Add("ServerCapabilities", typeof(string));
            m_dataset.Tables[0].Columns.Add("ServerOnNetwork", typeof(ServerOnNetwork));

            ServersDataGridView.DataSource = m_dataset.Tables[0];
        }
Exemple #18
0
        /// <summary>
        /// Creates a form which displays the status for a UA server.
        /// </summary>
        public ServerForm(ApplicationInstance application)
        {
            InitializeComponent();

            m_application = application;

            if (application.Server is StandardServer)
            {
                this.ServerDiagnosticsCTRL.Initialize((StandardServer)application.Server, application.ApplicationConfiguration);
            }

            if (!application.ApplicationConfiguration.SecurityConfiguration.AutoAcceptUntrustedCertificates)
            {
                application.ApplicationConfiguration.CertificateValidator.CertificateValidation += new CertificateValidationEventHandler(CertificateValidator_CertificateValidation);
            }

            TrayIcon.Text = this.Text = application.ApplicationName;
            this.Icon     = TrayIcon.Icon = ClientUtils.GetAppIcon();
        }
        public DataChangeFilterEditDlg()
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            Array values = Enum.GetValues(typeof(DataChangeTrigger));

            foreach (object value in values)
            {
                TriggerCB.Items.Add(value);
            }

            values = Enum.GetValues(typeof(DeadbandType));

            foreach (object value in values)
            {
                DeadbandTypeCB.Items.Add(value);
            }
        }
Exemple #20
0
        public ViewApplicationRecordsDialog(GlobalDiscoveryServerClient gds)
        {
            InitializeComponent();
            Icon = ClientUtils.GetAppIcon();
            ApplicationRecordDataGridView.AutoGenerateColumns = false;

            m_gds = gds;

            m_dataset = new DataSet();
            m_dataset.Tables.Add("ApplicationRecords");

            m_dataset.Tables[0].Columns.Add("ApplicationId", typeof(NodeId));
            m_dataset.Tables[0].Columns.Add("ApplicationName", typeof(string));
            m_dataset.Tables[0].Columns.Add("ApplicationType", typeof(ApplicationType));
            m_dataset.Tables[0].Columns.Add("ProductUri", typeof(string));
            m_dataset.Tables[0].Columns.Add("DiscoveryUrls", typeof(string));
            m_dataset.Tables[0].Columns.Add("ServerCapabilities", typeof(string));
            m_dataset.Tables[0].Columns.Add("ApplicationRecord", typeof(ApplicationRecordDataType));

            ApplicationRecordDataGridView.DataSource = m_dataset.Tables[0];
        }
        public ItemValueEditDlg()
        {
            // Required for Windows Form Designer support
            InitializeComponent();
            Icon = ClientUtils.GetAppIcon();

            // populate quality drop down.
            QualityCB.Items.Clear();

            foreach (TsDaQualityBits quality in Enum.GetValues(typeof(TsDaQualityBits)))
            {
                QualityCB.Items.Add(quality);
            }

            // populate limit bits drop down.
            LimitBitsCB.Items.Clear();

            foreach (TsDaLimitBits limitBits in Enum.GetValues(typeof(TsDaLimitBits)))
            {
                LimitBitsCB.Items.Add(limitBits);
            }
        }
Exemple #22
0
 /// <summary>
 /// 允许自己输入服务器地址的实例化
 /// </summary>
 public FrmOpcView()
 {
     InitializeComponent();
     Icon = ClientUtils.GetAppIcon();
     BrowseNodesTV.Enabled   = false;
     BrowseNodesTV.ImageList = new ImageList();
     BrowseNodesTV.ImageList.Images.Add("Class_489", Properties.Resources.Class_489);
     BrowseNodesTV.ImageList.Images.Add("ClassIcon", Properties.Resources.ClassIcon);
     BrowseNodesTV.ImageList.Images.Add("brackets", Properties.Resources.brackets_Square_16xMD);
     BrowseNodesTV.ImageList.Images.Add("VirtualMachine", Properties.Resources.VirtualMachine);
     BrowseNodesTV.ImageList.Images.Add("Enum_582", Properties.Resources.Enum_582);
     BrowseNodesTV.ImageList.Images.Add("Method_636", Properties.Resources.Method_636);
     BrowseNodesTV.ImageList.Images.Add("Module_648", Properties.Resources.Module_648);
     BrowseNodesTV.ImageList.Images.Add("Loading", Properties.Resources.loading);
     // 判断是否允许更改
     if (!string.IsNullOrEmpty(textBox1.Text))
     {
         textBox1.ReadOnly = true;
     }
     // Opc Ua 服务的初始化
     OpcUaClientInitialization();
 }
Exemple #23
0
        public PublisherForm(
            ServiceMessageContext context,
            ApplicationInstance application,
            PublisherForm masterForm,
            ApplicationConfiguration configuration)
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            m_masterForm  = masterForm;
            m_context     = context;
            m_application = application;
            m_server      = application.Server as Opc.Ua.Server.StandardServer;

            if (m_masterForm == null)
            {
                m_forms = new List <PublisherForm>();
            }

            SessionsCTRL.Configuration  = m_configuration = configuration;
            SessionsCTRL.MessageContext = context;

            // get list of cached endpoints.
            m_endpoints = m_configuration.LoadCachedEndpoints(true);
            m_endpoints.DiscoveryUrls = configuration.ClientConfiguration.WellKnownDiscoveryUrls;
            EndpointSelectorCTRL.Initialize(m_endpoints, m_configuration);

            // initialize control state.
            Disconnect();

            m_publishers = AmqpConnectionCollection.Load(configuration);
            foreach (var publisher in m_publishers)
            {
                Task t = publisher.OpenAsync();
            }

            this.NotificationsCTRL.ItemsAdded += NotificationsCTRL_ItemsAdded;
        }
Exemple #24
0
        private MainForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            Icon = ClientUtils.GetAppIcon();

            // connect the updates control to the subscriptions control.
            subscriptionCtrl_.SubscriptionModified += new SubscriptionModifiedCallback(updatesCtrl_.OnSubscriptionModified);

            // register for trace/debug output from the updates control.
            updatesCtrl_.UpdateEvent += new UpdateEventEventHandler(OnUpdateEvent);

#if (DEBUG)
            // initialize the set of known servers.
            OpcUrl[] knownUrLs = new OpcUrl[]
            {
                new OpcUrl("opcda://localhost/Technosoftware.DaSample"),
            };
#else
            // initialize the set of known servers.
            OpcUrl[] knownURLs = new OpcUrl[]
            {
                new OpcUrl("opcda://localhost/Technosoftware.DaSample"),
            };
#endif

            selectServerCtrl_.Initialize(knownUrLs, 0, OpcSpecification.OPC_DA_20);

            LoadSettings();

            // register for server connected callbacks.
            selectServerCtrl_.ConnectServer += OnConnect;
            UpdateTitle();
            updateTimerControl_.Enabled = true;
        }
Exemple #25
0
        /// <summary>
        /// Creates a form which uses the specified client configuration.
        /// </summary>
        /// <param name="configuration">The configuration to use.</param>
        public MainForm(ApplicationConfiguration configuration)
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            ConnectServerCTRL.Configuration = m_configuration = configuration;
            ConnectServerCTRL.ServerUrl     = "opc.tcp://localhost:62565/Quickstarts/UserAuthenticationServer";
            this.Text = m_configuration.ApplicationName;

            UserNameTB.Text         = "Operator";
            PreferredLocalesTB.Text = "de,es,en";
            SetAvailableUserTokens(null);

            KerberosUserNameTB.Text = "Operator";
            KerberosPasswordTB.Text = "operator";
            KerberosDomainTB.Text   = "GEMS";

            UserNameTokenLB.Text =
                "UserName/Password tokens can be used with any password based system including Windows.\r\n" +
                "The main disadvantage is client must trust the server with its password.\r\n" +
                "Password must be encrypted when sent to the server.";

            AnonymousTokenLB.Text =
                "Anonymous tokens mean no user is associated with the session.\r\n" +
                "It is used by servers that do not require user authentication.\r\n" +
                "It can also be used to logout while keeping a session active.";

            CertificateTokenLB.Text =
                "Certificate tokens use a X509 certicate associated with a user.\r\n" +
                "These could come from a smart card and identify a user account.\r\n" +
                "Tokens must be signed when sent to the server.";

            KereberosTokenLB.Text =
                "Kereberos tokens allow use of Windows domain credentials without\r\n" +
                "requiring the client to explictly enter a password.\r\n" +
                "The token must be encrypted when sent to the server.";
        }
Exemple #26
0
        /// <summary>
        /// Creates a form which uses the specified client configuration.
        /// </summary>
        /// <param name="configuration">The configuration to use.</param>
        public MainForm(ApplicationConfiguration configuration)
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            ConnectServerCTRL.Configuration = m_configuration = configuration;
            ConnectServerCTRL.ServerUrl     = "opc.tcp://localhost:62544/Quickstarts/AlarmConditionServer";
            this.Text = m_configuration.ApplicationName;

            // a table used to track event types.
            m_eventTypeMappings = new Dictionary <NodeId, NodeId>();

            // the filter to use.
            m_filter = new FilterDefinition();

            m_filter.AreaId   = ObjectIds.Server;
            m_filter.Severity = EventSeverity.Min;
            m_filter.IgnoreSuppressedOrShelved = true;
            m_filter.EventTypes = new NodeId[] { ObjectTypeIds.ConditionType };

            // declate callback.
            m_MonitoredItem_Notification = new MonitoredItemNotificationEventHandler(MonitoredItem_Notification);

            // initialize controls.
            Conditions_Severity_AllMI.Checked = true;
            Conditions_Severity_AllMI.Tag     = EventSeverity.Min;
            Conditions_Severity_LowMI.Tag     = EventSeverity.Low;
            Conditions_Severity_MediumMI.Tag  = EventSeverity.Medium;
            Conditions_Severity_HighMI.Tag    = EventSeverity.High;

            Condition_Type_AllMI.Checked            = true;
            Condition_Type_DialogsMI.Checked        = false;
            Condition_Type_AlarmsMI.Checked         = false;
            Condition_Type_LimitAlarmsMI.Checked    = false;
            Condition_Type_DiscreteAlarmsMI.Checked = false;
        }
Exemple #27
0
 public ReadDlg()
 {
     InitializeComponent();
     this.Icon = ClientUtils.GetAppIcon();
 }
Exemple #28
0
 public BrowseDlg()
 {
     InitializeComponent();
     this.Icon        = ClientUtils.GetAppIcon();
     m_SessionClosing = new EventHandler(Session_Closing);
 }
Exemple #29
0
 public TrendSelectItemsDlg()
 {
     // Required for Windows Form Designer support
     InitializeComponent();
     Icon = ClientUtils.GetAppIcon();
 }
 /// <summary>
 /// Creates an empty form.
 /// </summary>
 private MainForm()
 {
     InitializeComponent();
     this.Icon = ClientUtils.GetAppIcon();
 }