5 Commits

Author SHA1 Message Date
abdelkader
1f234c61e9 #38 fix when changing phone, email, web 2024-03-17 22:25:12 -04:00
abdelkader
927d36a9a0 save phone when changed 2024-03-17 22:05:27 -04:00
abdelkader
653f21b9cc extended, po box were not saved 2024-03-15 14:19:11 -04:00
abdelkader
f509d5da84 Added svg support for qr code 2023-10-19 15:12:35 -04:00
Abdel
9012d355d3 Update README.md 2023-10-18 08:57:42 -04:00
15 changed files with 136 additions and 100 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -1,4 +1,6 @@
0.5.3
0.5.4
Fix a regression when saving Phones, Website, Email
0.5.3
Support of QR Code.
0.5.2

View File

@@ -244,6 +244,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,

View File

@@ -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.

View File

@@ -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();
}
}
}

View File

@@ -1,6 +1,8 @@
namespace Thought.vCards
{
public class vCardRoot
abstract public class vCardRoot
{
abstract public void ChangeContent(string text);
abstract public string GetNameType();
}
}

View File

@@ -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.

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -128,7 +128,7 @@ namespace vCardEditor.View
this.helpToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1202, 28);
this.menuStrip1.Size = new System.Drawing.Size(1202, 30);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
@@ -142,7 +142,7 @@ namespace vCardEditor.View
this.recentFilesMenuItem,
this.miQuit});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24);
this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 26);
this.fileToolStripMenuItem.Text = "File";
//
// miSave
@@ -193,7 +193,7 @@ namespace vCardEditor.View
this.copyToolStripMenuItem,
this.extraFieldsToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(49, 24);
this.editToolStripMenuItem.Size = new System.Drawing.Size(49, 26);
this.editToolStripMenuItem.Text = "Edit";
//
// copyToolStripMenuItem
@@ -231,7 +231,7 @@ namespace vCardEditor.View
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.imagesToolStripMenuItem});
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(58, 24);
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(58, 26);
this.toolsToolStripMenuItem.Text = "Tools";
//
// imagesToolStripMenuItem
@@ -267,7 +267,7 @@ namespace vCardEditor.View
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.miAbout});
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Size = new System.Drawing.Size(55, 24);
this.helpToolStripMenuItem.Size = new System.Drawing.Size(55, 26);
this.helpToolStripMenuItem.Text = "Help";
//
// miAbout
@@ -301,9 +301,9 @@ namespace vCardEditor.View
this.toolStripSeparator1,
this.tbsAbout,
this.toolStripSeparator});
this.toolStrip1.Location = new System.Drawing.Point(0, 28);
this.toolStrip1.Location = new System.Drawing.Point(0, 30);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(1202, 27);
this.toolStrip1.Size = new System.Drawing.Size(1202, 31);
this.toolStrip1.TabIndex = 1;
this.toolStrip1.Text = "toolStrip1";
//
@@ -313,7 +313,7 @@ namespace vCardEditor.View
this.tbsNew.Image = ((System.Drawing.Image)(resources.GetObject("tbsNew.Image")));
this.tbsNew.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsNew.Name = "tbsNew";
this.tbsNew.Size = new System.Drawing.Size(29, 24);
this.tbsNew.Size = new System.Drawing.Size(29, 28);
this.tbsNew.Text = "&Nouveau";
this.tbsNew.Click += new System.EventHandler(this.tbsNew_Click);
//
@@ -323,7 +323,7 @@ namespace vCardEditor.View
this.tbsOpen.Image = ((System.Drawing.Image)(resources.GetObject("tbsOpen.Image")));
this.tbsOpen.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsOpen.Name = "tbsOpen";
this.tbsOpen.Size = new System.Drawing.Size(29, 24);
this.tbsOpen.Size = new System.Drawing.Size(29, 28);
this.tbsOpen.Text = "&Open";
this.tbsOpen.Click += new System.EventHandler(this.tbsOpen_Click);
//
@@ -333,7 +333,7 @@ namespace vCardEditor.View
this.tbsSave.Image = ((System.Drawing.Image)(resources.GetObject("tbsSave.Image")));
this.tbsSave.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsSave.Name = "tbsSave";
this.tbsSave.Size = new System.Drawing.Size(29, 24);
this.tbsSave.Size = new System.Drawing.Size(29, 28);
this.tbsSave.Text = "&Save";
this.tbsSave.Click += new System.EventHandler(this.tbsSave_Click);
//
@@ -343,7 +343,7 @@ namespace vCardEditor.View
this.tbsDelete.Image = ((System.Drawing.Image)(resources.GetObject("tbsDelete.Image")));
this.tbsDelete.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsDelete.Name = "tbsDelete";
this.tbsDelete.Size = new System.Drawing.Size(29, 24);
this.tbsDelete.Size = new System.Drawing.Size(29, 28);
this.tbsDelete.Text = "Delete";
this.tbsDelete.Click += new System.EventHandler(this.tbsDelete_Click);
//
@@ -353,14 +353,14 @@ namespace vCardEditor.View
this.tbsQR.Image = global::vCardEditor.Properties.Resources.nuget_icon;
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.Size = new System.Drawing.Size(29, 28);
this.tbsQR.Text = "&QR Code";
this.tbsQR.Click += new System.EventHandler(this.tbsQR_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 27);
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 31);
//
// tbsAbout
//
@@ -368,14 +368,14 @@ namespace vCardEditor.View
this.tbsAbout.Image = ((System.Drawing.Image)(resources.GetObject("tbsAbout.Image")));
this.tbsAbout.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbsAbout.Name = "tbsAbout";
this.tbsAbout.Size = new System.Drawing.Size(29, 24);
this.tbsAbout.Size = new System.Drawing.Size(29, 28);
this.tbsAbout.Text = "&?";
this.tbsAbout.Click += new System.EventHandler(this.tbsAbout_Click);
//
// toolStripSeparator
//
this.toolStripSeparator.Name = "toolStripSeparator";
this.toolStripSeparator.Size = new System.Drawing.Size(6, 27);
this.toolStripSeparator.Size = new System.Drawing.Size(6, 31);
//
// openFileDialog
//
@@ -392,7 +392,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, 586);
this.gbNameList.Size = new System.Drawing.Size(398, 580);
this.gbNameList.TabIndex = 2;
this.gbNameList.TabStop = false;
this.gbNameList.Text = "Name List :";
@@ -424,7 +424,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, 533);
this.dgContacts.Size = new System.Drawing.Size(390, 527);
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);
@@ -507,7 +507,7 @@ namespace vCardEditor.View
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 55);
this.splitContainer1.Location = new System.Drawing.Point(0, 61);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
@@ -517,7 +517,7 @@ namespace vCardEditor.View
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.tcMainTab);
this.splitContainer1.Size = new System.Drawing.Size(1202, 586);
this.splitContainer1.Size = new System.Drawing.Size(1202, 580);
this.splitContainer1.SplitterDistance = 398;
this.splitContainer1.TabIndex = 4;
//
@@ -530,7 +530,7 @@ namespace vCardEditor.View
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, 586);
this.tcMainTab.Size = new System.Drawing.Size(800, 580);
this.tcMainTab.TabIndex = 0;
//
// TapPageMain
@@ -546,7 +546,7 @@ namespace vCardEditor.View
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, 557);
this.TapPageMain.Size = new System.Drawing.Size(792, 551);
this.TapPageMain.TabIndex = 0;
this.TapPageMain.Text = "Main";
//
@@ -555,7 +555,7 @@ namespace vCardEditor.View
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.Location = new System.Drawing.Point(402, 383);
this.extendedPanelWeb.Name = "extendedPanelWeb";
this.extendedPanelWeb.panelType = vCardEditor.View.Customs.PanelType.Web;
this.extendedPanelWeb.Size = new System.Drawing.Size(381, 155);
@@ -565,7 +565,7 @@ namespace vCardEditor.View
//
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.Location = new System.Drawing.Point(13, 383);
this.extendedPanelPhones.Name = "extendedPanelPhones";
this.extendedPanelPhones.panelType = vCardEditor.View.Customs.PanelType.Phone;
this.extendedPanelPhones.Size = new System.Drawing.Size(367, 155);
@@ -735,7 +735,7 @@ namespace vCardEditor.View
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.Size = new System.Drawing.Size(770, 192);
this.groupBox4.TabIndex = 5;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Address:";
@@ -753,7 +753,7 @@ namespace vCardEditor.View
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.Size = new System.Drawing.Size(745, 154);
this.tbcAddress.TabIndex = 0;
//
// tabPage3
@@ -762,7 +762,7 @@ namespace vCardEditor.View
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.Size = new System.Drawing.Size(737, 123);
this.tabPage3.TabIndex = 0;
this.tabPage3.Text = " ";
//

View File

@@ -201,8 +201,10 @@ 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();
extendedPanelPhones.ClearFields();

View File

@@ -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;
}
}

View File

@@ -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);
}
}
}
}

View File

@@ -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>