Skip to content

Commit

Permalink
New logo and Container to MainWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
STY1001 committed Apr 30, 2023
1 parent 4cecc0e commit fc64a92
Show file tree
Hide file tree
Showing 18 changed files with 703 additions and 89 deletions.
18 changes: 9 additions & 9 deletions Unowhy Tools WPF/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Unowhy_Tools;
using Unowhy_Tools_WPF.Models;
using Unowhy_Tools_WPF.Services;
using Unowhy_Tools_WPF.Services.Contracts;
using Unowhy_Tools_WPF.ViewModels;
using Unowhy_Tools_WPF.Views;
using Wpf.Ui.Mvvm.Contracts;
using Wpf.Ui.Mvvm.Services;

using Unowhy_Tools;
using System;

namespace Unowhy_Tools_WPF;

/// <summary>
Expand All @@ -38,12 +35,10 @@ public partial class App
services.AddSingleton<ITaskBarService, TaskBarService>();
services.AddSingleton<ISnackbarService, SnackbarService>();
services.AddSingleton<IDialogService, DialogService>();
services.AddSingleton<INotifyIconService, CustomNotifyIconService>();
services.AddSingleton<IPageService, PageService>();
services.AddSingleton<ITestWindowService, TestWindowService>();
services.AddSingleton<INavigationService, NavigationService>();
services.AddScoped<INavigationWindow, Views.Container>();
services.AddScoped<ContainerViewModel>();
services.AddScoped<INavigationWindow, MainWindow>();
services.AddScoped<Views.Pages.Dashboard>();
services.AddScoped<DashboardViewModel>();
services.AddScoped<Views.Pages.About>();
Expand All @@ -65,7 +60,7 @@ public partial class App
services.AddScoped<Views.Pages.Updater>();
services.AddScoped<Views.Pages.Wifi>();
services.AddScoped<Views.Pages.FirstConfig>();
services.Configure<AppConfig>(context.Configuration.GetSection(nameof(AppConfig)));
services.AddScoped<TrayWindow>();
services.AddScoped<UT>();
}).Build();

Expand All @@ -89,10 +84,15 @@ private async void OnStartup(object sender, StartupEventArgs e)

