WinForms and Console
This commit is contained in:
		
							
								
								
									
										1
									
								
								Console/.vscode/format-report.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Console/.vscode/format-report.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | [] | ||||||
							
								
								
									
										30
									
								
								Console/.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Console/.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal 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/win-x64/OI.Metrology.Console.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
									
								
								Console/.vscode/mklink.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								Console/.vscode/mklink.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | |||||||
|  | # mklink | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | ``` | ||||||
							
								
								
									
										37
									
								
								Console/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Console/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal 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" | ||||||
|  |     ] | ||||||
|  | } | ||||||
							
								
								
									
										99
									
								
								Console/.vscode/tasks.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								Console/.vscode/tasks.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,99 @@ | |||||||
|  | { | ||||||
|  |     "version": "2.0.0", | ||||||
|  |     "tasks": [ | ||||||
|  |         { | ||||||
|  |             "label": "User Secrets Init", | ||||||
|  |             "command": "dotnet", | ||||||
|  |             "type": "process", | ||||||
|  |             "args": [ | ||||||
|  |                 "user-secrets", | ||||||
|  |                 "-p", | ||||||
|  |                 "${workspaceFolder}/OI.Metrology.Console.csproj", | ||||||
|  |                 "init" | ||||||
|  |             ], | ||||||
|  |             "problemMatcher": "$msCompile" | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             "label": "User Secrets Set", | ||||||
|  |             "command": "dotnet", | ||||||
|  |             "type": "process", | ||||||
|  |             "args": [ | ||||||
|  |                 "user-secrets", | ||||||
|  |                 "-p", | ||||||
|  |                 "${workspaceFolder}/OI.Metrology.Console.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.Console.csproj", | ||||||
|  |                 "/property:GenerateFullPaths=true", | ||||||
|  |                 "/consoleloggerparameters:NoSummary" | ||||||
|  |             ], | ||||||
|  |             "problemMatcher": "$msCompile" | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             "label": "publish", | ||||||
|  |             "command": "dotnet", | ||||||
|  |             "type": "process", | ||||||
|  |             "args": [ | ||||||
|  |                 "publish", | ||||||
|  |                 "${workspaceFolder}/OI.Metrology.Console.csproj", | ||||||
|  |                 "/property:GenerateFullPaths=true", | ||||||
|  |                 "/consoleloggerparameters:NoSummary" | ||||||
|  |             ], | ||||||
|  |             "problemMatcher": "$msCompile" | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             "label": "watch", | ||||||
|  |             "command": "dotnet", | ||||||
|  |             "type": "process", | ||||||
|  |             "args": [ | ||||||
|  |                 "watch", | ||||||
|  |                 "run", | ||||||
|  |                 "--project", | ||||||
|  |                 "${workspaceFolder}/OI.Metrology.Console.csproj" | ||||||
|  |             ], | ||||||
|  |             "problemMatcher": "$msCompile" | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             "label": "Publish AOT", | ||||||
|  |             "command": "dotnet", | ||||||
|  |             "type": "process", | ||||||
|  |             "args": [ | ||||||
|  |                 "publish", | ||||||
|  |                 "-r", | ||||||
|  |                 "win-x64", | ||||||
|  |                 "-c", | ||||||
|  |                 "Release", | ||||||
|  |                 "-p:PublishAot=true", | ||||||
|  |                 "${workspaceFolder}/OI.Metrology.Console.csproj", | ||||||
|  |                 "/property:GenerateFullPaths=true", | ||||||
|  |                 "/consoleloggerparameters:NoSummary" | ||||||
|  |             ], | ||||||
|  |             "problemMatcher": "$msCompile" | ||||||
|  |         } | ||||||
|  |     ] | ||||||
|  | } | ||||||
							
								
								
									
										21
									
								
								Console/Models/AppSettings.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Console/Models/AppSettings.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | |||||||
