コード例 #1
0
        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ConfiguredEndpoint ShowDialog(ApplicationConfiguration configuration, bool createNew)
        {
            m_configuration = configuration;
            m_endpoint      = null;

            // create a default collection if none provided.
            if (createNew)
            {
                ApplicationDescription server = new DiscoveredServerListDlg().ShowDialog(null, m_configuration);

                if (server != null)
                {
                    return(new ConfiguredEndpoint(server, EndpointConfiguration.Create(configuration)));
                }

                return(null);
            }

            ServersCTRL.Initialize(null, configuration);

            OkBTN.IsEnabled = false;

            Popup myPopup = new Popup();

            myPopup.Child  = this;
            myPopup.IsOpen = true;

            return(m_endpoint);
        }
コード例 #2
0
        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ServerOnNetwork ShowDialog(string hostname, ApplicationConfiguration configuration)
        {
            m_configuration = configuration;

            if (String.IsNullOrEmpty(hostname))
            {
                hostname = System.Net.Dns.GetHostName();
            }

            m_hostname = hostname;
            List <string> hostnames = new List <string>();

            HostNameCTRL.Initialize(hostname, hostnames);
            ServersCTRL.Initialize(m_hostname, this.StartingRecordUP, this.MaxRecordsUP, this.CapabilityFilterTB,
                                   m_configuration);

            OkBTN.Enabled = false;

            if (ShowDialog() != DialogResult.OK)
            {
                return(null);
            }

            return(m_server);
        }
コード例 #3
0
 public ComServerListDlg()
 {
     InitializeComponent();
     RegisteredServersRB.Checked = true;
     ServersCTRL.Initialize(CommonDefinitions.CATID_RegisteredDotNetOpcServers);
     m_currentDirectory = Application.StartupPath;
 }
コード例 #4
0
        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ConfiguredEndpoint ShowDialog(ApplicationConfiguration configuration, bool createNew)
        {
            m_configuration = configuration;
            m_endpoint      = null;

            // create a default collection if none provided.
            if (createNew)
            {
                ApplicationDescription server = new DiscoveredServerListDlg().ShowDialog(null, m_configuration);

                if (server != null)
                {
                    return(new ConfiguredEndpoint(server, EndpointConfiguration.Create(configuration)));
                }

                return(null);
            }

            ServersCTRL.Initialize(null, configuration);

            OkBTN.Enabled = false;

            if (ShowDialog() != DialogResult.OK)
            {
                return(null);
            }

            return(m_endpoint);
        }
コード例 #5
0
 private void View_RefreshMI_Click(object sender, EventArgs e) {
     try {
         ServersCTRL.Initialize(m_configuration);
     } catch (Exception exception) {
         GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
     }
 }
コード例 #6
0
        /// <summary>
        /// Displays the form.
        /// </summary>
        public void Show(ApplicationConfiguration configuration) {
            m_configuration = configuration;
            m_endpoint = null;

            ServersCTRL.Initialize(configuration);

            ButtonsPN.Visible = false;

            Show();
        }
コード例 #7
0
 private void HostNameCTRL_HostConnected(object sender, SelectHostCtrlEventArgs e)
 {
     try {
         m_hostname = e.Hostname;
         ServersCTRL.Initialize(m_hostname, m_configuration);
         m_server      = null;
         OkBTN.Enabled = false;
     } catch (Exception exception) {
         GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
     }
 }
コード例 #8
0
 private void WrappersRB_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (WrappersRB.Checked)
         {
             ServersCTRL.Initialize(CommonDefinitions.CATID_DotNetOpcServerWrappers);
         }
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
     }
 }
コード例 #9
0
 private void RegisteredServersRB_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (RegisteredServersRB.Checked)
         {
             ServersCTRL.Initialize(ConfigUtils.CATID_RegisteredDotNetOpcServers);
         }
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
     }
 }
 private void HostNameCTRL_HostConnected(object sender, SelectHostCtrlEventArgs e)
 {
     try
     {
         m_hostname = e.Hostname;
         ServersCTRL.Initialize(m_hostname, m_configuration);
         m_server        = null;
         OkBTN.IsEnabled = false;
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
     }
 }
コード例 #11
0
 private void HostNameCTRL_HostSelected(object sender, SelectHostCtrlEventArgs e)
 {
     try {
         if (m_hostname != e.Hostname)
         {
             m_hostname = e.Hostname;
             ServersCTRL.Initialize(m_hostname, this.StartingRecordUP, this.MaxRecordsUP,
                                    this.CapabilityFilterTB, m_configuration);
             m_server      = null;
             OkBTN.Enabled = false;
         }
     } catch (Exception exception) {
         GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
     }
 }
