Skip to content

Commit

Permalink
Update Libs and UI Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Feb 18, 2021
1 parent d3dae12 commit 01e9f21
Show file tree
Hide file tree
Showing 21 changed files with 272 additions and 309 deletions.
1 change: 1 addition & 0 deletions HandyUpdater/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ResourceDictionary.MergedDictionaries>
<mu:ThemeResources/>
<mu:XamlControlsResources/>
<hc:ThemeResources/>
<hc:Theme/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Expand Down
8 changes: 4 additions & 4 deletions HandyUpdater/HandyUpdater.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
Expand All @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HandyControls" Version="3.0.0" />
<PackageReference Include="ModernWpfUis" Version="1.0.0" />
<PackageReference Include="Downloader" Version="2.0.1" />
<PackageReference Include="HandyControls" Version="3.1.1" />
<PackageReference Include="ModernWpfUis" Version="1.2.0" />
<PackageReference Include="Downloader" Version="2.1.2" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion HandyUpdater/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void DownloadService_DownloadFileCompleted(object sender, AsyncCompleted
private void DownloadService_DownloadProgressChanged(object sender, Downloader.DownloadProgressChangedEventArgs e)
{
prgStatus.Value = e.ProgressPercentage;
txtStatus.Text = $"Downloaded {ConvertBytesToMegabytes(e.BytesReceived):N2} MB of {ConvertBytesToMegabytes(e.TotalBytesToReceive):N2} MB - {(int)e.ProgressPercentage} %";
txtStatus.Text = $"Downloaded {ConvertBytesToMegabytes(e.ReceivedBytesSize):N2} MB of {ConvertBytesToMegabytes(e.TotalBytesToReceive):N2} MB - {(int)e.ProgressPercentage} %";
}

double ConvertBytesToMegabytes(long bytes)
Expand Down
134 changes: 121 additions & 13 deletions HandyWinGet/App.xaml

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions HandyWinGet/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using HandyControl.Controls;
using HandyControl.Data;
using HandyControl.Themes;
using HandyControl.Tools;
using HandyWinGet.Data;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Analytics;
using Microsoft.AppCenter.Crashes;
using ModernWpf;
using System;
using System.IO;
using System.Runtime;
using System.Windows;
using ApplicationTheme = HandyControl.Themes.ApplicationTheme;

namespace HandyWinGet
{
Expand All @@ -35,9 +32,9 @@ protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
GlobalDataHelper<AppConfig>.Init($"{AppDomain.CurrentDomain.BaseDirectory}AppConfig.json");
if (GlobalDataHelper<AppConfig>.Config.Skin != SkinType.Default)
if (GlobalDataHelper<AppConfig>.Config.Theme != ApplicationTheme.Light)
{
UpdateSkin(GlobalDataHelper<AppConfig>.Config.Skin);
UpdateSkin(GlobalDataHelper<AppConfig>.Config.Theme);
}

var boot = new Bootstrapper();
Expand All @@ -47,14 +44,11 @@ protected override void OnStartup(StartupEventArgs e)
typeof(Analytics), typeof(Crashes));
}

public void UpdateSkin(SkinType skin)
public void UpdateSkin(ApplicationTheme theme)
{
SharedResourceDictionary.SharedDictionaries.Clear();
ResourceHelper.GetTheme("hcTheme", Resources).Skin = skin;
HandyControl.Themes.ThemeManager.Current.ApplicationTheme = theme;

ThemeManager.Current.ApplicationTheme = skin == SkinType.Dark ? ApplicationTheme.Dark : ApplicationTheme.Light;

Current.MainWindow?.OnApplyTemplate();
ModernWpf.ThemeManager.Current.ApplicationTheme = theme == ApplicationTheme.Dark ? ModernWpf.ApplicationTheme.Dark : ModernWpf.ApplicationTheme.Light;
}
}
}
3 changes: 2 additions & 1 deletion HandyWinGet/Data/AppConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using HandyControl.Controls;
using HandyControl.Data;
using HandyControl.Themes;
using ModernWpf.Controls;
using System;

Expand All @@ -14,6 +15,6 @@ internal class AppConfig : GlobalDataHelper<AppConfig>
public NavigationViewPaneDisplayMode PaneDisplayMode { get; set; } = NavigationViewPaneDisplayMode.Left;
public InstallMode InstallMode { get; set; } = InstallMode.Wingetcli;
public IdentifyPackageMode IdentifyPackageMode { get; set; } = IdentifyPackageMode.Off;
public SkinType Skin { get; set; } = SkinType.Default;
public ApplicationTheme Theme { get; set; } = ApplicationTheme.Light;
}
}
151 changes: 0 additions & 151 deletions HandyWinGet/Data/CollectionViewExtension.cs

