From abd0f46fd5b70d63cd7071a91618eb922dcf852f Mon Sep 17 00:00:00 2001 From: dch Date: Sun, 28 Apr 2019 10:44:37 +0800 Subject: [PATCH] update ui --- dff2dsf/FileToProcess.cs | 3 ++ dff2dsf/Form1.Designer.cs | 105 ++++++++++++++++++++++++++++++++------ dff2dsf/Form1.cs | 24 +++++---- dff2dsf/Form1.resx | 3 ++ dff2dsf/Program.cs | 32 +++++++++--- dff2dsf/app.manifest | 68 ++++++++++++++++++++++++ dff2dsf/dff2dsf.csproj | 11 +++- 7 files changed, 212 insertions(+), 34 deletions(-) create mode 100644 dff2dsf/app.manifest diff --git a/dff2dsf/FileToProcess.cs b/dff2dsf/FileToProcess.cs index f850609..f411c7b 100644 --- a/dff2dsf/FileToProcess.cs +++ b/dff2dsf/FileToProcess.cs @@ -13,6 +13,7 @@ public class FileToProcess : INotifyPropertyChanged private string _destFile; private string _status; + [DisplayName("Source File")] public string SrcFile { get => _srcFile; @@ -23,6 +24,7 @@ public string SrcFile } } + [DisplayName("Preview File")] public string DestFile { get => _destFile; @@ -33,6 +35,7 @@ public string DestFile } } + [DisplayName("Result")] public string Status { get => _status; diff --git a/dff2dsf/Form1.Designer.cs b/dff2dsf/Form1.Designer.cs index c3d8111..a23ff18 100644 --- a/dff2dsf/Form1.Designer.cs +++ b/dff2dsf/Form1.Designer.cs @@ -34,41 +34,54 @@ private void InitializeComponent() this.button2 = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.groupBox2.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.dataGridView1); - this.groupBox1.Location = new System.Drawing.Point(13, 13); + 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(609, 505); + this.groupBox1.Size = new System.Drawing.Size(594, 518); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; - this.groupBox1.Text = "Drag Files/Folder Here"; + this.groupBox1.Text = "File List"; // // dataGridView1 // this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control; + this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.ColumnHeadersVisible = false; this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.GridColor = System.Drawing.SystemColors.Control; this.dataGridView1.Location = new System.Drawing.Point(3, 21); + this.dataGridView1.MultiSelect = false; this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowTemplate.Height = 27; - this.dataGridView1.Size = new System.Drawing.Size(603, 481); + this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView1.Size = new System.Drawing.Size(588, 494); this.dataGridView1.TabIndex = 0; // // button1 // - this.button1.Location = new System.Drawing.Point(7, 62); + this.button1.Location = new System.Drawing.Point(6, 62); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.Size = new System.Drawing.Size(140, 32); this.button1.TabIndex = 1; this.button1.Text = "Convert"; this.button1.UseVisualStyleBackColor = true; @@ -78,9 +91,9 @@ private void InitializeComponent() // this.button2.Location = new System.Drawing.Point(6, 24); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.Size = new System.Drawing.Size(140, 32); this.button2.TabIndex = 2; - this.button2.Text = "Open"; + this.button2.Text = "Choose Folder"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // @@ -89,40 +102,97 @@ private void InitializeComponent() this.groupBox2.Controls.Add(this.checkBox1); this.groupBox2.Controls.Add(this.button2); this.groupBox2.Controls.Add(this.button1); - this.groupBox2.Location = new System.Drawing.Point(628, 13); + this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox2.Location = new System.Drawing.Point(603, 3); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(200, 502); + this.groupBox2.Size = new System.Drawing.Size(223, 518); this.groupBox2.TabIndex = 3; this.groupBox2.TabStop = false; - this.groupBox2.Text = "groupBox2"; + this.groupBox2.Text = "Commands"; // // checkBox1 // this.checkBox1.AutoSize = true; this.checkBox1.Checked = true; this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBox1.Location = new System.Drawing.Point(7, 105); + this.checkBox1.Location = new System.Drawing.Point(6, 105); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(197, 19); this.checkBox1.TabIndex = 3; this.checkBox1.Text = "Delete Converted File"; this.checkBox1.UseVisualStyleBackColor = true; // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel2, + this.toolStripStatusLabel1, + this.toolStripStatusLabel3}); + this.statusStrip1.Location = new System.Drawing.Point(0, 524); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(829, 25); + this.statusStrip1.SizingGrip = false; + this.statusStrip1.TabIndex = 4; + this.statusStrip1.Text = "statusStrip1"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 72.49699F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 27.50302F)); + this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.groupBox2, 1, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(829, 524); + this.tableLayoutPanel1.TabIndex = 5; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.IsLink = true; + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(168, 20); + this.toolStripStatusLabel1.Text = "VS2010 SP1 RUNTIME"; + this.toolStripStatusLabel1.Click += new System.EventHandler(this.toolStripStatusLabel1_Click); + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(76, 20); + this.toolStripStatusLabel2.Text = "Confirm ["; + // + // toolStripStatusLabel3 + // + this.toolStripStatusLabel3.Name = "toolStripStatusLabel3"; + this.toolStripStatusLabel3.Size = new System.Drawing.Size(148, 20); + this.toolStripStatusLabel3.Text = "] has been installed"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.ClientSize = new System.Drawing.Size(829, 549); - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.groupBox1); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.statusStrip1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "Form1"; - this.Text = "Converter(Not support unicode path, such as chinese characters)"; + this.ShowIcon = false; + this.Text = "Converter(Only support ascii path)"; this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); + this.PerformLayout(); } @@ -134,6 +204,11 @@ private void InitializeComponent() private System.Windows.Forms.Button button2; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3; } } diff --git a/dff2dsf/Form1.cs b/dff2dsf/Form1.cs index 33e01d2..333be64 100644 --- a/dff2dsf/Form1.cs +++ b/dff2dsf/Form1.cs @@ -14,7 +14,7 @@ namespace dff2dsf { public partial class Form1 : Form { - private BindingList bindingList = new BindingList(); + private readonly BindingList bindingList = new BindingList(); public Form1() { @@ -28,7 +28,7 @@ private void button2_Click(object sender, EventArgs e) { using (var fbd = new FolderBrowserDialog()) { - DialogResult result = fbd.ShowDialog(); + var result = fbd.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { @@ -70,13 +70,15 @@ private void button1_Click(object sender, EventArgs e) using (var process = new Process()) { - ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.FileName = Path.GetFullPath(converter); - startInfo.UseShellExecute = false; - startInfo.RedirectStandardError = true; - startInfo.RedirectStandardOutput = true; - startInfo.CreateNoWindow = true; - startInfo.Arguments = $"{tempSrcFile} {tempTargetFile}"; + var startInfo = new ProcessStartInfo + { + FileName = Path.GetFullPath(converter), + UseShellExecute = false, + RedirectStandardError = true, + RedirectStandardOutput = true, + CreateNoWindow = true, + Arguments = $"{tempSrcFile} {tempTargetFile}" + }; process.StartInfo = startInfo; process.Start(); @@ -104,7 +106,11 @@ private void button1_Click(object sender, EventArgs e) file.Status = ex.Message; } } + } + private void toolStripStatusLabel1_Click(object sender, EventArgs e) + { + Process.Start("http://www.microsoft.com/en-us/download/details.aspx?id=26999"); } } } diff --git a/dff2dsf/Form1.resx b/dff2dsf/Form1.resx index 1af7de1..174ebc7 100644 --- a/dff2dsf/Form1.resx +++ b/dff2dsf/Form1.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/dff2dsf/Program.cs b/dff2dsf/Program.cs index 72e4ff9..dec5573 100644 --- a/dff2dsf/Program.cs +++ b/dff2dsf/Program.cs @@ -1,22 +1,38 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; namespace dff2dsf { - static class Program + internal static class Program { /// /// The main entry point for the application. /// [STAThread] - static void Main() + private static void Main() { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + try + { + Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); + + Application.ThreadException += (s, e) => { MessageBox.Show(e.Exception.Message); }; + + AppDomain.CurrentDomain.UnhandledException += (s, e) => + { + if (e.ExceptionObject is Exception ex) + { + MessageBox.Show(ex.Message); + } + }; + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + catch (Exception e) + { + MessageBox.Show(e.Message); + } } } } diff --git a/dff2dsf/app.manifest b/dff2dsf/app.manifest new file mode 100644 index 0000000..b937260 --- /dev/null +++ b/dff2dsf/app.manifest @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + \ No newline at end of file diff --git a/dff2dsf/dff2dsf.csproj b/dff2dsf/dff2dsf.csproj index 3c41392..b842aeb 100644 --- a/dff2dsf/dff2dsf.csproj +++ b/dff2dsf/dff2dsf.csproj @@ -56,10 +56,16 @@ dff2dsf_TemporaryKey.pfx - true + false - true + false + + + app.manifest + + + LocalIntranet @@ -97,6 +103,7 @@ Resources.resx True + SettingsSingleFileGenerator Settings.Designer.cs