draft for adding/removing phones

This commit is contained in:
abdelkader
2023-07-15 21:37:02 -04:00
parent 016c23d4fc
commit 634f82b3bb
23 changed files with 1384 additions and 471 deletions

View File

@@ -208,9 +208,11 @@ namespace VCFEditor.Presenter
MostRecentUsedFiles.Enqueue(path);
_view.UpdateMRUMenu(MostRecentUsedFiles);
}
_repository.LoadContacts(path);
_view.DisplayContacts(_repository.Contacts);
if (!_repository.LoadContacts(path))
_view.DisplayMessage("File seems missing or corrupted!", "Error");
else
_view.DisplayContacts(_repository.Contacts);
}
@@ -218,6 +220,7 @@ namespace VCFEditor.Presenter
public void ChangeContactSelectedHandler(object sender, EventArgs e)
{
if (_view.SelectedContactIndex > -1)
{
vCard card = _repository.Contacts[_view.SelectedContactIndex].card;

View File

@@ -49,11 +49,18 @@ namespace VCFEditor.Repository
_fileHandler = fileHandler;
}
public SortableBindingList<Contact> LoadContacts(string fileName)
public bool LoadContacts(string fileName)
{
Contacts.Clear();
this.fileName = fileName;
if (!_fileHandler.FileExist(fileName))
{
OriginalContactList = null;
return false;
}
string[] lines = _fileHandler.ReadAllLines(fileName);
StringBuilder RawContent = new StringBuilder();
@@ -73,7 +80,7 @@ namespace VCFEditor.Repository
}
OriginalContactList = Contacts;
return Contacts;
return true;
}
public void AddEmptyContact()
@@ -204,9 +211,18 @@ namespace VCFEditor.Repository
SaveWebUrl(NewCard, card);
SaveAddresses(NewCard, card);
SaveExtraField(NewCard, card);
SaveExtraPhones(NewCard, card);
}
}
private void SaveExtraPhones(vCard newCard, vCard card)
{
card.Phones.Clear();
foreach (var item in newCard.Phones)
card.Phones.Add(new vCardPhone(item.FullNumber, item.PhoneType));
}
private void SaveExtraField(vCard newCard, vCard card)
{
card.Notes.Clear();

View File

@@ -14,7 +14,7 @@ namespace VCFEditor.Repository
bool dirty { get; }
string fileName { get; set; }
SortableBindingList<Contact> Contacts { get; set; }
SortableBindingList<Contact> LoadContacts(string fileName);
bool LoadContacts(string fileName);
SortableBindingList<Contact> FilterContacts(string p);
void SaveContactsToFile(string fileName);
void DeleteContact();

View File

@@ -21,7 +21,7 @@ namespace Thought.vCards
/// </remarks>
/// <seealso cref="vCardEmailAddressCollection"/>
/// <seealso cref="vCardEmailAddressType"/>
public class vCardEmailAddress
public class vCardEmailAddress : vCardRoot
{
private string address;

View File

@@ -16,7 +16,7 @@ namespace Thought.vCards
/// <seealso cref="vCardPhoneCollection"/>
/// <seealso cref="vCardPhoneTypes"/>
[Serializable]
public class vCardPhone
public class vCardPhone : vCardRoot
{
private string fullNumber;

View File

@@ -0,0 +1,6 @@
namespace Thought.vCards
{
public class vCardRoot
{
}
}

View File

@@ -15,7 +15,7 @@ namespace Thought.vCards
/// </summary>
/// <seealso cref="vCardWebsiteCollection"/>
/// <seealso cref="vCardWebsiteTypes"/>
public class vCardWebsite
public class vCardWebsite : vCardRoot
{
private string url;

View File

@@ -0,0 +1,98 @@

namespace vCardEditor.View.Customs
{
partial class CustumInputDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnOK = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.tbInput = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(252, 67);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 0;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(171, 67);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
//
// tbInput
//
this.tbInput.Location = new System.Drawing.Point(80, 26);
this.tbInput.Name = "tbInput";
this.tbInput.Size = new System.Drawing.Size(247, 22);
this.tbInput.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 17);
this.label1.TabIndex = 3;
this.label1.Text = "Label :";
//
// CustumInputDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(344, 102);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbInput);
this.Controls.Add(this.button2);
this.Controls.Add(this.btnOK);
this.Name = "CustumInputDialog";
this.Text = "Label Dialog";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CustumInputDialog_FormClosing);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox tbInput;
private System.Windows.Forms.Label label1;
}
}

View File

@@ -0,0 +1,21 @@
using System.Windows.Forms;
namespace vCardEditor.View.Customs
{
public partial class CustumInputDialog : Form
{
public CustumInputDialog()
{
InitializeComponent();
}
public string input { get; set; }
private void CustumInputDialog_FormClosing(object sender, FormClosingEventArgs e)
{
input = tbInput.Text;
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,158 @@

namespace vCardEditor.View.Customs
{
partial class ExtendedPanel
{
/// <summary>
/// Variable nécessaire au concepteur.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Nettoyage des ressources utilisées.
/// </summary>
/// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Code généré par le Concepteur de composants
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.gbExtended = new System.Windows.Forms.GroupBox();
this.btnAddExtraText = new System.Windows.Forms.Button();
this.PanelContent = new System.Windows.Forms.Panel();
this.menuPhone = new System.Windows.Forms.ContextMenuStrip(this.components);
this.miCell = new System.Windows.Forms.ToolStripMenuItem();
this.miHome = new System.Windows.Forms.ToolStripMenuItem();
this.miWork = new System.Windows.Forms.ToolStripMenuItem();
this.menuWeb = new System.Windows.Forms.ContextMenuStrip(this.components);
this.miEmail = new System.Windows.Forms.ToolStripMenuItem();
this.miWeb = new System.Windows.Forms.ToolStripMenuItem();
this.gbExtended.SuspendLayout();
this.menuPhone.SuspendLayout();
this.menuWeb.SuspendLayout();
this.SuspendLayout();
//
// gbExtended
//
this.gbExtended.Controls.Add(this.btnAddExtraText);
this.gbExtended.Controls.Add(this.PanelContent);
this.gbExtended.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbExtended.Location = new System.Drawing.Point(0, 0);
this.gbExtended.Margin = new System.Windows.Forms.Padding(4);
this.gbExtended.Name = "gbExtended";
this.gbExtended.Padding = new System.Windows.Forms.Padding(4);
this.gbExtended.Size = new System.Drawing.Size(367, 155);
this.gbExtended.TabIndex = 3;
this.gbExtended.TabStop = false;
//
// btnAddExtraText
//
this.btnAddExtraText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnAddExtraText.BackColor = System.Drawing.SystemColors.Window;
this.btnAddExtraText.Image = global::vCardEditor.Properties.Resources.Add;
this.btnAddExtraText.Location = new System.Drawing.Point(316, -3);
this.btnAddExtraText.Name = "btnAddExtraText";
this.btnAddExtraText.Size = new System.Drawing.Size(39, 23);
this.btnAddExtraText.TabIndex = 58;
this.btnAddExtraText.UseVisualStyleBackColor = true;
this.btnAddExtraText.Click += new System.EventHandler(this.btnAddExtraText_Click);
//
// PanelContent
//
this.PanelContent.AutoScroll = true;
this.PanelContent.Dock = System.Windows.Forms.DockStyle.Fill;
this.PanelContent.Location = new System.Drawing.Point(4, 19);
this.PanelContent.Name = "PanelContent";
this.PanelContent.Size = new System.Drawing.Size(359, 132);
this.PanelContent.TabIndex = 0;
//
// menuPhone
//
this.menuPhone.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuPhone.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.miCell,
this.miHome,
this.miWork});
this.menuPhone.Name = "contextMenuStrip1";
this.menuPhone.Size = new System.Drawing.Size(120, 76);
//
// miCell
//
this.miCell.Name = "miCell";
this.miCell.Size = new System.Drawing.Size(119, 24);
this.miCell.Text = "Cell";
//
// miHome
//
this.miHome.Name = "miHome";
this.miHome.Size = new System.Drawing.Size(119, 24);
this.miHome.Text = "Home";
//
// miWork
//
this.miWork.Name = "miWork";
this.miWork.Size = new System.Drawing.Size(119, 24);
this.miWork.Text = "Work";
//
// menuWeb
//
this.menuWeb.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuWeb.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.miEmail,
this.miWeb});
this.menuWeb.Name = "contextMenuStrip1";
this.menuWeb.Size = new System.Drawing.Size(211, 80);
//
// miEmail
//
this.miEmail.Name = "miEmail";
this.miEmail.Size = new System.Drawing.Size(210, 24);
this.miEmail.Text = "Email";
//
// miWeb
//
this.miWeb.Name = "miWeb";
this.miWeb.Size = new System.Drawing.Size(210, 24);
this.miWeb.Text = "Web";
//
// ExtendedPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.gbExtended);
this.Name = "ExtendedPanel";
this.Size = new System.Drawing.Size(367, 155);
this.gbExtended.ResumeLayout(false);
this.menuPhone.ResumeLayout(false);
this.menuWeb.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox gbExtended;
private System.Windows.Forms.Button btnAddExtraText;
private System.Windows.Forms.Panel PanelContent;
private System.Windows.Forms.ContextMenuStrip menuPhone;
private System.Windows.Forms.ToolStripMenuItem miCell;
private System.Windows.Forms.ToolStripMenuItem miHome;
private System.Windows.Forms.ToolStripMenuItem miWork;
private System.Windows.Forms.ContextMenuStrip menuWeb;
private System.Windows.Forms.ToolStripMenuItem miEmail;
private System.Windows.Forms.ToolStripMenuItem miWeb;
}
}

