WinForms and Console

This commit is contained in:
2024-03-14 15:30:40 -07:00
parent 127634f5ab
commit 37f6a68cd9
22 changed files with 800 additions and 0 deletions

1
WinForms/.vscode/format-report.json vendored Normal file
View File

@ -0,0 +1 @@
[]

30
WinForms/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,30 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net8.0-windows/win-x64/OI.Metrology.WinForms.dll",
"args": [
"s",
"M",
"L:/Git/Notes-EC-Documentation/.EC-Documentation",
"-s",
"L:/Git/Notes-EC-Documentation/.EC-Documentation/port"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

4
WinForms/.vscode/mklink.md vendored Normal file
View File

@ -0,0 +1,4 @@
# mklink
```bash
```

37
WinForms/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,37 @@
{
"[markdown]": {
"editor.wordWrap": "off"
},
"files.exclude": {
"**/.git": false,
"**/node_modules": true
},
"files.watcherExclude": {
"**/node_modules": true
},
"cSpell.words": [
"ASPNETCORE",
"BIRT",
"CHIL",
"DEAT",
"endianness",
"FAMC",
"FAMS",
"GIVN",
"HUSB",
"INDI",
"Infineon",
"Kanban",
"kanbn",
"Kofax",
"NSFX",
"OBJE",
"onenote",
"pged",
"Phares",
"Serilog",
"SUBM",
"SURN",
"SYSLIB"
]
}

83
WinForms/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,83 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "User Secrets Init",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/OI.Metrology.WinForms.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "User Secrets Set",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/OI.Metrology.WinForms.csproj",
"set",
"asdf",
"123"
],
"problemMatcher": "$msCompile"
},
{
"label": "Format",
"command": "dotnet",
"type": "process",
"args": [
"format",
"--report",
".vscode",
"--verbosity",
"detailed",
"--severity",
"warn"
],
"problemMatcher": "$msCompile"
},
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/OI.Metrology.WinForms.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/OI.Metrology.WinForms.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"-p:PublishSingleFile=true"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/OI.Metrology.WinForms.csproj"
],
"problemMatcher": "$msCompile"
}
]
}

