Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Erapchu committed Jun 11, 2023
2 parents 643073a + 4dbafbe commit bd13768
Show file tree
Hide file tree
Showing 18 changed files with 155 additions and 117 deletions.
34 changes: 3 additions & 31 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,30 @@ on:
- 'v*'

jobs:

build:
runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
runs-on: windows-latest
env:
SOLUTION_NAME: SinglePass.WPF.sln
PROJECT_PATH: .\SinglePass.WPF\SinglePass.WPF.csproj
CONFIGURATION: Release

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
- name: Setup MSBuild
uses: microsoft/[email protected]

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore
run: |
msbuild $env:PROJECT_PATH /t:Restore /p:Configuration=$env:CONFIGURATION
# Build the application to populate the bin folder
- name: Build
run: |
msbuild $env:PROJECT_PATH /t:Publish /p:Configuration=$env:CONFIGURATION /p:RuntimeIdentifier=win-x64 /p:SelfContained=true /p:PublishReadyToRun=True /p:PublishSingleFile=true
# Upload artifacts
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: build_result
path: .\SinglePass.WPF\bin\Release\net7.0-windows\win-x64\publish\

# Create .zip from artifacts
msbuild $env:PROJECT_PATH /t:Publish /p:Configuration=$env:CONFIGURATION /p:RuntimeIdentifier=win-x64 /p:SelfContained=true /p:PublishReadyToRun=true /p:PublishSingleFile=true
- name: Create .zip artifacts
run: |
Compress-Archive -Path '.\SinglePass.WPF\bin\Release\net7.0-windows\win-x64\publish\' -DestinationPath '.\build_result.zip'
# Use script because we need to automate generate_release_notes
- name: Create release
uses: "actions/[email protected]"
env:
Expand All @@ -77,8 +53,6 @@ jobs:
} catch (error) {
core.setFailed(error.message);
}
# Upload artifacts to release
- name: Upload artifact
uses: actions/upload-release-asset@v1
env:
Expand All @@ -88,8 +62,6 @@ jobs:
asset_path: .\build_result.zip
asset_name: build_result.zip
asset_content_type: application/zip



# - name: Create release
# uses: actions/create-release@v1
Expand Down
12 changes: 6 additions & 6 deletions SinglePass.Language/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions SinglePass.Language/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,11 @@
<data name="CanTMergeCredentials" xml:space="preserve">
<value>Can't merge credentials</value>
</data>
<data name="ToPasteLogin" xml:space="preserve">
<value>to paste login</value>
<data name="ToPasteCombination" xml:space="preserve">
<value>to paste combination</value>
</data>
<data name="ToPastePassword" xml:space="preserve">
<value>to paste password</value>
<data name="ToPasteLoginOrPassword" xml:space="preserve">
<value>to paste login or password</value>
</data>
<data name="Theme" xml:space="preserve">
<value>Theme</value>
Expand Down
8 changes: 4 additions & 4 deletions SinglePass.Language/Properties/Resources.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@
<data name="NoAnyChanges" xml:space="preserve">
<value>Нет изменений</value>
</data>
<data name="ToPasteLogin" xml:space="preserve">
<value>для вставки логина</value>
<data name="ToPasteCombination" xml:space="preserve">
<value>для вставки комбинации</value>
</data>
<data name="ToPastePassword" xml:space="preserve">
<value>для вставки пароля</value>
<data name="ToPasteLoginOrPassword" xml:space="preserve">
<value>для вставки логина или пароля</value>
</data>
<data name="Theme" xml:space="preserve">
<value>Тема</value>
Expand Down
56 changes: 27 additions & 29 deletions SinglePass.WPF/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public App()
_configuration = BuildConfiguration();
Services = ConfigureServices(_configuration);
}
else
{
// Show main window and shutdown process
InterprocessHelper.ShowMainWindow();
Environment.Exit(0);
}
}

private static IServiceProvider ConfigureServices(IConfiguration configuration)
Expand Down Expand Up @@ -138,42 +144,34 @@ private void Application_Startup(object sender, StartupEventArgs e)
// Override culture
//SinglePass.Language.Properties.Resources.Culture = new System.Globalization.CultureInfo("en-US");

if (IsFirstInstance)
{
var hiw = new HiddenInterprocessWindow();
hiw.InitWithoutShowing();
var hiw = new HiddenInterprocessWindow();
hiw.InitWithoutShowing();

Constants.EnsurePaths();

Constants.EnsurePaths();
// Resolve theme
var themeService = Services.GetService<ThemeService>();
themeService.Init();

// Resolve theme
var themeService = Services.GetService<ThemeService>();
themeService.Init();
// Login
using (var loginScope = Services.CreateScope())
{
var loginWindow = loginScope.ServiceProvider.GetService<LoginWindow>();
bool? dialogResult = loginWindow.ShowDialog(); // Stop here

// Login
using (var loginScope = Services.CreateScope())
if (dialogResult != true)
{
var loginWindow = loginScope.ServiceProvider.GetService<LoginWindow>();
bool? dialogResult = loginWindow.ShowDialog(); // Stop here

if (dialogResult != true)
{
Shutdown();
return;
}
Shutdown();
return;
}
}

// Create tray icon
_trayIcon = new TrayIcon();
// Create tray icon
_trayIcon = new TrayIcon();

// Open main window
var mainWindow = Services.GetService<MainWindow>();
mainWindow.Show();
}
else
{
InterprocessHelper.ShowMainWindow();
Shutdown();
}
// Open main window
var mainWindow = Services.GetService<MainWindow>();
mainWindow.Show();
}

private void Application_Exit(object sender, ExitEventArgs e)
Expand Down
1 change: 1 addition & 0 deletions SinglePass.WPF/Helpers/WindowsKeyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ internal static class WindowsKeyboard
{
public const byte VK_V = 0x56;
public const byte VK_CONTROL = 0x11;
public const byte VK_TAB = 0x09;
public const int KEYEVENTF_KEYUP = 0x0002;

public const uint WM_PASTE = 0x0302;
Expand Down
12 changes: 6 additions & 6 deletions SinglePass.WPF/SinglePass.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@

<ItemGroup>
<PackageReference Include="AsyncKeyedLock" Version="6.2.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.0" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
<PackageReference Include="MaterialDesignThemes" Version="4.6.1" />
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NHotkey.Wpf" Version="2.1.0" />
<PackageReference Include="NLog" Version="5.1.2" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NHotkey.Wpf" Version="2.1.1" />
<PackageReference Include="NLog" Version="5.2.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.0" />
<PackageReference Include="Unidecode.NET" Version="2.1.0" />
</ItemGroup>

Expand Down
3 changes: 1 addition & 2 deletions SinglePass.WPF/ViewModels/CloudSyncViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

namespace SinglePass.WPF.ViewModels
{
[INotifyPropertyChanged]
public partial class CloudSyncViewModel
public partial class CloudSyncViewModel : ObservableObject
{
#region Design time instance
private static readonly Lazy<CloudSyncViewModel> _lazy = new(GetDesignTimeVM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

namespace SinglePass.WPF.ViewModels.Dialogs
{
[INotifyPropertyChanged]
public partial class CredentialEditViewModel
public partial class CredentialEditViewModel : ObservableObject
{
public event Action<MaterialDialogResult?> Accept;

Expand All @@ -19,7 +18,7 @@ public partial class CredentialEditViewModel
[ObservableProperty]
private CredentialDetailsMode _mode;

public string CaptionText => _mode switch
public string CaptionText => Mode switch
{
CredentialDetailsMode.Edit => SinglePass.Language.Properties.Resources.Edit,
CredentialDetailsMode.New => SinglePass.Language.Properties.Resources.NewItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

namespace SinglePass.WPF.ViewModels.Dialogs
{
[INotifyPropertyChanged]
public partial class MaterialInputBoxViewModel
public partial class MaterialInputBoxViewModel : ObservableObject
{
private static readonly Lazy<MaterialInputBoxViewModel> _lazy = new(() => new MaterialInputBoxViewModel());
public static MaterialInputBoxViewModel DesignTimeInstance => _lazy.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

namespace SinglePass.WPF.ViewModels.Dialogs
{
[INotifyPropertyChanged]
public partial class MaterialMessageBoxViewModel
public partial class MaterialMessageBoxViewModel : ObservableObject
{
#region Design time instance
private static readonly Lazy<MaterialMessageBoxViewModel> _lazyDesignTime = new(CreateDesignTime);
Expand Down
3 changes: 1 addition & 2 deletions SinglePass.WPF/ViewModels/Dialogs/ProcessingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

namespace SinglePass.WPF.ViewModels.Dialogs
{
[INotifyPropertyChanged]
public partial class ProcessingViewModel
public partial class ProcessingViewModel : ObservableObject
{
#region Design time instance
private static readonly Lazy<ProcessingViewModel> _lazy = new(GetDesignTimeVM);
Expand Down
3 changes: 1 addition & 2 deletions SinglePass.WPF/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

namespace SinglePass.WPF.ViewModels
{
[INotifyPropertyChanged]
public partial class MainWindowViewModel
public partial class MainWindowViewModel : ObservableObject
{
#region Design time instance
private static readonly Lazy<MainWindowViewModel> _lazy = new(GetDesignTimeVM);
Expand Down
3 changes: 1 addition & 2 deletions SinglePass.WPF/ViewModels/PasswordsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

namespace SinglePass.WPF.ViewModels
{
[INotifyPropertyChanged]
public partial class PasswordsViewModel
public partial class PasswordsViewModel : ObservableObject
{
#region Design time instance
private static readonly Lazy<PasswordsViewModel> _lazy = new(GetDesignTimeVM);
Expand Down
Loading

0 comments on commit bd13768

Please sign in to comment.