View File

@@ -0,0 +1,154 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Thought.vCards;
namespace vCardEditor.View.Customs
{
public partial class ExtendedPanel : UserControl
{
public event EventHandler ContentTextChanged;
public string Caption
{
get { return PanelContent.Text; }
set { PanelContent.Text = value; }
}
public PanelType panelType { get; set; }
public ExtendedPanel(PanelType _panel)
{
InitializeComponent();
panelType = _panel;
miCell.Click += MenuItemClickHandlers;
miCell.Tag = new vCardPhone(string.Empty, vCardPhoneTypes.Cellular);
miHome.Tag = new vCardPhone(string.Empty, vCardPhoneTypes.Home);
miHome.Click += MenuItemClickHandlers;
miWork.Tag = new vCardPhone(string.Empty, vCardPhoneTypes.Home);
miWork.Click += MenuItemClickHandlers;
miEmail.Tag = new vCardEmailAddress(string.Empty, vCardEmailAddressType.Internet);
miEmail.Click += MenuItemClickHandlers;
miWeb.Tag = new vCardWebsite(string.Empty, vCardWebsiteTypes.Personal);
miWeb.Click += MenuItemClickHandlers;
//TODO : For Custom types
//CustumInputDialog custom = new CustumInputDialog();
//var res = custom.ShowDialog();
//if (res == DialogResult.OK)
//{
// AddControl(custom.input, string.Empty);
//}
}
private void MenuItemClickHandlers(object sender, EventArgs e)
{
var tag = (sender as ToolStripMenuItem).Tag;
if (tag != null && tag is vCardRoot)
AddControl(tag as vCardRoot);
}
private void btnAddExtraText_Click(object sender, EventArgs e)
{
Button btnSender = (Button)sender;
Point ptLowerLeft = new Point(0, btnSender.Height);
ptLowerLeft = btnSender.PointToScreen(ptLowerLeft);
switch (panelType)
{
case PanelType.Phone:
menuPhone.Show(ptLowerLeft);
break;
case PanelType.Web:
menuWeb.Show(ptLowerLeft);
break;
default:
break;
}
}
public void AddControl(vCardRoot card)
{
Point pt = GetCoordinatesForNewControl();
RemovableTextBox ctl = new RemovableTextBox(card);
ctl.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left;
ctl.Location = pt;
ctl.Width = PanelContent.Width - 20; //TODO : Calculte the right size of the scrollbar!
ctl.BoutonRemoveClicked += RemoveControl;
ctl.ContentTextChanged += (s, e) => ContentTextChanged?.Invoke(s, e);
PanelContent.Controls.Add(ctl);
}
public List<vCardRoot> GetExtraFields()
{
List<vCardRoot> result = new List<vCardRoot>();
foreach (var item in PanelContent.Controls)
{
var ctl = item as RemovableTextBox;
result.Add(ctl.Tag as vCardRoot);
}
return result;
}
public void ClearFields()
{
if (PanelContent.Controls.Count > 0)
PanelContent.Controls.Clear();
}
private void RemoveControl(object sender, EventArgs e)
{
var par = (sender as Control).Parent;
PanelContent.Controls.Remove(par);
ReplaceControls();
}
private void ReplaceControls()
{
for (int i = 0; i < PanelContent.Controls.Count; i++)
{
var ctl = PanelContent.Controls[i];
ctl.Location = new Point(5, (i * 30) + 10);
}
}
private Point GetCoordinatesForNewControl()
{
Point pt;
if (PanelContent.Controls.Count > 0)
{
var LastControl = PanelContent.Controls[PanelContent.Controls.Count - 1];
pt = LastControl.Location;
pt.Y += 30;
}
else
pt = new Point(5, 10);
return pt;
}
}
}

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuPhone.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuWeb.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>203, 17</value>
</metadata>
</root>

View File

@@ -39,7 +39,7 @@ namespace vCardEditor.View.UIToolbox
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.BackgroundImage = global::vCardEditor.Properties.Resources.Close;
this.btnClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.btnClose.Location = new System.Drawing.Point(594, 27);
this.btnClose.Location = new System.Drawing.Point(594, 18);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(23, 23);
this.btnClose.TabIndex = 1;

View File

@@ -0,0 +1,8 @@
namespace vCardEditor.View.Customs
{
public enum PanelType
{
Phone,
Web
}
}

View File

@@ -0,0 +1,91 @@