if (e.Args.Length > 0)
{
if (e.Args[0] == "-u")
if (e.Args[0] == "-user")
{
UTdata.UserID = e.Args[1];
}
else
{
string user = await UT.RunReturn("whoami", "");
UTdata.UserID = UT.GetLine(user, 1);
}
}
else
{
Expand Down
Binary file added Unowhy Tools WPF/Resources/micro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions Unowhy Tools WPF/Services/ApplicationHostService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ public class ApplicationHostService : IHostedService

private INavigationWindow _navigationWindow;

public ApplicationHostService(IServiceProvider serviceProvider, INavigationService navigationService,
IPageService pageService, IThemeService themeService,
ITaskBarService taskBarService)
public ApplicationHostService(IServiceProvider serviceProvider, INavigationService navigationService, IPageService pageService, IThemeService themeService, ITaskBarService taskBarService)
{
// If you want, you can do something with these services at the beginning of loading the application.
_serviceProvider = serviceProvider;
Expand Down Expand Up @@ -61,7 +59,7 @@ private async Task HandleActivationAsync()
{
await Task.CompletedTask;

if (!Application.Current.Windows.OfType<Container>().Any())
if (!Application.Current.Windows.OfType<MainWindow>().Any())
{
_navigationWindow = _serviceProvider.GetService(typeof(INavigationWindow)) as INavigationWindow;
_navigationWindow!.ShowWindow();
Expand All @@ -72,15 +70,15 @@ private async Task HandleActivationAsync()
// NOTICE: In the case of this window, we navigate to the Dashboard after loading with Container.InitializeUi()
// _navigationWindow.Navigate(typeof(Views.Pages.Dashboard));
}

/*
var notifyIconManager = _serviceProvider.GetService(typeof(INotifyIconService)) as INotifyIconService;
if (!notifyIconManager!.IsRegistered)
{
notifyIconManager!.SetParentWindow(_navigationWindow as Window);
notifyIconManager.Register();
}

*/
await Task.CompletedTask;
}

Expand Down
14 changes: 12 additions & 2 deletions Unowhy Tools WPF/Unowhy Tools WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<None Remove="Resources\azure.png" />
<None Remove="Resources\back.png" />
<None Remove="Resources\boot.png" />
<None Remove="Resources\camera.png" />
<None Remove="Resources\clouddl.png" />
<None Remove="Resources\cmd.png" />
<None Remove="Resources\code.png" />
Expand Down Expand Up @@ -71,6 +72,7 @@
<None Remove="Resources\laptop.png" />
<None Remove="Resources\manufacturer.png" />
<None Remove="Resources\master_chief.jpg" />
<None Remove="Resources\micro.png" />
<None Remove="Resources\microsoft-icon-store.png" />
<None Remove="Resources\microsoft-shell-accessibility.ico" />
<None Remove="Resources\microsoft-shell-colors.ico" />
Expand Down Expand Up @@ -115,7 +117,7 @@
<None Remove="Resources\UTB.png" />
<None Remove="Resources\UTI.png" />
<None Remove="Resources\UTL.png" />
<None Remove="Resources\UTLogoWhite2.0.png" />
<None Remove="Resources\UTLogoWhite3.0.png" />
<None Remove="Resources\UTPE.png" />
<None Remove="Resources\UTS.png" />
<None Remove="Resources\UTU.png" />
Expand Down Expand Up @@ -147,6 +149,12 @@
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Management">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8.1\System.Management.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<Resource Include="Resources\about.png" />
<Resource Include="Resources\adduser.png" />
Expand All @@ -156,6 +164,7 @@
<Resource Include="Resources\azure.png" />
<Resource Include="Resources\back.png" />
<Resource Include="Resources\boot.png" />
<Resource Include="Resources\camera.png" />
<Resource Include="Resources\clouddl.png" />
<Resource Include="Resources\cmd.png" />
<Resource Include="Resources\code.png" />
Expand Down Expand Up @@ -194,6 +203,7 @@
<Resource Include="Resources\laptop.png" />
<Resource Include="Resources\manufacturer.png" />
<Resource Include="Resources\master_chief.jpg" />
<Resource Include="Resources\micro.png" />
<Resource Include="Resources\microsoft-icon-store.png" />
<Resource Include="Resources\microsoft-shell-accessibility.ico" />
<Resource Include="Resources\microsoft-shell-colors.ico" />
Expand Down Expand Up @@ -240,7 +250,7 @@
<Resource Include="Resources\UTB.png" />
<Resource Include="Resources\UTI.png" />
<Resource Include="Resources\UTL.png" />
<Resource Include="Resources\UTLogoWhite2.0.png" />
<Resource Include="Resources\UTLogoWhite3.0.png" />
<Resource Include="Resources\UTPE.png" />
<Resource Include="Resources\UTS.png" />
<Resource Include="Resources\UTU.png" />
Expand Down
6 changes: 1 addition & 5 deletions Unowhy Tools WPF/ViewModels/DashboardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Wpf.Ui.Common.Interfaces;
using Unowhy_Tools_WPF.Services.Contracts;
using Wpf.Ui.Mvvm.Contracts;
using System.Threading.Tasks;
using Wpf.Ui.Controls;
Expand All @@ -14,8 +13,6 @@ public class DashboardViewModel : ObservableObject, INavigationAware
{
private readonly INavigationService _navigationService;

private readonly ITestWindowService _testWindowService;

private ICommand _navigateCommand;

private ICommand _openWindowCommand;
Expand All @@ -24,10 +21,9 @@ public class DashboardViewModel : ObservableObject, INavigationAware

public ICommand OpenWindowCommand => _openWindowCommand ??= new RelayCommand<string>(OnOpenWindow);

public DashboardViewModel(INavigationService navigationService, ITestWindowService testWindowService)
public DashboardViewModel(INavigationService navigationService)
{
_navigationService = navigationService;
_testWindowService = testWindowService;
}

public void OnNavigatedTo()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ui:UiWindow x:Class="Unowhy_Tools_WPF.Views.Container"
<ui:UiWindow x:Class="Unowhy_Tools_WPF.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand Down Expand Up @@ -219,7 +219,7 @@
x:Name="SB1"
Panel.ZIndex="0">
<Grid MinWidth="440"
MinHeight="243" />
MinHeight="229" />
</Border>
<Border Background="Transparent"
BorderThickness="1"
Expand All @@ -230,7 +230,7 @@
x:Name="SB2"
Panel.ZIndex="0">
<Grid MinWidth="440"
MinHeight="243" />
MinHeight="233" />
</Border>
<Border Background="#0affffff"
CornerRadius="8,8,8,8"
Expand Down Expand Up @@ -261,7 +261,7 @@
<Image Grid.Row="0"
x:Name="SplashImg"
RenderOptions.BitmapScalingMode="HighQuality"
Source="pack://application:,,,/Resources/UTLogoWhite2.0.png" />
Source="pack://application:,,,/Resources/UTLogoWhite3.0.png" />
</Grid>
<Grid Grid.Column="1"
Grid.Row="2">
Expand Down Expand Up @@ -359,36 +359,6 @@
ShowClose="True"
ShowMaximize="True"
ShowMinimize="True"
UseSnapLayout="True">
<ui:TitleBar.Tray>
<ui:NotifyIcon FocusOnLeftClick="True"
Visibility="Collapsed"
Icon="pack://application:,,,/Resources/UT.png"
MenuOnRightClick="True"
TooltipText="Unowhy Tools XAML Tray">
<ui:NotifyIcon.Menu>
<ContextMenu>
<ui:MenuItem Click="TrayMenuItem_OnClick"
Header="Home"
SymbolIcon="Library28"
Tag="home" />
<ui:MenuItem Click="TrayMenuItem_OnClick"
Header="Save"
SymbolIcon="Save24"
Tag="save" />
<ui:MenuItem Click="TrayMenuItem_OnClick"
Header="Open"
SymbolIcon="Folder28"
Tag="open" />
<Separator />
<ui:MenuItem Click="TrayMenuItem_OnClick"
Header="Reload"
SymbolIcon="ArrowClockwise24"
Tag="reload" />
</ContextMenu>
</ui:NotifyIcon.Menu>
</ui:NotifyIcon>
</ui:TitleBar.Tray>
</ui:TitleBar>
UseSnapLayout="True" />
</Grid>
</ui:UiWindow>
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,18 @@
using Wpf.Ui.Controls.Interfaces;
using Unowhy_Tools_WPF.ViewModels;
using Wpf.Ui.Mvvm.Contracts;
using Wpf.Ui.TaskBar;
using Unowhy_Tools_WPF.Services;

using Unowhy_Tools;
using Wpf.Ui.Mvvm.Interfaces;
using Wpf.Ui.Mvvm.Services;
using Unowhy_Tools_WPF.Views.Pages;
using System.Windows.Controls.Primitives;
using Unowhy_Tools_WPF.Views.Windows;
using System.Windows.Forms;
using System.Windows.Media.Imaging;
using System.Windows.Media.Animation;
using System.Windows.Media;
using System.Windows.Navigation;
using System.Xml.Linq;

namespace Unowhy_Tools_WPF.Views;

/// <summary>
/// Interaction logic for Container.xaml
/// </summary>
public partial class Container : INavigationWindow
public partial class MainWindow : INavigationWindow
{
UT.Data UTdata = new UT.Data();
private bool _initialized = false;
Expand All @@ -41,11 +31,6 @@ public partial class Container : INavigationWindow

private readonly IDialogService _dialogService;

public ContainerViewModel ViewModel
{
get;
}

public void applylang()
{
home.Content = UT.GetLang("titlehome");
Expand All @@ -66,9 +51,8 @@ public void applylang()
pcinfo.Content = UT.GetLang("titlepci");
}

public Container(ContainerViewModel viewModel, INavigationService navigationService, IPageService pageService, IThemeService themeService, ITaskBarService taskBarService, ISnackbarService snackbarService, IDialogService dialogService)
public MainWindow(INavigationService navigationService, IPageService pageService, IThemeService themeService, ITaskBarService taskBarService, ISnackbarService snackbarService, IDialogService dialogService)
{
ViewModel = viewModel;
DataContext = this;
_themeService = themeService;
_taskBarService = taskBarService;
Expand Down Expand Up @@ -302,7 +286,7 @@ private async Task Load()
RootWelcomeGrid.RenderTransform = trans;
trans.BeginAnimation(TranslateTransform.XProperty, anim);

UT.RunAdmin($"-u {UTdata.UserID}");
UT.RunAdmin($"-user {UTdata.UserID}");
}
else
{
Expand Down Expand Up @@ -360,12 +344,12 @@ private async Task Load()
animsb = new DoubleAnimation();
animsb.From = 20;
animsb.To = 0;
animsb.Duration = TimeSpan.FromMilliseconds(500);
animsb.Duration = TimeSpan.FromMilliseconds(1000);
animsb.EasingFunction = new PowerEase() { EasingMode = EasingMode.EaseOut, Power = 5 };
animsb2 = new DoubleAnimation();
animsb2.From = -20;
animsb2.To = 0;
animsb2.Duration = TimeSpan.FromMilliseconds(500);
animsb2.Duration = TimeSpan.FromMilliseconds(1000);
animsb2.EasingFunction = new PowerEase() { EasingMode = EasingMode.EaseOut, Power = 5 };
transsb = new TranslateTransform();
transsb2 = new TranslateTransform();
Expand Down
2 changes: 1 addition & 1 deletion Unowhy Tools WPF/Views/Pages/AddUser.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
Grid.ColumnSpan="3"
Text="Local Admin: "
Foreground="#ffffff" />
<CheckBox x:Name="acheck"
<ui:ToggleSwitch x:Name="acheck"
Grid.Row="2"
Grid.Column="2"
Content=""
Expand Down
2 changes: 1 addition & 1 deletion Unowhy Tools WPF/Views/Pages/DebugPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
Click="Button_Click_1" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ui:Button Content="Metro Test"
<ui:Button Content="Launch Tray"
Click="Button_Click_2" />
</StackPanel>
</StackPanel>
Expand Down
Loading

0 comments on commit fc64a92

Please sign in to comment.