This file was deleted.

3 changes: 2 additions & 1 deletion HandyWinGet/Data/IdentifyPackageMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ namespace HandyWinGet.Data
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum IdentifyPackageMode
{
[Description("Off (Fast)")] Off,
[Description("Off (Fast)")]
Off,

[Description("Internal Method (Normal)")]
Internal,
Expand Down
3 changes: 2 additions & 1 deletion HandyWinGet/Data/InstallMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ namespace HandyWinGet.Data
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum InstallMode
{
[Description("Winget-cli")] Wingetcli,
[Description("Winget-cli")]
Wingetcli,

[Description("Internal (Manual installation)")]
Internal
Expand Down
18 changes: 0 additions & 18 deletions HandyWinGet/Data/ItemEqualityComparer.cs

This file was deleted.

Binary file modified HandyWinGet/HandyUpdater.dll
Binary file not shown.
Binary file modified HandyWinGet/HandyUpdater.exe
Binary file not shown.
27 changes: 9 additions & 18 deletions HandyWinGet/HandyWinGet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
<FileVersion>2.1.0.0</FileVersion>
<Version>2.1.0</Version>
<AssemblyVersion>2.2.0.0</AssemblyVersion>
<FileVersion>2.2.0.0</FileVersion>
<Version>2.2.0</Version>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<DebugType>embedded</DebugType>
<ApplicationIcon>icon.ico</ApplicationIcon>
Expand All @@ -15,22 +15,13 @@
</PropertyGroup>

<ItemGroup>
<Page Include="Properties\DesignTimeResources.xaml"
Condition="'$(DesignTime)'=='true' OR ('$(SolutionPath)'!='' AND Exists('$(SolutionPath)') AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true')">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<ContainsDesignTimeResources>true</ContainsDesignTimeResources>
</Page>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Downloader" Version="2.0.4" />
<PackageReference Include="HandyControls" Version="3.0.0" />
<PackageReference Include="ModernWpfUis" Version="1.0.0" />
<PackageReference Include="Downloader" Version="2.1.2" />
<PackageReference Include="HandyControls" Version="3.1.1" />
<PackageReference Include="ModernWpfUis" Version="1.2.0" />
<PackageReference Include="Prism.DryIoc" Version="8.0.0.1909" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.0.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.0.0" />
<PackageReference Include="YamlDotNet" Version="9.1.0" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.1.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.1.0" />
<PackageReference Include="YamlDotNet" Version="9.1.4" />
</ItemGroup>
<ItemGroup>
<None Update="HandyUpdater.dll">
Expand Down
5 changes: 3 additions & 2 deletions HandyWinGet/Properties/DesignTimeResources.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:hc="https://handyorg.github.io/handycontrol">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/HandyControl;Component/Themes/Theme.xaml" />
<hc:IntellisenseResources Source="/HandyControl;Component/DesignTime/DesignTimeResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
2 changes: 1 addition & 1 deletion HandyWinGet/ViewModels/CreatePackageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ private void OnDownloadFileCompleted(object sender, AsyncCompletedEventArgs e)

private void OnDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
var bytesIn = double.Parse(e.BytesReceived.ToString());
var bytesIn = double.Parse(e.ReceivedBytesSize.ToString());
var totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
var percentage = bytesIn / totalBytes * 100;
Progress = int.Parse(Math.Truncate(percentage).ToString());
Expand Down
15 changes: 0 additions & 15 deletions HandyWinGet/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public NavigationViewPaneDisplayMode PaneDisplayMode
public DelegateCommand<NavigationViewSelectionChangedEventArgs> SwitchCommand =>
_switchCommand ??= new DelegateCommand<NavigationViewSelectionChangedEventArgs>(Switch);

private DelegateCommand<string> _openTerminalCommand;
public DelegateCommand<string> OpenTerminalCommand =>
_openTerminalCommand ??= new DelegateCommand<string>(OpenTerminal);
public MainWindowViewModel(IRegionManager regionManager)
{
Instance = this;
Expand All @@ -42,17 +39,5 @@ private void Switch(NavigationViewSelectionChangedEventArgs e)
}
}
}
private void OpenTerminal(string param)
{
switch (param)
{
case "PowerShell":
System.Diagnostics.Process.Start("powershell.exe");
break;
case "Cmd":
System.Diagnostics.Process.Start("cmd.exe");
break;
}
}
}
}
Loading

0 comments on commit 01e9f21

Please sign in to comment.