namespace vCardEditor.View.Customs
{
partial class RemovableTextBox
{
/// <summary>
/// Variable nécessaire au concepteur.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Nettoyage des ressources utilisées.
/// </summary>
/// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Code généré par le Concepteur de composants
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
private void InitializeComponent()
{
this.btnRemove = new System.Windows.Forms.Button();
this.TitleLabel = new System.Windows.Forms.Label();
this.ContentTextBox = new vCardEditor.View.StateTextBox();
this.SuspendLayout();
//
// btnRemove
//
this.btnRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRemove.BackgroundImage = global::vCardEditor.Properties.Resources.Close;
this.btnRemove.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.btnRemove.FlatAppearance.BorderSize = 0;
this.btnRemove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRemove.Location = new System.Drawing.Point(315, 4);
this.btnRemove.Name = "btnRemove";
this.btnRemove.Size = new System.Drawing.Size(18, 24);
this.btnRemove.TabIndex = 13;
this.btnRemove.UseVisualStyleBackColor = true;
//
// TitleLabel
//
this.TitleLabel.Location = new System.Drawing.Point(-1, 6);
this.TitleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.TitleLabel.Name = "TitleLabel";
this.TitleLabel.Size = new System.Drawing.Size(61, 23);
this.TitleLabel.TabIndex = 11;
this.TitleLabel.Text = "Home :";
this.TitleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// ContentTextBox
//
this.ContentTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ContentTextBox.Location = new System.Drawing.Point(67, 6);
this.ContentTextBox.Margin = new System.Windows.Forms.Padding(4);
this.ContentTextBox.Name = "ContentTextBox";
this.ContentTextBox.oldText = null;
this.ContentTextBox.Size = new System.Drawing.Size(241, 22);
this.ContentTextBox.TabIndex = 12;
//
// RemovableTextBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnRemove);
this.Controls.Add(this.TitleLabel);
this.Controls.Add(this.ContentTextBox);
this.Name = "RemovableTextBox";
this.Size = new System.Drawing.Size(332, 35);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnRemove;
internal System.Windows.Forms.Label TitleLabel;
internal StateTextBox ContentTextBox;
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Windows.Forms;
using Thought.vCards;
namespace vCardEditor.View.Customs
{
public partial class RemovableTextBox : UserControl
{
public event EventHandler BoutonRemoveClicked;
public event EventHandler ContentTextChanged;
public RemovableTextBox()
{
InitializeComponent();
btnRemove.Click += (s, e) => BoutonRemoveClicked?.Invoke(s, e);
ContentTextBox.LostFocus += (s, e) => ContentTextChanged?.Invoke(s, e);
ContentTextBox.Validated += (s, e) => ContentTextChanged?.Invoke(s, e);
}
public RemovableTextBox(vCardRoot cardType) : this()
{
//CardType = cardType;
this.Tag = cardType;
switch (cardType)
{
case vCardPhone phone:
Title = phone.PhoneType.ToString();
Content = phone.FullNumber;
break;
case vCardEmailAddress email:
Title = email.EmailType.ToString();
Content = email.Address;
break;
case vCardWebsite website:
Title = website.WebsiteType.ToString();
Content = website.Url;
break;
default:
break;
}
}
public string Title
{
get { return TitleLabel.Text; }
set { TitleLabel.Text = value; }
}
public string Content
{
get { return ContentTextBox.Text; }
set { ContentTextBox.Text = value; }
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -32,7 +32,7 @@ namespace vCardEditor.View
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.miSave = new System.Windows.Forms.ToolStripMenuItem();
@@ -43,6 +43,9 @@ namespace vCardEditor.View
this.miQuit = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.extraFieldsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addNotesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addOrgToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.imagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -74,41 +77,27 @@ namespace vCardEditor.View
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tcMainTab = new System.Windows.Forms.TabControl();
this.TapPageMain = new System.Windows.Forms.TabPage();
this.gbContactDetail = new System.Windows.Forms.GroupBox();
this.extendedPanelWeb = new vCardEditor.View.Customs.ExtendedPanel(PanelType.Web);
this.extendedPanelPhones = new vCardEditor.View.Customs.ExtendedPanel(PanelType.Phone);
this.btnExportImage = new System.Windows.Forms.Button();
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.btnRemoveImage = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.FormattedTitleLabel = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.FormattedNameLabel = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.EmailAddressLabel = new System.Windows.Forms.Label();
this.PersonalWebSiteLabel = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.WorkPhoneLabel = new System.Windows.Forms.Label();
this.HomePhoneLabel = new System.Windows.Forms.Label();
this.CellularPhoneLabel = new System.Windows.Forms.Label();
this.tbcAddress = new vCardEditor.View.Customs.AddressTabControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.PhotoBox = new System.Windows.Forms.PictureBox();
this.TapPageExtra = new System.Windows.Forms.TabPage();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.tbcAddress = new vCardEditor.View.Customs.AddressTabControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.FormattedTitleValue = new vCardEditor.View.StateTextBox();
this.lastNameValue = new vCardEditor.View.StateTextBox();
this.middleNameValue = new vCardEditor.View.StateTextBox();
this.firstNameValue = new vCardEditor.View.StateTextBox();
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.extraFieldsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addNotesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addOrgToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.bsContacts)).BeginInit();
@@ -121,14 +110,11 @@ namespace vCardEditor.View
this.splitContainer1.SuspendLayout();
this.tcMainTab.SuspendLayout();
this.TapPageMain.SuspendLayout();
this.gbContactDetail.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.tbcAddress.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).BeginInit();
this.TapPageExtra.SuspendLayout();
this.tbcAddress.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
@@ -212,10 +198,33 @@ namespace vCardEditor.View
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.copyToolStripMenuItem.Size = new System.Drawing.Size(167, 26);
this.copyToolStripMenuItem.Text = "Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
//
// extraFieldsToolStripMenuItem
//
this.extraFieldsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addNotesToolStripMenuItem,
this.addOrgToolStripMenuItem});
this.extraFieldsToolStripMenuItem.Name = "extraFieldsToolStripMenuItem";
this.extraFieldsToolStripMenuItem.Size = new System.Drawing.Size(167, 26);
this.extraFieldsToolStripMenuItem.Text = "Extra Fields";
//
// addNotesToolStripMenuItem
//
this.addNotesToolStripMenuItem.Name = "addNotesToolStripMenuItem";
this.addNotesToolStripMenuItem.Size = new System.Drawing.Size(163, 26);
this.addNotesToolStripMenuItem.Text = "Add Notes";
this.addNotesToolStripMenuItem.Click += new System.EventHandler(this.addNotesToolStripMenuItem_Click);
//
// addOrgToolStripMenuItem
//
this.addOrgToolStripMenuItem.Name = "addOrgToolStripMenuItem";
this.addOrgToolStripMenuItem.Size = new System.Drawing.Size(163, 26);
this.addOrgToolStripMenuItem.Text = "Add Org";
this.addOrgToolStripMenuItem.Click += new System.EventHandler(this.addOrgToolStripMenuItem_Click);
//
// toolsToolStripMenuItem
//
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -231,7 +240,7 @@ namespace vCardEditor.View
this.clearToolStripMenuItem,
this.countToolStripMenuItem});
this.imagesToolStripMenuItem.Name = "imagesToolStripMenuItem";
this.imagesToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.imagesToolStripMenuItem.Size = new System.Drawing.Size(140, 26);
this.imagesToolStripMenuItem.Text = "Images";
//
// exportToolStripMenuItem
@@ -272,7 +281,7 @@ namespace vCardEditor.View
// statusStrip1
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.statusStrip1.Location = new System.Drawing.Point(0, 625);
this.statusStrip1.Location = new System.Drawing.Point(0, 641);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);
this.statusStrip1.Size = new System.Drawing.Size(1202, 22);
@@ -371,7 +380,7 @@ namespace vCardEditor.View
this.gbNameList.Margin = new System.Windows.Forms.Padding(4);
this.gbNameList.Name = "gbNameList";
this.gbNameList.Padding = new System.Windows.Forms.Padding(4);
this.gbNameList.Size = new System.Drawing.Size(398, 570);
this.gbNameList.Size = new System.Drawing.Size(398, 586);
this.gbNameList.TabIndex = 2;
this.gbNameList.TabStop = false;
this.gbNameList.Text = "Name List :";
@@ -381,8 +390,8 @@ namespace vCardEditor.View
this.dgContacts.AllowUserToAddRows = false;
this.dgContacts.AllowUserToDeleteRows = false;
this.dgContacts.AllowUserToResizeRows = false;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.dgContacts.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.dgContacts.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgContacts.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)));
@@ -403,7 +412,7 @@ namespace vCardEditor.View
this.dgContacts.RowHeadersVisible = false;
this.dgContacts.RowHeadersWidth = 51;
this.dgContacts.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgContacts.Size = new System.Drawing.Size(390, 515);
this.dgContacts.Size = new System.Drawing.Size(390, 533);
this.dgContacts.TabIndex = 2;
this.dgContacts.CellContextMenuStripNeeded += new System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventHandler(this.dgContacts_CellContextMenuStripNeeded);
this.dgContacts.RowLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgContacts_RowLeave);
@@ -496,7 +505,7 @@ namespace vCardEditor.View
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.tcMainTab);
this.splitContainer1.Size = new System.Drawing.Size(1202, 570);
this.splitContainer1.Size = new System.Drawing.Size(1202, 586);
this.splitContainer1.SplitterDistance = 398;
this.splitContainer1.TabIndex = 4;
//
@@ -505,81 +514,60 @@ namespace vCardEditor.View
this.tcMainTab.Controls.Add(this.TapPageMain);
this.tcMainTab.Controls.Add(this.TapPageExtra);
this.tcMainTab.Dock = System.Windows.Forms.DockStyle.Fill;
this.tcMainTab.Enabled = false;
this.tcMainTab.Location = new System.Drawing.Point(0, 0);
this.tcMainTab.Name = "tcMainTab";
this.tcMainTab.SelectedIndex = 0;
this.tcMainTab.Size = new System.Drawing.Size(800, 570);
this.tcMainTab.Size = new System.Drawing.Size(800, 586);
this.tcMainTab.TabIndex = 0;
//
// TapPageMain
//
this.TapPageMain.BackColor = System.Drawing.SystemColors.Control;
this.TapPageMain.Controls.Add(this.gbContactDetail);
this.TapPageMain.Controls.Add(this.extendedPanelWeb);
this.TapPageMain.Controls.Add(this.extendedPanelPhones);
this.TapPageMain.Controls.Add(this.btnExportImage);
this.TapPageMain.Controls.Add(this.groupBox3);
this.TapPageMain.Controls.Add(this.btnRemoveImage);
this.TapPageMain.Controls.Add(this.groupBox4);
this.TapPageMain.Controls.Add(this.PhotoBox);
this.TapPageMain.Location = new System.Drawing.Point(4, 25);
this.TapPageMain.Name = "TapPageMain";
this.TapPageMain.Padding = new System.Windows.Forms.Padding(3);
this.TapPageMain.Size = new System.Drawing.Size(792, 541);
this.TapPageMain.Size = new System.Drawing.Size(792, 557);
this.TapPageMain.TabIndex = 0;
this.TapPageMain.Text = "Main";
//
// gbContactDetail
// extendedPanelWeb
//
this.gbContactDetail.Controls.Add(this.btnExportImage);
this.gbContactDetail.Controls.Add(this.btnRemoveImage);
this.gbContactDetail.Controls.Add(this.groupBox4);
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.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbContactDetail.Enabled = false;
this.gbContactDetail.ForeColor = System.Drawing.SystemColors.ControlText;
this.gbContactDetail.Location = new System.Drawing.Point(3, 3);
this.gbContactDetail.Margin = new System.Windows.Forms.Padding(4);
this.gbContactDetail.Name = "gbContactDetail";
this.gbContactDetail.Padding = new System.Windows.Forms.Padding(4);
this.gbContactDetail.Size = new System.Drawing.Size(786, 535);
this.gbContactDetail.TabIndex = 4;
this.gbContactDetail.TabStop = false;
this.gbContactDetail.Text = "Contact Detail :";
this.extendedPanelWeb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.extendedPanelWeb.Caption = "";
this.extendedPanelWeb.Location = new System.Drawing.Point(402, 389);
this.extendedPanelWeb.Name = "extendedPanelWeb";
this.extendedPanelWeb.Size = new System.Drawing.Size(381, 155);
this.extendedPanelWeb.TabIndex = 59;
//
// extendedPanelPhones
//
this.extendedPanelPhones.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.extendedPanelPhones.Caption = "";
this.extendedPanelPhones.Location = new System.Drawing.Point(13, 389);
this.extendedPanelPhones.Name = "extendedPanelPhones";
this.extendedPanelPhones.Size = new System.Drawing.Size(367, 155);
this.extendedPanelPhones.TabIndex = 58;
//
// btnExportImage
//
this.btnExportImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExportImage.BackColor = System.Drawing.SystemColors.Window;
this.btnExportImage.Image = ((System.Drawing.Image)(resources.GetObject("btnExportImage.Image")));
this.btnExportImage.Location = new System.Drawing.Point(734, 170);
this.btnExportImage.Location = new System.Drawing.Point(725, 154);
this.btnExportImage.Name = "btnExportImage";
this.btnExportImage.Size = new System.Drawing.Size(21, 23);
this.btnExportImage.TabIndex = 54;
this.btnExportImage.TabIndex = 57;
this.btnExportImage.UseVisualStyleBackColor = true;
//
// btnRemoveImage
//
this.btnRemoveImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRemoveImage.BackColor = System.Drawing.SystemColors.Window;
this.btnRemoveImage.Image = ((System.Drawing.Image)(resources.GetObject("btnRemoveImage.Image")));
this.btnRemoveImage.Location = new System.Drawing.Point(758, 170);
this.btnRemoveImage.Name = "btnRemoveImage";
this.btnRemoveImage.Size = new System.Drawing.Size(20, 23);
this.btnRemoveImage.TabIndex = 54;
this.btnRemoveImage.UseVisualStyleBackColor = true;
//
// groupBox4
//
this.groupBox4.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.groupBox4.Controls.Add(this.tbcAddress);
this.groupBox4.Location = new System.Drawing.Point(8, 190);
this.groupBox4.Margin = new System.Windows.Forms.Padding(4);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Padding = new System.Windows.Forms.Padding(4);
this.groupBox4.Size = new System.Drawing.Size(770, 194);
this.groupBox4.TabIndex = 1;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Address:";
//
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -594,210 +582,15 @@ namespace vCardEditor.View
this.groupBox3.Controls.Add(this.label1);
this.groupBox3.Controls.Add(this.FormattedNameValue);
this.groupBox3.Controls.Add(this.FormattedNameLabel);
this.groupBox3.Location = new System.Drawing.Point(8, 23);
this.groupBox3.Location = new System.Drawing.Point(11, 7);
this.groupBox3.Margin = new System.Windows.Forms.Padding(4);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(4);
this.groupBox3.Size = new System.Drawing.Size(561, 159);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabIndex = 6;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Name";
//
// FormattedTitleLabel
//
this.FormattedTitleLabel.Location = new System.Drawing.Point(7, 20);
this.FormattedTitleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.FormattedTitleLabel.Name = "FormattedTitleLabel";
this.FormattedTitleLabel.Size = new System.Drawing.Size(41, 23);
this.FormattedTitleLabel.TabIndex = 0;
this.FormattedTitleLabel.Text = "Title:";
this.FormattedTitleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label3
//
this.label3.Location = new System.Drawing.Point(341, 53);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 23);
this.label3.TabIndex = 8;
this.label3.Text = "Last:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label2
//
this.label2.Location = new System.Drawing.Point(151, 53);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 23);
this.label2.TabIndex = 6;
this.label2.Text = "Middle:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label1
//
this.label1.Location = new System.Drawing.Point(4, 53);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(44, 23);
this.label1.TabIndex = 4;
this.label1.Text = "First:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// FormattedNameLabel
//
this.FormattedNameLabel.Location = new System.Drawing.Point(148, 21);
this.FormattedNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.FormattedNameLabel.Name = "FormattedNameLabel";
this.FormattedNameLabel.Size = new System.Drawing.Size(81, 23);
this.FormattedNameLabel.TabIndex = 2;
this.FormattedNameLabel.Text = "Full Name:";
this.FormattedNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
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(350, 392);
this.groupBox2.Margin = new System.Windows.Forms.Padding(4);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(4);
this.groupBox2.Size = new System.Drawing.Size(420, 129);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Web : ";
//
// EmailAddressLabel
//
this.EmailAddressLabel.Location = new System.Drawing.Point(7, 27);
this.EmailAddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.EmailAddressLabel.Name = "EmailAddressLabel";
this.EmailAddressLabel.Size = new System.Drawing.Size(47, 23);
this.EmailAddressLabel.TabIndex = 0;
this.EmailAddressLabel.Text = "Email:";
this.EmailAddressLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// PersonalWebSiteLabel
//
this.PersonalWebSiteLabel.Location = new System.Drawing.Point(10, 55);
this.PersonalWebSiteLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.PersonalWebSiteLabel.Name = "PersonalWebSiteLabel";
this.PersonalWebSiteLabel.Size = new System.Drawing.Size(43, 23);
this.PersonalWebSiteLabel.TabIndex = 2;
this.PersonalWebSiteLabel.Text = "Web:";
this.PersonalWebSiteLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
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(8, 392);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
this.groupBox1.Size = new System.Drawing.Size(334, 129);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Phones : ";
//
// WorkPhoneLabel
//
this.WorkPhoneLabel.Location = new System.Drawing.Point(11, 86);
this.WorkPhoneLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.WorkPhoneLabel.Name = "WorkPhoneLabel";
this.WorkPhoneLabel.Size = new System.Drawing.Size(60, 23);
this.WorkPhoneLabel.TabIndex = 4;
this.WorkPhoneLabel.Text = "Work:";
this.WorkPhoneLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// HomePhoneLabel
//
this.HomePhoneLabel.Location = new System.Drawing.Point(12, 26);
this.HomePhoneLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.HomePhoneLabel.Name = "HomePhoneLabel";
this.HomePhoneLabel.Size = new System.Drawing.Size(60, 23);
this.HomePhoneLabel.TabIndex = 0;
this.HomePhoneLabel.Text = "Home :";
this.HomePhoneLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// CellularPhoneLabel
//
this.CellularPhoneLabel.Location = new System.Drawing.Point(8, 57);
this.CellularPhoneLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.CellularPhoneLabel.Name = "CellularPhoneLabel";
this.CellularPhoneLabel.Size = new System.Drawing.Size(60, 23);
this.CellularPhoneLabel.TabIndex = 2;
this.CellularPhoneLabel.Text = "Cellular:";
this.CellularPhoneLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// PhotoBox
//
this.PhotoBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.PhotoBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.PhotoBox.Image = ((System.Drawing.Image)(resources.GetObject("PhotoBox.Image")));
this.PhotoBox.Location = new System.Drawing.Point(593, 23);
this.PhotoBox.Margin = new System.Windows.Forms.Padding(4);
this.PhotoBox.Name = "PhotoBox";
this.PhotoBox.Size = new System.Drawing.Size(185, 159);
this.PhotoBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.PhotoBox.TabIndex = 53;
this.PhotoBox.TabStop = false;
//
// TapPageExtra
//
this.TapPageExtra.BackColor = System.Drawing.SystemColors.Control;
this.TapPageExtra.Controls.Add(this.flowLayoutPanel1);
this.TapPageExtra.Location = new System.Drawing.Point(4, 25);
this.TapPageExtra.Name = "TapPageExtra";
this.TapPageExtra.Padding = new System.Windows.Forms.Padding(3);
this.TapPageExtra.Size = new System.Drawing.Size(792, 535);
this.TapPageExtra.TabIndex = 1;
this.TapPageExtra.Text = "Extra";
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.BackColor = System.Drawing.SystemColors.Control;
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(786, 529);
this.flowLayoutPanel1.TabIndex = 0;
//
// tbcAddress
//
this.tbcAddress.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.tbcAddress.Controls.Add(this.tabPage3);
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(745, 156);
this.tbcAddress.TabIndex = 0;
//
// tabPage3
//
this.tabPage3.BackColor = System.Drawing.SystemColors.Control;
this.tabPage3.Location = new System.Drawing.Point(4, 27);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(737, 125);
this.tabPage3.TabIndex = 0;
this.tabPage3.Text = " ";
//
// FormattedTitleValue
//
this.FormattedTitleValue.Location = new System.Drawing.Point(45, 21);
@@ -809,6 +602,16 @@ namespace vCardEditor.View
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(7, 20);
this.FormattedTitleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.FormattedTitleLabel.Name = "FormattedTitleLabel";
this.FormattedTitleLabel.Size = new System.Drawing.Size(41, 23);
this.FormattedTitleLabel.TabIndex = 0;
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)
@@ -822,6 +625,16 @@ namespace vCardEditor.View
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);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 23);
this.label3.TabIndex = 8;
this.label3.Text = "Last:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// middleNameValue
//
this.middleNameValue.Location = new System.Drawing.Point(237, 53);
@@ -833,6 +646,16 @@ namespace vCardEditor.View
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);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 23);
this.label2.TabIndex = 6;
this.label2.Text = "Middle:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// firstNameValue
//
this.firstNameValue.Location = new System.Drawing.Point(45, 53);
@@ -844,6 +667,16 @@ namespace vCardEditor.View
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);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(44, 23);
this.label1.TabIndex = 4;
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)
@@ -857,100 +690,108 @@ namespace vCardEditor.View
this.FormattedNameValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.FormattedNameValue.Validated += new System.EventHandler(this.Value_TextChanged);
//
// EmailAddressValue
// FormattedNameLabel
//
this.EmailAddressValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.FormattedNameLabel.Location = new System.Drawing.Point(148, 21);
this.FormattedNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.FormattedNameLabel.Name = "FormattedNameLabel";
this.FormattedNameLabel.Size = new System.Drawing.Size(81, 23);
this.FormattedNameLabel.TabIndex = 2;
this.FormattedNameLabel.Text = "Full Name:";
this.FormattedNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnRemoveImage
//
this.btnRemoveImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRemoveImage.BackColor = System.Drawing.SystemColors.Window;
this.btnRemoveImage.Image = ((System.Drawing.Image)(resources.GetObject("btnRemoveImage.Image")));
this.btnRemoveImage.Location = new System.Drawing.Point(749, 154);
this.btnRemoveImage.Name = "btnRemoveImage";
this.btnRemoveImage.Size = new System.Drawing.Size(20, 23);
this.btnRemoveImage.TabIndex = 56;
this.btnRemoveImage.UseVisualStyleBackColor = true;
//
// groupBox4
//
this.groupBox4.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.EmailAddressValue.Location = new System.Drawing.Point(62, 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(350, 22);
this.EmailAddressValue.TabIndex = 1;
this.EmailAddressValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.EmailAddressValue.Validated += new System.EventHandler(this.Value_TextChanged);
this.groupBox4.Controls.Add(this.tbcAddress);
this.groupBox4.Location = new System.Drawing.Point(13, 184);
this.groupBox4.Margin = new System.Windows.Forms.Padding(4);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Padding = new System.Windows.Forms.Padding(4);
this.groupBox4.Size = new System.Drawing.Size(770, 198);
this.groupBox4.TabIndex = 5;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Address:";
//
// PersonalWebSiteValue
// tbcAddress
//
this.PersonalWebSiteValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.tbcAddress.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.PersonalWebSiteValue.Location = new System.Drawing.Point(62, 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(350, 22);
this.PersonalWebSiteValue.TabIndex = 3;
this.PersonalWebSiteValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.PersonalWebSiteValue.Validated += new System.EventHandler(this.Value_TextChanged);
this.tbcAddress.Controls.Add(this.tabPage3);
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(745, 160);
this.tbcAddress.TabIndex = 0;
//
// HomePhoneValue
// tabPage3
//
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(219, 22);
this.HomePhoneValue.TabIndex = 1;
this.HomePhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.HomePhoneValue.Validated += new System.EventHandler(this.Value_TextChanged);
this.tabPage3.BackColor = System.Drawing.SystemColors.Control;
this.tabPage3.Location = new System.Drawing.Point(4, 27);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(737, 129);
this.tabPage3.TabIndex = 0;
this.tabPage3.Text = " ";
//
// WorkPhoneValue
// PhotoBox
//
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(219, 22);
this.WorkPhoneValue.TabIndex = 5;
this.WorkPhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.WorkPhoneValue.Validated += new System.EventHandler(this.Value_TextChanged);
this.PhotoBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.PhotoBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.PhotoBox.Image = ((System.Drawing.Image)(resources.GetObject("PhotoBox.Image")));
this.PhotoBox.Location = new System.Drawing.Point(584, 7);
this.PhotoBox.Margin = new System.Windows.Forms.Padding(4);
this.PhotoBox.Name = "PhotoBox";
this.PhotoBox.Size = new System.Drawing.Size(185, 159);
this.PhotoBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.PhotoBox.TabIndex = 55;
this.PhotoBox.TabStop = false;
//
// CellularPhoneValue
// TapPageExtra
//
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(219, 22);
this.CellularPhoneValue.TabIndex = 3;
this.CellularPhoneValue.LostFocus += new System.EventHandler(this.Value_TextChanged);
this.CellularPhoneValue.Validated += new System.EventHandler(this.Value_TextChanged);
this.TapPageExtra.BackColor = System.Drawing.SystemColors.Control;
this.TapPageExtra.Controls.Add(this.flowLayoutPanel1);
this.TapPageExtra.Location = new System.Drawing.Point(4, 25);
this.TapPageExtra.Name = "TapPageExtra";
this.TapPageExtra.Padding = new System.Windows.Forms.Padding(3);
this.TapPageExtra.Size = new System.Drawing.Size(792, 557);
this.TapPageExtra.TabIndex = 1;
this.TapPageExtra.Text = "Extra";
//
// extraFieldsToolStripMenuItem
// flowLayoutPanel1
//
this.extraFieldsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addNotesToolStripMenuItem,
this.addOrgToolStripMenuItem});
this.extraFieldsToolStripMenuItem.Name = "extraFieldsToolStripMenuItem";
this.extraFieldsToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.extraFieldsToolStripMenuItem.Text = "Extra Fields";
//
// addNotesToolStripMenuItem
//
this.addNotesToolStripMenuItem.Name = "addNotesToolStripMenuItem";
this.addNotesToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.addNotesToolStripMenuItem.Text = "Add Notes";
this.addNotesToolStripMenuItem.Click += new System.EventHandler(this.addNotesToolStripMenuItem_Click);
//
// addOrgToolStripMenuItem
//
this.addOrgToolStripMenuItem.Name = "addOrgToolStripMenuItem";
this.addOrgToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.addOrgToolStripMenuItem.Text = "Add Org";
this.addOrgToolStripMenuItem.Click += new System.EventHandler(this.addOrgToolStripMenuItem_Click);
this.flowLayoutPanel1.BackColor = System.Drawing.SystemColors.Control;
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(786, 551);
this.flowLayoutPanel1.TabIndex = 0;
//
// MainForm
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1202, 647);
this.ClientSize = new System.Drawing.Size(1202, 663);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.statusStrip1);
@@ -979,17 +820,12 @@ namespace vCardEditor.View
this.splitContainer1.ResumeLayout(false);
this.tcMainTab.ResumeLayout(false);
this.TapPageMain.ResumeLayout(false);
this.gbContactDetail.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.tbcAddress.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).EndInit();
this.TapPageExtra.ResumeLayout(false);
this.tbcAddress.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -1038,12 +874,14 @@ namespace vCardEditor.View
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TabControl tcMainTab;
private System.Windows.Forms.TabPage TapPageMain;
private System.Windows.Forms.GroupBox gbContactDetail;
private System.Windows.Forms.TabPage TapPageExtra;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.ToolStripMenuItem extraFieldsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addNotesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addOrgToolStripMenuItem;
private ExtendedPanel extendedPanelWeb;
private ExtendedPanel extendedPanelPhones;
private System.Windows.Forms.Button btnExportImage;
private System.Windows.Forms.Button btnRemoveImage;
private System.Windows.Forms.GroupBox groupBox4;
private AddressTabControl tbcAddress;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.GroupBox groupBox3;
internal StateTextBox FormattedTitleValue;
internal System.Windows.Forms.Label FormattedTitleLabel;
@@ -1055,23 +893,10 @@ namespace vCardEditor.View
internal System.Windows.Forms.Label label1;
internal StateTextBox FormattedNameValue;
internal System.Windows.Forms.Label FormattedNameLabel;
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;
internal System.Windows.Forms.Label WorkPhoneLabel;
internal System.Windows.Forms.Label HomePhoneLabel;
internal StateTextBox HomePhoneValue;
internal StateTextBox WorkPhoneValue;
internal System.Windows.Forms.Label CellularPhoneLabel;
internal StateTextBox CellularPhoneValue;
private System.Windows.Forms.Button btnRemoveImage;
private System.Windows.Forms.GroupBox groupBox4;
private AddressTabControl tbcAddress;
private System.Windows.Forms.TabPage tabPage3;
internal System.Windows.Forms.PictureBox PhotoBox;
private System.Windows.Forms.TabPage TapPageExtra;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.ToolStripMenuItem extraFieldsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addNotesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addOrgToolStripMenuItem;
}
}

