private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.mailComboBox.Text.Trim() != EmptyText)
            {
                ModelLoader.CurrentModel.MailAdresses.Add(this.mailComboBox.Text);

                ModelLoader.SaveModel();

                this.mailComboBox.Items.Add(this.mailComboBox.Text);
                this.mailComboBox.SelectedIndex = this.mailComboBox.Items.Count - 1;
            }
        }
        private void removeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.mailComboBox.SelectedItem != null && this.mailComboBox.Text != EmptyText)
            {
                ModelLoader.CurrentModel.MailAdresses.Remove(this.mailComboBox.SelectedItem.ToString());

                ModelLoader.SaveModel();

                this.mailComboBox.Items.Remove(this.mailComboBox.SelectedItem);

                this.mailComboBox.SelectedIndex = 0;
            }
        }
示例#3
0
        private void RemoveSelectedEntry()
        {
            Assert.IsTrue(this.EntrySelected);

            if (MessageBox.Show(string.Format("Are you sure to delete \"{0}\"?", this.SelectedEntry.Label), "Delete?", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                ModelLoader.CurrentModel.Entries.Remove(this.SelectedEntry);
                ModelLoader.SaveModel();

                this.RenderItems();
                this.sideMenuListBox.SelectedItem = null;
                this.RenderForm();
            }
        }
        private void okButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(this.textBox1.Text))
            {
                this.entry.Label = this.textBox1.Text;
                ModelLoader.SaveModel();

                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("Please enter a name!");
                this.DialogResult = DialogResult.None;
            }
        }
        private void okButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(this.Label))
            {
                var newEntry = new Core.Entry(this.Label);

                newEntry.Content = this.Content;

                ModelLoader.CurrentModel.Entries.Add(newEntry);
                ModelLoader.SaveModel();

                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("Invalid input!");

                this.DialogResult = DialogResult.None;
            }
        }
示例#6
0
        private void ImportFromXml()
        {
            if (MessageBox.Show("All current keys will be lost after import!\n\nDo you want to continue?", "Import", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
            {
                return;
            }

            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                var importedModel = Core.XmlSerialization.DeserializeModel(this.openFileDialog1.FileName);

                ModelLoader.ReplaceCurrentModelWithImportedModel(importedModel);
                ModelLoader.SaveModel();

                this.RenderItems();
                this.RenderForm();
                this.sideMenuListBox.SelectedItem = null;

                MessageBox.Show("Import was successful!", "Import");
            }
        }
示例#7
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var path = Settings.Default.AbsolutePaths ? Settings.Default.KeyPath : Path.Combine(Application.StartupPath, Settings.Default.KeyPath);

            LoginGui.PasswordInfoLoader.PasswordChanged += PasswordInfoLoader_PasswordChanged;

            var authenticationResult = LoginGui.PasswordInfoLoader.Authenticate(path);

            if (authenticationResult.Success)
            {
                ModelLoader.LoadModel(authenticationResult);

                //////XML Test
                ////Core.XmlSerialization.SerializeModel(ModelLoader.CurrentModel, @"B:\modelXml.xml");
                ////var res = Core.XmlSerialization.DeserializeModel(@"B:\modelXml.xml");

                Application.Run(new MainForm());
            }
        }
示例#8
0
 private static void PasswordInfoLoader_PasswordChanged(object sender, LoginGui.PasswordChangedEventArgs e)
 {
     ModelLoader.ChangeAuthData(e.OldAuthData, e.NewAuthData);
 }