Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI App for Windows #89

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4a31dce
Adding GUI prototype apps
bowencode May 25, 2023
5570d9f
Merge branch 'main' into feature/gui
bowencode Jun 28, 2023
b382356
Merge branch 'main' into feature/gui
bowencode Jul 27, 2023
8b37d4c
Moving GUI into main solution
bowencode Jul 27, 2023
2b60cda
Testing build on net7
bowencode Jul 28, 2023
43d0dbd
Adding workload to build
bowencode Jul 28, 2023
aa467e9
Adding maui workload install
bowencode Jul 28, 2023
aefc495
Splitting solutions for build support
bowencode Jul 28, 2023
a7e0f4a
Testing build jobs for maui app
bowencode Jul 28, 2023
8da1fa6
Updating build platform settings
bowencode Jul 28, 2023
0f19097
Updating build settings
bowencode Jul 28, 2023
c8900ee
Adjusting settings for mac
bowencode Jul 28, 2023
6a69569
Removing win packaging; updating mac build tool versions
bowencode Jul 28, 2023
83852d2
Improving core app discovery
bowencode Jul 28, 2023
d1e1ea7
Fix for dev path priority
bowencode Jul 28, 2023
57a061f
Fix for app search priority
bowencode Jul 29, 2023
7fa6627
Fix for styles in renamed assembly
bowencode Jul 29, 2023
3d79922
Adding windows specific WPF client to enable app deployment
bowencode Aug 7, 2023
2ac8694
Namespace fixes
bowencode Aug 7, 2023
f2509cc
Adding basic commands and logging
bowencode Aug 7, 2023
b43dd4f
Matching functionality and design of Maui app
bowencode Aug 7, 2023
bf935b9
Saving window position
bowencode Aug 8, 2023
cfb19bb
Publishing setup
bowencode Aug 8, 2023
4e3e670
script fix
bowencode Aug 8, 2023
a5aa351
Removing net6 install
bowencode Aug 8, 2023
906d637
Adding windows gui and cmdline only packages
bowencode Aug 9, 2023
5755a0d
Testing compression on publish
bowencode Aug 10, 2023
020def5
Adding app icon
bowencode Sep 16, 2023
a98fef0
Merge remote-tracking branch 'project/main' into feature/gui
bowencode Sep 16, 2023
50c799e
Updating builds for current packagable apps
bowencode Sep 16, 2023
c5b4e68
Aligning package name
bowencode Sep 16, 2023
2d00135
Adding GUI to docs
bowencode Sep 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 47 additions & 4 deletions .github/workflows/dotnet-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ "main" ]

jobs:
build:
build_core:
name: Build and test .NET projects
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:6.0
Expand All @@ -18,14 +18,57 @@ jobs:
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
run: dotnet restore ./CosmosDbDataMigrationTool.sln
- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore ./CosmosDbDataMigrationTool.sln
- name: Test
run: dotnet test --no-build --verbosity normal
run: dotnet test --no-build --verbosity normal ./CosmosDbDataMigrationTool.sln