View File

@@ -52,12 +52,15 @@ namespace vCardEditor.View
public MainForm()
{
InitializeComponent();
resources = new ComponentResourceManager(typeof(MainForm));
tbcAddress.AddTab += (sender, e) => AddressAdded?.Invoke(sender, e);
tbcAddress.RemoveTab += (sender, e) => AddressRemoved?.Invoke(sender, e);
tbcAddress.ModifyTab += (sender, e) => AddressModified?.Invoke(sender, e);
tbcAddress.TextChangedEvent += (sender, e) => TextBoxValueChanged?.Invoke(sender, e);
btnClearFilter.Click += (sender, e) => textBoxFilter.Clear();
extendedPanelPhones.ContentTextChanged += (sender, e) => TextBoxValueChanged?.Invoke(sender, e);
extendedPanelWeb.ContentTextChanged += (sender, e) => TextBoxValueChanged?.Invoke(sender, e);
BuildMRUMenu();
}
@@ -108,36 +111,54 @@ namespace vCardEditor.View
public void DisplayContactDetail(vCard card, string FileName)
{
if (card == null)
throw new ArgumentException("vCard must be valid!");
ClearContactDetail();
Text = string.Format("{0} - vCard Editor", FileName);
gbContactDetail.Enabled = true;
//gbContactDetail.Enabled = true;
tcMainTab.Enabled = true;
gbNameList.Enabled = true;
SetSummaryValue(FormattedTitleValue, card.Title);
SetSummaryValue(firstNameValue, card.GivenName);
SetSummaryValue(lastNameValue, card.FamilyName);
SetSummaryValue(middleNameValue, card.AdditionalNames);
SetSummaryValue(FormattedTitleValue, card.Title);
SetSummaryValue(FormattedNameValue, card.FormattedName);
SetSummaryValue(HomePhoneValue, card.Phones.GetFirstChoice(vCardPhoneTypes.Home));
SetSummaryValue(CellularPhoneValue, card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular));
SetSummaryValue(WorkPhoneValue, card.Phones.GetFirstChoice(vCardPhoneTypes.Work));
SetSummaryValue(EmailAddressValue, card.EmailAddresses.GetFirstChoice(vCardEmailAddressType.Internet));
SetSummaryValue(PersonalWebSiteValue, card.Websites.GetFirstChoice(vCardWebsiteTypes.Personal));
SetAddressesValues(card);
SetPhotoValue(card.Photos);
SetExtraField(card);
SetExtraInfos(card);
SetExtraTabFields(card);
}
private void SetExtraField(vCard card)
private void SetExtraInfos(vCard card)
{
//Clear everything
flowLayoutPanel1.Controls.Clear();
foreach (var item in card.EmailAddresses)
{
extendedPanelWeb.AddControl(item);
}
foreach (var item in card.Websites)
{
extendedPanelWeb.AddControl(item);
}
foreach (var item in card.Phones)
{
extendedPanelPhones.AddControl(item);
}
}
private void SetExtraTabFields(vCard card)
{
if (card.Notes.Count > 0)
{
foreach (var note in card.Notes)
@@ -170,7 +191,8 @@ namespace vCardEditor.View
public void ClearContactDetail()
{
gbContactDetail.Enabled = false;
//gbContactDetail.Enabled = false;
tcMainTab.Enabled = false;
gbNameList.Enabled = false;
SetSummaryValue(firstNameValue, string.Empty);
@@ -178,14 +200,12 @@ namespace vCardEditor.View
SetSummaryValue(middleNameValue, string.Empty);
SetSummaryValue(FormattedTitleValue, string.Empty);
SetSummaryValue(FormattedNameValue, string.Empty);
SetSummaryValue(HomePhoneValue, string.Empty);
SetSummaryValue(CellularPhoneValue, string.Empty);
SetSummaryValue(WorkPhoneValue, string.Empty);
SetSummaryValue(EmailAddressValue, string.Empty);
SetSummaryValue(PersonalWebSiteValue, string.Empty);
SetAddressesValues(new vCard());
SetPhotoValue(new vCardPhotoCollection());
flowLayoutPanel1.Controls.Clear();
extendedPanelPhones.ClearFields();
extendedPanelWeb.ClearFields();
}
private void SetSummaryValue(StateTextBox valueLabel, string value)
@@ -198,28 +218,6 @@ namespace vCardEditor.View
valueLabel.oldText = value;
}
private void SetSummaryValue(StateTextBox valueLabel, vCardEmailAddress email)
{
valueLabel.Text = string.Empty;
if (email != null)
SetSummaryValue(valueLabel, email.Address);
}
private void SetSummaryValue(StateTextBox valueLabel, vCardPhone phone)
{
valueLabel.Text = string.Empty;
if (phone != null)
SetSummaryValue(valueLabel, phone.FullNumber);
}
private void SetSummaryValue(StateTextBox valueLabel, vCardWebsite webSite)
{
valueLabel.Text = string.Empty;
if (webSite != null)
SetSummaryValue(valueLabel, webSite.Url.ToString());
}
void SetPhotoValue(vCardPhotoCollection photos)
{
if (photos.Any())
@@ -287,24 +285,53 @@ namespace vCardEditor.View
};
if (!string.IsNullOrEmpty(HomePhoneValue.Text))
card.Phones.Add(new vCardPhone(HomePhoneValue.Text, vCardPhoneTypes.Home));
if (!string.IsNullOrEmpty(CellularPhoneValue.Text))
card.Phones.Add(new vCardPhone(CellularPhoneValue.Text, vCardPhoneTypes.Cellular));
if (!string.IsNullOrEmpty(WorkPhoneValue.Text))
card.Phones.Add(new vCardPhone(WorkPhoneValue.Text, vCardPhoneTypes.Work));
if (!string.IsNullOrEmpty(this.EmailAddressValue.Text))
card.EmailAddresses.Add(new vCardEmailAddress(this.EmailAddressValue.Text));
if (!string.IsNullOrEmpty(this.PersonalWebSiteValue.Text))
card.Websites.Add(new vCardWebsite(this.PersonalWebSiteValue.Text));
tbcAddress.getDeliveryAddress(card);
getExtraPhones(card);
getExtraWeb(card);
getExtraData(card);
return card;
}
private void getExtraPhones(vCard card)
{
card.Phones.Clear();
foreach (var item in extendedPanelPhones.GetExtraFields())
{
if (item is vCardPhone)
{
vCardPhone phone = item as vCardPhone;
card.Phones.Add(phone);
}
}
}
private void getExtraWeb(vCard card)
{
card.Websites.Clear();
card.EmailAddresses.Clear();
foreach (var item in extendedPanelWeb.GetExtraFields())
{
switch (item)
{
case vCardEmailAddress email:
card.EmailAddresses.Add(email);
break;
case vCardWebsite website:
card.Websites.Add(website);
break;
default:
break;
}
}
}
private void getExtraData(vCard card)
{
foreach (var item in flowLayoutPanel1.Controls)
@@ -586,5 +613,6 @@ namespace vCardEditor.View
var evt = new EventArg<vCardPropeties>(vCardPropeties.ORG);
AddExtraField?.Invoke(sender, evt);
}
}
}

