Ejemplo n.º 1
0
        private void init()
        {
            // password box in main toolstrip
            var passwordTextBox = this.passwordTextBox.Control as TextBox;

            passwordTextBox.PasswordChar = '*';

            // set credentials, if available
            this.toolStripTextBoxServer.Text     = SettingsManagement.GetHostName();
            this.toolStripTextBoxCertificat.Text = SettingsManagement.GetClientCertificate();
        }
Ejemplo n.º 2
0
        public async void connect()
        {
            SettingsManagement.PersistConnectionData(
                this.toolStripTextBoxServer.Text,
                this.toolStripTextBoxCertificat.Text);

            var uri =
                new Uri(
                    string.Format(
                        "https://{0}:{1}/",
                        SettingsManagement.GetHostName(),
                        SettingsManagement.GetServicePort()));

            formatting = new FormattingServiceWrapper();

            try
            {
                // path to service certificate (located in program folder)
                var serverCertPath = @"C:\CERTIFICAT\Format.Service_server.cer";

                var svcConfig =
                    new FormattingServiceConfig(
                        uri,
                        serverCertPath,
                        SettingsManagement.GetClientCertificate());
                formatting.Initialize(svcConfig);

                // get version, for testing
                this.SwitchWaiting(true);
                string version = await formatting.GetVersionAsync();

                this.SwitchOnline(true, version);
                recupFormats();
            }
            catch (Exception ex)
            {
                this.HandleFailure(ex);
            }
            finally
            {
                this.SwitchWaiting(false);
            }
        }