Exemple #1
0
        private void ExecuteDeleteProfile(object o)
        {
            var result = MessageBox.Show("Do you want to delete connection profile '" + SelectedProfile.Name + "' ?"
                                         , "Question", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                MtRegistryManager.RemoveConnectionProfile(SelectedProfile.Name);
                ConnectionProfiles.Remove(SelectedProfile);
            }
        }
Exemple #2
0
        public void Initialize()
        {
            var profiles = MtRegistryManager.LoadConnectionProfiles();

            if (profiles != null)
            {
                foreach (var prof in profiles)
                {
                    ConnectionProfiles.Add(prof);
                }
            }
        }
Exemple #3
0
        private void ExecuteAddProfile(object o)
        {
            var dlg    = new AddProfileDialog(App.Current.MainWindow);
            var result = dlg.ShowDialog();

            if (result == true)
            {
                var profile = new MtConnectionProfile(dlg.ProfileName);
                profile.Host = dlg.Host;
                profile.Port = int.Parse(dlg.Port);

                MtRegistryManager.AddConnectionProfile(profile);
                ConnectionProfiles.Add(profile);
            }
        }
Exemple #4
0
        private void saveToRegBtn_Click(object sender, EventArgs e)
        {
            string signature     = textBoxSignature.Text;
            string accountName   = textBoxAccountName.Text;
            string accountNumber = textBoxAccountNumber.Text;

            if (string.IsNullOrEmpty(signature))
            {
                MessageBox.Show("Signature is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(accountName))
            {
                MessageBox.Show("AccountName is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(accountNumber))
            {
                MessageBox.Show("AccountNumber is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = "Registry files (*.reg)|*.reg";
            dlg.Title  = "Registry files";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string key = MtRegistryManager.SaveSignatureKey(accountName, accountNumber, signature);

                bool exported = MtRegistryManager.ExportKey(key, dlg.FileName);

                if (exported)
                {
                    MessageBox.Show("Export successed.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.None);
                }
                else
                {
                    MessageBox.Show("Export failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #5
0
        private void readRegBtn_Click(object sender, EventArgs e)
        {
            string accountName   = textBoxAccountName.Text;
            string accountNumber = textBoxAccountNumber.Text;

            if (string.IsNullOrEmpty(accountName))
            {
                MessageBox.Show("AccountName is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(accountNumber))
            {
                MessageBox.Show("AccountNumber is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string signature = MtRegistryManager.ReadSignatureKey(accountName, accountNumber);

            textBoxSignature.Text = signature;
        }