View File

@@ -111,6 +111,7 @@
<Compile Include="Thought.vCards\vCardProperty.cs" />
<Compile Include="Thought.vCards\vCardPropertyCollection.cs" />
<Compile Include="Thought.vCards\vCardReader.cs" />
<Compile Include="Thought.vCards\vCardRoot.cs" />
<Compile Include="Thought.vCards\vCardSocialProfile.cs" />
<Compile Include="Thought.vCards\vCardSocialProfileCollection.cs" />
<Compile Include="Thought.vCards\vCardSource.cs" />
@@ -159,6 +160,25 @@
<Compile Include="View\Customs\ColumnsDialog.Designer.cs">
<DependentUpon>ColumnsDialog.cs</DependentUpon>
</Compile>
<Compile Include="View\Customs\CustumInputDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="View\Customs\CustumInputDialog.Designer.cs">
<DependentUpon>CustumInputDialog.cs</DependentUpon>
</Compile>
<Compile Include="View\Customs\ExtendedPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="View\Customs\ExtendedPanel.Designer.cs">
<DependentUpon>ExtendedPanel.cs</DependentUpon>
</Compile>
<Compile Include="View\Customs\PanelType.cs" />
<Compile Include="View\Customs\RemovableTextBox.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="View\Customs\RemovableTextBox.Designer.cs">
<DependentUpon>RemovableTextBox.cs</DependentUpon>
</Compile>
<Compile Include="View\EventArgs.cs" />
<Compile Include="View\IMainView.cs" />
<Compile Include="View\MainForm.cs">
@@ -203,6 +223,15 @@
<EmbeddedResource Include="View\Customs\ColumnsDialog.resx">
<DependentUpon>ColumnsDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="View\Customs\CustumInputDialog.resx">
<DependentUpon>CustumInputDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="View\Customs\ExtendedPanel.resx">
<DependentUpon>ExtendedPanel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="View\Customs\RemovableTextBox.resx">
<DependentUpon>RemovableTextBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="View\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -21,9 +21,9 @@ namespace vCardEditor_Test
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfEmtpy);
var repo = Substitute.For<ContactRepository>(fileHandler);
var contacts = repo.LoadContacts("file.vcf");
repo.LoadContacts("file.vcf");
Assert.IsTrue(contacts.Count == 0);
Assert.IsTrue(repo.Contacts.Count == 0);
}
[TestMethod]
@@ -31,22 +31,24 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfIncorrect);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
var contacts = repo.LoadContacts("file.vcf");
repo.LoadContacts("file.vcf");
Assert.IsTrue(contacts.Count == 0);
Assert.IsTrue(repo.Contacts.Count == 0);
}
[TestMethod]
public void NewFileOpened_Utf8Entry_Test()
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfUtf8Entry);
var repo = Substitute.For<ContactRepository>(fileHandler);
var contacts = repo.LoadContacts("file.vcf");
Assert.AreEqual(contacts[0].Name, "Oum Alaâ");
Assert.AreEqual(repo.Contacts[0].Name, "Oum Alaâ");
}
[TestMethod]
@@ -54,9 +56,10 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfOneEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
var contacts = repo.LoadContacts("file.vcf");
Assert.IsTrue(contacts[0].card.DeliveryAddresses.FirstOrDefault().AddressType.Contains(vCardDeliveryAddressTypes.Work));
Assert.IsTrue(repo.Contacts[0].card.DeliveryAddresses.FirstOrDefault().AddressType.Contains(vCardDeliveryAddressTypes.Work));
}
[TestMethod]
@@ -64,7 +67,8 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfFourEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.LoadContacts("file.vcf");
repo.Contacts[0].isDirty=true;
@@ -85,6 +89,7 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfFourEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.LoadContacts("file.vcf");
@@ -94,7 +99,7 @@ namespace vCardEditor_Test
var card = repo.Contacts[0].card;
Assert.AreEqual(card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular).FullNumber, string.Empty);
Assert.AreEqual(card.Phones.Count, 0);
}
[TestMethod]
@@ -102,6 +107,7 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfFourEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.LoadContacts("file.vcf");
repo.Contacts[2].isDirty = true;
@@ -120,6 +126,7 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfFourEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.LoadContacts("file.vcf");
repo.Contacts[3].isDirty = true;
@@ -136,6 +143,7 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfWikiv21);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.LoadContacts("file.vcf");
repo.Contacts[0].isDirty = true;
@@ -145,5 +153,33 @@ namespace vCardEditor_Test
var card = repo.Contacts[0].card;
Assert.IsNull(card.Phones.GetFirstChoice(vCardPhoneTypes.Cellular));
}
[TestMethod]
public void AddEmptyContact_ContactNotNull_Test()
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfOneEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.LoadContacts("file.vcf");
repo.AddEmptyContact();
Assert.IsTrue(repo.Contacts.Count > 0);
}
[TestMethod]
public void AddEmptyContact_ContactIsNull_Test()
{
var fileHandler = Substitute.For<IFileHandler>();
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.AddEmptyContact();
Assert.IsTrue(repo.Contacts.Count == 0);
}
}
}