136
WinForms/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,136 @@
namespace WinForms;
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
this._Go = new System.Windows.Forms.Button();
this._NoGo = new System.Windows.Forms.Button();
this._Cancel = new System.Windows.Forms.Button();
this._BaseDirectory = new System.Windows.Forms.Label();
this._CommandLineArgs = new System.Windows.Forms.Label();
this._WebBrowser = new System.Windows.Forms.WebBrowser();
this._CurrentDirectory = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// _Go
//
this._Go.AutoSize = true;
this._Go.Location = new System.Drawing.Point(5, 5);
this._Go.Name = "Go";
this._Go.Size = new System.Drawing.Size(68, 16);
this._Go.Text = "Go";
this._Go.ForeColor = Color.White;
this._Go.Click += new EventHandler(this.Go_Click);
//
// _NoGo
//
this._NoGo.AutoSize = true;
this._NoGo.Location = new System.Drawing.Point(105, 5);
this._NoGo.Name = "NoGo";
this._NoGo.Size = new System.Drawing.Size(68, 16);
this._NoGo.Text = "NoGo";
this._NoGo.ForeColor = Color.White;
this._NoGo.Click += new EventHandler(this.NoGo_Click);
//
// _Cancel
//
this._Cancel.AutoSize = true;
this._Cancel.Location = new System.Drawing.Point(205, 5);
this._Cancel.Name = "Cancel";
this._Cancel.Size = new System.Drawing.Size(68, 16);
this._Cancel.Text = "Cancel";
this._Cancel.ForeColor = Color.White;
this._Cancel.Click += new EventHandler(this.Cancel_Click);
//
// _BaseDirectory
//
this._BaseDirectory.AutoSize = true;
this._BaseDirectory.Location = new System.Drawing.Point(5, 55);
this._BaseDirectory.Name = "BaseDirectory";
this._BaseDirectory.Size = new System.Drawing.Size(68, 16);
this._BaseDirectory.Text = "BaseDirectory";
this._BaseDirectory.ForeColor = Color.White;
//
// _CommandLineArgs
//
this._CommandLineArgs.AutoSize = true;
this._CommandLineArgs.Location = new System.Drawing.Point(5, 105);
this._CommandLineArgs.Name = "CurrentDirectory";
this._CommandLineArgs.Size = new System.Drawing.Size(68, 16);
this._CommandLineArgs.Text = "CurrentDirectory";
this._CommandLineArgs.ForeColor = Color.White;
//
// _CurrentDirectory
//
this._CurrentDirectory.AutoSize = true;
this._CurrentDirectory.Location = new System.Drawing.Point(5, 155);
this._CurrentDirectory.Name = "CurrentDirectory";
this._CurrentDirectory.Size = new System.Drawing.Size(68, 16);
this._CurrentDirectory.Text = "CurrentDirectory";
this._CurrentDirectory.ForeColor = Color.White;
//
// _WebBrowser
//
this._WebBrowser.Location = new System.Drawing.Point(5, 205);
this._WebBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this._WebBrowser.Name = "WebBrowser";
this._WebBrowser.ScriptErrorsSuppressed = true;
this._WebBrowser.Size = new System.Drawing.Size(1008, 729);
this._WebBrowser.Visible = false;
this._WebBrowser.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.WebBrowser_DocumentCompleted);
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(43)))), ((int)(((byte)(48)))));
this.ClientSize = new System.Drawing.Size(1008, 729);
this.Controls.Add(this._Go);
this.Controls.Add(this._NoGo);
this.Controls.Add(this._Cancel);
this.Controls.Add(this._WebBrowser);
this.Controls.Add(this._BaseDirectory);
this.Controls.Add(this._CommandLineArgs);
this.Controls.Add(this._CurrentDirectory);
this.Font = new System.Drawing.Font("Tahoma", 9.75F);
this.Load += new System.EventHandler(this.Form_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
internal System.Windows.Forms.Button _Go;
internal System.Windows.Forms.Button _NoGo;
internal System.Windows.Forms.Button _Cancel;
internal System.Windows.Forms.Label _BaseDirectory;
internal System.Windows.Forms.Label _CommandLineArgs;
internal System.Windows.Forms.WebBrowser _WebBrowser;
internal System.Windows.Forms.Label _CurrentDirectory;
#endregion
}

62
WinForms/Form1.cs Normal file
View File

@ -0,0 +1,62 @@
namespace WinForms;
public partial class Form1 : Form
{
public Form1() =>
InitializeComponent();
private void Form_Load(object sender, EventArgs e)
{
try
{
_BaseDirectory.Text = AppContext.BaseDirectory;
_CurrentDirectory.Text = Environment.CurrentDirectory;
_CommandLineArgs.Text = string.Join(' ', Environment.GetCommandLineArgs());
_WebBrowser.Navigate("https://oi-metrology-viewer-prod.mes.infineon.com/Export");
}
catch (Exception ex) { CatchException(ex); }
}
private static void CatchException(Exception ex) =>
_ = MessageBox.Show(ex.StackTrace, ex.Message);
private void Go_Click(object sender, EventArgs e)
{
try
{
Environment.ExitCode = 1;
Application.Exit();
}
catch (Exception ex) { CatchException(ex); }
}
private void NoGo_Click(object sender, EventArgs e)
{
try
{
Environment.ExitCode = 2;
Application.Exit();
}
catch (Exception ex) { CatchException(ex); }
}
private void Cancel_Click(object sender, EventArgs e)
{
try
{
Environment.ExitCode = -1;
Application.Exit();
}
catch (Exception ex) { CatchException(ex); }
}
private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
try
{
_WebBrowser.Visible = true;
}
catch (Exception ex) { CatchException(ex); }
}
}

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>a98b14f0-fc21-4f31-a1e4-1337f6c60100</UserSecretsId>
</PropertyGroup>
</Project>

16
WinForms/Program.cs Normal file
View File

@ -0,0 +1,16 @@
namespace WinForms;
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}