- name: Debug Build Artifact
uses: actions/upload-artifact@v3
with:
name: debug-build
path: /home/runner/work/data-migration-desktop-tool/data-migration-desktop-tool/Core/Cosmos.DataTransfer.Core/bin/Debug/net6.0 #path/to/artifact/ # or path/to/artifact
# build-gui-win:
# name: Build GUI projects for Windows
# runs-on: windows-2022
# steps:
# - uses: actions/checkout@v3
# - name: Setup .NET
# uses: actions/setup-dotnet@v2
# with:
# dotnet-version: 7.0.x
# - name: Install MAUI Workload
# run: dotnet workload install maui-windows --ignore-failed-sources
# - name: Restore Dependencies
# run: dotnet restore ./App/CosmosDbApp.sln
# - name: Build App
# run: dotnet build --no-restore ./App/CosmosDbApp.sln
# - name: Debug Build Artifact
# uses: actions/upload-artifact@v3
# with:
# name: app-win-build
# path: D:\a\data-migration-desktop-tool\data-migration-desktop-tool\App\Cosmos.DataTransfer.App\bin\Debug\net7.0-windows10.0.19041.0\win10-x64 #path/to/artifact/ # or path/to/artifact
# build-gui-mac:
# name: Build GUI projects for Mac
# runs-on: macos-13
# steps:
# - uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: '14.3'
# - uses: actions/checkout@v3
# - name: Setup .NET
# uses: actions/setup-dotnet@v2
# with:
# dotnet-version: 7.0.x
# - name: Install MAUI Workload
# run: dotnet workload install maui-maccatalyst --ignore-failed-sources
# - name: Restore Dependencies
# run: dotnet restore ./App/CosmosDbApp.sln
# - name: Build App
# run: dotnet build --no-restore ./App/CosmosDbApp.sln
# - name: Debug Build Artifact
# uses: actions/upload-artifact@v3
# with:
# name: app-mac-build
# path: /Users/runner/work/data-migration-desktop-tool/data-migration-desktop-tool/App/Cosmos.DataTransfer.App/bin/Debug/net7.0-maccatalyst/maccatalyst-x64 #path/to/artifact/ # or path/to/artifact
47 changes: 39 additions & 8 deletions .github/workflows/internal-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ jobs:
run: dotnet --version
- name: Checkout source code
uses: actions/checkout@v3
- name: Execute Action build-with-plugins for Windows
uses: ./.github/actions/build-with-plugins
id: build-with-plugins-win
with:
platform: windows
platform-short: win
runtime: win-x64
build-version: 0.0.${{ github.run_number }}
- name: Execute Action build-with-plugins for MacOS
uses: ./.github/actions/build-with-plugins
id: build-with-plugins-mac
Expand All @@ -39,3 +31,42 @@ jobs:
platform-short: linux
runtime: linux-x64
build-version: 0.0.${{ github.run_number }}
build-package-win:
name: Build self-contained Windows executables
runs-on: windows-2022
steps:
- name: Check .NET version
run: dotnet --version
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup .NET 7
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
- name: Execute Action build-with-plugins for Windows
uses: ./.github/actions/build-with-plugins
id: build-with-plugins-win
with:
platform: windows
platform-short: win
runtime: win-x64
build-version: 0.0.${{ github.run_number }}
- name: Build Windows desktop package
shell: bash
run: |
dotnet publish \
App/Cosmos.DataTransfer.App.Windows/Cosmos.DataTransfer.App.Windows.csproj \
--configuration Release \
--output win \
--self-contained true \
--runtime win-x64 \
-p:PublishSingleFile=true \
-p:DebugType=embedded \
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:EnableCompressionInSingleFile=true \
-p:Version=0.0.${{ github.run_number }}
- name: Upload gui package
uses: actions/upload-artifact@v3
with:
name: windows-gui-package
path: win/
57 changes: 48 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ jobs:
github-release:
name: Create GitHub release
runs-on: ubuntu-latest
needs: build-package
needs: build-package-win
steps:
- name: Download Windows GUI x64 package
uses: actions/download-artifact@v3
with:
name: windows-gui-package
path: windows-gui-package
- name: Download Windows x64 package
uses: actions/download-artifact@v3
with:
Expand All @@ -26,13 +31,15 @@ jobs:
path: linux-package
- name: Package output files
run: |
zip -r dmt-gui-${{ github.event.release.tag_name }}-win-x64.zip windows-gui-package/*
zip -r dmt-${{ github.event.release.tag_name }}-win-x64.zip windows-package/*
zip -r dmt-${{ github.event.release.tag_name }}-mac-x64.zip mac-package/*
zip -r dmt-${{ github.event.release.tag_name }}-linux-x64.zip linux-package/*
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
files: |
dmt-gui-${{ github.event.release.tag_name }}-win-x64.zip
dmt-${{ github.event.release.tag_name }}-win-x64.zip
dmt-${{ github.event.release.tag_name }}-mac-x64.zip
dmt-${{ github.event.release.tag_name }}-linux-x64.zip
Expand All @@ -45,14 +52,6 @@ jobs:
run: dotnet --version
- name: Checkout source code
uses: actions/checkout@v3
- name: Execute Action build-with-plugins for Windows
uses: ./.github/actions/build-with-plugins
id: build-with-plugins-win
with:
platform: windows
platform-short: win
runtime: win-x64
build-version: ${{ github.event.release.tag_name }}
- name: Execute Action build-with-plugins for MacOS
uses: ./.github/actions/build-with-plugins
id: build-with-plugins-mac
Expand All @@ -69,3 +68,43 @@ jobs:
platform-short: linux
runtime: linux-x64
build-version: ${{ github.event.release.tag_name }}
build-package-win:
name: Build self-contained Windows executables
runs-on: windows-2022
needs: build-package
steps:
- name: Check .NET version
run: dotnet --version
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup .NET 7
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
- name: Execute Action build-with-plugins for Windows
uses: ./.github/actions/build-with-plugins
id: build-with-plugins-win
with:
platform: windows
platform-short: win
runtime: win-x64
build-version: ${{ github.event.release.tag_name }}
- name: Build Windows desktop package
shell: bash
run: |
dotnet publish \
App/Cosmos.DataTransfer.App.Windows/Cosmos.DataTransfer.App.Windows.csproj \
--configuration Release \
--output win \
--self-contained true \
--runtime win-x64 \
-p:PublishSingleFile=true \
-p:DebugType=embedded \
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:EnableCompressionInSingleFile=true \
-p:Version=${{ github.event.release.tag_name }}
- name: Upload gui package
uses: actions/upload-artifact@v3
with:
name: windows-gui-package
path: win/
72 changes: 72 additions & 0 deletions App/Cosmos.DataTransfer.App.Windows/Actions/CommandAction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Cosmos.DataTransfer.Ui.Common;

namespace Cosmos.DataTransfer.App.Windows.Actions;

public abstract class CommandAction
{
public MainViewModel Host { get; set; }
protected IMessenger Messenger => Host.GetMessenger();

protected ExtensionDefinition? SelectedSource => Host.SelectedSource;
protected ExtensionDefinition? SelectedSink => Host.SelectedSink;
protected ExtensionSettings? SourceSettings => Host.SourceSettings;
protected ExtensionSettings? SinkSettings => Host.SinkSettings;
protected IAppDataService DataService => Host.DataService;

protected CommandAction(MainViewModel host)
{
Host = host;
}

protected bool SettingsSelected()
{
if (SelectedSource == null || SelectedSink == null)
{
Messenger.Log(LogMessage.Warn("Choose Source and Sink to generate settings."));
return false;
}

return true;
}

protected abstract Task Execute(CancellationToken cancellationToken);

public async Task Execute()
{
if (!SettingsSelected())
return;

Host.CurrentExecutionAction = new CancellationTokenSource();
Host.IsExecuting = true;

Task task = Execute(Host.CurrentExecutionAction.Token);
ThenReset(task);
try
{
await task;
}
catch (TaskCanceledException)
{
Messenger.Log(LogMessage.Warn("Operation Canceled"));
}
catch (Exception ex)
{
Messenger.Log(LogMessage.Error(ex.Message));
}
}

public void ThenReset(Task task)
{
task.ContinueWith(t =>
{
App.Current.Dispatcher.Invoke(() =>
{
Host.CancelExecution(true);
});
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Cosmos.DataTransfer.Ui.Common;

namespace Cosmos.DataTransfer.App.Windows.Actions;

public class ExportSettingsAction : CommandAction
{
public ExportSettingsAction(MainViewModel host) : base(host)
{
}

protected override async Task Execute(CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var output = await DataService.BuildSettingsAsync(SelectedSource?.DisplayName ?? throw new InvalidOperationException("No Source selected"),
SelectedSink?.DisplayName ?? throw new InvalidOperationException("No Sink selected"),
SourceSettings?.Settings,
SinkSettings?.Settings);

Messenger.Log(LogMessage.Data(output));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Cosmos.DataTransfer.Ui.Common;

namespace Cosmos.DataTransfer.App.Windows.Actions;

public class GenerateCommandLineAction : CommandAction
{
public GenerateCommandLineAction(MainViewModel host) : base(host)
{
}

protected override async Task Execute(CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var output = await DataService.BuildCommandAsync(SelectedSource?.DisplayName ?? throw new InvalidOperationException("No Source selected"),
SelectedSink?.DisplayName ?? throw new InvalidOperationException("No Sink selected"),
SourceSettings?.Settings,
SinkSettings?.Settings);
Messenger.Log(LogMessage.Data(output));
}
}
23 changes: 23 additions & 0 deletions App/Cosmos.DataTransfer.App.Windows/Actions/RunJobAction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Cosmos.DataTransfer.App.Windows.Actions;

public class RunJobAction : CommandAction
{
public RunJobAction(MainViewModel host) : base(host)
{
}

protected override async Task Execute(CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
bool completed = await DataService.ExecuteWithSettingsAsync(SelectedSource?.DisplayName ?? throw new InvalidOperationException("No Source selected"),
SelectedSink?.DisplayName ?? throw new InvalidOperationException("No Sink selected"),
SourceSettings?.Settings,
SinkSettings?.Settings,
async m => Messenger.Log(m),
cancellationToken);
}
}
21 changes: 21 additions & 0 deletions App/Cosmos.DataTransfer.App.Windows/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Cosmos.DataTransfer.App.Windows.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<Cosmos.DataTransfer.App.Windows.Properties.Settings>
<setting name="WindowPosition" serializeAs="String">
<value>0, 0</value>
</setting>
<setting name="WindowSize" serializeAs="String">
<value>0, 0</value>
</setting>
<setting name="WindowMaximized" serializeAs="String">
<value>False</value>
</setting>
</Cosmos.DataTransfer.App.Windows.Properties.Settings>
</userSettings>
</configuration>
Loading
Loading