View File

@@ -37,6 +37,7 @@ namespace vCardEditor_Test
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfOneEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.GetExtension(Arg.Any<string>()).Returns(".vcf");
var view = Substitute.For<IMainView>();
@@ -57,6 +58,7 @@ namespace vCardEditor_Test
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfThreeEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.GetExtension(Arg.Any<string>()).Returns(".vcf");
var view = Substitute.For<IMainView>();
@@ -90,6 +92,8 @@ namespace vCardEditor_Test
fileHandler.Received().MoveFile("aaa.vcf", "aaa.vcf.old0");
}
[TestMethod]
public void SaveFile_ExistAlready_Test()
{
@@ -115,6 +119,7 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfThreeEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
repo.GetExtension(Arg.Any<string>()).Returns(".vcf");
var view = Substitute.For<IMainView>();
@@ -139,6 +144,7 @@ namespace vCardEditor_Test
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfOneEntry);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
var view = Substitute.For<IMainView>();
view.SelectedContactIndex.Returns(0);
@@ -157,6 +163,7 @@ namespace vCardEditor_Test
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfOneEntryWithTwoAddress);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
var view = Substitute.For<IMainView>();
view.SelectedContactIndex.Returns(0);
@@ -165,7 +172,7 @@ namespace vCardEditor_Test
view.AddressRemoved += Raise.EventWith(new EventArg<int>(0));
Assert.AreEqual(1, contact[0].card.DeliveryAddresses.Count);
Assert.AreEqual(1, repo.Contacts[0].card.DeliveryAddresses.Count);
}
@@ -175,6 +182,7 @@ namespace vCardEditor_Test
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfOneEntryWithTwoAddress);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
var view = Substitute.For<IMainView>();
view.SelectedContactIndex.Returns(0);
@@ -186,8 +194,8 @@ namespace vCardEditor_Test
view.AddressAdded += Raise.EventWith(new EventArg<List<vCardDeliveryAddressTypes>>(lstvCardDeliveryAddressTypes));
Assert.AreEqual(2 + 1, contact[0].card.DeliveryAddresses.Count);
Assert.AreEqual(2, contact[0].card.DeliveryAddresses[2].AddressType.Count);
Assert.AreEqual(2 + 1, repo.Contacts[0].card.DeliveryAddresses.Count);
Assert.AreEqual(2, repo.Contacts[0].card.DeliveryAddresses[2].AddressType.Count);
}
@@ -198,6 +206,7 @@ namespace vCardEditor_Test
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfOneEntryWithTwoAddress);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
var view = Substitute.For<IMainView>();
view.SelectedContactIndex.Returns(0);
@@ -209,8 +218,8 @@ namespace vCardEditor_Test
view.AddressModified += Raise.EventWith(new EventArg<List<vCardDeliveryAddressTypes>>(lstvCardDeliveryAddressTypes));
Assert.AreEqual(1, contact[0].card.DeliveryAddresses.Count);
Assert.AreEqual(2, contact[0].card.DeliveryAddresses[0].AddressType.Count);
Assert.AreEqual(1, repo.Contacts[0].card.DeliveryAddresses.Count);
Assert.AreEqual(2, repo.Contacts[0].card.DeliveryAddresses[0].AddressType.Count);
}
@@ -219,6 +228,7 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfwithInternalPhoto);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
var view = Substitute.For<IMainView>();
view.SelectedContactIndex.Returns(0);
@@ -236,6 +246,7 @@ namespace vCardEditor_Test
{
var fileHandler = Substitute.For<IFileHandler>();
fileHandler.ReadAllLines(Arg.Any<string>()).Returns(Entries.vcfwithInternalPhoto);
fileHandler.FileExist(Arg.Any<string>()).Returns(true);
var repo = Substitute.For<ContactRepository>(fileHandler);
var view = Substitute.For<IMainView>();
view.SelectedContactIndex.Returns(0);
@@ -244,8 +255,8 @@ namespace vCardEditor_Test
view.ModifyImage += Raise.EventWith(new EventArg<string>(""));
Assert.AreEqual(0, contact[0].card.Photos.Count);
Assert.IsTrue(contact[0].isDirty);
Assert.AreEqual(0, repo.Contacts[0].card.Photos.Count);
Assert.IsTrue(repo.Contacts[0].isDirty);
}