コード例 #12
0
        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ConfiguredEndpoint ShowDialog(ApplicationConfiguration configuration) {
            m_configuration = configuration;
            m_endpoint = null;

            ServersCTRL.Initialize(configuration);

            OkBTN.Enabled = false;
            ButtonsPN.Visible = true;

            if (ShowDialog() != DialogResult.OK) {
                return null;
            }

            return m_endpoint;
        }
コード例 #13
0
 public void ShowDialog(Guid CATID)
 {
     if (CATID == CommonDefinitions.CATID_DotNetOpcServers)
     {
         DotNetServersRB.Checked = true;
     }
     else if (CATID == CommonDefinitions.CATID_DotNetOpcServerWrappers)
     {
         WrappersRB.Checked = true;
     }
     else if (CATID == CommonDefinitions.CATID_RegisteredDotNetOpcServers)
     {
         RegisteredServersRB.Checked = true;
     }
     ServersCTRL.Initialize(CATID);
     base.ShowDialog();
 }
コード例 #14
0
 private void RegisterServerMI_Click(object sender, EventArgs e)
 {
     try
     {
         if (new RegisterServerDlg().ShowDialog(null) != null)
         {
             if (RegisteredServersRB.Checked)
             {
                 ServersCTRL.Initialize(ConfigUtils.CATID_RegisteredDotNetOpcServers);
             }
         }
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
     }
 }
コード例 #15
0
        public void ShowDialog(Guid catid)
        {
            if (catid == ConfigUtils.CATID_DotNetOpcServers)
            {
                DotNetServersRB.Checked = true;
            }

            else if (catid == ConfigUtils.CATID_DotNetOpcServerWrappers)
            {
                WrappersRB.Checked = true;
            }

            else if (catid == ConfigUtils.CATID_RegisteredDotNetOpcServers)
            {
                RegisteredServersRB.Checked = true;
            }

            ServersCTRL.Initialize(catid);
            base.ShowDialog();
        }
        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ApplicationDescription ShowDialog(string hostname, ApplicationConfiguration configuration)
        {
            m_configuration = configuration;

            if (String.IsNullOrEmpty(hostname))
            {
                hostname = Utils.GetHostName();
            }

            m_hostname = hostname;
            m_server   = null;

            List <string> hostnames = new List <string>();

            HostNameCTRL.Initialize(hostname, hostnames);
            ServersCTRL.Initialize(hostname, configuration);

            OkBTN.IsEnabled = false;

            return(m_server);
        }
コード例 #17
0
        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ApplicationDescription ShowDialog(string hostname, ApplicationConfiguration configuration)
        {
            m_configuration = configuration;

            if (String.IsNullOrEmpty(hostname))
            {
                hostname = System.Net.Dns.GetHostName();
            }

            m_hostname = hostname;
            List <string> hostnames = new List <string>();

            HostNameCTRL.Initialize(hostname, hostnames);
            ServersCTRL.Initialize(hostname, configuration);

            OkBTN.Enabled = false;

            if (ShowDialog() != DialogResult.OK)
            {
                return(null);
            }

            return(m_server);
        }
コード例 #18
0
        private void File_ImportMI_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_exportFile == null)
                {
                    m_exportFile = "ComServers.endpoints.xml";
                }

                FileInfo fileInfo = new FileInfo(Utils.GetAbsoluteFilePath(m_exportFile));

                OpenFileDialog dialog = new OpenFileDialog();

                dialog.CheckFileExists  = true;
                dialog.CheckPathExists  = true;
                dialog.DefaultExt       = ".xml";
                dialog.Filter           = "Configuration Files (*.xml)|*.xml|All Files (*.*)|*.*";
                dialog.Multiselect      = false;
                dialog.ValidateNames    = true;
                dialog.Title            = "Open Endpoint Configuration File";
                dialog.FileName         = fileInfo.Name;
                dialog.InitialDirectory = fileInfo.DirectoryName;

                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                m_exportFile = dialog.FileName;

                // load the endpoints from the file.
                ConfiguredEndpointCollection endpoints = ConfiguredEndpointCollection.Load(m_exportFile);

                // update the endpoint configuration.
                StringBuilder buffer = new StringBuilder();

                foreach (ConfiguredEndpoint endpoint in endpoints.Endpoints)
                {
                    if (endpoint.ComIdentity == null)
                    {
                        continue;
                    }

                    try
                    {
                        PseudoComServer.Save(endpoint);
                    }
                    catch (Exception exception)
                    {
                        if (buffer.Length > 0)
                        {
                            buffer.Append("\r\n");
                        }

                        buffer.AppendFormat(
                            "Error Registering COM pseudo-server '{0}': {1}",
                            endpoint.ComIdentity.ProgId,
                            exception.Message);
                    }
                }

                // display warning.
                if (buffer.Length > 0)
                {
                    MessageBox.Show(
                        buffer.ToString(),
                        "Endpoint Import Errors",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Warning);
                }

                ServersCTRL.Initialize(m_configuration);
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }