diff --git a/.github/workflows/post-integration.yml b/.github/workflows/post-integration.yml index d660d9e..bbd859c 100644 --- a/.github/workflows/post-integration.yml +++ b/.github/workflows/post-integration.yml @@ -14,7 +14,7 @@ env: jobs: merge-to-stable: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: ๐Ÿ›’ Checkout repository uses: actions/checkout@v4 @@ -42,16 +42,16 @@ jobs: distribution: 'zulu' - name: ๐Ÿงน Clean - run: dotnet clean -c Release && dotnet nuget locals all --clear + run: dotnet clean Atc.Azure.IoT.sln -c Release && dotnet nuget locals all --clear - name: ๐Ÿ” Restore packages - run: dotnet restore + run: dotnet restore Atc.Azure.IoT.sln - name: ๐Ÿ› ๏ธ Build - run: dotnet build -c Release --no-restore /p:UseSourceLink=true + run: dotnet build Atc.Azure.IoT.sln -c Release --no-restore /p:UseSourceLink=true - name: ๐Ÿงช Run unit tests - run: dotnet test -c Release --no-build --filter "Category!=Integration" + run: dotnet test Atc.Azure.IoT.sln -c Release --no-build --filter "Category!=Integration" - name: ๐ŸŒฉ๏ธ SonarCloud install scanner run: dotnet tool install --global dotnet-sonarscanner diff --git a/.github/workflows/pre-integration.yml b/.github/workflows/pre-integration.yml index 2536549..83e74e9 100644 --- a/.github/workflows/pre-integration.yml +++ b/.github/workflows/pre-integration.yml @@ -24,17 +24,32 @@ jobs: with: dotnet-version: '8.0.x' - - name: ๐Ÿงน Clean - run: dotnet clean -c Release && dotnet nuget locals all --clear + - name: ๐Ÿงน Clean non-wpf solution + run: dotnet clean Atc.Azure.IoT-WithoutWpf.sln -c Release && dotnet nuget locals all --clear + if: runner.os != 'Windows' - - name: ๐Ÿ” Restore packages - run: dotnet restore + - name: ๐Ÿงน Clean all + run: dotnet clean Atc.Azure.IoT.sln -c Release && dotnet nuget locals all --clear + if: runner.os == 'Windows' + + - name: ๐Ÿ” Restore packages non-wpf solution + run: dotnet restore Atc.Azure.IoT-WithoutWpf.sln + if: runner.os != 'Windows' + + - name: ๐Ÿ” Restore packages all + run: dotnet restore Atc.Azure.IoT.sln + if: runner.os == 'Windows' + + - name: ๐Ÿ› ๏ธ Build non-wpf solution + run: dotnet build Atc.Azure.IoT-WithoutWpf.sln -c Release --no-restore + if: runner.os != 'Windows' - - name: ๐Ÿ› ๏ธ Building library in release mode - run: dotnet build -c Release --no-restore + - name: ๐Ÿ› ๏ธ Build all + run: dotnet build Atc.Azure.IoT.sln -c Release --no-restore + if: runner.os == 'Windows' dotnet-test: - runs-on: ubuntu-latest + runs-on: windows-latest needs: - dotnet-build steps: @@ -49,10 +64,10 @@ jobs: dotnet-version: '8.0.x' - name: ๐Ÿ” Restore packages - run: dotnet restore + run: dotnet restore Atc.Azure.IoT.sln - - name: ๐Ÿ› ๏ธ Build - run: dotnet build -c Release --no-restore /p:UseSourceLink=true + - name: ๐Ÿ› ๏ธ Build all + run: dotnet build Atc.Azure.IoT.sln -c Release --no-restore /p:UseSourceLink=true - name: ๐Ÿงช Run unit tests - run: dotnet test -c Release --no-build --filter "Category!=Integration" \ No newline at end of file + run: dotnet test Atc.Azure.IoT.sln -c Release --no-build --filter "Category!=Integration" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd1ae41..5238c17 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ env: jobs: release: if: github.ref == 'refs/heads/stable' - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: ๐Ÿ›’ Checkout repository uses: actions/checkout@v4 @@ -33,13 +33,13 @@ jobs: dotnet-version: '8.0.x' - name: ๐Ÿงน Clean - run: dotnet clean -c Release && dotnet nuget locals all --clear + run: dotnet clean Atc.Azure.IoT.sln -c Release && dotnet nuget locals all --clear - name: ๐Ÿ” Restore packages - run: dotnet restore + run: dotnet restore Atc.Azure.IoT.sln - name: ๐Ÿ› ๏ธ Building library in release mode - run: dotnet build -c Release --no-restore /p:UseSourceLink=true + run: dotnet build Atc.Azure.IoT.sln -c Release --no-restore /p:UseSourceLink=true - name: โฉ Merge to release-branch run: | diff --git a/.gitignore b/.gitignore index 17f8ff3..c54446d 100644 --- a/.gitignore +++ b/.gitignore @@ -397,3 +397,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml /sample/src/IoTEdgeModules/modules/opcpublishernodemanagermodule/appsettings.emulator.json +/src/Atc.Azure.IoT.Wpf.App/appsettings.development.json diff --git a/Atc.Azure.IoT-WithoutWpf.sln b/Atc.Azure.IoT-WithoutWpf.sln new file mode 100644 index 0000000..f08204d --- /dev/null +++ b/Atc.Azure.IoT-WithoutWpf.sln @@ -0,0 +1,116 @@ +๏ปฟ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{69C84246-AA75-43E8-94B2-66FD555B18B0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{DAC1423F-D386-4838-AEA0-8BFFBB449ED2}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{58BC6728-197C-484C-A8EC-38BC2F0B58C4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Azure.IoT", "src\Atc.Azure.IoT\Atc.Azure.IoT.csproj", "{A6CEF902-11CB-4877-BBD2-FBE1AF27A62F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Azure.IotEdge.Client.Tests", "test\Atc.Azure.IotEdge.Client.Tests\Atc.Azure.IotEdge.Client.Tests.csproj", "{607C2690-8F7C-4348-B38D-6DE633FC37F9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Azure.IoT.Tests", "test\Atc.Azure.IoT.Tests\Atc.Azure.IoT.Tests.csproj", "{CB8A2B57-146C-4D3F-B02C-F6DE21C5DE42}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Azure.IoT.CLI", "src\Atc.Azure.IoT.CLI\Atc.Azure.IoT.CLI.csproj", "{2326FBB5-CB4B-4153-AF13-22152C265D5F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Azure.IoTEdge", "src\Atc.Azure.IoTEdge\Atc.Azure.IoTEdge.csproj", "{04852479-8932-4AE0-8D87-AABAED0EA971}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Azure.IoTEdge.DeviceEmulator", "src\Atc.Azure.IoTEdge.DeviceEmulator\Atc.Azure.IoTEdge.DeviceEmulator.csproj", "{23EA1D43-328D-4EC1-830E-C1797E1666A6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{E84E1AF8-ACAF-4D1A-A59D-999E873C0A71}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{711F4C2D-06C4-4A34-BDF3-5FA737DB1133}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IoTEdgeModules", "IoTEdgeModules", "{E122CEC1-82DD-43C7-952A-CBF61C0273B5}" + ProjectSection(SolutionItems) = preProject + sample\src\IoTEdgeModules\deployment.debug.template.json = sample\src\IoTEdgeModules\deployment.debug.template.json + sample\src\IoTEdgeModules\deployment.template.emulation.manifest.json = sample\src\IoTEdgeModules\deployment.template.emulation.manifest.json + sample\src\IoTEdgeModules\deployment.template.json = sample\src\IoTEdgeModules\deployment.template.json + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{17137DCD-1D96-4640-9977-4CC9EED18057}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Azure.Iot.Sample.Modules.Contracts", "sample\src\Atc.Azure.Iot.Sample.Modules.Contracts\Atc.Azure.Iot.Sample.Modules.Contracts.csproj", "{D996F215-48C7-4489-9B26-7AE3221A394A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimulationModule", "sample\src\IoTEdgeModules\modules\simulationmodule\SimulationModule.csproj", "{B5E634E9-9CF8-469B-9312-B439E797A96D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpcPublisherNodeManagerModule", "sample\src\IoTEdgeModules\modules\opcpublishernodemanagermodule\OpcPublisherNodeManagerModule.csproj", "{1A393DB3-C6F8-4736-9A5A-462394D320A5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Azure.Iot.Certificate.Sample", "sample\src\Atc.Azure.Iot.Certificate.Sample\Atc.Azure.Iot.Certificate.Sample.csproj", "{CBD19CC8-E6BF-4BF8-8121-A4E325115143}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A6CEF902-11CB-4877-BBD2-FBE1AF27A62F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6CEF902-11CB-4877-BBD2-FBE1AF27A62F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6CEF902-11CB-4877-BBD2-FBE1AF27A62F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6CEF902-11CB-4877-BBD2-FBE1AF27A62F}.Release|Any CPU.Build.0 = Release|Any CPU + {607C2690-8F7C-4348-B38D-6DE633FC37F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {607C2690-8F7C-4348-B38D-6DE633FC37F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {607C2690-8F7C-4348-B38D-6DE633FC37F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {607C2690-8F7C-4348-B38D-6DE633FC37F9}.Release|Any CPU.Build.0 = Release|Any CPU + {CB8A2B57-146C-4D3F-B02C-F6DE21C5DE42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB8A2B57-146C-4D3F-B02C-F6DE21C5DE42}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB8A2B57-146C-4D3F-B02C-F6DE21C5DE42}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB8A2B57-146C-4D3F-B02C-F6DE21C5DE42}.Release|Any CPU.Build.0 = Release|Any CPU + {2326FBB5-CB4B-4153-AF13-22152C265D5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2326FBB5-CB4B-4153-AF13-22152C265D5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2326FBB5-CB4B-4153-AF13-22152C265D5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2326FBB5-CB4B-4153-AF13-22152C265D5F}.Release|Any CPU.Build.0 = Release|Any CPU + {04852479-8932-4AE0-8D87-AABAED0EA971}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04852479-8932-4AE0-8D87-AABAED0EA971}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04852479-8932-4AE0-8D87-AABAED0EA971}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04852479-8932-4AE0-8D87-AABAED0EA971}.Release|Any CPU.Build.0 = Release|Any CPU + {23EA1D43-328D-4EC1-830E-C1797E1666A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {23EA1D43-328D-4EC1-830E-C1797E1666A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {23EA1D43-328D-4EC1-830E-C1797E1666A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {23EA1D43-328D-4EC1-830E-C1797E1666A6}.Release|Any CPU.Build.0 = Release|Any CPU + {D996F215-48C7-4489-9B26-7AE3221A394A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D996F215-48C7-4489-9B26-7AE3221A394A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D996F215-48C7-4489-9B26-7AE3221A394A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D996F215-48C7-4489-9B26-7AE3221A394A}.Release|Any CPU.Build.0 = Release|Any CPU + {B5E634E9-9CF8-469B-9312-B439E797A96D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B5E634E9-9CF8-469B-9312-B439E797A96D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B5E634E9-9CF8-469B-9312-B439E797A96D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B5E634E9-9CF8-469B-9312-B439E797A96D}.Release|Any CPU.Build.0 = Release|Any CPU + {1A393DB3-C6F8-4736-9A5A-462394D320A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1A393DB3-C6F8-4736-9A5A-462394D320A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1A393DB3-C6F8-4736-9A5A-462394D320A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1A393DB3-C6F8-4736-9A5A-462394D320A5}.Release|Any CPU.Build.0 = Release|Any CPU + {CBD19CC8-E6BF-4BF8-8121-A4E325115143}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CBD19CC8-E6BF-4BF8-8121-A4E325115143}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CBD19CC8-E6BF-4BF8-8121-A4E325115143}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CBD19CC8-E6BF-4BF8-8121-A4E325115143}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {A6CEF902-11CB-4877-BBD2-FBE1AF27A62F} = {69C84246-AA75-43E8-94B2-66FD555B18B0} + {607C2690-8F7C-4348-B38D-6DE633FC37F9} = {58BC6728-197C-484C-A8EC-38BC2F0B58C4} + {CB8A2B57-146C-4D3F-B02C-F6DE21C5DE42} = {58BC6728-197C-484C-A8EC-38BC2F0B58C4} + {2326FBB5-CB4B-4153-AF13-22152C265D5F} = {69C84246-AA75-43E8-94B2-66FD555B18B0} + {04852479-8932-4AE0-8D87-AABAED0EA971} = {69C84246-AA75-43E8-94B2-66FD555B18B0} + {23EA1D43-328D-4EC1-830E-C1797E1666A6} = {69C84246-AA75-43E8-94B2-66FD555B18B0} + {711F4C2D-06C4-4A34-BDF3-5FA737DB1133} = {E84E1AF8-ACAF-4D1A-A59D-999E873C0A71} + {E122CEC1-82DD-43C7-952A-CBF61C0273B5} = {711F4C2D-06C4-4A34-BDF3-5FA737DB1133} + {17137DCD-1D96-4640-9977-4CC9EED18057} = {E122CEC1-82DD-43C7-952A-CBF61C0273B5} + {D996F215-48C7-4489-9B26-7AE3221A394A} = {711F4C2D-06C4-4A34-BDF3-5FA737DB1133} + {B5E634E9-9CF8-469B-9312-B439E797A96D} = {17137DCD-1D96-4640-9977-4CC9EED18057} + {1A393DB3-C6F8-4736-9A5A-462394D320A5} = {17137DCD-1D96-4640-9977-4CC9EED18057} + {CBD19CC8-E6BF-4BF8-8121-A4E325115143} = {711F4C2D-06C4-4A34-BDF3-5FA737DB1133} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {04120463-05C5-417B-8D7A-2D7D35B71A07} + EndGlobalSection +EndGlobal diff --git a/Atc.Azure.IoT.sln b/Atc.Azure.IoT.sln index f08204d..dd6ae1a 100644 --- a/Atc.Azure.IoT.sln +++ b/Atc.Azure.IoT.sln @@ -45,6 +45,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpcPublisherNodeManagerModu EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Azure.Iot.Certificate.Sample", "sample\src\Atc.Azure.Iot.Certificate.Sample\Atc.Azure.Iot.Certificate.Sample.csproj", "{CBD19CC8-E6BF-4BF8-8121-A4E325115143}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atc.Azure.IoT.Wpf.App", "src\Atc.Azure.IoT.Wpf.App\Atc.Azure.IoT.Wpf.App.csproj", "{91F3342D-3511-4B66-A0E0-3CC4DE184387}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -91,6 +93,10 @@ Global {CBD19CC8-E6BF-4BF8-8121-A4E325115143}.Debug|Any CPU.Build.0 = Debug|Any CPU {CBD19CC8-E6BF-4BF8-8121-A4E325115143}.Release|Any CPU.ActiveCfg = Release|Any CPU {CBD19CC8-E6BF-4BF8-8121-A4E325115143}.Release|Any CPU.Build.0 = Release|Any CPU + {91F3342D-3511-4B66-A0E0-3CC4DE184387}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91F3342D-3511-4B66-A0E0-3CC4DE184387}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91F3342D-3511-4B66-A0E0-3CC4DE184387}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91F3342D-3511-4B66-A0E0-3CC4DE184387}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -109,6 +115,7 @@ Global {B5E634E9-9CF8-469B-9312-B439E797A96D} = {17137DCD-1D96-4640-9977-4CC9EED18057} {1A393DB3-C6F8-4736-9A5A-462394D320A5} = {17137DCD-1D96-4640-9977-4CC9EED18057} {CBD19CC8-E6BF-4BF8-8121-A4E325115143} = {711F4C2D-06C4-4A34-BDF3-5FA737DB1133} + {91F3342D-3511-4B66-A0E0-3CC4DE184387} = {69C84246-AA75-43E8-94B2-66FD555B18B0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {04120463-05C5-417B-8D7A-2D7D35B71A07} diff --git a/Directory.Build.props b/Directory.Build.props index dc9852c..329c758 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -41,10 +41,10 @@ - + - + \ No newline at end of file diff --git a/sample/src/IoTEdgeModules/modules/opcpublishernodemanagermodule/OpcPublisherNodeManagerModule.csproj b/sample/src/IoTEdgeModules/modules/opcpublishernodemanagermodule/OpcPublisherNodeManagerModule.csproj index df8e410..85fc7b1 100644 --- a/sample/src/IoTEdgeModules/modules/opcpublishernodemanagermodule/OpcPublisherNodeManagerModule.csproj +++ b/sample/src/IoTEdgeModules/modules/opcpublishernodemanagermodule/OpcPublisherNodeManagerModule.csproj @@ -7,7 +7,7 @@ - + diff --git a/sample/src/IoTEdgeModules/modules/simulationmodule/SimulationModule.csproj b/sample/src/IoTEdgeModules/modules/simulationmodule/SimulationModule.csproj index 158cad1..932e237 100644 --- a/sample/src/IoTEdgeModules/modules/simulationmodule/SimulationModule.csproj +++ b/sample/src/IoTEdgeModules/modules/simulationmodule/SimulationModule.csproj @@ -7,7 +7,7 @@ - + @@ -18,7 +18,7 @@ - + diff --git a/src/Atc.Azure.IoT.CLI/Atc.Azure.IoT.CLI.csproj b/src/Atc.Azure.IoT.CLI/Atc.Azure.IoT.CLI.csproj index 6d035b6..a5cc696 100644 --- a/src/Atc.Azure.IoT.CLI/Atc.Azure.IoT.CLI.csproj +++ b/src/Atc.Azure.IoT.CLI/Atc.Azure.IoT.CLI.csproj @@ -18,8 +18,8 @@ - - + + diff --git a/src/Atc.Azure.IoT.Wpf.App/.editorconfig b/src/Atc.Azure.IoT.Wpf.App/.editorconfig new file mode 100644 index 0000000..a2ab9c3 --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/.editorconfig @@ -0,0 +1,25 @@ +# ATC coding rules - https://github.com/atc-net/atc-coding-rules +# Version: 1.0.0 +# Updated: 27-03-2024 +# Location: wpf +# Distribution: Frameworks + +########################################## +# Code Analyzers Rules +########################################## +[*.{cs}] + +dotnet_diagnostic.MA0004.severity = error # Use Task.ConfigureAwait(false) https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0004.md +dotnet_diagnostic.MA0048.severity = none # To support partial classes - File will not match type name. + +########################################## +# Custom - Code Analyzers Rules +########################################## + +dotnet_diagnostic.MA0049.severity = none # Type name should not match containing namespace (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0049.md) + +dotnet_diagnostic.S4487.severity = none # + +dotnet_diagnostic.CA1724.severity = none # + +dotnet_diagnostic.IDE0052.severity = none # \ No newline at end of file diff --git a/src/Atc.Azure.IoT.Wpf.App/App.xaml b/src/Atc.Azure.IoT.Wpf.App/App.xaml new file mode 100644 index 0000000..43a9889 --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/App.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/src/Atc.Azure.IoT.Wpf.App/App.xaml.cs b/src/Atc.Azure.IoT.Wpf.App/App.xaml.cs new file mode 100644 index 0000000..481ebcd --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/App.xaml.cs @@ -0,0 +1,59 @@ +namespace Atc.Azure.IoT.Wpf.App; + +/// +/// Interaction logic for App. +/// +public partial class App +{ + private readonly IHost host; + private IConfiguration? configuration; + + public App() + { + host = Host.CreateDefaultBuilder() + .ConfigureAppConfiguration( + configurationBuilder => + { + configuration = configurationBuilder + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true) + .AddEnvironmentVariables() + .Build(); + }) + .ConfigureServices((_, services) => + { + services.AddSingleton(); + services.AddSingleton(); + }) + .Build(); + } + + private async void ApplicationStartup( + object sender, + StartupEventArgs e) + { + await host + .StartAsync() + .ConfigureAwait(false); + + ThemeManager.Current.ChangeTheme(Current, "Dark.Taupe"); + + var mainWindow = host + .Services + .GetService()!; + + mainWindow.Show(); + } + + private async void ApplicationExit( + object sender, + ExitEventArgs e) + { + await host + .StopAsync() + .ConfigureAwait(false); + + host.Dispose(); + } +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT.Wpf.App/AssemblyInfo.cs b/src/Atc.Azure.IoT.Wpf.App/AssemblyInfo.cs new file mode 100644 index 0000000..cccb9d1 --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/AssemblyInfo.cs @@ -0,0 +1 @@ +[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] \ No newline at end of file diff --git a/src/Atc.Azure.IoT.Wpf.App/Atc.Azure.IoT.Wpf.App.csproj b/src/Atc.Azure.IoT.Wpf.App/Atc.Azure.IoT.Wpf.App.csproj new file mode 100644 index 0000000..aa36bf9 --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/Atc.Azure.IoT.Wpf.App.csproj @@ -0,0 +1,32 @@ + + + + WinExe + net8.0-windows + true + false + + + + + + + + + PreserveNewest + + + + + + + + + + + + + + + + diff --git a/src/Atc.Azure.IoT.Wpf.App/GlobalUsings.cs b/src/Atc.Azure.IoT.Wpf.App/GlobalUsings.cs new file mode 100644 index 0000000..77ceffe --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/GlobalUsings.cs @@ -0,0 +1,11 @@ +// Global using directives + +global using System.ComponentModel; +global using System.IO; +global using System.Windows; +global using System.Windows.Input; +global using Atc.Wpf.Mvvm; +global using ControlzEx.Theming; +global using Microsoft.Extensions.Configuration; +global using Microsoft.Extensions.DependencyInjection; +global using Microsoft.Extensions.Hosting; \ No newline at end of file diff --git a/src/Atc.Azure.IoT.Wpf.App/MainWindow.xaml b/src/Atc.Azure.IoT.Wpf.App/MainWindow.xaml new file mode 100644 index 0000000..af16c9a --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/MainWindow.xaml @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/src/Atc.Azure.IoT.Wpf.App/MainWindow.xaml.cs b/src/Atc.Azure.IoT.Wpf.App/MainWindow.xaml.cs new file mode 100644 index 0000000..34bbc71 --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/MainWindow.xaml.cs @@ -0,0 +1,51 @@ +namespace Atc.Azure.IoT.Wpf.App; + +/// +/// Interaction logic for MainWindow. +/// +public partial class MainWindow +{ + public MainWindow( + IMainWindowViewModelBase viewModel) + { + InitializeComponent(); + DataContext = viewModel; + + Loaded += OnLoaded; + Closing += OnClosing; + KeyDown += OnKeyDown; + KeyUp += OnKeyUp; + } + + private void OnLoaded( + object sender, + RoutedEventArgs e) + { + var vm = DataContext as IMainWindowViewModelBase; + vm!.OnLoaded(this, e); + } + + private void OnClosing( + object? sender, + CancelEventArgs e) + { + var vm = DataContext as IMainWindowViewModelBase; + vm!.OnClosing(this, e); + } + + private void OnKeyDown( + object sender, + KeyEventArgs e) + { + var vm = DataContext as IMainWindowViewModelBase; + vm!.OnKeyDown(this, e); + } + + private void OnKeyUp( + object sender, + KeyEventArgs e) + { + var vm = DataContext as IMainWindowViewModelBase; + vm!.OnKeyUp(this, e); + } +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT.Wpf.App/MainWindowViewModel.cs b/src/Atc.Azure.IoT.Wpf.App/MainWindowViewModel.cs new file mode 100644 index 0000000..90c5a49 --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/MainWindowViewModel.cs @@ -0,0 +1,11 @@ +namespace Atc.Azure.IoT.Wpf.App; + +public partial class MainWindowViewModel : MainWindowViewModelBase, IMainWindowViewModelBase +{ +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public MainWindowViewModel() + { + // Dummy for XAML design view + } +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT.Wpf.App/appsettings.json b/src/Atc.Azure.IoT.Wpf.App/appsettings.json new file mode 100644 index 0000000..222224e --- /dev/null +++ b/src/Atc.Azure.IoT.Wpf.App/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT/Atc.Azure.IoT.csproj b/src/Atc.Azure.IoT/Atc.Azure.IoT.csproj index 2dbdb14..b4e018f 100644 --- a/src/Atc.Azure.IoT/Atc.Azure.IoT.csproj +++ b/src/Atc.Azure.IoT/Atc.Azure.IoT.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/Atc.Azure.IoTEdge.DeviceEmulator/Atc.Azure.IoTEdge.DeviceEmulator.csproj b/src/Atc.Azure.IoTEdge.DeviceEmulator/Atc.Azure.IoTEdge.DeviceEmulator.csproj index acaf8c8..a1000b0 100644 --- a/src/Atc.Azure.IoTEdge.DeviceEmulator/Atc.Azure.IoTEdge.DeviceEmulator.csproj +++ b/src/Atc.Azure.IoTEdge.DeviceEmulator/Atc.Azure.IoTEdge.DeviceEmulator.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/Atc.Azure.IoTEdge/Atc.Azure.IoTEdge.csproj b/src/Atc.Azure.IoTEdge/Atc.Azure.IoTEdge.csproj index 25bd142..71a09ad 100644 --- a/src/Atc.Azure.IoTEdge/Atc.Azure.IoTEdge.csproj +++ b/src/Atc.Azure.IoTEdge/Atc.Azure.IoTEdge.csproj @@ -13,7 +13,7 @@ - + diff --git a/test/Atc.Azure.IoT.Tests/Atc.Azure.IoT.Tests.csproj b/test/Atc.Azure.IoT.Tests/Atc.Azure.IoT.Tests.csproj index a765447..4d6f113 100644 --- a/test/Atc.Azure.IoT.Tests/Atc.Azure.IoT.Tests.csproj +++ b/test/Atc.Azure.IoT.Tests/Atc.Azure.IoT.Tests.csproj @@ -11,9 +11,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/Atc.Azure.IotEdge.Client.Tests/Atc.Azure.IotEdge.Client.Tests.csproj b/test/Atc.Azure.IotEdge.Client.Tests/Atc.Azure.IotEdge.Client.Tests.csproj index a765447..4d6f113 100644 --- a/test/Atc.Azure.IotEdge.Client.Tests/Atc.Azure.IotEdge.Client.Tests.csproj +++ b/test/Atc.Azure.IotEdge.Client.Tests/Atc.Azure.IotEdge.Client.Tests.csproj @@ -11,9 +11,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive