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

Maui #5

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 16 additions & 5 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,24 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 7.0.x
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1
with:
vs-prerelease: true
- name: Decrypt PFX File
run: |
echo "${{ secrets.WINDOWS_PFX_FILE }}" > cert.pfx.asc
certutil -decode cert.pfx.asc cert.pfx
- name: Add Cert to Store
run: certutil -user -q -p ${{ secrets.WINDOWS_PFX_PASSWORD }} -importpfx cert.pfx NoRoot
- name: Install MAUI Workloads
run: |
dotnet workload install maui --ignore-failed-sources
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true -o ./publish
- name: Publish
run: dotnet publish -f net7.0-windows10.0.19041.0 -c Release /p:RuntimeIdentifierOverride=win10-x64 /p:GenerateAppxPackageOnBuild=true /p:AppxPackageSigningEnabled=true /p:PackageCertificateThumbprint="${{ secrets.WINDOWS_PFX_THUMBPRINT }}" -o publish
- name: Create Archive
run: powershell Compress-Archive -Path ./publish/* -DestinationPath ./StudentFileRename.zip
- name: Upload a Build Artifact
Expand Down
34 changes: 10 additions & 24 deletions StudentFileRename.sln
Original file line number Diff line number Diff line change
@@ -1,41 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30611.23
# Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StudentFileRename", "StudentFileRename\StudentFileRename.csproj", "{170C05E7-034C-409B-9A05-6C27E38AFC03}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StudentFileRename", "StudentFileRename\StudentFileRename.csproj", "{07902AE7-9819-4034-85DE-5A5B2E19DA06}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{03B84C34-9812-4724-91E3-668691721AC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03B84C34-9812-4724-91E3-668691721AC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03B84C34-9812-4724-91E3-668691721AC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03B84C34-9812-4724-91E3-668691721AC4}.Release|Any CPU.Build.0 = Release|Any CPU
{B997F407-C7D4-4537-B100-BFA989A0B952}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B997F407-C7D4-4537-B100-BFA989A0B952}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B997F407-C7D4-4537-B100-BFA989A0B952}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B997F407-C7D4-4537-B100-BFA989A0B952}.Release|Any CPU.Build.0 = Release|Any CPU
{0402661D-D955-4902-8CE4-4F5F286F5228}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0402661D-D955-4902-8CE4-4F5F286F5228}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0402661D-D955-4902-8CE4-4F5F286F5228}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0402661D-D955-4902-8CE4-4F5F286F5228}.Release|Any CPU.Build.0 = Release|Any CPU
{170C05E7-034C-409B-9A05-6C27E38AFC03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{170C05E7-034C-409B-9A05-6C27E38AFC03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{170C05E7-034C-409B-9A05-6C27E38AFC03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{170C05E7-034C-409B-9A05-6C27E38AFC03}.Release|Any CPU.Build.0 = Release|Any CPU
{B1025947-8153-44AD-9AB7-515812A291D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1025947-8153-44AD-9AB7-515812A291D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1025947-8153-44AD-9AB7-515812A291D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1025947-8153-44AD-9AB7-515812A291D5}.Release|Any CPU.Build.0 = Release|Any CPU
{07902AE7-9819-4034-85DE-5A5B2E19DA06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07902AE7-9819-4034-85DE-5A5B2E19DA06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07902AE7-9819-4034-85DE-5A5B2E19DA06}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{07902AE7-9819-4034-85DE-5A5B2E19DA06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07902AE7-9819-4034-85DE-5A5B2E19DA06}.Release|Any CPU.Build.0 = Release|Any CPU
{07902AE7-9819-4034-85DE-5A5B2E19DA06}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {10CB4309-A38C-4812-934F-C1F0DA4DD488}
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
EndGlobalSection
EndGlobal
27 changes: 6 additions & 21 deletions StudentFileRename/App.xaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
<Application x:Class="StudentFileRename.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:StudentFileRename"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
x:Class="StudentFileRename.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="Lime" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="TextBox" BasedOn="{StaticResource MaterialDesignTextBox}">
<Setter Property="Margin" Value="0,0,0,20" />
</Style>
<Style TargetType="{x:Type Button}" x:Key="BrowseButton" BasedOn="{StaticResource MaterialDesignRaisedButton}">
<Setter Property="Height" Value="25" />
<Setter Property="Margin" Value="10, 0, 0, 0" />
<Setter Property="FontSize" Value="13" />
</Style>
<Style TargetType="TextBox" x:Key="FloatingLabelTextBox" BasedOn="{StaticResource MaterialDesignFloatingHintTextBox}">
<Setter Property="Margin" Value="0,0,0,15" />
</Style>
<Style TargetType="Label" x:Key="FieldLabel" BasedOn="{StaticResource MaterialDesignLabel}">
<Setter Property="Margin" Value="0,0,10,0" />
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
56 changes: 7 additions & 49 deletions StudentFileRename/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,53 +1,11 @@
using StudentFileRename.Interface;
using StudentFileRename.Service;
using StudentFileRename.ViewModel;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Win32;
using Ookii.Dialogs.Wpf;
using System.Windows;
using StudentFileRename.View;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
namespace StudentFileRename;

namespace StudentFileRename
public partial class App : Application
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private readonly ServiceProvider _serviceProvider;
public App()
{
InitializeComponent();

public App()
{
ServiceCollection services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
}

private void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<MainWindow>()
.AddLogging(loggingBuilder =>
{
loggingBuilder.ClearProviders();
loggingBuilder.SetMinimumLevel(LogLevel.Trace);
loggingBuilder.AddNLog();
})
.AddSingleton<StartupPageViewModel>()
.AddSingleton<MainWindowViewModel>()
.AddSingleton<IFileDialogService, WindowsFileDialogService>()
.AddSingleton<VistaFolderBrowserDialog>()
.AddSingleton<OpenFileDialog>()
.AddSingleton<IDialogService, MaterialDesignDialogService>();
}

protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

var mainWindow = _serviceProvider.GetRequiredService<MainWindow>();
mainWindow.Show();
}
}
MainPage = new AppShell();
}
}
14 changes: 14 additions & 0 deletions StudentFileRename/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="StudentFileRename.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:StudentFileRename"
Shell.FlyoutBehavior="Disabled">

<ShellContent
Title="Student File Renaming Utility"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
9 changes: 9 additions & 0 deletions StudentFileRename/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace StudentFileRename;

public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
10 changes: 0 additions & 10 deletions StudentFileRename/AssemblyInfo.cs

This file was deleted.

12 changes: 0 additions & 12 deletions StudentFileRename/Interface/IDialogService.cs

This file was deleted.

11 changes: 0 additions & 11 deletions StudentFileRename/Interface/IFileDialogService.cs

This file was deleted.

11 changes: 0 additions & 11 deletions StudentFileRename/Interface/IFileNameRetrievalService.cs

This file was deleted.

72 changes: 72 additions & 0 deletions StudentFileRename/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="StudentFileRename.MainPage">

<ScrollView>
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">

<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />

<Label
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />

<HorizontalStackLayout HorizontalOptions="Center" Spacing="25">
<Button
x:Name="InputFolderButton"
Text="Select Input Folder"
Clicked="OnInputFolderClicked" />
<Label
x:Name="InputFolderLabel"
WidthRequest="400"
Text="" />
</HorizontalStackLayout>

<HorizontalStackLayout HorizontalOptions="Center" Spacing="25">
<Button
x:Name="OutputFolderButton"
Text="Select Output Folder"
Clicked="OnOutputFolderClicked" />
<Label
x:Name="OutputFolderLabel"
WidthRequest="400"
Text="" />
</HorizontalStackLayout>

<Button
x:Name="GenerateNewFilesButton"
Text="Generate New Files"
IsEnabled="False"
Clicked="OnGenerateNewFiles"
HorizontalOptions="Center"
IsVisible="True"
HeightRequest="50"/>

<ProgressBar
x:Name="GenerateNewFilesProgressBar"
IsVisible="False"
ProgressColor="MediumPurple"
ScaleY="4"
HeightRequest="50"/>

<Label
x:Name="FileProgressLabel"
IsVisible="False"
HorizontalOptions="Center"
Text=""
/>

</VerticalStackLayout>
</ScrollView>

</ContentPage>
Loading