diff --git a/CHANGELOG.md b/CHANGELOG.md
index ca9e4a5..0a5b95b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,17 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
+## [1.0.9]
+### Changed
+- Code enhancements
+
+### Fixed
+- Update checker
+- Minors bugs
+
+### Added
+- Gallery folder viewer
+
## [1.0.8]
### Changed
- Camera tile view fix
diff --git a/CameraToolkit/CameraToolkit.csproj b/CameraToolkit/CameraToolkit.csproj
index 2caa382..100f954 100644
--- a/CameraToolkit/CameraToolkit.csproj
+++ b/CameraToolkit/CameraToolkit.csproj
@@ -40,7 +40,7 @@
DEBUG;TRACE
prompt
4
- false
+ true
AnyCPU
@@ -50,7 +50,7 @@
TRACE
prompt
4
- false
+ true
App.ico
@@ -71,8 +71,8 @@
..\packages\AForge.Video.DirectShow.2.2.5\lib\AForge.Video.DirectShow.dll
True
-
- ..\packages\Octokit.0.28.0\lib\net45\Octokit.dll
+
+ ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll
@@ -95,6 +95,12 @@
+
+ UserControl
+
+
+ Gallery.cs
+
Form
@@ -119,13 +125,20 @@
Messages.resx
+
True
True
Settings.settings
-
+
+
+ Gallery.cs
+
+
+ Gallery.cs
+
FormAbout.cs
diff --git a/CameraToolkit/Controls/Gallery.Designer.cs b/CameraToolkit/Controls/Gallery.Designer.cs
new file mode 100644
index 0000000..dbba801
--- /dev/null
+++ b/CameraToolkit/Controls/Gallery.Designer.cs
@@ -0,0 +1,206 @@
+namespace Toolkit.Controls
+{
+ partial class Gallery
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Gallery));
+ this.imageListThumbs = new System.Windows.Forms.ImageList(this.components);
+ this.listViewItems = new System.Windows.Forms.ListView();
+ this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.columnHeaderPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.columnHeaderSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.contextMenuStripActions = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.listToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.smallIconsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.largeIconsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.detailsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.tilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.fileSystemWatcher = new System.IO.FileSystemWatcher();
+ this.labelInformation = new System.Windows.Forms.Label();
+ this.contextMenuStripActions.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher)).BeginInit();
+ this.SuspendLayout();
+ //
+ // imageListThumbs
+ //
+ this.imageListThumbs.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
+ resources.ApplyResources(this.imageListThumbs, "imageListThumbs");
+ this.imageListThumbs.TransparentColor = System.Drawing.Color.Transparent;
+ //
+ // listViewItems
+ //
+ this.listViewItems.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.listViewItems.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeaderName,
+ this.columnHeaderPath,
+ this.columnHeaderSize});
+ this.listViewItems.ContextMenuStrip = this.contextMenuStripActions;
+ resources.ApplyResources(this.listViewItems, "listViewItems");
+ this.listViewItems.FullRowSelect = true;
+ this.listViewItems.LargeImageList = this.imageListThumbs;
+ this.listViewItems.Name = "listViewItems";
+ this.listViewItems.SmallImageList = this.imageListThumbs;
+ this.listViewItems.UseCompatibleStateImageBehavior = false;
+ this.listViewItems.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.ListViewItems_MouseDoubleClick);
+ //
+ // columnHeaderName
+ //
+ resources.ApplyResources(this.columnHeaderName, "columnHeaderName");
+ //
+ // columnHeaderPath
+ //
+ resources.ApplyResources(this.columnHeaderPath, "columnHeaderPath");
+ //
+ // columnHeaderSize
+ //
+ resources.ApplyResources(this.columnHeaderSize, "columnHeaderSize");
+ //
+ // contextMenuStripActions
+ //
+ this.contextMenuStripActions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.viewToolStripMenuItem,
+ this.toolStripSeparator1,
+ this.openToolStripMenuItem,
+ this.deleteToolStripMenuItem});
+ this.contextMenuStripActions.Name = "contextMenuStripActions";
+ resources.ApplyResources(this.contextMenuStripActions, "contextMenuStripActions");
+ this.contextMenuStripActions.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripActions_Opening);
+ //
+ // viewToolStripMenuItem
+ //
+ this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.listToolStripMenuItem,
+ this.smallIconsToolStripMenuItem,
+ this.largeIconsToolStripMenuItem,
+ this.detailsToolStripMenuItem,
+ this.tilesToolStripMenuItem});
+ this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
+ resources.ApplyResources(this.viewToolStripMenuItem, "viewToolStripMenuItem");
+ //
+ // listToolStripMenuItem
+ //
+ this.listToolStripMenuItem.Name = "listToolStripMenuItem";
+ resources.ApplyResources(this.listToolStripMenuItem, "listToolStripMenuItem");
+ this.listToolStripMenuItem.Click += new System.EventHandler(this.ListToolStripMenuItem_Click);
+ //
+ // smallIconsToolStripMenuItem
+ //
+ this.smallIconsToolStripMenuItem.Name = "smallIconsToolStripMenuItem";
+ resources.ApplyResources(this.smallIconsToolStripMenuItem, "smallIconsToolStripMenuItem");
+ this.smallIconsToolStripMenuItem.Click += new System.EventHandler(this.SmallIconsToolStripMenuItem_Click);
+ //
+ // largeIconsToolStripMenuItem
+ //
+ this.largeIconsToolStripMenuItem.Name = "largeIconsToolStripMenuItem";
+ resources.ApplyResources(this.largeIconsToolStripMenuItem, "largeIconsToolStripMenuItem");
+ this.largeIconsToolStripMenuItem.Click += new System.EventHandler(this.LargeIconsToolStripMenuItem_Click);
+ //
+ // detailsToolStripMenuItem
+ //
+ this.detailsToolStripMenuItem.Name = "detailsToolStripMenuItem";
+ resources.ApplyResources(this.detailsToolStripMenuItem, "detailsToolStripMenuItem");
+ this.detailsToolStripMenuItem.Click += new System.EventHandler(this.DetailsToolStripMenuItem_Click);
+ //
+ // tilesToolStripMenuItem
+ //
+ this.tilesToolStripMenuItem.Name = "tilesToolStripMenuItem";
+ resources.ApplyResources(this.tilesToolStripMenuItem, "tilesToolStripMenuItem");
+ this.tilesToolStripMenuItem.Click += new System.EventHandler(this.TilesToolStripMenuItem_Click);
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
+ //
+ // openToolStripMenuItem
+ //
+ this.openToolStripMenuItem.Name = "openToolStripMenuItem";
+ resources.ApplyResources(this.openToolStripMenuItem, "openToolStripMenuItem");
+ this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenToolStripMenuItem_Click);
+ //
+ // deleteToolStripMenuItem
+ //
+ this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
+ resources.ApplyResources(this.deleteToolStripMenuItem, "deleteToolStripMenuItem");
+ this.deleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click);
+ //
+ // fileSystemWatcher
+ //
+ this.fileSystemWatcher.EnableRaisingEvents = true;
+ this.fileSystemWatcher.SynchronizingObject = this;
+ this.fileSystemWatcher.Changed += new System.IO.FileSystemEventHandler(this.FileSystemWatcher_Changed);
+ this.fileSystemWatcher.Created += new System.IO.FileSystemEventHandler(this.FileSystemWatcher_Changed);
+ this.fileSystemWatcher.Deleted += new System.IO.FileSystemEventHandler(this.FileSystemWatcher_Changed);
+ this.fileSystemWatcher.Renamed += new System.IO.RenamedEventHandler(this.FileSystemWatcher_Renamed);
+ //
+ // labelInformation
+ //
+ resources.ApplyResources(this.labelInformation, "labelInformation");
+ this.labelInformation.Name = "labelInformation";
+ //
+ // Gallery
+ //
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.labelInformation);
+ this.Controls.Add(this.listViewItems);
+ this.DoubleBuffered = true;
+ this.Name = "Gallery";
+ this.Load += new System.EventHandler(this.Gallery_Load);
+ this.contextMenuStripActions.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ImageList imageListThumbs;
+ private System.Windows.Forms.ListView listViewItems;
+ private System.IO.FileSystemWatcher fileSystemWatcher;
+ private System.Windows.Forms.ContextMenuStrip contextMenuStripActions;
+ private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
+ private System.Windows.Forms.ColumnHeader columnHeaderName;
+ private System.Windows.Forms.ColumnHeader columnHeaderSize;
+ private System.Windows.Forms.ColumnHeader columnHeaderPath;
+ private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem listToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem smallIconsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem largeIconsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem detailsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem tilesToolStripMenuItem;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.Label labelInformation;
+ }
+}
diff --git a/CameraToolkit/Controls/Gallery.cs b/CameraToolkit/Controls/Gallery.cs
new file mode 100644
index 0000000..c94c5ad
--- /dev/null
+++ b/CameraToolkit/Controls/Gallery.cs
@@ -0,0 +1,147 @@
+using System;
+using System.Data;
+using System.Diagnostics;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Toolkit.Controls
+{
+ public partial class Gallery : UserControl
+ {
+ public Gallery()
+ {
+ InitializeComponent();
+ }
+
+ private void ListViewItems_MouseDoubleClick(object sender, MouseEventArgs e)
+ {
+ OpenToolStripMenuItem_Click(sender, e);
+ }
+
+ private async void Gallery_Load(object sender, EventArgs e)
+ {
+ listViewItems.DataBindings.Add("BackColor", this, "BackColor");
+ listViewItems.DataBindings.Add("ForeColor", this, "ForeColor");
+
+ Width = (int)(FindForm().Width * 0.3);
+ FindForm().Resize += (s, v) =>
+ {
+ Width = (int)((s as Form).Width * 0.3);
+ };
+ fileSystemWatcher.Path = Path.Combine(Properties.Settings.Default.DefaultPath, Program.AlbumName);
+ await PopulateAsync();
+ }
+
+ private async Task PopulateAsync()
+ {
+ var path = new DirectoryInfo(fileSystemWatcher.Path);
+ var files = path.GetFiles().Where(m => Program.Formats.Contains(m.Extension)).ToList();
+
+ var images = await Task.Run(() =>
+ (from item in files
+ let index = files.IndexOf(item)
+ let image = Image.FromFile(item.FullName)
+ let thumbnail = image.GetThumbnailImage(imageListThumbs.ImageSize.Width, imageListThumbs.ImageSize.Height, null, IntPtr.Zero)
+ select new { item.FullName, Index = index, Thumbnail = thumbnail, Size = (item.Length / 1024) }).ToList());
+
+ var data = from item in images
+ select new ListViewItem(new[] { Path.GetFileNameWithoutExtension(item.FullName), item.FullName, $"{item.Size.ToString()} Kb" }, item.Index);
+
+ this.Invoke(new Action(() =>
+ {
+ imageListThumbs.Images.Clear();
+ listViewItems.Items.Clear();
+ imageListThumbs.Images.AddRange(images.Select(m => m.Thumbnail).ToArray());
+ listViewItems.Items.AddRange(data.ToArray());
+
+ listViewItems.Visible = listViewItems.Items.Count > 0;
+ labelInformation.Visible = !listViewItems.Visible;
+
+ images = null;
+ data = null;
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ }));
+ }
+
+ private async void FileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
+ {
+ if (Program.Formats.Contains(Path.GetExtension(e.FullPath)))
+ await PopulateAsync();
+ }
+
+ private async void FileSystemWatcher_Renamed(object sender, RenamedEventArgs e)
+ {
+ if (Program.Formats.Contains(Path.GetExtension(e.FullPath)) || Program.Formats.Contains(Path.GetExtension(e.OldFullPath)))
+ await PopulateAsync();
+ }
+
+ private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (listViewItems.SelectedItems != null && listViewItems.SelectedItems.OfType().Any())
+ foreach (var item in listViewItems.SelectedItems)
+ Process.Start((item as ListViewItem).SubItems[1].Text);
+ }
+
+ private void ContextMenuStripActions_Opening(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ var hasItemSelected = (listViewItems.SelectedItems != null && listViewItems.SelectedItems.OfType().Any());
+ openToolStripMenuItem.Enabled = hasItemSelected;
+ deleteToolStripMenuItem.Enabled = hasItemSelected;
+ }
+
+ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (listViewItems.SelectedItems != null && listViewItems.SelectedItems.OfType().Any())
+ foreach (var item in listViewItems.SelectedItems)
+ {
+ try
+ {
+ File.Delete((item as ListViewItem).SubItems[1].Text);
+ }
+ catch (Exception)
+ {
+ }
+ }
+ }
+
+ public void Close()
+ {
+ fileSystemWatcher.EnableRaisingEvents = false;
+ fileSystemWatcher = null;
+ Parent.Controls.Remove(this);
+ Dispose();
+ GC.WaitForPendingFinalizers();
+ GC.Collect();
+ }
+
+ private void ListToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ listViewItems.View = View.List;
+ }
+
+ private void SmallIconsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ listViewItems.View = View.SmallIcon;
+ }
+
+ private void LargeIconsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ listViewItems.View = View.LargeIcon;
+ }
+
+ private void DetailsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ listViewItems.View = View.Details;
+ }
+
+ private void TilesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ listViewItems.View = View.Tile;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CameraToolkit/Controls/Gallery.es.resx b/CameraToolkit/Controls/Gallery.es.resx
new file mode 100644
index 0000000..e794dff
--- /dev/null
+++ b/CameraToolkit/Controls/Gallery.es.resx
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Nombre
+
+
+ Ruta
+
+
+ Tamaño
+
+
+ &Lista
+
+
+ Iconos &pequeños
+
+
+ Iconos &grandes
+
+
+ &Detalles
+
+
+ &Mosaicos
+
+
+ &Ver
+
+
+ &Abrir
+
+
+ &Eliminar
+
+
+ No se encontraron elementos
+
+
\ No newline at end of file
diff --git a/CameraToolkit/Controls/Gallery.resx b/CameraToolkit/Controls/Gallery.resx
new file mode 100644
index 0000000..e980946
--- /dev/null
+++ b/CameraToolkit/Controls/Gallery.resx
@@ -0,0 +1,370 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+
+ 48, 48
+
+
+ Name
+
+
+
+ 120
+
+
+ Path
+
+
+ Size
+
+
+ 100
+
+
+ 316, 17
+
+
+ 134, 22
+
+
+ &List
+
+
+ 134, 22
+
+
+ &Small icons
+
+
+ 134, 22
+
+
+ L&arge icons
+
+
+ 134, 22
+
+
+ &Details
+
+
+ 134, 22
+
+
+ &Tiles
+
+
+ 107, 22
+
+
+ &View
+
+
+ 104, 6
+
+
+ 107, 22
+
+
+ &Open
+
+
+ 107, 22
+
+
+ &Delete
+
+
+ 108, 76
+
+
+ contextMenuStripActions
+
+
+ System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ Fill
+
+
+ 0, 0
+
+
+ 240, 435
+
+
+ 0
+
+
+ False
+
+
+ listViewItems
+
+
+ System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 2
+
+
+ 164, 17
+
+
+ True
+
+
+ 6, 13
+
+
+ Fill
+
+
+ 0, 0
+
+
+ 240, 435
+
+
+ 1
+
+
+ No items was found
+
+
+
+ MiddleCenter
+
+
+ False
+
+
+ labelInformation
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 1
+
+
+ 240, 435
+
+
+ imageListThumbs
+
+
+ System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ columnHeaderName
+
+
+ System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ columnHeaderPath
+
+
+ System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ columnHeaderSize
+
+
+ System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ viewToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ listToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ smallIconsToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ largeIconsToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ detailsToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ tilesToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ toolStripSeparator1
+
+
+ System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ openToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ deleteToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ fileSystemWatcher
+
+
+ System.IO.FileSystemWatcher, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Gallery
+
+
+ System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/CameraToolkit/Forms/FormAbout.resx b/CameraToolkit/Forms/FormAbout.resx
index 93312cc..12183b4 100644
--- a/CameraToolkit/Forms/FormAbout.resx
+++ b/CameraToolkit/Forms/FormAbout.resx
@@ -413,7 +413,7 @@
3, 4, 3, 4
- CenterScreen
+ CenterParent
About...
diff --git a/CameraToolkit/Forms/FormMain.Designer.cs b/CameraToolkit/Forms/FormMain.Designer.cs
index 44e2eab..4e8a5db 100644
--- a/CameraToolkit/Forms/FormMain.Designer.cs
+++ b/CameraToolkit/Forms/FormMain.Designer.cs
@@ -85,12 +85,12 @@ private void InitializeComponent()
this.toolStripSeparatorMain1,
this.toolStripButtonCapture,
this.toolStripButtonSave,
- this.toolStripButtonFolder,
this.toolStripButtonClose,
this.toolStripButtonAbout,
this.toolStripButtonSettings,
this.toolStripSeparator1,
- this.toolStripButtonGallery});
+ this.toolStripButtonGallery,
+ this.toolStripButtonFolder});
this.toolStripMenu.Name = "toolStripMenu";
this.toolStripMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
this.helpProviderMain.SetShowHelp(this.toolStripMenu, ((bool)(resources.GetObject("toolStripMenu.ShowHelp"))));
@@ -194,13 +194,16 @@ private void InitializeComponent()
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
+ this.toolStripSeparator1.Visible = global::Toolkit.Properties.Settings.Default.AutoSave;
//
// toolStripButtonGallery
//
resources.ApplyResources(this.toolStripButtonGallery, "toolStripButtonGallery");
+ this.toolStripButtonGallery.CheckOnClick = true;
this.toolStripButtonGallery.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButtonGallery.Margin = new System.Windows.Forms.Padding(0);
this.toolStripButtonGallery.Name = "toolStripButtonGallery";
+ this.toolStripButtonGallery.Visible = global::Toolkit.Properties.Settings.Default.AutoSave;
this.toolStripButtonGallery.Click += new System.EventHandler(this.ToolStripButtonGallery_Click);
//
// saveFileDialogMain
diff --git a/CameraToolkit/Forms/FormMain.cs b/CameraToolkit/Forms/FormMain.cs
index fcdc5f8..0630f47 100644
--- a/CameraToolkit/Forms/FormMain.cs
+++ b/CameraToolkit/Forms/FormMain.cs
@@ -20,29 +20,30 @@ public FormMain()
{
InitializeComponent();
- Icon = Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetEntryAssembly().Location);
+ Icon = Icon.ExtractAssociatedIcon(Program.Assembly.Location);
// saveFileDialogMain
- saveFileDialogMain.DefaultExt = Program.imageFiles[0];
+ saveFileDialogMain.DefaultExt = Program.Formats.FirstOrDefault();
// Icons
- toolStripButtonDevices.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.linked_camera, 48, Color.White);
- toolStripButtonCapture.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.camera, 48, Color.White);
- toolStripButtonSave.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.save, 48, Color.White);
+ toolStripButtonDevices.SetImage(MaterialDesign.Instance, Program.Icon, 48, SystemColors.Control);
+ toolStripButtonCapture.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.camera, 48, SystemColors.Control);
+ toolStripButtonSave.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.save, 48, SystemColors.Control);
- toolStripMenuItemCamera.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.settings_brightness, 48, toolStripMenu.BackColor);
- toolStripMenuItemSystem.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.settings_system_daydream, 48, toolStripMenu.BackColor);
+ //toolStripMenuItemCamera.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.settings_brightness, 48, toolStripMenu.BackColor);
+ //toolStripMenuItemSystem.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.settings_system_daydream, 48, toolStripMenu.BackColor);
- toolStripButtonGallery.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.image, 48, Color.White);
- toolStripButtonFolder.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.folder_open, 48, Color.White);
+ toolStripMenuItemCamera.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.build, 48, toolStripMenu.BackColor);
+ toolStripMenuItemSystem.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.settings, 48, toolStripMenu.BackColor);
- toolStripButtonSettings.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.settings, 48, Color.White);
- toolStripButtonAbout.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.info, 48, Color.White);
- toolStripButtonClose.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.close, 48, Color.White);
+ toolStripButtonGallery.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.image, 48, SystemColors.Control);
+ toolStripButtonFolder.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.folder_open, 48, SystemColors.Control);
- toolStripMenuDisconnectItem.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.videocam_off, 48, toolStripMenu.BackColor);
+ toolStripButtonSettings.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.settings, 48, SystemColors.Control);
+ toolStripButtonAbout.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.info, 48, SystemColors.Control);
+ toolStripButtonClose.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.close, 48, SystemColors.Control);
- toolStripMenuItemCopy.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.content_copy, 16, toolStripMenu.BackColor);
+ toolStripMenuDisconnectItem.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.videocam_off, 48, toolStripMenu.BackColor);
#if DEBUG
FormHelper.ExtractResources(toolStripMenu);
@@ -78,7 +79,7 @@ private void Item_Click(object sender, EventArgs e)
toolStripMenuDisconnectItem.Enabled = IsRunning();
if (Properties.Settings.Default.AskAlbumName)
- Program.ShowInputDialog(ref Program.albumName, "Album");
+ Program.ShowInputDialog(ref Program.AlbumName, "Album");
}
catch (Exception ex)
{
@@ -140,10 +141,13 @@ private async void FormViewer_Shown(object sender, EventArgs e)
defaultDevice = _item;
}
+ labelPreview.Visible = defaultDevice == null;
+
if (defaultDevice != null)
defaultDevice.PerformClick();
- await GitHubInfo.CheckForUpdateAsync();
+ if (Properties.Settings.Default.CheckForUpdates)
+ await GitHubInfo.CheckForUpdateAsync();
}
private void FormViewer_FormClosing(object sender, FormClosingEventArgs e)
@@ -205,7 +209,7 @@ private void ToolStripMenuItemDisconnect_Click(object sender, EventArgs e)
toolStripMenuDisconnectItem.Enabled = IsRunning();
- Program.albumName = string.Empty;
+ Program.AlbumName = string.Empty;
}
private void ToolStripButtonSave_Click(object sender, EventArgs e)
@@ -217,13 +221,16 @@ private void ToolStripButtonSave_Click(object sender, EventArgs e)
while (filename == string.Empty || File.Exists(filename))
{
- filename = string.Format("{0}_{1}_{2}_{3}.jpg", DeviceName.Replace(' ', '_'), Program.sessionId, DateTime.Now.ToString("yyyyMMdd"), i.ToString());
+ filename = string.Format("{0}_{1}_{2}_{3}.jpg", DeviceName.Replace(' ', '_'), Program.SessionId, DateTime.Now.ToString("yyyyMMdd"), i.ToString());
if (Properties.Settings.Default.AutoSave &&
!string.IsNullOrEmpty(Properties.Settings.Default.DefaultPath) &&
Directory.Exists(Properties.Settings.Default.DefaultPath))
+ {
+ if (Properties.Settings.Default.AskAlbumName && string.IsNullOrEmpty(Program.AlbumName))
+ Program.ShowInputDialog(ref Program.AlbumName, "Album");
- filename = Path.Combine(Properties.Settings.Default.DefaultPath, Program.albumName, filename);
-
+ filename = Path.Combine(Properties.Settings.Default.DefaultPath, Program.AlbumName, filename);
+ }
i++;
}
@@ -248,14 +255,31 @@ private void ToolStripButtonFolder_Click(object sender, EventArgs e)
Properties.Settings.Default.DefaultPath = string.Empty;
Properties.Settings.Default.Save();
- MessageBox.Show(Toolkit.Messages.PathNotFound, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(Messages.PathNotFound, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
- System.Diagnostics.Process.Start(Properties.Settings.Default.DefaultPath);
+ Process.Start(Path.Combine(Properties.Settings.Default.DefaultPath, Program.AlbumName));
}
private void ToolStripButtonGallery_Click(object sender, EventArgs e)
{
+ if (!this.Controls.OfType().Any())
+ {
+ var child = new Controls.Gallery
+ {
+ Dock = DockStyle.Right,
+ BackColor = toolStripMenu.BackColor,
+ ForeColor = SystemColors.Control
+ };
+ Controls.Add(child);
+ child.BringToFront();
+ }
+ else
+ {
+ var child = this.Controls.OfType().FirstOrDefault();
+ if (child != null)
+ child.Close();
+ }
}
private void ToolStripMenuItemCamera_Click(object sender, EventArgs e)
@@ -268,6 +292,9 @@ private void ToolStripMenuItemSystem_Click(object sender, EventArgs e)
{
var child = new FormSettings();
child.ShowDialog();
+ toolStripButtonGallery.Visible = Properties.Settings.Default.AutoSave;
+ toolStripButtonFolder.Visible = Properties.Settings.Default.AutoSave;
+ toolStripSeparator1.Visible = Properties.Settings.Default.AutoSave;
}
private void ToolStripButtonAbout_Click(object sender, EventArgs e)
diff --git a/CameraToolkit/Forms/FormMain.resx b/CameraToolkit/Forms/FormMain.resx
index 10e6415..70f3996 100644
--- a/CameraToolkit/Forms/FormMain.resx
+++ b/CameraToolkit/Forms/FormMain.resx
@@ -163,13 +163,13 @@
None
- 133, 22
+ 152, 22
&Disconnect
- 130, 6
+ 149, 6
@@ -264,31 +264,6 @@
&Save
-
- False
-
-
-
- iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADgSURBVGhD7djhDYIwEIZhBmAB52APJ2ADN3AFd3EgV2ko
- 3tn7QRMSildCNe+TNBij991n/CF2AAD8vXme+xjjfZqm59aR113tbW3Q5UMIL7kWa6qELDPaXrs0U0IW
- udlOu619xTbOQ/IuFl2Hp4BDb/F+ZxSQzNHi/ZYFdLBchiOOzf7QTIv3WxYQgz1dnc5OERTIUaCQzk4R
- FMhRoJDOThEUyFGgkM5OERTIUaCQzk4RBxaQxz/5a/SrW0oPzbR4P5m3+6bew7Lq3ZEpHSifStHfKp6j
- GdWXBwAAALCu696F5IZLWtKCwgAAAABJRU5ErkJggg==
-
-
-
- None
-
-
- Magenta
-
-
- 48, 48
-
-
- &Open folder
-
False
@@ -344,16 +319,16 @@
False
- 124, 22
+ 152, 22
- &Camera...
+ &Camera
- 124, 22
+ 152, 22
- &System...
+ &System
@@ -383,9 +358,6 @@
47, 6
-
- False
-
False
@@ -412,9 +384,31 @@
&Gallery
-
+
False
+
+
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADgSURBVGhD7djhDYIwEIZhBmAB52APJ2ADN3AFd3EgV2ko
+ 3tn7QRMSildCNe+TNBij991n/CF2AAD8vXme+xjjfZqm59aR113tbW3Q5UMIL7kWa6qELDPaXrs0U0IW
+ udlOu619xTbOQ/IuFl2Hp4BDb/F+ZxSQzNHi/ZYFdLBchiOOzf7QTIv3WxYQgz1dnc5OERTIUaCQzk4R
+ FMhRoJDOThEUyFGgkM5OERTIUaCQzk4RBxaQxz/5a/SrW0oPzbR4P5m3+6bew7Lq3ZEpHSifStHfKp6j
+ GdWXBwAAALCu696F5IZLWtKCwgAAAABJRU5ErkJggg==
+
+
+
+ None
+
+
+ Magenta
+
+
+ 48, 48
+
+
+ &Open folder
+
0, 0
@@ -457,6 +451,9 @@
Fill
+
+ Segoe UI, 18pt
+
NoControl
@@ -533,6 +530,9 @@ To start capturing
Segoe UI, 9.75pt
+
+ NoControl
+
3, 4, 3, 4
diff --git a/CameraToolkit/Forms/FormSettings.Designer.cs b/CameraToolkit/Forms/FormSettings.Designer.cs
index 5a459ad..3bcf30b 100644
--- a/CameraToolkit/Forms/FormSettings.Designer.cs
+++ b/CameraToolkit/Forms/FormSettings.Designer.cs
@@ -42,6 +42,7 @@ private void InitializeComponent()
this.checkBoxAlbumName = new System.Windows.Forms.CheckBox();
this.checkBoxAutoSave = new System.Windows.Forms.CheckBox();
this.textBoxAutoSavePath = new System.Windows.Forms.TextBox();
+ this.checkBoxCheckForUpdates = new System.Windows.Forms.CheckBox();
this.groupBoxAutostart.SuspendLayout();
this.groupBoxAutoSave.SuspendLayout();
this.SuspendLayout();
@@ -52,14 +53,14 @@ private void InitializeComponent()
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.UseVisualStyleBackColor = true;
- this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
+ this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// buttonAccept
//
resources.ApplyResources(this.buttonAccept, "buttonAccept");
this.buttonAccept.Name = "buttonAccept";
this.buttonAccept.UseVisualStyleBackColor = true;
- this.buttonAccept.Click += new System.EventHandler(this.buttonAccept_Click);
+ this.buttonAccept.Click += new System.EventHandler(this.ButtonAccept_Click);
//
// comboBoxDevices
//
@@ -73,7 +74,7 @@ private void InitializeComponent()
resources.ApplyResources(this.buttonExamine, "buttonExamine");
this.buttonExamine.Name = "buttonExamine";
this.buttonExamine.UseVisualStyleBackColor = true;
- this.buttonExamine.Click += new System.EventHandler(this.buttonExamine_Click);
+ this.buttonExamine.Click += new System.EventHandler(this.ButtonExamine_Click);
//
// labelAutoSavePath
//
@@ -136,6 +137,15 @@ private void InitializeComponent()
this.textBoxAutoSavePath.Name = "textBoxAutoSavePath";
this.textBoxAutoSavePath.Text = global::Toolkit.Properties.Settings.Default.DefaultPath;
//
+ // checkBoxCheckForUpdates
+ //
+ resources.ApplyResources(this.checkBoxCheckForUpdates, "checkBoxCheckForUpdates");
+ this.checkBoxCheckForUpdates.Checked = global::Toolkit.Properties.Settings.Default.CheckForUpdates;
+ this.checkBoxCheckForUpdates.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.checkBoxCheckForUpdates.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::Toolkit.Properties.Settings.Default, "CheckForUpdates", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
+ this.checkBoxCheckForUpdates.Name = "checkBoxCheckForUpdates";
+ this.checkBoxCheckForUpdates.UseVisualStyleBackColor = true;
+ //
// FormSettings
//
this.AcceptButton = this.buttonAccept;
@@ -143,6 +153,7 @@ private void InitializeComponent()
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.CancelButton = this.buttonCancel;
+ this.Controls.Add(this.checkBoxCheckForUpdates);
this.Controls.Add(this.groupBoxAutoSave);
this.Controls.Add(this.groupBoxAutostart);
this.Controls.Add(this.buttonAccept);
@@ -158,6 +169,7 @@ private void InitializeComponent()
this.groupBoxAutoSave.ResumeLayout(false);
this.groupBoxAutoSave.PerformLayout();
this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -176,5 +188,6 @@ private void InitializeComponent()
private System.Windows.Forms.GroupBox groupBoxAutostart;
private System.Windows.Forms.GroupBox groupBoxAutoSave;
private System.Windows.Forms.CheckBox checkBoxAlbumName;
+ private System.Windows.Forms.CheckBox checkBoxCheckForUpdates;
}
}
\ No newline at end of file
diff --git a/CameraToolkit/Forms/FormSettings.cs b/CameraToolkit/Forms/FormSettings.cs
index ae9b934..f90a8dc 100644
--- a/CameraToolkit/Forms/FormSettings.cs
+++ b/CameraToolkit/Forms/FormSettings.cs
@@ -1,5 +1,6 @@
using System;
using System.Drawing;
+using System.IO;
using System.Windows.Forms;
namespace Toolkit.Forms
@@ -10,7 +11,7 @@ public FormSettings()
{
InitializeComponent();
- Icon = Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetEntryAssembly().Location);
+ Icon = Icon.ExtractAssociatedIcon(Program.Assembly.Location);
comboBoxDevices.DisplayMember = "Value";
comboBoxDevices.ValueMember = "Key";
@@ -22,23 +23,23 @@ public FormSettings()
checkBoxAlbumName.DataBindings.Add("Enabled", checkBoxAutoSave, "Checked");
}
- private void buttonExamine_Click(object sender, EventArgs e)
+ private void ButtonExamine_Click(object sender, EventArgs e)
{
folderBrowserDialogAutoSavePath.ShowDialog();
if (!string.IsNullOrEmpty(folderBrowserDialogAutoSavePath.SelectedPath))
textBoxAutoSavePath.Text = folderBrowserDialogAutoSavePath.SelectedPath;
}
- private void buttonAccept_Click(object sender, EventArgs e)
+ private void ButtonAccept_Click(object sender, EventArgs e)
{
- if (checkBoxAutoSave.Checked && !System.IO.Directory.Exists(textBoxAutoSavePath.Text))
+ if (checkBoxAutoSave.Checked && !Directory.Exists(textBoxAutoSavePath.Text))
{
var question = MessageBox.Show(Toolkit.Messages.PathNotFoundAndCreate, Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (question == DialogResult.Yes)
{
try
{
- System.IO.Directory.CreateDirectory(textBoxAutoSavePath.Text);
+ Directory.CreateDirectory(textBoxAutoSavePath.Text);
}
catch (Exception ex)
{
@@ -53,12 +54,13 @@ private void buttonAccept_Click(object sender, EventArgs e)
}
}
+ Properties.Settings.Default.AutoSave = checkBoxAutoSave.Checked;
Properties.Settings.Default.DefaultDevice = comboBoxDevices.SelectedValue.ToString();
Properties.Settings.Default.Save();
Close();
}
- private void buttonCancel_Click(object sender, EventArgs e)
+ private void ButtonCancel_Click(object sender, EventArgs e)
{
Close();
}
diff --git a/CameraToolkit/Forms/FormSettings.es.resx b/CameraToolkit/Forms/FormSettings.es.resx
index 395783b..4fb6596 100644
--- a/CameraToolkit/Forms/FormSettings.es.resx
+++ b/CameraToolkit/Forms/FormSettings.es.resx
@@ -155,7 +155,7 @@
128, 17
- &Guardado automatico
+ &Guardado automático
@@ -775,4 +775,7 @@
Sistema
+
+ &Buscar actualizaciones al iniciar
+
\ No newline at end of file
diff --git a/CameraToolkit/Forms/FormSettings.resx b/CameraToolkit/Forms/FormSettings.resx
index aa31038..da83e1e 100644
--- a/CameraToolkit/Forms/FormSettings.resx
+++ b/CameraToolkit/Forms/FormSettings.resx
@@ -121,6 +121,9 @@
Bottom, Right
+
+ NoControl
+
297, 286
@@ -145,11 +148,14 @@
$this
- 3
+ 4
Bottom, Right
+
+ NoControl
+
216, 286
@@ -172,7 +178,7 @@
$this
- 2
+ 3
Top, Left, Right
@@ -207,6 +213,9 @@
False
+
+ NoControl
+
279, 69
@@ -237,6 +246,9 @@
True
+
+ NoControl
+
6, 24
@@ -264,6 +276,9 @@
True
+
+ NoControl
+
6, 24
@@ -294,6 +309,9 @@
True
+
+ NoControl
+
6, 0
@@ -337,7 +355,7 @@
$this
- 1
+ 2
Top, Left, Right
@@ -348,6 +366,9 @@
False
+
+ NoControl
+
9, 73
@@ -375,6 +396,9 @@
True
+
+ NoControl
+
6, 0
@@ -445,6 +469,39 @@
$this
+ 1
+
+
+ Bottom, Left
+
+
+ True
+
+
+ NoControl
+
+
+ 18, 290
+
+
+ 160, 17
+
+
+ 0
+
+
+ Check for &updates at startup
+
+
+ checkBoxCheckForUpdates
+
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
0
diff --git a/CameraToolkit/Program.cs b/CameraToolkit/Program.cs
index ffb98ab..e59ad77 100644
--- a/CameraToolkit/Program.cs
+++ b/CameraToolkit/Program.cs
@@ -1,102 +1,44 @@
-using AForge.Video.DirectShow;
-using System;
+using System;
using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Pictograms;
+using System.Reflection;
+using System.Threading;
using System.Windows.Forms;
namespace Toolkit
{
- internal static class Program
+ internal static partial class Program
{
- internal static FilterInfoCollection devices;
- internal static List activeDevices;
- internal static string sessionId;
+ internal static bool IsNewInstance = false;
+ internal static Mutex Mutex = new Mutex(true, ApplicationInfo.Guid, out IsNewInstance);
+ internal static Assembly Assembly = Assembly.GetExecutingAssembly();
- internal static string albumName;
-
- internal static List imageFiles = new List(new string[] { ".bmp", ".jpg", ".jpeg", ".jpe", ".jfif", ".png", ".gif" });
+ internal static Dictionary CommandArgs => ApplicationInfo.GetCommandLine();
[STAThread]
private static void Main()
{
-#if DEBUG
- ImageHelper.GetEditorIcon(MaterialDesign.GetImage(MaterialDesign.IconType.linked_camera, 256, Color.White));
-#endif
+ Initialize();
- sessionId = DateTime.Now.TimeOfDay.Ticks.ToString();
- activeDevices = new List();
- devices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Forms.FormMain());
+
+ if (IsNewInstance)
+ Application.Run(new Forms.FormMain());
+ else
+ NewInstanceHandler(null, EventArgs.Empty);
}
- internal static Dictionary GetDevices()
+ private static void UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
- var result = new Dictionary();
-
- if (devices.Count > 0)
- for (int i = 0; i < devices.Count; i++)
- result.Add(devices[i].MonikerString, devices[i].Name.ToString());
-
- return result;
}
- internal static DialogResult ShowInputDialog(ref string input, string caption)
+ private static void NewInstanceHandler(object sender, EventArgs e)
{
- var size = new Size(200, 70);
-
- var inputBox = new Form
- {
- Padding = new Padding(6),
- FormBorderStyle = FormBorderStyle.FixedDialog,
- ShowIcon = false,
- ShowInTaskbar = false,
- MaximizeBox = false,
- MinimizeBox = false,
- ClientSize = size,
- Text = caption,
- StartPosition = FormStartPosition.CenterParent
- };
-
- var textBox = new TextBox
- {
- Dock = DockStyle.Top,
- Size = new Size(size.Width - 10, 23),
- Location = new Point(5, 5),
- Text = input
- };
- inputBox.Controls.Add(textBox);
-
- var okButton = new Button
- {
- DialogResult = DialogResult.OK,
- Name = "okButton",
- Size = new Size(75, 23),
- Text = Messages.OK,
- Location = new Point(size.Width - 80 - 80, 39)
- };
- inputBox.Controls.Add(okButton);
-
- var cancelButton = new Button
- {
- DialogResult = DialogResult.Cancel,
- Name = "cancelButton",
- Size = new Size(75, 23),
- Text = Messages.Cancel,
- Location = new Point(size.Width - 80, 39)
- };
- inputBox.Controls.Add(cancelButton);
-
- inputBox.AcceptButton = okButton;
- inputBox.CancelButton = cancelButton;
-
- var result = inputBox.ShowDialog();
- input = textBox.Text;
-
- return result;
+ NewInstance?.Invoke(sender, e);
}
+
+ public static event EventHandler NewInstance;
}
}
\ No newline at end of file
diff --git a/CameraToolkit/Properties/Settings.Designer.cs b/CameraToolkit/Properties/Settings.Designer.cs
index d2e83c1..9ca42da 100644
--- a/CameraToolkit/Properties/Settings.Designer.cs
+++ b/CameraToolkit/Properties/Settings.Designer.cs
@@ -82,5 +82,17 @@ public bool AskAlbumName {
this["AskAlbumName"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool CheckForUpdates {
+ get {
+ return ((bool)(this["CheckForUpdates"]));
+ }
+ set {
+ this["CheckForUpdates"] = value;
+ }
+ }
}
}
diff --git a/CameraToolkit/Properties/Settings.settings b/CameraToolkit/Properties/Settings.settings
index 268a635..3edc501 100644
--- a/CameraToolkit/Properties/Settings.settings
+++ b/CameraToolkit/Properties/Settings.settings
@@ -17,5 +17,8 @@
False
+
+ True
+
\ No newline at end of file
diff --git a/CameraToolkit/References.cs b/CameraToolkit/References.cs
deleted file mode 100644
index 20c945e..0000000
--- a/CameraToolkit/References.cs
+++ /dev/null
@@ -1,305 +0,0 @@
-// ----------------------------------------
-// References
-// Version 1.0.2
-// Updated 2018-12-26
-// ----------------------------------------
-
-using Octokit;
-using System.Diagnostics;
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-#if DEBUG
-
-namespace System.Drawing
-{
- ///
- /// Provides helper methods for imaging
- ///
- internal static partial class ImageHelper
- {
- ///
- /// Converts a PNG image to a icon (ico)
- ///
- /// The input stream
- /// The output stream
- /// The size (16x16 px by default)
- /// Preserve the aspect ratio
- /// Wether or not the icon was succesfully generated
- internal static bool ConvertToIcon(Stream input, Stream output, int size = 16, bool preserveAspectRatio = false)
- {
- Bitmap inputBitmap = (Bitmap)Bitmap.FromStream(input);
- if (inputBitmap != null)
- {
- int width, height;
- if (preserveAspectRatio)
- {
- width = size;
- height = inputBitmap.Height / inputBitmap.Width * size;
- }
- else
- {
- width = height = size;
- }
- Bitmap newBitmap = new Bitmap(inputBitmap, new Size(width, height));
- if (newBitmap != null)
- {
- // save the resized png into a memory stream for future use
- using (MemoryStream memoryStream = new MemoryStream())
- {
- newBitmap.Save(memoryStream, ImageFormat.Png);
-
- BinaryWriter iconWriter = new BinaryWriter(output);
- if (output != null && iconWriter != null)
- {
- // 0-1 reserved, 0
- iconWriter.Write((byte)0);
- iconWriter.Write((byte)0);
-
- // 2-3 image type, 1 = icon, 2 = cursor
- iconWriter.Write((short)1);
-
- // 4-5 number of images
- iconWriter.Write((short)1);
-
- // image entry 1
- // 0 image width
- iconWriter.Write((byte)width);
- // 1 image height
- iconWriter.Write((byte)height);
-
- // 2 number of colors
- iconWriter.Write((byte)0);
-
- // 3 reserved
- iconWriter.Write((byte)0);
-
- // 4-5 color planes
- iconWriter.Write((short)0);
-
- // 6-7 bits per pixel
- iconWriter.Write((short)32);
-
- // 8-11 size of image data
- iconWriter.Write((int)memoryStream.Length);
-
- // 12-15 offset of image data
- iconWriter.Write((int)(6 + 16));
-
- // write image data
- // png data must contain the whole png data file
- iconWriter.Write(memoryStream.ToArray());
-
- iconWriter.Flush();
-
- return true;
- }
- }
- }
- return false;
- }
- return false;
- }
-
- ///
- /// Converts a PNG image to a icon (ico)
- ///
- /// The input path
- /// The output path
- /// The size (16x16 px by default)
- /// Preserve the aspect ratio
- /// Wether or not the icon was succesfully generated
- internal static bool ConvertToIcon(string inputPath, string outputPath, int size = 16, bool preserveAspectRatio = false)
- {
- using (FileStream inputStream = new FileStream(inputPath, IO.FileMode.Open))
- using (FileStream outputStream = new FileStream(outputPath, IO.FileMode.OpenOrCreate))
- {
- return ConvertToIcon(inputStream, outputStream, size, preserveAspectRatio);
- }
- }
-
- internal static bool GetEditorIcon(Image img)
- {
- Bitmap bmp = new Bitmap(img.Width, img.Height);
- using (Graphics gfx = Graphics.FromImage(bmp))
- using (SolidBrush brush = new SolidBrush(Color.FromArgb(43, 43, 43)))
- {
- gfx.FillRectangle(brush, 0, 0, bmp.Width, bmp.Height);
- gfx.DrawImage(img, 0, 0);
- }
-
- var assemblyName = Assembly.GetEntryAssembly().GetName().Name;
-
- bmp.Save(@"..\..\.editoricon.png");
- ConvertToIcon(@"..\..\.editoricon.png", string.Format(@"..\..\{0}\App.ico", assemblyName), (img.Width + img.Height) / 2, true);
-
- return true;
- }
- }
-}
-
-namespace System.Windows.Forms
-{
- internal static partial class FormHelper
- {
- public static void ExtractResources(Image image, string name)
- {
- if (image != null)
- {
- var assemblyName = Assembly.GetEntryAssembly().GetName().Name;
- var dirPath = string.Format(@"..\..\{0}\Resources\", assemblyName);
- if (!System.IO.Directory.Exists(dirPath))
- System.IO.Directory.CreateDirectory(dirPath);
- image.Save(string.Format(@"..\..\{0}\Resources\{1}.png", assemblyName, name));
- }
- }
-
- public static void ExtractResources(ToolStrip source)
- {
- foreach (var item in source.Items.OfType().Where(i => i.Image != null))
- ExtractResources(item.Image, item.Name);
- foreach (var item in source.Items.OfType().Where(i => i.Image != null))
- ExtractResources(item.Image, item.Name);
- }
- }
-}
-
-#endif
-
-namespace System.Windows.Forms
-{
- internal static partial class FormHelper
- {
- public static Rectangle GetWorkingArea()
- {
- int minx, miny, maxx, maxy;
- minx = miny = int.MaxValue;
- maxx = maxy = int.MinValue;
-
- foreach (Screen screen in Screen.AllScreens)
- {
- var bounds = screen.Bounds;
- minx = Math.Min(minx, bounds.X);
- miny = Math.Min(miny, bounds.Y);
- maxx = Math.Max(maxx, bounds.Right);
- maxy = Math.Max(maxy, bounds.Bottom);
- }
-
- return new System.Drawing.Rectangle(0, 0, (maxx - minx), (maxy - miny));
- }
- }
-
- internal class BufferedPanel : Panel
- {
- #region Public Constructors
-
- public BufferedPanel()
- {
- SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw, true);
- }
-
- #endregion Public Constructors
- }
-}
-
-namespace System.Reflection
-{
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public class GitHubAttribute : Attribute
- {
- public GitHubAttribute()
- {
- }
-
- public GitHubAttribute(string owner, string repo, string assetName = "") : base()
- {
- Owner = owner;
- Repo = repo;
- AssetName = assetName;
- }
-
- public string Owner { get; private set; }
- public string Repo { get; private set; }
- public string AssetName { get; private set; }
-
- public override string ToString()
- {
- return $"https://github.com/{Owner}/{Repo}";
- }
- }
-
- internal static class ApplicationInfo
- {
- public static Assembly Assembly => Assembly.GetCallingAssembly();
-
- public static Version Version => ApplicationInfo.Assembly.GetName().Version;
- public static string Title => ApplicationInfo.Assembly.GetCustomAttribute().Title;
- public static string Product => ApplicationInfo.Assembly.GetCustomAttribute().Product;
- public static string Description => ApplicationInfo.Assembly.GetCustomAttribute().Description;
- public static string Copyright => ApplicationInfo.Assembly.GetCustomAttribute().Copyright;
- public static string Company => ApplicationInfo.Assembly.GetCustomAttribute().Company;
- }
-
- internal static class GitHubInfo
- {
- public static string Repo => ApplicationInfo.Assembly.GetCustomAttribute().ToString();
- public static string Owner => ApplicationInfo.Assembly.GetCustomAttribute().Owner;
- public static string Name => ApplicationInfo.Assembly.GetCustomAttribute().Repo;
- public static string AssetName => ApplicationInfo.Assembly.GetCustomAttribute().AssetName;
-
- public static Release LatestRelease { get; set; }
-
- public async static Task GetLatestReleaseAsync()
- {
- try
- {
- var client = new GitHubClient(new ProductHeaderValue(ApplicationInfo.Title, ApplicationInfo.Version.ToString()));
- return await client.Repository.Release.GetLatest(GitHubInfo.Owner, GitHubInfo.Repo);
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex.Message);
- }
- return null;
- }
-
- public async static Task CheckForUpdateAsync()
- {
- try
- {
- LatestRelease = await GetLatestReleaseAsync();
- if (ApplicationInfo.Version < LatestRelease.GetVersion())
- {
- var updateMessage = Toolkit.Messages.NewVersion;
- updateMessage = updateMessage.Replace("{VERSION}", LatestRelease.GetVersion().ToString());
- updateMessage = updateMessage.Replace("{CREATEDAT}", LatestRelease.CreatedAt.UtcDateTime.ToShortDateString());
- if (MessageBox.Show(updateMessage, ApplicationInfo.Title, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- var assetName = GitHubInfo.AssetName;
- if (string.IsNullOrEmpty(assetName)) assetName = $"{ApplicationInfo.Product}.zip";
- var assetUrl = LatestRelease.Assets.FirstOrDefault(m => m.Name == assetName);
- var url = LatestRelease.AssetsUrl;
- if (assetUrl != null) url = assetUrl.BrowserDownloadUrl;
- if (string.IsNullOrEmpty(url)) url = GitHubInfo.Repo;
- if (!string.IsNullOrEmpty(url)) Process.Start(url);
- }
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex.Message);
- }
- }
-
- public static Version GetVersion(this Release release)
- {
- Version.TryParse(release.TagName.Replace("v", ""), out Version result);
- return result;
- }
- }
-}
\ No newline at end of file
diff --git a/CameraToolkit/References/System.cs b/CameraToolkit/References/System.cs
new file mode 100644
index 0000000..a4445f4
--- /dev/null
+++ b/CameraToolkit/References/System.cs
@@ -0,0 +1,443 @@
+// ----------------------------------------
+// System References
+// Version 1.1.0
+// Updated 2017-12-26
+// ----------------------------------------
+
+using GitHub;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Linq;
+using System.Net.Http;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace System
+{
+#if DEBUG
+
+ namespace Drawing
+ {
+ ///
+ /// Provides helper methods for imaging
+ ///
+ internal static partial class ImageHelper
+ {
+ ///
+ /// Converts a PNG image to a icon (ico)
+ ///
+ /// The input stream
+ /// The output stream
+ /// The size (16x16 px by default)
+ /// Preserve the aspect ratio
+ /// Wether or not the icon was succesfully generated
+ internal static bool ConvertToIcon(Stream input, Stream output, int size = 16, bool preserveAspectRatio = false)
+ {
+ Bitmap inputBitmap = (Bitmap)Bitmap.FromStream(input);
+ if (inputBitmap != null)
+ {
+ int width, height;
+ if (preserveAspectRatio)
+ {
+ width = size;
+ height = inputBitmap.Height / inputBitmap.Width * size;
+ }
+ else
+ {
+ width = height = size;
+ }
+ Bitmap newBitmap = new Bitmap(inputBitmap, new Size(width, height));
+ if (newBitmap != null)
+ {
+ // save the resized png into a memory stream for future use
+ using (MemoryStream memoryStream = new MemoryStream())
+ {
+ newBitmap.Save(memoryStream, ImageFormat.Png);
+
+ BinaryWriter iconWriter = new BinaryWriter(output);
+ if (output != null && iconWriter != null)
+ {
+ // 0-1 reserved, 0
+ iconWriter.Write((byte)0);
+ iconWriter.Write((byte)0);
+
+ // 2-3 image type, 1 = icon, 2 = cursor
+ iconWriter.Write((short)1);
+
+ // 4-5 number of images
+ iconWriter.Write((short)1);
+
+ // image entry 1
+ // 0 image width
+ iconWriter.Write((byte)width);
+ // 1 image height
+ iconWriter.Write((byte)height);
+
+ // 2 number of colors
+ iconWriter.Write((byte)0);
+
+ // 3 reserved
+ iconWriter.Write((byte)0);
+
+ // 4-5 color planes
+ iconWriter.Write((short)0);
+
+ // 6-7 bits per pixel
+ iconWriter.Write((short)32);
+
+ // 8-11 size of image data
+ iconWriter.Write((int)memoryStream.Length);
+
+ // 12-15 offset of image data
+ iconWriter.Write((int)(6 + 16));
+
+ // write image data
+ // png data must contain the whole png data file
+ iconWriter.Write(memoryStream.ToArray());
+
+ iconWriter.Flush();
+
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ return false;
+ }
+
+ ///
+ /// Converts a PNG image to a icon (ico)
+ ///
+ /// The input path
+ /// The output path
+ /// The size (16x16 px by default)
+ /// Preserve the aspect ratio
+ /// Wether or not the icon was succesfully generated
+ internal static bool ConvertToIcon(string inputPath, string outputPath, int size = 16, bool preserveAspectRatio = false)
+ {
+ using (FileStream inputStream = new FileStream(inputPath, FileMode.Open))
+ using (FileStream outputStream = new FileStream(outputPath, FileMode.OpenOrCreate))
+ {
+ return ConvertToIcon(inputStream, outputStream, size, preserveAspectRatio);
+ }
+ }
+
+ internal static bool GetEditorIcon(Image img)
+ {
+ Bitmap bmp = new Bitmap(img.Width, img.Height);
+ using (Graphics gfx = Graphics.FromImage(bmp))
+ using (SolidBrush brush = new SolidBrush(Color.FromArgb(43, 43, 43)))
+ {
+ gfx.FillRectangle(brush, 0, 0, bmp.Width, bmp.Height);
+ gfx.DrawImage(img, 0, 0);
+ }
+
+ var assemblyName = Assembly.GetEntryAssembly().GetName().Name;
+
+ bmp.Save(@"..\..\.editoricon.png");
+ ConvertToIcon(@"..\..\.editoricon.png", string.Format(@"..\..\{0}\App.ico", assemblyName), (img.Width + img.Height) / 2, true);
+
+ return true;
+ }
+ }
+ }
+
+#endif
+
+ namespace Windows
+ {
+ namespace Forms
+ {
+#if DEBUG
+
+ internal static partial class FormHelper
+ {
+ public static void ExtractResources(Image image, string name)
+ {
+ if (image != null)
+ {
+ var assemblyName = Assembly.GetEntryAssembly().GetName().Name;
+ var dirPath = string.Format(@"..\..\{0}\Resources\", assemblyName);
+ if (!Directory.Exists(dirPath))
+ Directory.CreateDirectory(dirPath);
+ image.Save(string.Format(@"..\..\{0}\Resources\{1}.png", assemblyName, name));
+ }
+ }
+
+ public static void ExtractResources(ToolStrip source)
+ {
+ foreach (var item in source.Items.OfType().Where(i => i.Image != null))
+ ExtractResources(item.Image, item.Name);
+ foreach (var item in source.Items.OfType().Where(i => i.Image != null))
+ ExtractResources(item.Image, item.Name);
+ }
+ }
+
+#endif
+
+ internal static partial class FormHelper
+ {
+ public static Rectangle GetWorkingArea()
+ {
+ int minx, miny, maxx, maxy;
+ minx = miny = int.MaxValue;
+ maxx = maxy = int.MinValue;
+
+ foreach (Screen screen in Screen.AllScreens)
+ {
+ var bounds = screen.Bounds;
+ minx = Math.Min(minx, bounds.X);
+ miny = Math.Min(miny, bounds.Y);
+ maxx = Math.Max(maxx, bounds.Right);
+ maxy = Math.Max(maxy, bounds.Bottom);
+ }
+
+ return new Rectangle(0, 0, (maxx - minx), (maxy - miny));
+ }
+ }
+
+ internal class BufferedPanel : Panel
+ {
+ #region Public Constructors
+
+ public BufferedPanel()
+ {
+ SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw, true);
+ }
+
+ #endregion Public Constructors
+ }
+ }
+ }
+
+ namespace Reflection
+ {
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public class GitHubAttribute : Attribute
+ {
+ public GitHubAttribute()
+ {
+ }
+
+ public GitHubAttribute(string owner, string repo, string assetName = "") : base()
+ {
+ Owner = owner;
+ Repo = repo;
+ AssetName = assetName;
+ }
+
+ public string Owner { get; private set; }
+ public string Repo { get; private set; }
+ public string AssetName { get; private set; }
+
+ public override string ToString()
+ {
+ return $"https://github.com/{Owner}/{Repo}";
+ }
+ }
+
+ internal static class ApplicationInfo
+ {
+ public static Assembly Assembly => Assembly.GetCallingAssembly();
+
+ public static Version Version => ApplicationInfo.Assembly.GetName().Version;
+ public static string Title => ApplicationInfo.Assembly.GetCustomAttribute().Title;
+ public static string Product => ApplicationInfo.Assembly.GetCustomAttribute().Product;
+ public static string Description => ApplicationInfo.Assembly.GetCustomAttribute().Description;
+ public static string Copyright => ApplicationInfo.Assembly.GetCustomAttribute().Copyright;
+ public static string Company => ApplicationInfo.Assembly.GetCustomAttribute().Company;
+
+ public static string Guid => ApplicationInfo.Assembly.GetCustomAttribute().Value;
+
+ internal static Dictionary GetCommandLine()
+ {
+ var commandArgs = new Dictionary();
+
+ var assembly = string.Format(@"""{0}"" ", Assembly.GetExecutingAssembly().Location);
+ var collection = Environment.CommandLine.Replace(assembly, "").Split(' ').Select(a => a.ToLower()).ToList();
+
+ if (collection.Any())
+ foreach (var item in collection.Where(m => m.StartsWith("/")))
+ if (collection.Count - 1 > collection.IndexOf(item))
+ commandArgs.Add(item.ToLower(), collection[collection.IndexOf(item) + 1].Replace(@"""", @""));
+ else
+ commandArgs.Add(item.ToLower(), null);
+
+ return commandArgs;
+ }
+ }
+
+ internal static class GitHubInfo
+ {
+ public static string Repo => ApplicationInfo.Assembly.GetCustomAttribute().ToString();
+ public static string Owner => ApplicationInfo.Assembly.GetCustomAttribute().Owner;
+ public static string Name => ApplicationInfo.Assembly.GetCustomAttribute().Repo;
+ public static string AssetName => ApplicationInfo.Assembly.GetCustomAttribute().AssetName;
+
+ public static Release LatestRelease { get; set; }
+
+ public async static Task GetLatestReleaseAsync()
+ {
+ try
+ {
+ using (var client = new HttpClient())
+ {
+ var url = new Uri($"https://api.github.com/repos/{GitHubInfo.Owner}/{GitHubInfo.Name}/releases/latest");
+ client.DefaultRequestHeaders.Add("User-Agent", ApplicationInfo.Title);
+ var response = await client.GetAsync(url);
+ if (response.IsSuccessStatusCode)
+ return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); ;
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex.Message);
+ }
+ return null;
+ }
+
+ public async static Task CheckForUpdateAsync()
+ {
+ try
+ {
+ LatestRelease = await GetLatestReleaseAsync();
+ if (ApplicationInfo.Version < LatestRelease.GetVersion())
+ {
+ var updateMessage = Toolkit.Messages.NewVersion;
+ updateMessage = updateMessage.Replace("{VERSION}", LatestRelease.GetVersion().ToString());
+ updateMessage = updateMessage.Replace("{CREATEDAT}", LatestRelease.CreatedAt.UtcDateTime.ToShortDateString());
+ if (MessageBox.Show(updateMessage, ApplicationInfo.Title, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ var assetName = GitHubInfo.AssetName;
+ if (string.IsNullOrEmpty(assetName)) assetName = $"{ApplicationInfo.Product}.zip";
+ var assetUrl = LatestRelease.Assets.FirstOrDefault(m => m.Name == assetName);
+ var url = LatestRelease.AssetsUrl;
+ if (assetUrl != null) url = assetUrl.BrowserDownloadUrl;
+ if (string.IsNullOrEmpty(url)) url = GitHubInfo.Repo;
+ if (!string.IsNullOrEmpty(url)) Process.Start(url);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex.Message);
+ }
+ }
+
+ public static Version GetVersion(this Release release)
+ {
+ Version.TryParse(release.TagName.Replace("v", ""), out Version result);
+ return result;
+ }
+ }
+ }
+}
+
+namespace GitHub
+{
+ internal class Release
+ {
+ public Release()
+ {
+ Assets = new HashSet();
+ }
+
+ [JsonProperty("tarball_url")]
+ public string TarballUrl { get; set; }
+
+ //[JsonProperty("author")]
+ //public Author Author { get; set; }
+
+ [JsonProperty("published_at")]
+ public DateTimeOffset? PublishedAt { get; set; }
+
+ [JsonProperty("created_at")]
+ public DateTimeOffset CreatedAt { get; set; }
+
+ [JsonProperty("prerelease")]
+ public bool Prerelease { get; set; }
+
+ [JsonProperty("draft")]
+ public bool Draft { get; set; }
+
+ [JsonProperty("body")]
+ public string Body { get; set; }
+
+ [JsonProperty("name")]
+ public string Name { get; set; }
+
+ [JsonProperty("target_commitish")]
+ public string TargetCommitish { get; set; }
+
+ [JsonProperty("tag_name")]
+ public string TagName { get; set; }
+
+ [JsonProperty("id")]
+ public int Id { get; set; }
+
+ [JsonProperty("upload_url")]
+ public string UploadUrl { get; set; }
+
+ [JsonProperty("assets_url")]
+ public string AssetsUrl { get; set; }
+
+ [JsonProperty("html_url")]
+ public string HtmlUrl { get; set; }
+
+ [JsonProperty("url")]
+ public string Url { get; set; }
+
+ [JsonProperty("zipball_url")]
+ public string ZipballUrl { get; set; }
+
+ [JsonProperty("assets")]
+ public ICollection Assets { get; set; }
+ }
+
+ internal class Asset
+ {
+ [JsonProperty("url")]
+ public string Url { get; set; }
+
+ [JsonProperty("id")]
+ public int Id { get; set; }
+
+ [JsonProperty("name")]
+ public string Name { get; set; }
+
+ [JsonProperty("label")]
+ public string Label { get; set; }
+
+ [JsonProperty("state")]
+ public string State { get; set; }
+
+ [JsonProperty("content_type")]
+ public string ContentType { get; set; }
+
+ [JsonProperty("size")]
+ public int Size { get; set; }
+
+ [JsonProperty("download_count")]
+ public int DownloadCount { get; set; }
+
+ [JsonProperty("created_at")]
+ public DateTimeOffset CreatedAt { get; set; }
+
+ [JsonProperty("updated_at")]
+ public DateTimeOffset UpdatedAt { get; set; }
+
+ [JsonProperty("browser_download_url")]
+ public string BrowserDownloadUrl { get; set; }
+
+ //[JsonProperty("uploader")]
+ //public Author Uploader { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/CameraToolkit/Resources/toolStripButtonAbout.png b/CameraToolkit/Resources/toolStripButtonAbout.png
index a625430..130fa75 100644
Binary files a/CameraToolkit/Resources/toolStripButtonAbout.png and b/CameraToolkit/Resources/toolStripButtonAbout.png differ
diff --git a/CameraToolkit/Resources/toolStripButtonCapture.png b/CameraToolkit/Resources/toolStripButtonCapture.png
index 44d3fcb..1cbe1a8 100644
Binary files a/CameraToolkit/Resources/toolStripButtonCapture.png and b/CameraToolkit/Resources/toolStripButtonCapture.png differ
diff --git a/CameraToolkit/Resources/toolStripButtonClose.png b/CameraToolkit/Resources/toolStripButtonClose.png
index f95d015..14d2465 100644
Binary files a/CameraToolkit/Resources/toolStripButtonClose.png and b/CameraToolkit/Resources/toolStripButtonClose.png differ
diff --git a/CameraToolkit/Resources/toolStripButtonDevices.png b/CameraToolkit/Resources/toolStripButtonDevices.png
index 9c44c86..3554c0c 100644
Binary files a/CameraToolkit/Resources/toolStripButtonDevices.png and b/CameraToolkit/Resources/toolStripButtonDevices.png differ
diff --git a/CameraToolkit/Resources/toolStripButtonFolder.png b/CameraToolkit/Resources/toolStripButtonFolder.png
index 7b3c1de..0bc454e 100644
Binary files a/CameraToolkit/Resources/toolStripButtonFolder.png and b/CameraToolkit/Resources/toolStripButtonFolder.png differ
diff --git a/CameraToolkit/Resources/toolStripButtonGallery.png b/CameraToolkit/Resources/toolStripButtonGallery.png
index 8585b50..441204b 100644
Binary files a/CameraToolkit/Resources/toolStripButtonGallery.png and b/CameraToolkit/Resources/toolStripButtonGallery.png differ
diff --git a/CameraToolkit/Resources/toolStripButtonSave.png b/CameraToolkit/Resources/toolStripButtonSave.png
index 66e72a4..39760b5 100644
Binary files a/CameraToolkit/Resources/toolStripButtonSave.png and b/CameraToolkit/Resources/toolStripButtonSave.png differ
diff --git a/CameraToolkit/Resources/toolStripButtonSettings.png b/CameraToolkit/Resources/toolStripButtonSettings.png
index 6cfc317..2dc6b1d 100644
Binary files a/CameraToolkit/Resources/toolStripButtonSettings.png and b/CameraToolkit/Resources/toolStripButtonSettings.png differ
diff --git a/CameraToolkit/Toolkit.cs b/CameraToolkit/Toolkit.cs
new file mode 100644
index 0000000..b3221fa
--- /dev/null
+++ b/CameraToolkit/Toolkit.cs
@@ -0,0 +1,106 @@
+using AForge.Video.DirectShow;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Pictograms;
+using System.Windows.Forms;
+
+namespace Toolkit
+{
+ internal static partial class Program
+ {
+ internal static MaterialDesign.IconType Icon => MaterialDesign.IconType.linked_camera;
+ internal static string SessionId => DateTime.Now.TimeOfDay.Ticks.ToString();
+ internal static FilterInfoCollection Devices => new FilterInfoCollection(FilterCategory.VideoInputDevice);
+
+ internal static List Formats => new List(new[] { ".bmp", ".jpg", ".jpeg", ".jpe", ".jfif", ".png", ".gif" });
+
+ internal static string AlbumName = string.Empty;
+
+ internal static JsonSerializerSettings SerializerSettings = new JsonSerializerSettings()
+ {
+ Formatting = Formatting.Indented,
+ ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+ NullValueHandling = NullValueHandling.Ignore,
+ MissingMemberHandling = MissingMemberHandling.Ignore,
+ Error = new EventHandler((object sender, Newtonsoft.Json.Serialization.ErrorEventArgs args) =>
+ {
+ args.ErrorContext.Handled = true;
+ })
+ };
+
+ internal static void Initialize()
+ {
+#if DEBUG
+ ImageHelper.GetEditorIcon(MaterialDesign.GetImage(Program.Icon, 256, Color.White));
+#endif
+ }
+
+ internal static Dictionary GetDevices()
+ {
+ var result = new Dictionary();
+
+ if (Devices.Count > 0)
+ for (int i = 0; i < Devices.Count; i++)
+ result.Add(Devices[i].MonikerString, Devices[i].Name.ToString());
+
+ return result;
+ }
+
+ internal static DialogResult ShowInputDialog(ref string input, string caption)
+ {
+ var size = new Size(200, 70);
+
+ var inputBox = new Form
+ {
+ Padding = new Padding(6),
+ FormBorderStyle = FormBorderStyle.FixedDialog,
+ ShowIcon = false,
+ ShowInTaskbar = false,
+ MaximizeBox = false,
+ MinimizeBox = false,
+ ClientSize = size,
+ Text = caption,
+ StartPosition = FormStartPosition.CenterParent
+ };
+
+ var textBox = new TextBox
+ {
+ Dock = DockStyle.Top,
+ Size = new Size(size.Width - 10, 23),
+ Location = new Point(5, 5),
+ Text = input
+ };
+ inputBox.Controls.Add(textBox);
+
+ var okButton = new Button
+ {
+ DialogResult = DialogResult.OK,
+ Name = "okButton",
+ Size = new Size(75, 23),
+ Text = Messages.OK,
+ Location = new Point(size.Width - 80 - 80, 39)
+ };
+ inputBox.Controls.Add(okButton);
+
+ var cancelButton = new Button
+ {
+ DialogResult = DialogResult.Cancel,
+ Name = "cancelButton",
+ Size = new Size(75, 23),
+ Text = Messages.Cancel,
+ Location = new Point(size.Width - 80, 39)
+ };
+ inputBox.Controls.Add(cancelButton);
+
+ inputBox.AcceptButton = okButton;
+ inputBox.CancelButton = cancelButton;
+
+ var result = inputBox.ShowDialog();
+ input = textBox.Text;
+
+ return result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CameraToolkit/app.config b/CameraToolkit/app.config
index aca9bcd..d00a81b 100644
--- a/CameraToolkit/app.config
+++ b/CameraToolkit/app.config
@@ -22,6 +22,9 @@
False
+
+ True
+
diff --git a/CameraToolkit/packages.config b/CameraToolkit/packages.config
index c54da54..53c09a7 100644
--- a/CameraToolkit/packages.config
+++ b/CameraToolkit/packages.config
@@ -5,7 +5,7 @@
-
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 422d51b..b97d5bb 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ See the [changelog](CHANGELOG.md) for changes.
- [x] Settings separations
- [x] Album name
- [x] Spanish translation
-- [ ] Gallery management
+- [x] Gallery management
- [ ] OCR module
## Table of contents