mirror of
https://github.com/abdelkader/vCardEditor
synced 2025-12-12 08:27:19 +07:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba9d26f981 | ||
|
|
abbb03dddf | ||
|
|
a989351889 | ||
|
|
22f7f88018 | ||
|
|
85bb588f42 | ||
|
|
1bf467f81f | ||
|
|
7e8c43e011 | ||
|
|
7d09a9ee3e | ||
|
|
77c1e45bfd | ||
|
|
1f234c61e9 | ||
|
|
927d36a9a0 | ||
|
|
653f21b9cc | ||
|
|
f509d5da84 | ||
|
|
9012d355d3 |
@@ -24,6 +24,7 @@ The software is still in **early stage**.
|
||||
- 📖 [MVP pattern from this example](https://github.com/lennykean/NoteCards)
|
||||
- 🧰 [SortableBindingList](http://timvw.be/2008/08/02/presenting-the-sortablebindinglistt-take-two/)
|
||||
- 🧰 [Custom TabControl](https://github.com/r-aghaei/TabControlWithCloseButtonAndAddButton)
|
||||
- 🧰 [QRCoder](https://github.com/codebude/QRCoder)
|
||||
|
||||
## 📑 Release notes
|
||||
Check release text file for history.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0 || NET6_0_WINDOWS
|
||||
using QRCoder.Extensions;
|
||||
using System;
|
||||
using System.Collections;
|
||||
@@ -11,9 +10,7 @@ using static QRCoder.SvgQRCode;
|
||||
|
||||
namespace QRCoder
|
||||
{
|
||||
#if NET6_0_WINDOWS
|
||||
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
|
||||
#endif
|
||||
|
||||
public class SvgQRCode : AbstractQRCode, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
@@ -379,9 +376,7 @@ namespace QRCoder
|
||||
}
|
||||
}
|
||||
|
||||
#if NET6_0_WINDOWS
|
||||
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
|
||||
#endif
|
||||
|
||||
public static class SvgQRCodeHelper
|
||||
{
|
||||
public static string GetQRCode(string plainText, int pixelsPerModule, string darkColorHex, string lightColorHex, ECCLevel eccLevel, bool forceUtf8 = false, bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, bool drawQuietZones = true, SizingMode sizingMode = SizingMode.WidthHeightAttribute, SvgLogo logo = null)
|
||||
@@ -394,4 +389,3 @@ namespace QRCoder
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
|
||||
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
|
||||
// en utilisant '*', comme indiqué ci-dessous :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.5.3")]
|
||||
[assembly: AssemblyVersion("0.5.5")]
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
0.5.3
|
||||
0.5.5
|
||||
redisgn the extra tab
|
||||
Fix some bugs
|
||||
|
||||
0.5.4
|
||||
Fix a regression when saving Phones, Website, Email
|
||||
added the update button in the about dialog to check the latest version.
|
||||
|
||||
0.5.3
|
||||
Support of QR Code.
|
||||
|
||||
0.5.2
|
||||
|
||||
@@ -33,7 +33,10 @@ namespace vCardEditor.Repository
|
||||
public bool OverWrite { get; set; }
|
||||
[Description("Maximum entries for MRU ")]
|
||||
public int Maximum { get; set; }
|
||||
|
||||
|
||||
[Description("Url for checking application version")]
|
||||
public string VersionUrl { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public FixedList Paths { get; set; }
|
||||
|
||||
@@ -86,7 +89,8 @@ namespace vCardEditor.Repository
|
||||
configData = new ConfigRepository
|
||||
{
|
||||
Maximum = MAX_RECENT_FILES,
|
||||
Paths = new FixedList(MAX_RECENT_FILES)
|
||||
Paths = new FixedList(MAX_RECENT_FILES),
|
||||
VersionUrl = "https://raw.githubusercontent.com/abdelkader/vCardEditor/master/vCardEditor/Releases.txt"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -69,20 +69,37 @@ namespace VCFEditor.Repository
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
RawContent.AppendLine(lines[i]);
|
||||
if (string.Equals(lines[i].TrimEnd(), "END:VCARD", StringComparison.OrdinalIgnoreCase))
|
||||
try
|
||||
{
|
||||
contact.card = ParseRawContent(RawContent);
|
||||
Contacts.Add(contact);
|
||||
contact = new Contact();
|
||||
RawContent.Length = 0;
|
||||
if (string.Equals(lines[i].TrimEnd(), "END:VCARD", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
contact.card = ParseRawContent(RawContent);
|
||||
Contacts.Add(contact);
|
||||
contact = new Contact();
|
||||
RawContent.Length = 0;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
OriginalContactList = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OriginalContactList = Contacts;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private vCard ParseRawContent(StringBuilder rawContent)
|
||||
{
|
||||
vCard card = null;
|
||||
|
||||
using (StringReader reader = new StringReader(rawContent.ToString()))
|
||||
card = new vCard(reader);
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
public void AddEmptyContact()
|
||||
{
|
||||
if (_contacts != null && _contacts.Count > 0)
|
||||
@@ -118,9 +135,9 @@ namespace VCFEditor.Repository
|
||||
|
||||
//Clean the flag for every contact, even the deleted ones.
|
||||
entry.isDirty = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
_dirty = false;
|
||||
_fileHandler.WriteAllText(fileName, sb.ToString());
|
||||
}
|
||||
|
||||
@@ -156,28 +173,6 @@ namespace VCFEditor.Repository
|
||||
|
||||
}
|
||||
|
||||
private vCard ParseRawContent(StringBuilder rawContent)
|
||||
{
|
||||
vCard card = null;
|
||||
|
||||
using (MemoryStream s = GenerateStreamFromString(rawContent.ToString()))
|
||||
using (TextReader streamReader = new StreamReader(s, Encoding.UTF8))
|
||||
{
|
||||
card = new vCard(streamReader);
|
||||
}
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
private MemoryStream GenerateStreamFromString(string s)
|
||||
{
|
||||
MemoryStream stream = new MemoryStream();
|
||||
StreamWriter writer = new StreamWriter(stream);
|
||||
writer.Write(s);
|
||||
writer.Flush();
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
|
||||
public SortableBindingList<Contact> FilterContacts(string filter)
|
||||
{
|
||||
@@ -244,6 +239,8 @@ namespace VCFEditor.Repository
|
||||
adr.PostalCode = item.PostalCode;
|
||||
adr.Region = item.Region;
|
||||
adr.Street = item.Street;
|
||||
adr.ExtendedAddress = item.ExtendedAddress;
|
||||
adr.PostOfficeBox = item.PostOfficeBox;
|
||||
}
|
||||
else
|
||||
card.DeliveryAddresses.Add(new vCardDeliveryAddress(item.Street, item.City, item.Region, item.Country,
|
||||
@@ -358,10 +355,11 @@ namespace VCFEditor.Repository
|
||||
public string GenerateStringFromVCard(vCard card)
|
||||
{
|
||||
vCardStandardWriter writer = new vCardStandardWriter();
|
||||
TextWriter tw = new StringWriter();
|
||||
writer.Write(card, tw);
|
||||
|
||||
return tw.ToString();
|
||||
using (TextWriter tw = new StringWriter())
|
||||
{
|
||||
writer.Write(card, tw);
|
||||
return tw.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void ModifyImage(int index, vCardPhoto photo)
|
||||
|
||||
@@ -120,6 +120,16 @@ namespace Thought.vCards
|
||||
|
||||
}
|
||||
|
||||
public override void ChangeContent(string text)
|
||||
{
|
||||
this.address = text;
|
||||
}
|
||||
|
||||
public override string GetNameType()
|
||||
{
|
||||
return EmailType.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Builds a string that represents the email address.
|
||||
|
||||
@@ -42,6 +42,10 @@ namespace Thought.vCards
|
||||
this.fullNumber = fullNumber;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.fullNumber;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="vCardPhone"/> with the specified number and subtype.
|
||||
@@ -452,6 +456,15 @@ namespace Thought.vCards
|
||||
}
|
||||
}
|
||||
|
||||
public override void ChangeContent(string text)
|
||||
{
|
||||
this.FullNumber = text;
|
||||
}
|
||||
|
||||
public override string GetNameType()
|
||||
{
|
||||
return PhoneType.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
namespace Thought.vCards
|
||||
{
|
||||
public class vCardRoot
|
||||
abstract public class vCardRoot
|
||||
{
|
||||
abstract public void ChangeContent(string text);
|
||||
abstract public string GetNameType();
|
||||
}
|
||||
}
|
||||
@@ -311,8 +311,8 @@ namespace Thought.vCards
|
||||
|
||||
vCardValueCollection values = new vCardValueCollection(';');
|
||||
|
||||
values.Add(string.Empty);
|
||||
values.Add(string.Empty);
|
||||
values.Add(address.PostOfficeBox);
|
||||
values.Add(address.ExtendedAddress);
|
||||
values.Add(!string.IsNullOrEmpty(address.Street) ? address.Street.Replace("\r\n", "\n") : string.Empty);
|
||||
values.Add(address.City);
|
||||
values.Add(address.Region);
|
||||
|
||||
@@ -154,6 +154,16 @@ namespace Thought.vCards
|
||||
}
|
||||
}
|
||||
|
||||
public override void ChangeContent(string text)
|
||||
{
|
||||
this.url = text;
|
||||
}
|
||||
|
||||
public override string GetNameType()
|
||||
{
|
||||
return WebsiteType.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string representation (URL) of the web site.
|
||||
|
||||
64
vCardEditor/View/AboutDialog.Designer.cs
generated
64
vCardEditor/View/AboutDialog.Designer.cs
generated
@@ -36,36 +36,42 @@
|
||||
this.labelCompanyName = new System.Windows.Forms.Label();
|
||||
this.textBoxDescription = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.updateButton = new System.Windows.Forms.Button();
|
||||
this.tableLayoutPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel
|
||||
//
|
||||
this.tableLayoutPanel.ColumnCount = 2;
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 27.81775F));
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 72.18225F));
|
||||
this.tableLayoutPanel.ColumnCount = 3;
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 32.31441F));
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67.68559F));
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 119F));
|
||||
this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3);
|
||||
this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4);
|
||||
this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5);
|
||||
this.tableLayoutPanel.Controls.Add(this.okButton, 2, 5);
|
||||
this.tableLayoutPanel.Controls.Add(this.updateButton, 1, 5);
|
||||
this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel.Location = new System.Drawing.Point(12, 11);
|
||||
this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tableLayoutPanel.Name = "tableLayoutPanel";
|
||||
this.tableLayoutPanel.RowCount = 6;
|
||||
this.tableLayoutPanel.RowCount = 7;
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 47.93651F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.69841F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 8F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel.Size = new System.Drawing.Size(556, 326);
|
||||
this.tableLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
@@ -76,69 +82,74 @@
|
||||
this.logoPictureBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.logoPictureBox.Name = "logoPictureBox";
|
||||
this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6);
|
||||
this.logoPictureBox.Size = new System.Drawing.Size(145, 121);
|
||||
this.logoPictureBox.Size = new System.Drawing.Size(133, 121);
|
||||
this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.logoPictureBox.TabIndex = 12;
|
||||
this.logoPictureBox.TabStop = false;
|
||||
//
|
||||
// labelProductName
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.labelProductName, 2);
|
||||
this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelProductName.Location = new System.Drawing.Point(162, 0);
|
||||
this.labelProductName.Location = new System.Drawing.Point(149, 0);
|
||||
this.labelProductName.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0);
|
||||
this.labelProductName.MaximumSize = new System.Drawing.Size(0, 21);
|
||||
this.labelProductName.Name = "labelProductName";
|
||||
this.labelProductName.Size = new System.Drawing.Size(390, 21);
|
||||
this.labelProductName.Size = new System.Drawing.Size(403, 21);
|
||||
this.labelProductName.TabIndex = 19;
|
||||
this.labelProductName.Text = "Nom du produit";
|
||||
this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelVersion
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.labelVersion, 2);
|
||||
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelVersion.Location = new System.Drawing.Point(162, 32);
|
||||
this.labelVersion.Location = new System.Drawing.Point(149, 31);
|
||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0);
|
||||
this.labelVersion.MaximumSize = new System.Drawing.Size(0, 21);
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
this.labelVersion.Size = new System.Drawing.Size(390, 21);
|
||||
this.labelVersion.Size = new System.Drawing.Size(403, 21);
|
||||
this.labelVersion.TabIndex = 0;
|
||||
this.labelVersion.Text = "Version";
|
||||
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelCopyright
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.labelCopyright, 2);
|
||||
this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCopyright.Location = new System.Drawing.Point(162, 64);
|
||||
this.labelCopyright.Location = new System.Drawing.Point(149, 62);
|
||||
this.labelCopyright.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0);
|
||||
this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 21);
|
||||
this.labelCopyright.Name = "labelCopyright";
|
||||
this.labelCopyright.Size = new System.Drawing.Size(390, 21);
|
||||
this.labelCopyright.Size = new System.Drawing.Size(403, 21);
|
||||
this.labelCopyright.TabIndex = 21;
|
||||
this.labelCopyright.Text = "Copyright";
|
||||
this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelCompanyName
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.labelCompanyName, 2);
|
||||
this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCompanyName.Location = new System.Drawing.Point(162, 96);
|
||||
this.labelCompanyName.Location = new System.Drawing.Point(149, 93);
|
||||
this.labelCompanyName.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0);
|
||||
this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 21);
|
||||
this.labelCompanyName.Name = "labelCompanyName";
|
||||
this.labelCompanyName.Size = new System.Drawing.Size(390, 21);
|
||||
this.labelCompanyName.Size = new System.Drawing.Size(403, 21);
|
||||
this.labelCompanyName.TabIndex = 22;
|
||||
this.labelCompanyName.Text = "Nom de la société";
|
||||
this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// textBoxDescription
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.textBoxDescription, 2);
|
||||
this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBoxDescription.Location = new System.Drawing.Point(162, 132);
|
||||
this.textBoxDescription.Location = new System.Drawing.Point(149, 128);
|
||||
this.textBoxDescription.Margin = new System.Windows.Forms.Padding(8, 4, 4, 4);
|
||||
this.textBoxDescription.Multiline = true;
|
||||
this.textBoxDescription.Name = "textBoxDescription";
|
||||
this.textBoxDescription.ReadOnly = true;
|
||||
this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBoxDescription.Size = new System.Drawing.Size(390, 155);
|
||||
this.textBoxDescription.Size = new System.Drawing.Size(403, 143);
|
||||
this.textBoxDescription.TabIndex = 23;
|
||||
this.textBoxDescription.TabStop = false;
|
||||
this.textBoxDescription.Text = "Description";
|
||||
@@ -147,13 +158,23 @@
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.okButton.Location = new System.Drawing.Point(452, 295);
|
||||
this.okButton.Location = new System.Drawing.Point(442, 282);
|
||||
this.okButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(100, 27);
|
||||
this.okButton.Size = new System.Drawing.Size(110, 29);
|
||||
this.okButton.TabIndex = 24;
|
||||
this.okButton.Text = "&OK";
|
||||
//
|
||||
// updateButton
|
||||
//
|
||||
this.updateButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.updateButton.Location = new System.Drawing.Point(312, 283);
|
||||
this.updateButton.Name = "updateButton";
|
||||
this.updateButton.Size = new System.Drawing.Size(121, 29);
|
||||
this.updateButton.TabIndex = 25;
|
||||
this.updateButton.Text = "Check update...";
|
||||
this.updateButton.Click += new System.EventHandler(this.updateButton_Click);
|
||||
//
|
||||
// AboutDialog
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
@@ -188,5 +209,6 @@
|
||||
private System.Windows.Forms.Label labelCompanyName;
|
||||
private System.Windows.Forms.TextBox textBoxDescription;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button updateButton;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using vCardEditor.Repository;
|
||||
|
||||
namespace vCardEditor.View
|
||||
{
|
||||
@@ -100,5 +104,36 @@ namespace vCardEditor.View
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private async void updateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
string result = await client.DownloadStringTaskAsync(ConfigRepository.Instance.VersionUrl);
|
||||
using (var reader = new StringReader(result))
|
||||
{
|
||||
string InternetVersion = reader.ReadLine();
|
||||
string AssemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
Version v1 = new Version(InternetVersion);
|
||||
Version v2 = new Version(AssemblyVersion);
|
||||
|
||||
if (v1.CompareTo(v2) > 0)
|
||||
MessageBox.Show(string.Format("New version {0} found!", result), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
else
|
||||
MessageBox.Show("You have the latest version!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException )
|
||||
{
|
||||
MessageBox.Show("Could not download version information from GitHub.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
catch (Exception )
|
||||
{
|
||||
MessageBox.Show("Error processing version information.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
vCardEditor/View/Customs/AddressBox.Designer.cs
generated
19
vCardEditor/View/Customs/AddressBox.Designer.cs
generated
@@ -60,12 +60,12 @@ namespace vCardEditor.View.Customs
|
||||
//
|
||||
// ExtAdressLabel
|
||||
//
|
||||
this.ExtAdressLabel.Location = new System.Drawing.Point(1, 42);
|
||||
this.ExtAdressLabel.Location = new System.Drawing.Point(4, 45);
|
||||
this.ExtAdressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.ExtAdressLabel.Name = "ExtAdressLabel";
|
||||
this.ExtAdressLabel.Size = new System.Drawing.Size(87, 23);
|
||||
this.ExtAdressLabel.Size = new System.Drawing.Size(40, 23);
|
||||
this.ExtAdressLabel.TabIndex = 26;
|
||||
this.ExtAdressLabel.Text = "Ext Address:";
|
||||
this.ExtAdressLabel.Text = "Ext:";
|
||||
this.ExtAdressLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// StreetLabel
|
||||
@@ -93,14 +93,13 @@ namespace vCardEditor.View.Customs
|
||||
//
|
||||
// POBoxLabel
|
||||
//
|
||||
this.POBoxLabel.Location = new System.Drawing.Point(334, 75);
|
||||
this.POBoxLabel.Location = new System.Drawing.Point(338, 75);
|
||||
this.POBoxLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.POBoxLabel.Name = "POBoxLabel";
|
||||
this.POBoxLabel.Size = new System.Drawing.Size(59, 23);
|
||||
this.POBoxLabel.Size = new System.Drawing.Size(38, 23);
|
||||
this.POBoxLabel.TabIndex = 16;
|
||||
this.POBoxLabel.Text = "PO Box:";
|
||||
this.POBoxLabel.Text = "PO :";
|
||||
this.POBoxLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
|
||||
//
|
||||
// CountryValue
|
||||
//
|
||||
@@ -129,7 +128,7 @@ namespace vCardEditor.View.Customs
|
||||
//
|
||||
this.POBoxValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.POBoxValue.Location = new System.Drawing.Point(397, 75);
|
||||
this.POBoxValue.Location = new System.Drawing.Point(397, 76);
|
||||
this.POBoxValue.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.POBoxValue.Name = "POBoxValue";
|
||||
this.POBoxValue.oldText = null;
|
||||
@@ -140,7 +139,7 @@ namespace vCardEditor.View.Customs
|
||||
//
|
||||
// CityLabel
|
||||
//
|
||||
this.CityLabel.Location = new System.Drawing.Point(338, 45);
|
||||
this.CityLabel.Location = new System.Drawing.Point(338, 46);
|
||||
this.CityLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.CityLabel.Name = "CityLabel";
|
||||
this.CityLabel.Size = new System.Drawing.Size(32, 23);
|
||||
@@ -176,7 +175,7 @@ namespace vCardEditor.View.Customs
|
||||
//
|
||||
// StateLabel
|
||||
//
|
||||
this.StateLabel.Location = new System.Drawing.Point(17, 74);
|
||||
this.StateLabel.Location = new System.Drawing.Point(2, 74);
|
||||
this.StateLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.StateLabel.Name = "StateLabel";
|
||||
this.StateLabel.Size = new System.Drawing.Size(61, 23);
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace vCardEditor.View.UIToolbox
|
||||
//
|
||||
// txtContent
|
||||
//
|
||||
this.txtContent.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtContent.Location = new System.Drawing.Point(56, 4);
|
||||
this.txtContent.Multiline = true;
|
||||
this.txtContent.Name = "txtContent";
|
||||
|
||||
@@ -12,38 +12,25 @@ namespace vCardEditor.View.Customs
|
||||
{
|
||||
InitializeComponent();
|
||||
btnRemove.Click += (s, e) => BoutonRemoveClicked?.Invoke(s, e);
|
||||
|
||||
// Bubble up to set the dirty flag from the parent.
|
||||
ContentTextBox.LostFocus += (s, e) => ContentTextChanged?.Invoke(s, e);
|
||||
ContentTextBox.Validated += (s, e) => ContentTextChanged?.Invoke(s, e);
|
||||
|
||||
//Reflect the changes inside the control, stored inside the Tag.
|
||||
ContentTextBox.Validated += ContentTextBox_Validated;
|
||||
}
|
||||
|
||||
private void ContentTextBox_Validated(object sender, EventArgs e)
|
||||
{
|
||||
var card = this.Tag as vCardRoot;
|
||||
card.ChangeContent(Content);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Title = cardType.GetNameType();
|
||||
Content = cardType.ToString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
95
vCardEditor/View/MainForm.Designer.cs
generated
95
vCardEditor/View/MainForm.Designer.cs
generated
@@ -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 dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = 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();
|
||||
@@ -78,8 +78,6 @@ 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.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();
|
||||
@@ -98,7 +96,12 @@ namespace vCardEditor.View
|
||||
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.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.panelTabExtra = new System.Windows.Forms.Panel();
|
||||
this.btnAddExtraText = new System.Windows.Forms.Button();
|
||||
this.menuExtraField = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.miNote = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.miOrg = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.gbNameList.SuspendLayout();
|
||||
@@ -116,6 +119,8 @@ namespace vCardEditor.View
|
||||
this.tbcAddress.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).BeginInit();
|
||||
this.TapPageExtra.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.menuExtraField.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
@@ -199,7 +204,7 @@ namespace vCardEditor.View
|
||||
// copyToolStripMenuItem
|
||||
//
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(167, 26);
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
this.copyToolStripMenuItem.Text = "Copy";
|
||||
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -209,7 +214,7 @@ namespace vCardEditor.View
|
||||
this.addNotesToolStripMenuItem,
|
||||
this.addOrgToolStripMenuItem});
|
||||
this.extraFieldsToolStripMenuItem.Name = "extraFieldsToolStripMenuItem";
|
||||
this.extraFieldsToolStripMenuItem.Size = new System.Drawing.Size(167, 26);
|
||||
this.extraFieldsToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
this.extraFieldsToolStripMenuItem.Text = "Extra Fields";
|
||||
//
|
||||
// addNotesToolStripMenuItem
|
||||
@@ -354,7 +359,7 @@ namespace vCardEditor.View
|
||||
this.tbsQR.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tbsQR.Name = "tbsQR";
|
||||
this.tbsQR.Size = new System.Drawing.Size(29, 24);
|
||||
this.tbsQR.Text = "toolStripButton1";
|
||||
this.tbsQR.Text = "&QR Code";
|
||||
this.tbsQR.Click += new System.EventHandler(this.tbsQR_Click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
@@ -402,8 +407,8 @@ namespace vCardEditor.View
|
||||
this.dgContacts.AllowUserToAddRows = false;
|
||||
this.dgContacts.AllowUserToDeleteRows = false;
|
||||
this.dgContacts.AllowUserToResizeRows = false;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.dgContacts.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.dgContacts.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
|
||||
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)));
|
||||
@@ -782,7 +787,7 @@ namespace vCardEditor.View
|
||||
// TapPageExtra
|
||||
//
|
||||
this.TapPageExtra.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.TapPageExtra.Controls.Add(this.flowLayoutPanel1);
|
||||
this.TapPageExtra.Controls.Add(this.groupBox1);
|
||||
this.TapPageExtra.Location = new System.Drawing.Point(4, 25);
|
||||
this.TapPageExtra.Name = "TapPageExtra";
|
||||
this.TapPageExtra.Padding = new System.Windows.Forms.Padding(3);
|
||||
@@ -790,15 +795,60 @@ namespace vCardEditor.View
|
||||
this.TapPageExtra.TabIndex = 1;
|
||||
this.TapPageExtra.Text = "Extra";
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
// groupBox1
|
||||
//
|
||||
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;
|
||||
this.groupBox1.Controls.Add(this.btnAddExtraText);
|
||||
this.groupBox1.Controls.Add(this.panelTabExtra);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(786, 551);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// panelTabExtra
|
||||
//
|
||||
this.panelTabExtra.AutoScroll = true;
|
||||
this.panelTabExtra.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelTabExtra.Location = new System.Drawing.Point(3, 18);
|
||||
this.panelTabExtra.Name = "panelTabExtra";
|
||||
this.panelTabExtra.Size = new System.Drawing.Size(780, 530);
|
||||
this.panelTabExtra.TabIndex = 1;
|
||||
//
|
||||
// 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(732, 0);
|
||||
this.btnAddExtraText.Name = "btnAddExtraText";
|
||||
this.btnAddExtraText.Size = new System.Drawing.Size(39, 22);
|
||||
this.btnAddExtraText.TabIndex = 59;
|
||||
this.btnAddExtraText.UseVisualStyleBackColor = true;
|
||||
this.btnAddExtraText.Click += new System.EventHandler(this.btnAddExtraText_Click);
|
||||
//
|
||||
// menuExtraField
|
||||
//
|
||||
this.menuExtraField.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuExtraField.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.miNote,
|
||||
this.miOrg});
|
||||
this.menuExtraField.Name = "contextMenuStrip1";
|
||||
this.menuExtraField.Size = new System.Drawing.Size(211, 80);
|
||||
//
|
||||
// miNote
|
||||
//
|
||||
this.miNote.Name = "miNote";
|
||||
this.miNote.Size = new System.Drawing.Size(210, 24);
|
||||
this.miNote.Text = "Note";
|
||||
this.miNote.Click += new System.EventHandler(this.miNote_Click);
|
||||
//
|
||||
// miOrg
|
||||
//
|
||||
this.miOrg.Name = "miOrg";
|
||||
this.miOrg.Size = new System.Drawing.Size(210, 24);
|
||||
this.miOrg.Text = "Organisation";
|
||||
this.miOrg.Click += new System.EventHandler(this.miOrg_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
@@ -840,6 +890,8 @@ namespace vCardEditor.View
|
||||
this.tbcAddress.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).EndInit();
|
||||
this.TapPageExtra.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.menuExtraField.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -889,7 +941,6 @@ namespace vCardEditor.View
|
||||
private System.Windows.Forms.TabControl tcMainTab;
|
||||
private System.Windows.Forms.TabPage TapPageMain;
|
||||
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;
|
||||
@@ -913,5 +964,11 @@ namespace vCardEditor.View
|
||||
private System.Windows.Forms.TabPage tabPage3;
|
||||
internal System.Windows.Forms.PictureBox PhotoBox;
|
||||
private System.Windows.Forms.ToolStripButton tbsQR;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Panel panelTabExtra;
|
||||
private System.Windows.Forms.Button btnAddExtraText;
|
||||
private System.Windows.Forms.ContextMenuStrip menuExtraField;
|
||||
private System.Windows.Forms.ToolStripMenuItem miNote;
|
||||
private System.Windows.Forms.ToolStripMenuItem miOrg;
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,9 @@ namespace vCardEditor.View
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
this.extendedPanelWeb = new vCardEditor.View.Customs.ExtendedPanel(PanelType.Web);
|
||||
this.extendedPanelPhones = new vCardEditor.View.Customs.ExtendedPanel(PanelType.Phone);
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
resources = new ComponentResourceManager(typeof(MainForm));
|
||||
@@ -84,6 +87,10 @@ namespace vCardEditor.View
|
||||
{
|
||||
//make sure the last changes in the textboxes is saved.
|
||||
Validate();
|
||||
|
||||
//Make sure to save changes for the current row.
|
||||
dgContacts_RowLeave(null, null);
|
||||
|
||||
SaveContactsSelected(sender, e);
|
||||
}
|
||||
|
||||
@@ -184,10 +191,12 @@ namespace vCardEditor.View
|
||||
etg.ControlDeleted += (sender, e) =>
|
||||
{
|
||||
var send = sender as Control;
|
||||
flowLayoutPanel1.Controls.Remove(send.Parent);
|
||||
panelTabExtra.Controls.Remove(send.Parent);
|
||||
};
|
||||
etg.Dock = DockStyle.Top;
|
||||
|
||||
flowLayoutPanel1.Controls.Add(etg);
|
||||
|
||||
panelTabExtra.Controls.Add(etg);
|
||||
}
|
||||
|
||||
public void ClearContactDetail()
|
||||
@@ -201,10 +210,12 @@ namespace vCardEditor.View
|
||||
SetSummaryValue(middleNameValue, string.Empty);
|
||||
SetSummaryValue(FormattedTitleValue, string.Empty);
|
||||
SetSummaryValue(FormattedNameValue, string.Empty);
|
||||
|
||||
SetAddressesValues(new vCard());
|
||||
|
||||
//SetAddressesValues(new vCard());
|
||||
|
||||
|
||||
SetPhotoValue(new vCardPhotoCollection());
|
||||
flowLayoutPanel1.Controls.Clear();
|
||||
panelTabExtra.Controls.Clear();
|
||||
extendedPanelPhones.ClearFields();
|
||||
extendedPanelWeb.ClearFields();
|
||||
}
|
||||
@@ -335,7 +346,7 @@ namespace vCardEditor.View
|
||||
|
||||
private void getExtraData(vCard card)
|
||||
{
|
||||
foreach (var item in flowLayoutPanel1.Controls)
|
||||
foreach (var item in panelTabExtra.Controls)
|
||||
{
|
||||
var tbc = item as ExtraTextGroup;
|
||||
switch (tbc.CardProp)
|
||||
@@ -604,6 +615,17 @@ namespace vCardEditor.View
|
||||
}
|
||||
}
|
||||
}
|
||||
private void tbsQR_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportQR?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void DisplayQRCode(string content)
|
||||
{
|
||||
QRDialog qr = new QRDialog(content);
|
||||
qr.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
private void addNotesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -617,15 +639,25 @@ namespace vCardEditor.View
|
||||
AddExtraField?.Invoke(sender, evt);
|
||||
}
|
||||
|
||||
private void tbsQR_Click(object sender, EventArgs e)
|
||||
private void btnAddExtraText_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportQR?.Invoke(sender, e);
|
||||
Button btnSender = (Button)sender;
|
||||
Point ptLowerLeft = new Point(0, btnSender.Height);
|
||||
ptLowerLeft = btnSender.PointToScreen(ptLowerLeft);
|
||||
menuExtraField.Show(ptLowerLeft);
|
||||
}
|
||||
|
||||
public void DisplayQRCode(string content)
|
||||
|
||||
private void miNote_Click(object sender, EventArgs e)
|
||||
{
|
||||
QRDialog qr = new QRDialog(content);
|
||||
qr.ShowDialog();
|
||||
var evt = new EventArg<vCardPropeties>(vCardPropeties.NOTE);
|
||||
AddExtraField?.Invoke(sender, evt);
|
||||
}
|
||||
|
||||
private void miOrg_Click(object sender, EventArgs e)
|
||||
{
|
||||
var evt = new EventArg<vCardPropeties>(vCardPropeties.ORG);
|
||||
AddExtraField?.Invoke(sender, evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,6 +336,9 @@
|
||||
XvxneHv7DU8zWBta5VGXAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="menuExtraField.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>804, 17</value>
|
||||
</metadata>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAkAAAAAAAEAIAAHLwAAlgAAAICAAAABACAAKAgBAJ0vAABgYAAAAQAgAKiUAADFNwEASEgAAAEA
|
||||
|
||||
2
vCardEditor/View/QRDialog.Designer.cs
generated
2
vCardEditor/View/QRDialog.Designer.cs
generated
@@ -32,7 +32,6 @@ namespace vCardEditor.View
|
||||
this.btnExport = new System.Windows.Forms.Button();
|
||||
this.btnClose = new System.Windows.Forms.Button();
|
||||
this.pictureBoxQRCode = new System.Windows.Forms.PictureBox();
|
||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQRCode)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -91,6 +90,5 @@ namespace vCardEditor.View
|
||||
private System.Windows.Forms.Button btnExport;
|
||||
private System.Windows.Forms.Button btnClose;
|
||||
private System.Windows.Forms.PictureBox pictureBoxQRCode;
|
||||
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ namespace vCardEditor.View
|
||||
{
|
||||
public partial class QRDialog : Form
|
||||
{
|
||||
string _qrContentCode = null;
|
||||
public QRDialog(string content)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -24,9 +25,12 @@ namespace vCardEditor.View
|
||||
using (QRCodeData qrCodeData = qrGenerator.CreateQrCode(code, eccLevel))
|
||||
using (QRCode qrCode = new QRCode(qrCodeData))
|
||||
{
|
||||
_qrContentCode = code;
|
||||
pictureBoxQRCode.BackgroundImage = qrCode.GetGraphic(20, Color.Black, Color.White, null, 1);
|
||||
pictureBoxQRCode.Size = new System.Drawing.Size(pictureBoxQRCode.Width, pictureBoxQRCode.Height);
|
||||
pictureBoxQRCode.Size = new Size(pictureBoxQRCode.Width, pictureBoxQRCode.Height);
|
||||
pictureBoxQRCode.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,34 +43,49 @@ namespace vCardEditor.View
|
||||
{
|
||||
// Displays a SaveFileDialog so the user can save the Image
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
|
||||
saveFileDialog1.Filter = "Bitmap Image|*.bmp|PNG Image|*.png|JPeg Image|*.jpg|Gif Image|*.gif";
|
||||
saveFileDialog1.Filter = "Bitmap Image|*.bmp|PNG Image|*.png|JPeg Image|*.jpg|Gif Image|*.gif|SVG Image|*.svg";
|
||||
saveFileDialog1.Title = "Save an Image File";
|
||||
saveFileDialog1.ShowDialog();
|
||||
|
||||
if (saveFileDialog1.FileName != "")
|
||||
{
|
||||
using (FileStream fs = (System.IO.FileStream)saveFileDialog1.OpenFile())
|
||||
{
|
||||
ImageFormat imageFormat = null;
|
||||
switch (saveFileDialog1.FilterIndex)
|
||||
{
|
||||
case 1:
|
||||
imageFormat = ImageFormat.Bmp;
|
||||
break;
|
||||
case 2:
|
||||
imageFormat = ImageFormat.Png;
|
||||
break;
|
||||
case 3:
|
||||
imageFormat = ImageFormat.Jpeg;
|
||||
break;
|
||||
case 4:
|
||||
imageFormat = ImageFormat.Gif;
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException("File extension is not supported");
|
||||
}
|
||||
|
||||
pictureBoxQRCode.BackgroundImage.Save(fs, imageFormat);
|
||||
if (saveFileDialog1.FilterIndex == 5)
|
||||
{
|
||||
QRCodeGenerator qrGenerator = new QRCodeGenerator();
|
||||
QRCodeData qrCodeData = qrGenerator.CreateQrCode(_qrContentCode, QRCodeGenerator.ECCLevel.H);
|
||||
SvgQRCode qrCode = new SvgQRCode(qrCodeData);
|
||||
string qrCodeAsSvg = qrCode.GetGraphic(20);
|
||||
|
||||
File.WriteAllText(saveFileDialog1.FileName, qrCodeAsSvg);
|
||||
}
|
||||
else
|
||||
{
|
||||
using (FileStream fs = (System.IO.FileStream)saveFileDialog1.OpenFile())
|
||||
{
|
||||
|
||||
|
||||
ImageFormat imageFormat = null;
|
||||
switch (saveFileDialog1.FilterIndex)
|
||||
{
|
||||
case 1:
|
||||
imageFormat = ImageFormat.Bmp;
|
||||
break;
|
||||
case 2:
|
||||
imageFormat = ImageFormat.Png;
|
||||
break;
|
||||
case 3:
|
||||
imageFormat = ImageFormat.Jpeg;
|
||||
break;
|
||||
case 4:
|
||||
imageFormat = ImageFormat.Gif;
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException("File extension is not supported");
|
||||
}
|
||||
pictureBoxQRCode.BackgroundImage.Save(fs, imageFormat);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,4 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -9,8 +9,8 @@ namespace vCardEditor.View
|
||||
|
||||
protected override void OnLostFocus(EventArgs e)
|
||||
{
|
||||
base.OnLostFocus(e);
|
||||
oldText = this.Text;
|
||||
base.OnLostFocus(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user