This commit is contained in:
abdelkader
2023-05-08 19:57:21 -04:00
2 changed files with 209 additions and 24 deletions

View File

@@ -42,6 +42,17 @@ namespace VCFEditor.Presenter
}
private void _view_CopyTextToClipboardEvent(object sender, EventArgs e)
{
if (_view.SelectedContactIndex < 0)
return;
var contact = _repository.Contacts[_view.SelectedContactIndex];
string SerializedCard = _repository.GenerateStringFromVCard(contact.card);
_view.SendTextToClipBoard(SerializedCard);
_view.DisplayMessage("vCard copied to clipboard!", "Information");
private void _view_LoadForm(object sender, EventArg<FormState> e)
{
e.Data = ConfigRepository.Instance.FormState;

View File

@@ -67,16 +67,28 @@ namespace vCardEditor.View
this.btnExportImage = new System.Windows.Forms.Button();
this.btnRemoveImage = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.tbcAddress = new vCardEditor.View.Customs.AddressTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.FormattedTitleValue = new vCardEditor.View.StateTextBox();
this.FormattedTitleLabel = new System.Windows.Forms.Label();
this.lastNameValue = new vCardEditor.View.StateTextBox();
this.label3 = new System.Windows.Forms.Label();
this.middleNameValue = new vCardEditor.View.StateTextBox();
this.label2 = new System.Windows.Forms.Label();
this.firstNameValue = new vCardEditor.View.StateTextBox();
this.label1 = new System.Windows.Forms.Label();
this.FormattedNameValue = new vCardEditor.View.StateTextBox();
this.FormattedNameLabel = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.EmailAddressLabel = new System.Windows.Forms.Label();
this.EmailAddressValue = new vCardEditor.View.StateTextBox();
this.PersonalWebSiteLabel = new System.Windows.Forms.Label();
this.PersonalWebSiteValue = new vCardEditor.View.StateTextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.HomePhoneValue = new vCardEditor.View.StateTextBox();
this.WorkPhoneValue = new vCardEditor.View.StateTextBox();
this.CellularPhoneValue = new vCardEditor.View.StateTextBox();
this.PhotoBox = new System.Windows.Forms.PictureBox();
this.bsContacts = new System.Windows.Forms.BindingSource(this.components);
this.gbNameList = new System.Windows.Forms.GroupBox();
@@ -106,6 +118,7 @@ namespace vCardEditor.View
this.toolStrip1.SuspendLayout();
this.gbContactDetail.SuspendLayout();
this.groupBox4.SuspendLayout();
this.tbcAddress.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -145,7 +158,7 @@ namespace vCardEditor.View
this.recentFilesMenuItem,
this.miQuit});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 26);
this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24);
this.fileToolStripMenuItem.Text = "File";
//
// miSave
@@ -195,13 +208,13 @@ namespace vCardEditor.View
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(49, 26);
this.editToolStripMenuItem.Size = new System.Drawing.Size(49, 24);
this.editToolStripMenuItem.Text = "Edit";
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(126, 26);
this.copyToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.copyToolStripMenuItem.Text = "Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
//
@@ -246,7 +259,7 @@ namespace vCardEditor.View
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.miAbout});
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Size = new System.Drawing.Size(55, 26);
this.helpToolStripMenuItem.Size = new System.Drawing.Size(55, 24);
this.helpToolStripMenuItem.Text = "Help";
//
// miAbout
@@ -258,6 +271,24 @@ namespace vCardEditor.View
this.miAbout.Text = "&About";
this.miAbout.Click += new System.EventHandler(this.tbsAbout_Click);
//
// toolsToolStripMenuItem
//
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.imagesToolStripMenuItem});
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(58, 24);
this.toolsToolStripMenuItem.Text = "Tools";
//
// imagesToolStripMenuItem
//
this.imagesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exportToolStripMenuItem,
this.clearToolStripMenuItem,
this.countToolStripMenuItem});
this.imagesToolStripMenuItem.Name = "imagesToolStripMenuItem";
this.imagesToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.imagesToolStripMenuItem.Text = "Images";
//
// statusStrip1
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
@@ -279,7 +310,7 @@ namespace vCardEditor.View
this.toolStripSeparator1,
this.tbsAbout,
this.toolStripSeparator});
this.toolStrip1.Location = new System.Drawing.Point(0, 30);
this.toolStrip1.Location = new System.Drawing.Point(0, 28);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(1197, 31);
this.toolStrip1.TabIndex = 1;
@@ -291,7 +322,7 @@ namespace vCardEditor.View
this.tbsNew.Image = ((System.Drawing.Image)(resources.GetObject("tbsNew.Image")));
this.tbsNew.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsNew.Name = "tbsNew";
this.tbsNew.Size = new System.Drawing.Size(29, 28);
this.tbsNew.Size = new System.Drawing.Size(29, 24);
this.tbsNew.Text = "&Nouveau";
this.tbsNew.Click += new System.EventHandler(this.tbsNew_Click);
//
@@ -301,7 +332,7 @@ namespace vCardEditor.View
this.tbsOpen.Image = ((System.Drawing.Image)(resources.GetObject("tbsOpen.Image")));
this.tbsOpen.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsOpen.Name = "tbsOpen";
this.tbsOpen.Size = new System.Drawing.Size(29, 28);
this.tbsOpen.Size = new System.Drawing.Size(29, 24);
this.tbsOpen.Text = "&Open";
this.tbsOpen.Click += new System.EventHandler(this.tbsOpen_Click);
//
@@ -311,7 +342,7 @@ namespace vCardEditor.View
this.tbsSave.Image = ((System.Drawing.Image)(resources.GetObject("tbsSave.Image")));
this.tbsSave.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsSave.Name = "tbsSave";
this.tbsSave.Size = new System.Drawing.Size(29, 28);
this.tbsSave.Size = new System.Drawing.Size(29, 24);
this.tbsSave.Text = "&Save";
this.tbsSave.Click += new System.EventHandler(this.tbsSave_Click);
//
@@ -321,14 +352,14 @@ namespace vCardEditor.View
this.tbsDelete.Image = ((System.Drawing.Image)(resources.GetObject("tbsDelete.Image")));
this.tbsDelete.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsDelete.Name = "tbsDelete";
this.tbsDelete.Size = new System.Drawing.Size(29, 28);
this.tbsDelete.Size = new System.Drawing.Size(29, 24);
this.tbsDelete.Text = "Delete";
this.tbsDelete.Click += new System.EventHandler(this.tbsDelete_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 31);
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 27);
//
// tbsAbout
//
@@ -336,14 +367,14 @@ namespace vCardEditor.View
this.tbsAbout.Image = ((System.Drawing.Image)(resources.GetObject("tbsAbout.Image")));
this.tbsAbout.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsAbout.Name = "tbsAbout";
this.tbsAbout.Size = new System.Drawing.Size(29, 28);
this.tbsAbout.Size = new System.Drawing.Size(29, 24);
this.tbsAbout.Text = "&?";
this.tbsAbout.Click += new System.EventHandler(this.tbsAbout_Click);
//
// toolStripSeparator
//
this.toolStripSeparator.Name = "toolStripSeparator";
this.toolStripSeparator.Size = new System.Drawing.Size(6, 31);
this.toolStripSeparator.Size = new System.Drawing.Size(6, 27);
//
// openFileDialog
//
@@ -438,6 +469,29 @@ namespace vCardEditor.View
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Address:";
//
// tbcAddress
//
this.tbcAddress.Controls.Add(this.tabPage1);
this.tbcAddress.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
this.tbcAddress.Location = new System.Drawing.Point(17, 23);
this.tbcAddress.Margin = new System.Windows.Forms.Padding(4);
this.tbcAddress.Name = "tbcAddress";
this.tbcAddress.Padding = new System.Drawing.Point(12, 4);
this.tbcAddress.SelectedIndex = 0;
this.tbcAddress.ShowToolTips = true;
this.tbcAddress.Size = new System.Drawing.Size(739, 144);
this.tbcAddress.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.SystemColors.Control;
this.tabPage1.Location = new System.Drawing.Point(4, 27);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(731, 113);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = " ";
//
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -461,6 +515,17 @@ namespace vCardEditor.View
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Name";
//
// FormattedTitleValue
//
this.FormattedTitleValue.Location = new System.Drawing.Point(45, 21);
this.FormattedTitleValue.Margin = new System.Windows.Forms.Padding(4);
this.FormattedTitleValue.Name = "FormattedTitleValue";
this.FormattedTitleValue.oldText = null;
this.FormattedTitleValue.Size = new System.Drawing.Size(100, 22);
this.FormattedTitleValue.TabIndex = 1;
this.FormattedTitleValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.FormattedTitleValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// FormattedTitleLabel
//
this.FormattedTitleLabel.Location = new System.Drawing.Point(-4, 20);
@@ -471,6 +536,19 @@ namespace vCardEditor.View
this.FormattedTitleLabel.Text = "Title:";
this.FormattedTitleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// lastNameValue
//
this.lastNameValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lastNameValue.Location = new System.Drawing.Point(395, 53);
this.lastNameValue.Margin = new System.Windows.Forms.Padding(4);
this.lastNameValue.Name = "lastNameValue";
this.lastNameValue.oldText = null;
this.lastNameValue.Size = new System.Drawing.Size(168, 22);
this.lastNameValue.TabIndex = 9;
this.lastNameValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.lastNameValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// label3
//
this.label3.Location = new System.Drawing.Point(341, 53);
@@ -481,6 +559,19 @@ namespace vCardEditor.View
this.label3.Text = "Last:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// middleNameValue
//
this.middleNameValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.middleNameValue.Location = new System.Drawing.Point(237, 53);
this.middleNameValue.Margin = new System.Windows.Forms.Padding(4);
this.middleNameValue.Name = "middleNameValue";
this.middleNameValue.oldText = null;
this.middleNameValue.Size = new System.Drawing.Size(95, 22);
this.middleNameValue.TabIndex = 7;
this.middleNameValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.middleNameValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// label2
//
this.label2.Location = new System.Drawing.Point(151, 53);
@@ -491,6 +582,17 @@ namespace vCardEditor.View
this.label2.Text = "Middle:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// firstNameValue
//
this.firstNameValue.Location = new System.Drawing.Point(45, 53);
this.firstNameValue.Margin = new System.Windows.Forms.Padding(4);
this.firstNameValue.Name = "firstNameValue";
this.firstNameValue.oldText = null;
this.firstNameValue.Size = new System.Drawing.Size(100, 22);
this.firstNameValue.TabIndex = 5;
this.firstNameValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.firstNameValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(4, 53);
@@ -501,6 +603,19 @@ namespace vCardEditor.View
this.label1.Text = "First:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// FormattedNameValue
//
this.FormattedNameValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.FormattedNameValue.Location = new System.Drawing.Point(237, 21);
this.FormattedNameValue.Margin = new System.Windows.Forms.Padding(4);
this.FormattedNameValue.Name = "FormattedNameValue";
this.FormattedNameValue.oldText = null;
this.FormattedNameValue.Size = new System.Drawing.Size(324, 22);
this.FormattedNameValue.TabIndex = 3;
this.FormattedNameValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.FormattedNameValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// FormattedNameLabel
//
this.FormattedNameLabel.Location = new System.Drawing.Point(148, 21);
@@ -537,6 +652,19 @@ namespace vCardEditor.View
this.EmailAddressLabel.Text = "Email:";
this.EmailAddressLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// EmailAddressValue
//
this.EmailAddressValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.EmailAddressValue.Location = new System.Drawing.Point(71, 26);
this.EmailAddressValue.Margin = new System.Windows.Forms.Padding(4);
this.EmailAddressValue.Name = "EmailAddressValue";
this.EmailAddressValue.oldText = null;
this.EmailAddressValue.Size = new System.Drawing.Size(360, 22);
this.EmailAddressValue.TabIndex = 1;
this.EmailAddressValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.EmailAddressValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// PersonalWebSiteLabel
//
this.PersonalWebSiteLabel.Location = new System.Drawing.Point(13, 55);
@@ -547,6 +675,19 @@ namespace vCardEditor.View
this.PersonalWebSiteLabel.Text = "Web:";
this.PersonalWebSiteLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// PersonalWebSiteValue
//
this.PersonalWebSiteValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PersonalWebSiteValue.Location = new System.Drawing.Point(71, 55);
this.PersonalWebSiteValue.Margin = new System.Windows.Forms.Padding(4);
this.PersonalWebSiteValue.Name = "PersonalWebSiteValue";
this.PersonalWebSiteValue.oldText = null;
this.PersonalWebSiteValue.Size = new System.Drawing.Size(360, 22);
this.PersonalWebSiteValue.TabIndex = 3;
this.PersonalWebSiteValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.PersonalWebSiteValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
@@ -566,6 +707,45 @@ namespace vCardEditor.View
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Phones : ";
//
// HomePhoneValue
//
this.HomePhoneValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.HomePhoneValue.Location = new System.Drawing.Point(80, 25);
this.HomePhoneValue.Margin = new System.Windows.Forms.Padding(4);
this.HomePhoneValue.Name = "HomePhoneValue";
this.HomePhoneValue.oldText = null;
this.HomePhoneValue.Size = new System.Drawing.Size(229, 22);
this.HomePhoneValue.TabIndex = 1;
this.HomePhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.HomePhoneValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// WorkPhoneValue
//
this.WorkPhoneValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.WorkPhoneValue.Location = new System.Drawing.Point(80, 89);
this.WorkPhoneValue.Margin = new System.Windows.Forms.Padding(4);
this.WorkPhoneValue.Name = "WorkPhoneValue";
this.WorkPhoneValue.oldText = null;
this.WorkPhoneValue.Size = new System.Drawing.Size(229, 22);
this.WorkPhoneValue.TabIndex = 5;
this.WorkPhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.WorkPhoneValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// CellularPhoneValue
//
this.CellularPhoneValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CellularPhoneValue.Location = new System.Drawing.Point(80, 55);
this.CellularPhoneValue.Margin = new System.Windows.Forms.Padding(4);
this.CellularPhoneValue.Name = "CellularPhoneValue";
this.CellularPhoneValue.oldText = null;
this.CellularPhoneValue.Size = new System.Drawing.Size(229, 22);
this.CellularPhoneValue.TabIndex = 3;
this.CellularPhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.CellularPhoneValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// PhotoBox
//
this.PhotoBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -721,7 +901,7 @@ namespace vCardEditor.View
this.splitContainer1.SplitterDistance = 397;
this.splitContainer1.TabIndex = 4;
//
// tbcAddress
// exportToolStripMenuItem
//
this.tbcAddress.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
@@ -760,18 +940,11 @@ namespace vCardEditor.View
//
// lastNameValue
//
this.lastNameValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lastNameValue.Location = new System.Drawing.Point(395, 53);
this.lastNameValue.Margin = new System.Windows.Forms.Padding(4);
this.lastNameValue.Name = "lastNameValue";
this.lastNameValue.oldText = null;
this.lastNameValue.Size = new System.Drawing.Size(168, 22);
this.lastNameValue.TabIndex = 9;
this.lastNameValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.lastNameValue.Validated += new System.EventHandler(this.Value_TextChanged);
this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
this.clearToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.clearToolStripMenuItem.Text = "Clear";
//
// middleNameValue
// countToolStripMenuItem
//
this.middleNameValue.Location = new System.Drawing.Point(237, 53);
this.middleNameValue.Margin = new System.Windows.Forms.Padding(4);
@@ -896,6 +1069,7 @@ namespace vCardEditor.View
this.toolStrip1.PerformLayout();
this.gbContactDetail.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.tbcAddress.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);