From 2d864d7c00272eaa1fe081b8b5a3d536d6af8f38 Mon Sep 17 00:00:00 2001 From: abdelkader Date: Sun, 31 Jan 2021 10:37:07 -0500 Subject: [PATCH] Fix bug #4 Rearranged the main view --- vCardEditor/Repository/ContactRepository.cs | 109 ++++++-- vCardEditor/View/MainForm.Designer.cs | 288 +++++++++++--------- vCardEditor/View/MainForm.resx | 112 ++++---- vCardEditor_Test/ContactRepositoryTest.cs | 88 ++++++ vCardEditor_Test/Entries.cs | 65 ++++- 5 files changed, 456 insertions(+), 206 deletions(-) diff --git a/vCardEditor/Repository/ContactRepository.cs b/vCardEditor/Repository/ContactRepository.cs index 222be87..9617cab 100644 --- a/vCardEditor/Repository/ContactRepository.cs +++ b/vCardEditor/Repository/ContactRepository.cs @@ -6,6 +6,7 @@ using Thought.vCards; using VCFEditor.Model; using System.ComponentModel; using vCardEditor.Repository; +using System.Collections.Generic; namespace VCFEditor.Repository { @@ -190,39 +191,93 @@ namespace VCFEditor.Repository vCard card = _contacts[index].card; card.FormattedName = NewCard.FormattedName; - - //HomePhone - if (card.Phones.GetFirstChoice(vCardPhoneTypes.Home) != null) - card.Phones.GetFirstChoice(vCardPhoneTypes.Home).FullNumber = NewCard.Phones.GetFirstChoice(vCardPhoneTypes.Home).FullNumber; - else - { - if (NewCard.Phones.GetFirstChoice(vCardPhoneTypes.Home) != null - && !string.IsNullOrEmpty(NewCard.Phones.GetFirstChoice(vCardPhoneTypes.Home).FullNumber)) - card.Phones.Add(new vCardPhone(NewCard.Phones.GetFirstChoice(vCardPhoneTypes.Home).FullNumber, vCardPhoneTypes.Home)); - } - - - //Cellular - if (card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular) != null) - card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular).FullNumber = NewCard.Phones.GetFirstChoice(vCardPhoneTypes.Cellular).FullNumber; - else - { - if (NewCard.Phones.GetFirstChoice(vCardPhoneTypes.Cellular) != null - && !string.IsNullOrEmpty(NewCard.Phones.GetFirstChoice(vCardPhoneTypes.Cellular).FullNumber)) - card.Phones.Add(new vCardPhone(NewCard.Phones.GetFirstChoice(vCardPhoneTypes.Cellular).FullNumber, vCardPhoneTypes.Cellular)); - } - - if (card.EmailAddresses.GetFirstChoice(vCardEmailAddressType.Internet) != null) - card.EmailAddresses.GetFirstChoice(vCardEmailAddressType.Internet).Address = NewCard.EmailAddresses.GetFirstChoice(vCardEmailAddressType.Internet).Address; - if (card.Websites.GetFirstChoice(vCardWebsiteTypes.Personal) != null) - card.Websites.GetFirstChoice(vCardWebsiteTypes.Personal).Url = NewCard.Websites.GetFirstChoice(vCardWebsiteTypes.Personal).Url; - + SavePhone(NewCard, card); + SaveEmail(NewCard, card); + SaveWebUrl(NewCard, card); _contacts[index].isDirty = false; _dirty = false; } } + + private void SaveWebUrl(vCard NewCard, vCard card) + { + var type = typeof(vCardWebsiteTypes); + var names = Enum.GetNames(type); + + foreach (var name in names) + { + var urlType = (vCardWebsiteTypes)Enum.Parse(type, name); + + if (NewCard.Websites.GetFirstChoice(urlType) != null) + { + if (card.Websites.GetFirstChoice(urlType) != null) + card.Websites.GetFirstChoice(urlType).Url = NewCard.Websites.GetFirstChoice(urlType).Url; + else + card.Websites.Add(new vCardWebsite(NewCard.Websites.GetFirstChoice(urlType).Url, urlType)); + } + else + { + if (card.Websites.GetFirstChoice(urlType) != null) + card.Websites.GetFirstChoice(urlType).Url = string.Empty; + + } + } + } + + private void SavePhone(vCard NewCard, vCard card) + { + var type = typeof(vCardPhoneTypes); + var names = Enum.GetNames(type); + + foreach (var name in names) + { + var phoneType = (vCardPhoneTypes)Enum.Parse(type, name); + + if (NewCard.Phones.GetFirstChoice(phoneType) != null) + { + if (card.Phones.GetFirstChoice(phoneType) != null) + card.Phones.GetFirstChoice(phoneType).FullNumber = NewCard.Phones.GetFirstChoice(phoneType).FullNumber; + else + card.Phones.Add(new vCardPhone(NewCard.Phones.GetFirstChoice(phoneType).FullNumber, phoneType)); + } + else + { + if (card.Phones.GetFirstChoice(phoneType) != null) + card.Phones.GetFirstChoice(phoneType).FullNumber = string.Empty; + + } + } + } + + private void SaveEmail(vCard NewCard, vCard card) + { + var type = typeof(vCardEmailAddressType); + var names = Enum.GetNames(type); + + foreach (var name in names) + { + var emailType = (vCardEmailAddressType)Enum.Parse(type, name); + + if (NewCard.EmailAddresses.GetFirstChoice(emailType) != null) + { + if (card.EmailAddresses.GetFirstChoice(emailType) != null) + card.EmailAddresses.GetFirstChoice(emailType).Address = NewCard.EmailAddresses.GetFirstChoice(emailType).Address; + else + card.EmailAddresses.Add(new vCardEmailAddress(NewCard.EmailAddresses.GetFirstChoice(emailType).Address, + emailType)); + } + else + { + if (card.EmailAddresses.GetFirstChoice(emailType) != null) + card.EmailAddresses.GetFirstChoice(emailType).Address = string.Empty; + + } + } + + } + /// /// Generate a VCard class from a string. /// diff --git a/vCardEditor/View/MainForm.Designer.cs b/vCardEditor/View/MainForm.Designer.cs index 036b356..c9eb493 100644 --- a/vCardEditor/View/MainForm.Designer.cs +++ b/vCardEditor/View/MainForm.Designer.cs @@ -35,6 +35,7 @@ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.miOpen = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.miConfig = new System.Windows.Forms.ToolStripMenuItem(); this.recentFilesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.miQuit = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -47,20 +48,15 @@ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.tbsAbout = new System.Windows.Forms.ToolStripButton(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); - this.FormattedNameLabel = new System.Windows.Forms.Label(); this.HomePhoneLabel = new System.Windows.Forms.Label(); this.CellularPhoneLabel = new System.Windows.Forms.Label(); - this.PersonalWebSiteLabel = new System.Windows.Forms.Label(); this.WorkPhoneLabel = new System.Windows.Forms.Label(); this.gbContactDetail = new System.Windows.Forms.GroupBox(); - this.EmailAddressValue = new vCardEditor.View.StateTextBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); this.EmailAddressLabel = new System.Windows.Forms.Label(); - this.WorkPhoneValue = new vCardEditor.View.StateTextBox(); - this.PersonalWebSiteValue = new vCardEditor.View.StateTextBox(); + this.PersonalWebSiteLabel = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); this.PhotoBox = new System.Windows.Forms.PictureBox(); - this.CellularPhoneValue = new vCardEditor.View.StateTextBox(); - this.HomePhoneValue = new vCardEditor.View.StateTextBox(); - this.FormattedNameValue = new vCardEditor.View.StateTextBox(); this.bsContacts = new System.Windows.Forms.BindingSource(this.components); this.gbNameList = new System.Windows.Forms.GroupBox(); this.btnClearFilter = new System.Windows.Forms.Button(); @@ -68,14 +64,24 @@ this.dgContacts = new System.Windows.Forms.DataGridView(); this.Column1 = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.miConfig = new System.Windows.Forms.ToolStripMenuItem(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.FormattedNameLabel = new System.Windows.Forms.Label(); + this.FormattedNameValue = new vCardEditor.View.StateTextBox(); + this.EmailAddressValue = new vCardEditor.View.StateTextBox(); + this.PersonalWebSiteValue = new vCardEditor.View.StateTextBox(); + this.HomePhoneValue = new vCardEditor.View.StateTextBox(); + this.WorkPhoneValue = new vCardEditor.View.StateTextBox(); + this.CellularPhoneValue = new vCardEditor.View.StateTextBox(); this.menuStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.gbContactDetail.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bsContacts)).BeginInit(); this.gbNameList.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgContacts)).BeginInit(); + this.groupBox3.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -106,26 +112,33 @@ this.miOpen.Image = ((System.Drawing.Image)(resources.GetObject("miOpen.Image"))); this.miOpen.ImageTransparentColor = System.Drawing.Color.Fuchsia; this.miOpen.Name = "miOpen"; - this.miOpen.Size = new System.Drawing.Size(152, 22); + this.miOpen.Size = new System.Drawing.Size(130, 22); this.miOpen.Text = "&Open"; this.miOpen.Click += new System.EventHandler(this.tbsOpen_Click); // // toolStripMenuItem1 // this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6); + this.toolStripMenuItem1.Size = new System.Drawing.Size(127, 6); + // + // miConfig + // + this.miConfig.Name = "miConfig"; + this.miConfig.Size = new System.Drawing.Size(130, 22); + this.miConfig.Text = "Preference"; + this.miConfig.Click += new System.EventHandler(this.miConfig_Click); // // recentFilesMenuItem // this.recentFilesMenuItem.Name = "recentFilesMenuItem"; - this.recentFilesMenuItem.Size = new System.Drawing.Size(152, 22); + this.recentFilesMenuItem.Size = new System.Drawing.Size(130, 22); this.recentFilesMenuItem.Text = "Recent"; // // miQuit // this.miQuit.Image = ((System.Drawing.Image)(resources.GetObject("miQuit.Image"))); this.miQuit.Name = "miQuit"; - this.miQuit.Size = new System.Drawing.Size(152, 22); + this.miQuit.Size = new System.Drawing.Size(130, 22); this.miQuit.Text = "&Quit"; this.miQuit.Click += new System.EventHandler(this.miQuit_Click); // @@ -218,18 +231,9 @@ this.openFileDialog.Filter = "vCard Files|*.vcf"; this.openFileDialog.Title = "Open vCard File"; // - // FormattedNameLabel - // - this.FormattedNameLabel.Location = new System.Drawing.Point(15, 25); - this.FormattedNameLabel.Name = "FormattedNameLabel"; - this.FormattedNameLabel.Size = new System.Drawing.Size(102, 19); - this.FormattedNameLabel.TabIndex = 42; - this.FormattedNameLabel.Text = "Name:"; - this.FormattedNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // // HomePhoneLabel // - this.HomePhoneLabel.Location = new System.Drawing.Point(34, 50); + this.HomePhoneLabel.Location = new System.Drawing.Point(25, 21); this.HomePhoneLabel.Name = "HomePhoneLabel"; this.HomePhoneLabel.Size = new System.Drawing.Size(83, 19); this.HomePhoneLabel.TabIndex = 43; @@ -238,29 +242,20 @@ // // CellularPhoneLabel // - this.CellularPhoneLabel.Location = new System.Drawing.Point(25, 75); + this.CellularPhoneLabel.Location = new System.Drawing.Point(16, 46); this.CellularPhoneLabel.Name = "CellularPhoneLabel"; this.CellularPhoneLabel.Size = new System.Drawing.Size(92, 19); this.CellularPhoneLabel.TabIndex = 46; this.CellularPhoneLabel.Text = "Mobile:"; this.CellularPhoneLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // PersonalWebSiteLabel - // - this.PersonalWebSiteLabel.Location = new System.Drawing.Point(34, 150); - this.PersonalWebSiteLabel.Name = "PersonalWebSiteLabel"; - this.PersonalWebSiteLabel.Size = new System.Drawing.Size(83, 19); - this.PersonalWebSiteLabel.TabIndex = 54; - this.PersonalWebSiteLabel.Text = "Personal Web Page:"; - this.PersonalWebSiteLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // // WorkPhoneLabel // - this.WorkPhoneLabel.Location = new System.Drawing.Point(25, 125); + this.WorkPhoneLabel.Location = new System.Drawing.Point(16, 75); this.WorkPhoneLabel.Name = "WorkPhoneLabel"; this.WorkPhoneLabel.Size = new System.Drawing.Size(92, 19); this.WorkPhoneLabel.TabIndex = 55; - this.WorkPhoneLabel.Text = "Business Phone:"; + this.WorkPhoneLabel.Text = "Work Phone:"; this.WorkPhoneLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // gbContactDetail @@ -268,19 +263,10 @@ this.gbContactDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.gbContactDetail.Controls.Add(this.EmailAddressValue); - this.gbContactDetail.Controls.Add(this.EmailAddressLabel); - this.gbContactDetail.Controls.Add(this.WorkPhoneValue); - this.gbContactDetail.Controls.Add(this.PersonalWebSiteValue); - this.gbContactDetail.Controls.Add(this.WorkPhoneLabel); - this.gbContactDetail.Controls.Add(this.PersonalWebSiteLabel); + this.gbContactDetail.Controls.Add(this.groupBox3); + this.gbContactDetail.Controls.Add(this.groupBox2); + this.gbContactDetail.Controls.Add(this.groupBox1); this.gbContactDetail.Controls.Add(this.PhotoBox); - this.gbContactDetail.Controls.Add(this.CellularPhoneValue); - this.gbContactDetail.Controls.Add(this.CellularPhoneLabel); - this.gbContactDetail.Controls.Add(this.HomePhoneValue); - this.gbContactDetail.Controls.Add(this.FormattedNameValue); - this.gbContactDetail.Controls.Add(this.HomePhoneLabel); - this.gbContactDetail.Controls.Add(this.FormattedNameLabel); this.gbContactDetail.Enabled = false; this.gbContactDetail.Location = new System.Drawing.Point(250, 52); this.gbContactDetail.Name = "gbContactDetail"; @@ -289,47 +275,51 @@ this.gbContactDetail.TabStop = false; this.gbContactDetail.Text = "Contact Detail :"; // - // EmailAddressValue + // groupBox2 // - 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(123, 99); - this.EmailAddressValue.Name = "EmailAddressValue"; - this.EmailAddressValue.Size = new System.Drawing.Size(272, 20); - this.EmailAddressValue.TabIndex = 59; - this.EmailAddressValue.LostFocus += new System.EventHandler(this.Value_TextChanged); - this.EmailAddressValue.Validated += new System.EventHandler(this.Value_TextChanged); + this.groupBox2.Controls.Add(this.EmailAddressLabel); + this.groupBox2.Controls.Add(this.EmailAddressValue); + this.groupBox2.Controls.Add(this.PersonalWebSiteLabel); + this.groupBox2.Controls.Add(this.PersonalWebSiteValue); + this.groupBox2.Location = new System.Drawing.Point(18, 191); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(377, 100); + this.groupBox2.TabIndex = 65; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Web : "; // // EmailAddressLabel // - this.EmailAddressLabel.Location = new System.Drawing.Point(-7, 100); + this.EmailAddressLabel.Location = new System.Drawing.Point(-16, 29); this.EmailAddressLabel.Name = "EmailAddressLabel"; this.EmailAddressLabel.Size = new System.Drawing.Size(124, 19); - this.EmailAddressLabel.TabIndex = 58; + this.EmailAddressLabel.TabIndex = 63; this.EmailAddressLabel.Text = "Email Address:"; this.EmailAddressLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // WorkPhoneValue + // PersonalWebSiteLabel // - 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(123, 124); - this.WorkPhoneValue.Name = "WorkPhoneValue"; - this.WorkPhoneValue.Size = new System.Drawing.Size(272, 20); - this.WorkPhoneValue.TabIndex = 57; - this.WorkPhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged); - this.WorkPhoneValue.Validated += new System.EventHandler(this.Value_TextChanged); + this.PersonalWebSiteLabel.Location = new System.Drawing.Point(25, 56); + this.PersonalWebSiteLabel.Name = "PersonalWebSiteLabel"; + this.PersonalWebSiteLabel.Size = new System.Drawing.Size(83, 19); + this.PersonalWebSiteLabel.TabIndex = 61; + this.PersonalWebSiteLabel.Text = "Personal Web Page:"; + this.PersonalWebSiteLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // PersonalWebSiteValue + // groupBox1 // - 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(123, 149); - this.PersonalWebSiteValue.Name = "PersonalWebSiteValue"; - this.PersonalWebSiteValue.Size = new System.Drawing.Size(272, 20); - this.PersonalWebSiteValue.TabIndex = 56; - this.PersonalWebSiteValue.LostFocus += new System.EventHandler(this.Value_TextChanged); - this.PersonalWebSiteValue.Validated += new System.EventHandler(this.Value_TextChanged); + this.groupBox1.Controls.Add(this.WorkPhoneLabel); + this.groupBox1.Controls.Add(this.HomePhoneLabel); + this.groupBox1.Controls.Add(this.HomePhoneValue); + this.groupBox1.Controls.Add(this.WorkPhoneValue); + this.groupBox1.Controls.Add(this.CellularPhoneLabel); + this.groupBox1.Controls.Add(this.CellularPhoneValue); + this.groupBox1.Location = new System.Drawing.Point(18, 72); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(377, 113); + this.groupBox1.TabIndex = 60; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Phones : "; // // PhotoBox // @@ -337,44 +327,11 @@ this.PhotoBox.Image = ((System.Drawing.Image)(resources.GetObject("PhotoBox.Image"))); this.PhotoBox.Location = new System.Drawing.Point(412, 25); this.PhotoBox.Name = "PhotoBox"; - this.PhotoBox.Size = new System.Drawing.Size(128, 144); + this.PhotoBox.Size = new System.Drawing.Size(128, 123); this.PhotoBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.PhotoBox.TabIndex = 53; this.PhotoBox.TabStop = false; // - // 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(123, 74); - this.CellularPhoneValue.Name = "CellularPhoneValue"; - this.CellularPhoneValue.Size = new System.Drawing.Size(272, 20); - this.CellularPhoneValue.TabIndex = 47; - this.CellularPhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged); - this.CellularPhoneValue.Validated += new System.EventHandler(this.Value_TextChanged); - // - // 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(123, 49); - this.HomePhoneValue.Name = "HomePhoneValue"; - this.HomePhoneValue.Size = new System.Drawing.Size(272, 20); - this.HomePhoneValue.TabIndex = 45; - this.HomePhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged); - this.HomePhoneValue.Validated += new System.EventHandler(this.Value_TextChanged); - // - // 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(123, 24); - this.FormattedNameValue.Name = "FormattedNameValue"; - this.FormattedNameValue.Size = new System.Drawing.Size(272, 20); - this.FormattedNameValue.TabIndex = 44; - this.FormattedNameValue.LostFocus += new System.EventHandler(this.Value_TextChanged); - this.FormattedNameValue.Validated += new System.EventHandler(this.Value_TextChanged); - // // gbNameList // this.gbNameList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -450,12 +407,91 @@ this.Column2.Name = "Column2"; this.Column2.ReadOnly = true; // - // miConfig + // groupBox3 // - this.miConfig.Name = "miConfig"; - this.miConfig.Size = new System.Drawing.Size(152, 22); - this.miConfig.Text = "Preference"; - this.miConfig.Click += new System.EventHandler(this.miConfig_Click); + this.groupBox3.Controls.Add(this.FormattedNameValue); + this.groupBox3.Controls.Add(this.FormattedNameLabel); + this.groupBox3.Location = new System.Drawing.Point(18, 14); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(377, 52); + this.groupBox3.TabIndex = 66; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Name"; + // + // FormattedNameLabel + // + this.FormattedNameLabel.Location = new System.Drawing.Point(6, 17); + this.FormattedNameLabel.Name = "FormattedNameLabel"; + this.FormattedNameLabel.Size = new System.Drawing.Size(102, 19); + this.FormattedNameLabel.TabIndex = 45; + this.FormattedNameLabel.Text = "Name:"; + this.FormattedNameLabel.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(114, 17); + this.FormattedNameValue.Name = "FormattedNameValue"; + this.FormattedNameValue.oldText = null; + this.FormattedNameValue.Size = new System.Drawing.Size(225, 20); + this.FormattedNameValue.TabIndex = 46; + // + // 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(114, 28); + this.EmailAddressValue.Name = "EmailAddressValue"; + this.EmailAddressValue.oldText = null; + this.EmailAddressValue.Size = new System.Drawing.Size(225, 20); + this.EmailAddressValue.TabIndex = 64; + // + // 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(114, 54); + this.PersonalWebSiteValue.Name = "PersonalWebSiteValue"; + this.PersonalWebSiteValue.oldText = null; + this.PersonalWebSiteValue.Size = new System.Drawing.Size(225, 20); + this.PersonalWebSiteValue.TabIndex = 62; + // + // 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(114, 20); + this.HomePhoneValue.Name = "HomePhoneValue"; + this.HomePhoneValue.oldText = null; + this.HomePhoneValue.Size = new System.Drawing.Size(225, 20); + this.HomePhoneValue.TabIndex = 45; + 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(114, 74); + this.WorkPhoneValue.Name = "WorkPhoneValue"; + this.WorkPhoneValue.oldText = null; + this.WorkPhoneValue.Size = new System.Drawing.Size(225, 20); + this.WorkPhoneValue.TabIndex = 57; + 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(114, 45); + this.CellularPhoneValue.Name = "CellularPhoneValue"; + this.CellularPhoneValue.oldText = null; + this.CellularPhoneValue.Size = new System.Drawing.Size(225, 20); + this.CellularPhoneValue.TabIndex = 47; + this.CellularPhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged); + this.CellularPhoneValue.Validated += new System.EventHandler(this.Value_TextChanged); // // MainForm // @@ -480,12 +516,17 @@ this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.gbContactDetail.ResumeLayout(false); - this.gbContactDetail.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bsContacts)).EndInit(); this.gbNameList.ResumeLayout(false); this.gbNameList.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgContacts)).EndInit(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -509,18 +550,13 @@ private System.Windows.Forms.ToolStripButton tbsAbout; private System.Windows.Forms.OpenFileDialog openFileDialog; private System.Windows.Forms.BindingSource bsContacts; - internal System.Windows.Forms.Label FormattedNameLabel; internal System.Windows.Forms.Label HomePhoneLabel; internal StateTextBox HomePhoneValue; internal System.Windows.Forms.Label CellularPhoneLabel; internal StateTextBox CellularPhoneValue; - internal System.Windows.Forms.Label PersonalWebSiteLabel; internal System.Windows.Forms.Label WorkPhoneLabel; - internal StateTextBox PersonalWebSiteValue; internal StateTextBox WorkPhoneValue; private System.Windows.Forms.GroupBox gbContactDetail; - internal StateTextBox EmailAddressValue; - internal System.Windows.Forms.Label EmailAddressLabel; private System.Windows.Forms.GroupBox gbNameList; private System.Windows.Forms.TextBox textBoxFilter; private System.Windows.Forms.DataGridView dgContacts; @@ -529,7 +565,15 @@ private System.Windows.Forms.Button btnClearFilter; internal System.Windows.Forms.PictureBox PhotoBox; private System.Windows.Forms.ToolStripMenuItem recentFilesMenuItem; - internal StateTextBox FormattedNameValue; private System.Windows.Forms.ToolStripMenuItem miConfig; + private System.Windows.Forms.GroupBox groupBox2; + internal System.Windows.Forms.Label EmailAddressLabel; + internal StateTextBox EmailAddressValue; + internal System.Windows.Forms.Label PersonalWebSiteLabel; + internal StateTextBox PersonalWebSiteValue; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox3; + internal StateTextBox FormattedNameValue; + internal System.Windows.Forms.Label FormattedNameLabel; } } \ No newline at end of file diff --git a/vCardEditor/View/MainForm.resx b/vCardEditor/View/MainForm.resx index 6540b03..be9ea89 100644 --- a/vCardEditor/View/MainForm.resx +++ b/vCardEditor/View/MainForm.resx @@ -112,15 +112,15 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 - + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 @@ -139,16 +139,16 @@ - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAH9SURBVDhPpZLdS1NhHMcfCMFuvOj9wrQ5S5a62TKdKSZpu5CVowbzjc1srZh6nDp3EF8YQ8XI - G0EEQWqCaHgT1kCJ5aYDmQt1IAYhSN11lX/Ct9+ziXrmEQS/8DkP/J7n++FwnsPOnR+iFmfloCIN39ga - NSDkfbKXcoHpOTTWEWoim7hBXDxVEHXfQ8h1H3+/iAh/6AieJjCMXgKbZCcl7912LDs1+DXyCP+C7zDR - rAnSWCoYZzPxspwg4ipAQFDjp1eHP76XeFN0hR86Egyydl4cjg0mBMmsdWrwrTUf255i/PbZpIJeJvJD - 3i0PXNEOOCOt6NsQ4Y0NQFh/C9ZFgrAzH4uOXMT6C7E72SgVUNmzOQD90mOU+otQtVQOQ0AP84oRQtSe - EKy05cF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4ytYxOsYMAnAAAAAElFTkSuQmCC @@ -166,10 +166,10 @@ E9ew//AVxE8OItv/9O/Cf0ck8gud2vKswuxNZgAAAABJRU5ErkJggg== - + 132, 17 - + 248, 17 @@ -238,60 +238,60 @@ E9ew//AVxE8OItv/9O/Cf0ck8gud2vKswuxNZgAAAABJRU5ErkJggg== - + 353, 17 - iVBORw0KGgoAAAANSUhEUgAAAGYAAABmCAMAAAAOARRQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAACHUExURf///y4uLi8vLykpKUBAQEVFRUtLS0REREpKSj09PUFBQd/f3ygoKDk5OU5OTiAgIAAA - ADQ0NBwcHBkZGff39+zs7BMTE9nZ2QkJCWlpaebm5qenp/Pz88LCws/Pz4eHh3h4eFhYWJKSkp+fn8XF - xWdnZ6+vr3BwcH5+frm5uY2NjV5eXqGhob8kg48AAARnSURBVGhD7ZiLkqI6EEAHoqNAmPAGdXzg23H/ - //u2u9OiIM4Okq3aW9dTNVVj0vQh5EHI24sXL178T/nMZ8dyOCyP+zzhIvOk85WrIkKNjttPLjbMaSdj - JYQFCKFi67DlCpMkK6VQYRPwj1RyyXXm8MpCkCIkyCSC85SrDeGVMUq0Q4Oi7JBygBGSHVgwt19BJis+ - cIQRVgW1xPedChLZVrHmEAPMC5JA8oHLDNCEnmDBQb1JS6lbMnBHoyExGqEIW6TOpibqXtloAQkIxgSa - QAQeW5w4rCfpRJFFS94JEmmPWplZDrbxxUKOD4BM7LGFmd5ZgwaemG4KShDdIPSE2S8O7EUyFrpfbiQI - ekYujANZmhgEXgGNubdUHugdE0vBqeBHdqfR3eP7RqbOV0T9f9sxGuqeEfRONuPQPhykw8+sVQO9o44c - 2ofSujyzOw0ParHj0D6Mw+ucaQIaeGpWyaF9GJDmMv1r4NQBjf3BoX1wQ+waXMs4+ZWLxkRrPvihtaI1 - Zw7tw9n+XuM61oRD+3AQ9NBaPfg+GDhGdjhrxW+aVvCtE+85tA/z7I8aE4uNR6154MGXtW+ZW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1B3y1EH3Ql + kFq0ng6esSiz4rETXZGn2DVI9NybfgAr5kZErNcRsbUlx2rGL1MNZFY87NXKgm3MnidEL9z7dAjU1yJs + bklKwFSLCa0WfURd4lG97CQy8jrXbFEhwjYLQo0NCDXUb4W1cGc7Zg3HwfP8clSzfDR8GJPf62oRuXcH + a9dasFpdnRTpRe7exuypk3KAk8oHJ4XfWIpQUxNWL9dgpfJigooqplKFa1UP1Zt4thn+sjPKEjkJ10Ju + AYLGcwiWnkewrJzhbDyLhdw8BakVTXoyw9dzh7PwlKiDHhKVDxF9/JKRhWVDMZYLSziX4Fv2UTwi+ixI + LVqiVwxf2kGwx1VBlCrHoDHxDzJANOXTp2Ep34Cvmdl4TDRtJbokSC3aUoEBPv1+8KybfXpmuyyQ0DCp + 0ni3Yyf4lX7qJKpSdY3Uonm0u5OaN0OElGaiIs4yIObNkFp/k+gCZx2jmon+AEJJs9KsJOQkAAAAAElF + TkSuQmCC - + True - + True diff --git a/vCardEditor_Test/ContactRepositoryTest.cs b/vCardEditor_Test/ContactRepositoryTest.cs index 83ae1a8..094e4a5 100644 --- a/vCardEditor_Test/ContactRepositoryTest.cs +++ b/vCardEditor_Test/ContactRepositoryTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Thought.vCards; using vCardEditor.Repository; using VCFEditor.Repository; @@ -22,5 +23,92 @@ namespace vCardEditor_Test Assert.AreEqual(repo.LoadContacts("name")[0].Name, "Oum Alaâ"); } + + [TestMethod] + public void NewFileOpened_SaveDirtyCellPhone_NotNullWithNotNull_Test() + { + var fileHandler = Substitute.For(); + fileHandler.ReadAllLines(Arg.Any()).Returns(Entries.vcfFourEntry); + + var repo = Substitute.For(fileHandler); + repo.LoadContacts("name"); + repo.Contacts[0].isDirty=true; + + string phone = "0011223344"; + var newCard = new vCard(); + newCard.Phones.Add(new vCardPhone(phone, vCardPhoneTypes.Cellular)); + + repo.SaveDirtyVCard(0, newCard); + + + var card = repo.Contacts[0].card; + Assert.AreEqual(card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular).FullNumber, phone); + } + + [TestMethod] + public void NewFileOpened_SaveDirtyCellPhone_NotNullWithNull_Test() + { + var fileHandler = Substitute.For(); + fileHandler.ReadAllLines(Arg.Any()).Returns(Entries.vcfFourEntry); + + var repo = Substitute.For(fileHandler); + repo.LoadContacts("name"); + repo.Contacts[0].isDirty = true; + + repo.SaveDirtyVCard(0, new vCard()); + + + var card = repo.Contacts[0].card; + Assert.AreEqual(card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular).FullNumber, string.Empty); + } + + [TestMethod] + public void NewFileOpened_SaveDirtyCellPhone_NullWithNotNull_Test() + { + var fileHandler = Substitute.For(); + fileHandler.ReadAllLines(Arg.Any()).Returns(Entries.vcfFourEntry); + var repo = Substitute.For(fileHandler); + repo.LoadContacts("name"); + repo.Contacts[2].isDirty = true; + + string phone = "0011223344"; + var newCard = new vCard(); + newCard.Phones.Add(new vCardPhone(phone, vCardPhoneTypes.Cellular)); + repo.SaveDirtyVCard(2, newCard); + + var card = repo.Contacts[2].card; + Assert.AreEqual(card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular).FullNumber, phone); + } + + [TestMethod] + public void NewFileOpened_SaveDirtyCellPhone_NullWithNull_Test() + { + var fileHandler = Substitute.For(); + fileHandler.ReadAllLines(Arg.Any()).Returns(Entries.vcfFourEntry); + var repo = Substitute.For(fileHandler); + repo.LoadContacts("name"); + repo.Contacts[3].isDirty = true; + + repo.SaveDirtyVCard(3, new vCard()); + + var card = repo.Contacts[2].card; + Assert.IsNull(card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular)); + } + + + [TestMethod] + public void NewFileOpened_v21_Test() + { + var fileHandler = Substitute.For(); + fileHandler.ReadAllLines(Arg.Any()).Returns(Entries.vcfWikiv21); + var repo = Substitute.For(fileHandler); + repo.LoadContacts("name"); + repo.Contacts[0].isDirty = true; + + repo.SaveDirtyVCard(0, new vCard()); + + //var card = repo.Contacts[2].card; + //Assert.IsNull(card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular)); + } } } diff --git a/vCardEditor_Test/Entries.cs b/vCardEditor_Test/Entries.cs index 47d33b7..d95b3a7 100644 --- a/vCardEditor_Test/Entries.cs +++ b/vCardEditor_Test/Entries.cs @@ -39,7 +39,7 @@ namespace vCardEditor_Test "END:VCARD\n" + "BEGIN:VCARD\n" + "VERSION:2.1\n" + - "FN:Jean Dupont1\n" + + "FN:Jean Dupont2\n" + "N:Dupont;Jean\n" + "ADR;WORK;PREF;QUOTED-PRINTABLE:;Bruxelles 1200=Belgique;6A Rue Th. Decuyper\n" + "TEL;CELL:+1234 56789\n" + @@ -56,6 +56,43 @@ namespace vCardEditor_Test return s.Split('\n'); } } + public static string[] vcfFourEntry + { + get + { + string s = "BEGIN:VCARD\n" + + "VERSION:2.1\n" + + "FN:Jean Dupont1\n" + + "N:Dupont;Jean1\n" + + "ADR;WORK;PREF;QUOTED-PRINTABLE:;Bruxelles 1200=Belgique;6A Rue Th. Decuyper\n" + + "TEL;CELL:+1234 56789\n" + + "EMAIL;INTERNET:jean.dupont@example.com\n" + + "END:VCARD\n" + + "BEGIN:VCARD\n" + + "VERSION:2.1\n" + + "FN:Jean Dupont2\n" + + "N:Dupont;Jean\n" + + "ADR;WORK;PREF;QUOTED-PRINTABLE:;Bruxelles 1200=Belgique;6A Rue Th. Decuyper\n" + + "TEL;CELL:+1234 56789\n" + + "EMAIL;INTERNET:jean.dupont@example.com\n" + + "END:VCARD\n" + + "BEGIN:VCARD\n" + + "VERSION:2.1\n" + + "FN:Jean Dupont3\n" + + "N:Dupont;Jean\n" + + "ADR;WORK;PREF;QUOTED-PRINTABLE:;Bruxelles 1200=Belgique;6A Rue Th. Decuyper\n" + + "EMAIL;INTERNET:jean.dupont@example.com\n" + + "END:VCARD\n" + + "BEGIN:VCARD\n" + + "VERSION:2.1\n" + + "FN:Jean Dupont4\n" + + "N:Dupont;Jean\n" + + "ADR;WORK;PREF;QUOTED-PRINTABLE:;Bruxelles 1200=Belgique;6A Rue Th. Decuyper\n" + + "EMAIL;INTERNET:jean.dupont@example.com\n" + + "END:VCARD"; + return s.Split('\n'); + } + } public static string[] vcfUtf8Entry { get @@ -68,5 +105,31 @@ namespace vCardEditor_Test return s.Split('\n'); } } + + public static string[] vcfWikiv21 + { + get + { + string s = "BEGIN:VCARD" + + "VERSION:2.1\n" + + "N:Gump;Forrest;;Mr.\n" + + "FN:Forrest Gump\n" + + "ORG:Bubba Gump Shrimp Co.\n" + + "TITLE:Shrimp Man\n" + + "PHOTO;GIF:http://www.example.com/dir_photos/my_photo.gif\n" + + "TEL;WORK;VOICE:(111) 555-1212\n" + + "TEL;HOME;VOICE:(404) 555-1212\n" + + "ADR;WORK;PREF:;;100 Waters Edge;Baytown;LA;30314;United States of America\n" + + "LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:100 Waters Edge=0D=\n" + + " =0ABaytown\\, LA 30314=0D=0AUnited States of America\n" + + "ADR;HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America\n" + + "LABEL;HOME;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:42 Plantation St.=0D=0A=\n" + + " Baytown, LA 30314=0D=0AUnited States of America\n" + + "EMAIL:forrestgump@example.com\n" + + "REV:20080424T195243Z\n" + + "END:VCARD"; + return s.Split('\n'); + } + } } }