示例#1
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            CMSettings  cmSettings;
            CRMSettings crmSettings;

            cmSettings = new CMSettings()
            {
                UserName = CMUserName.Text,
                Password = CMPassword.Password,
                ApiKey   = CMApiKey.Text
            };

            bool protocilSsh;

            if (CRMProtocol.SelectedIndex == 0)
            {
                protocilSsh = false;
            }
            else
            {
                protocilSsh = true;
            }

            crmSettings = new CRMSettings()
            {
                UserName    = CRMUserName.Text,
                Password    = CRMPassword.Password,
                Domain      = CRMDomain.Text,
                Url         = CRMUrl.Text,
                ProtocolSSH = protocilSsh
            };

            ConnectionSettingsManager.SetCMSettings(cmSettings);
            ConnectionSettingsManager.SetCRMSettings(crmSettings);



            //RegistryKey rk = Registry.CurrentUser.OpenSubKey("Software", true);
            //rk.OpenSubKey("CM_CRM_Sync");
            //rk.SetValue("CMUserName", CMUserName.Text);
            //rk.SetValue("CMPassword", CMPassword.Password);
            //rk.SetValue("CMApiKey", CMApiKey.Text);
            //rk.SetValue("CRMUserName", CRMUserName.Text);
            //rk.SetValue("CRMPassword", CRMPassword.Password);
            //rk.SetValue("CRMDomain", CRMDomain.Text);
            //rk.SetValue("CRMUrl", CRMUrl.Text);
            //if (CRMProtocol.SelectedIndex == 0)
            //    rk.SetValue("CRMProtocol", "HTTP");
            //else
            //    rk.SetValue("CRMProtocol", "HTTPS");

            MessageBox.Show("Settings saved successfully");
            SettingsWindow.Close();
        }
示例#2
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            CMSettings  cmSettings;
            CRMSettings crmSettings;

            cmSettings = new CMSettings()
            {
                UserName = CMUserName.Text,
                Password = CMPassword.Password,
                ApiKey   = CMApiKey.Text
            };

            bool protocilSsh;

            if (CRMProtocol.SelectedIndex == 0)
            {
                protocilSsh = false;
            }
            else
            {
                protocilSsh = true;
            }

            crmSettings = new CRMSettings()
            {
                UserName    = CRMUserName.Text,
                Password    = CRMPassword.Password,
                Domain      = CRMDomain.Text,
                Url         = CRMUrl.Text,
                ProtocolSSH = protocilSsh
            };

            ConnectionSettingsManager.SetCMSettings(cmSettings);
            ConnectionSettingsManager.SetCRMSettings(crmSettings);
            ServiceSettingsManager.SetRefreshRate(RefreshRate.Text);

            MessageBox.Show("Settings saved successfully");
            this.Close();
        }