|  | using System.Text.Json; | ||||||
|  | using System.Text.Json.Serialization; | ||||||
|  |  | ||||||
|  | namespace OI.Metrology.Console.Models; | ||||||
|  |  | ||||||
|  | public record AppSettings(string Company) | ||||||
|  | { | ||||||
|  |  | ||||||
|  |     public override string ToString() | ||||||
|  |     { | ||||||
|  |         string result = JsonSerializer.Serialize(this, AppSettingsSourceGenerationContext.Default.AppSettings); | ||||||
|  |         return result; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | [JsonSourceGenerationOptions(WriteIndented = true)] | ||||||
|  | [JsonSerializable(typeof(AppSettings))] | ||||||
|  | internal partial class AppSettingsSourceGenerationContext : JsonSerializerContext | ||||||
|  | { | ||||||
|  | } | ||||||
							
								
								
									
										2
									
								
								Console/Models/Binder/.editorconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Console/Models/Binder/.editorconfig
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | [*.cs] | ||||||
|  | csharp_preserve_single_line_statements = true | ||||||
							
								
								
									
										61
									
								
								Console/Models/Binder/AppSettings.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								Console/Models/Binder/AppSettings.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,61 @@ | |||||||
|  | using Microsoft.Extensions.Configuration; | ||||||
|  | using System.Text.Json; | ||||||
|  | using System.Text.Json.Serialization; | ||||||
|  |  | ||||||
|  | namespace OI.Metrology.Console.Models.Binder; | ||||||
|  |  | ||||||
|  | public class AppSettings | ||||||
|  | { | ||||||
|  |  | ||||||
|  |     public string? Company { get; set; } | ||||||
|  |  | ||||||
|  |     public override string ToString() | ||||||
|  |     { | ||||||
|  |         string result = JsonSerializer.Serialize(this, BinderAppSettingsSourceGenerationContext.Default.AppSettings); | ||||||
|  |         return result; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private static void PreVerify(IConfigurationRoot configurationRoot, AppSettings? appSettings) | ||||||
|  |     { | ||||||
|  |         if (appSettings?.Company is null) | ||||||
|  |         { | ||||||
|  |             List<string> paths = []; | ||||||
|  |             foreach (IConfigurationProvider configurationProvider in configurationRoot.Providers) | ||||||
|  |             { | ||||||
|  |                 if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider) | ||||||
|  |                     continue; | ||||||
|  |                 if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider) | ||||||
|  |                     continue; | ||||||
|  |                 paths.Add(physicalFileProvider.Root); | ||||||
|  |             } | ||||||
|  |             throw new NotSupportedException($"Not found!{Environment.NewLine}{string.Join(Environment.NewLine, paths.Distinct())}"); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private static Models.AppSettings Get(AppSettings? appSettings) | ||||||
|  |     { | ||||||
|  |         Models.AppSettings result; | ||||||
|  |         if (appSettings is null) throw new NullReferenceException(nameof(appSettings)); | ||||||
|  |         if (appSettings.Company is null) throw new NullReferenceException(nameof(Company)); | ||||||
|  |         result = new(appSettings.Company); | ||||||
|  |         return result; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public static Models.AppSettings Get(IConfigurationRoot configurationRoot) | ||||||
|  |     { | ||||||
|  |         Models.AppSettings result; | ||||||
|  | #pragma warning disable IL3050, IL2026 | ||||||
|  |         AppSettings? appSettings = configurationRoot.Get<AppSettings>(); | ||||||
|  | #pragma warning restore IL3050, IL2026 | ||||||
|  |         PreVerify(configurationRoot, appSettings); | ||||||
|  |         result = Get(appSettings); | ||||||
|  |         return result; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | [JsonSourceGenerationOptions(WriteIndented = true)] | ||||||
|  | [JsonSerializable(typeof(AppSettings))] | ||||||
|  | internal partial class BinderAppSettingsSourceGenerationContext : JsonSerializerContext | ||||||
|  | { | ||||||
|  | } | ||||||
							
								
								
									
										50
									
								
								Console/Models/WorkingDirectory.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Console/Models/WorkingDirectory.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | |||||||
|  | namespace OI.Metrology.Console.Models; | ||||||
|  |  | ||||||
|  | internal abstract class WorkingDirectory | ||||||
|  | { | ||||||
|  |  | ||||||
|  |     internal static string GetWorkingDirectory(string? executingAssemblyName, string subDirectoryName) | ||||||
|  |     { | ||||||
|  |         string result = string.Empty; | ||||||
|  |         if (executingAssemblyName is null) | ||||||
|  |             throw new Exception(); | ||||||
|  |         string traceFile; | ||||||
|  |         List<string> directories = []; | ||||||
|  |         Environment.SpecialFolder[] specialFolders = | ||||||
|  |         [ | ||||||
|  |                     Environment.SpecialFolder.LocalApplicationData, | ||||||
|  |             Environment.SpecialFolder.ApplicationData, | ||||||
|  |             Environment.SpecialFolder.History, | ||||||
|  |             Environment.SpecialFolder.CommonApplicationData, | ||||||
|  |             Environment.SpecialFolder.InternetCache | ||||||
|  |         ]; | ||||||
|  |         foreach (Environment.SpecialFolder specialFolder in specialFolders) | ||||||
|  |             directories.Add(Path.Combine(Environment.GetFolderPath(specialFolder), subDirectoryName, executingAssemblyName)); | ||||||
|  |         foreach (string directory in directories) | ||||||
|  |         { | ||||||
|  |             for (int i = 1; i < 3; i++) | ||||||
|  |             { | ||||||
|  |                 if (i == 1) | ||||||
|  |                     result = directory; | ||||||
|  |                 else | ||||||
|  |                     result = string.Concat("D", directory[1..]); | ||||||
|  |                 try | ||||||
|  |                 { | ||||||
|  |                     if (!Directory.Exists(result)) | ||||||
|  |                         _ = Directory.CreateDirectory(result); | ||||||
|  |                     traceFile = string.Concat(result, @"\", DateTime.Now.Ticks, ".txt"); | ||||||
|  |                     File.WriteAllText(traceFile, traceFile); | ||||||
|  |                     File.Delete(traceFile); | ||||||
|  |                     break; | ||||||
|  |                 } | ||||||
|  |                 catch (Exception) { result = string.Empty; } | ||||||
|  |             } | ||||||
|  |             if (!string.IsNullOrEmpty(result)) | ||||||
|  |                 break; | ||||||
|  |         } | ||||||
|  |         if (string.IsNullOrEmpty(result)) | ||||||
|  |             throw new Exception("Unable to set working directory!"); | ||||||
|  |         return result; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								Console/OI.Metrology.Console.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Console/OI.Metrology.Console.csproj
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |   <PropertyGroup> | ||||||
|  |     <ImplicitUsings>enable</ImplicitUsings> | ||||||
|  |     <Nullable>enable</Nullable> | ||||||
|  |     <OutputType>Exe</OutputType> | ||||||
|  |     <RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||||||
|  |     <TargetFramework>net8.0</TargetFramework> | ||||||
|  |     <UserSecretsId>d9488860-fd41-4dd8-9448-19f1dde7a0f7</UserSecretsId> | ||||||
|  |   </PropertyGroup> | ||||||
|  |   <ItemGroup> | ||||||
|  |     <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" /> | ||||||
|  |     <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" /> | ||||||
|  |     <PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.3" /> | ||||||
|  |     <PackageReference Include="System.Text.Json" Version="8.0.3" /> | ||||||
|  |   </ItemGroup> | ||||||
|  | </Project> | ||||||
							
								
								
									
										29
									
								
								Console/Program.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								Console/Program.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | |||||||
|  | using Microsoft.Extensions.Configuration; | ||||||
|  | using Microsoft.Extensions.DependencyInjection; | ||||||
|  | using Microsoft.Extensions.Hosting; | ||||||
|  | using Microsoft.Extensions.Logging; | ||||||
|  | using OI.Metrology.Console.Models; | ||||||
|  |  | ||||||
|  | namespace OI.Metrology.Console; | ||||||
|  |  | ||||||
|  | internal class Program | ||||||
|  | { | ||||||
|  |  | ||||||
|  |     public static void Main(string[] args) | ||||||
|  |     { | ||||||
|  | #pragma warning disable IL3050 | ||||||
|  |         HostApplicationBuilder builder = Host.CreateApplicationBuilder(args); | ||||||
|  | #pragma warning restore IL3050 | ||||||
|  |         _ = builder.Configuration.AddEnvironmentVariables(); | ||||||
|  |         _ = builder.Configuration.AddUserSecrets<Program>(); | ||||||
|  |         _ = builder.Services.AddSingleton(args.ToList()); | ||||||
|  |         AppSettings appSettings = Models.Binder.AppSettings.Get(builder.Configuration); | ||||||
|  |         _ = builder.Services.AddSingleton(appSettings); | ||||||
|  |         _ = builder.Services.AddHostedService<Worker>(); | ||||||
|  |         using IHost host = builder.Build(); | ||||||
|  |         ILogger<Program> logger = host.Services.GetRequiredService<ILogger<Program>>(); | ||||||
|  |         logger.LogCritical("{appSettings.Company}", appSettings.Company); | ||||||
|  |         host.Run(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										67
									
								
								Console/Worker.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								Console/Worker.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,67 @@ | |||||||
|  | using Microsoft.Extensions.Hosting; | ||||||
|  | using Microsoft.Extensions.Logging; | ||||||
|  | using OI.Metrology.Console.Models; | ||||||
|  | using System.Diagnostics; | ||||||
|  |  | ||||||
|  | namespace OI.Metrology.Console; | ||||||
|  |  | ||||||
|  | public class Worker : BackgroundService | ||||||
|  | { | ||||||
|  |  | ||||||
|  |     private readonly List<string> _Args; | ||||||
|  |     private readonly ILogger<Worker> _Logger; | ||||||
|  |     private readonly AppSettings _AppSettings; | ||||||
|  |     private readonly IHostApplicationLifetime _Lifetime; | ||||||
|  |  | ||||||
|  |     public Worker(ILogger<Worker> logger, IHostApplicationLifetime lifetime, List<string> args, AppSettings appSettings) | ||||||
|  |     { | ||||||
|  |         _Args = args; | ||||||
|  |         _Logger = logger; | ||||||
|  |         _Lifetime = lifetime; | ||||||
|  |         _AppSettings = appSettings; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public override Task StartAsync(CancellationToken cancellationToken) => | ||||||
|  |         base.StartAsync(cancellationToken); | ||||||
|  |  | ||||||
|  |     public override Task StopAsync(CancellationToken cancellationToken) => | ||||||
|  |         base.StopAsync(cancellationToken); | ||||||
|  |  | ||||||
|  |     protected override async Task ExecuteAsync(CancellationToken stoppingToken) | ||||||
|  |     { | ||||||
|  |         if (!stoppingToken.IsCancellationRequested) | ||||||
|  |             await Task.Delay(500, stoppingToken); | ||||||
|  |         if (_AppSettings is null) | ||||||
|  |             throw new NullReferenceException(nameof(_AppSettings)); | ||||||
|  |         try | ||||||
|  |         { | ||||||
|  |             _Logger.LogInformation("BaseDirectory: <{BaseDirectory}>", AppContext.BaseDirectory); | ||||||
|  |             _Logger.LogInformation("CurrentDirectory: <{CurrentDirectory}>", Environment.CurrentDirectory); | ||||||
|  |             _Logger.LogInformation("Press Escape key to get -1, Enter key to get 0, y key to get 1 and n key to get 2 exit code"); | ||||||
|  |             ConsoleKeyInfo consoleKeyInfo = System.Console.ReadKey(); | ||||||
|  |             if (consoleKeyInfo.Key == ConsoleKey.W) | ||||||
|  |             { | ||||||
|  |                 Process process = Process.Start("L:/DevOps/Mesa_FI/OI-Metrology/WinForms/bin/Debug/net8.0-windows/win-x64/OI.Metrology.WinForms.exe", "Mike"); | ||||||
|  |                 process.WaitForExit(); | ||||||
|  |                 _Logger.LogInformation("ExitCode: <{ExitCode}>", process.ExitCode); | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 Environment.ExitCode = consoleKeyInfo.Key switch | ||||||
|  |                 { | ||||||
|  |                     ConsoleKey.Escape => -1, | ||||||
|  |                     ConsoleKey.Enter => 0, | ||||||
|  |                     ConsoleKey.Y => 1, | ||||||
|  |                     ConsoleKey.N => 2, | ||||||
|  |                     _ => 9 | ||||||
|  |                 }; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         catch (Exception ex) | ||||||
|  |         { _Logger.LogError("{Message}{NewLine}{StackTrace}", ex.Message, Environment.NewLine, ex.StackTrace); } | ||||||
|  |         _Logger.LogInformation("Done. Press 'Enter' to end"); | ||||||
|  |         _ = System.Console.ReadLine(); | ||||||
|  |         _Lifetime.StopApplication(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										3
									
								
								Console/secrets.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Console/secrets.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | { | ||||||
|  |     "Company": "Infineon Technologies Americas Corp." | ||||||
|  | } | ||||||
							
								
								
									
										1
									
								
								WinForms/.vscode/format-report.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								WinForms/.vscode/format-report.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | [] | ||||||
							
								
								
									
										30
									
								
								WinForms/.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								WinForms/.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal 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
									
								
							
							
						
						
									
										4
									
								
								WinForms/.vscode/mklink.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | |||||||
|  | # mklink | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | ``` | ||||||
							
								
								
									
										37
									
								
								WinForms/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								WinForms/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal 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
									
								
							
							
						
						
									
										83
									
								
								WinForms/.vscode/tasks.json
									
									
									
									
										vendored
									
									
										Normal 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
									
								
							
							
						
						
									
										136
									
								
								WinForms/Form1.Designer.cs
									
									
									
										generated
									
									
									
										Normal 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
									
								
							
							
						
						
									
										62
									
								
								WinForms/Form1.cs
									
									
									
									
									
										Normal 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); } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										11
									
								
								WinForms/OI.Metrology.WinForms.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								WinForms/OI.Metrology.WinForms.csproj
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										16
									
								
								WinForms/Program.cs
									
									
									
									
									
										Normal 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()); | ||||||
|  |     }     | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user