From c6b19120d939299525517a28a73cdf9d7b48f014 Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Tue, 18 Feb 2020 21:48:50 -0800 Subject: [PATCH] Create main window viewmodel. --- .../Agent.Installer.Win.csproj | 9 +- Agent.Installer.Win/App.xaml | 23 +++- .../Assets/Remotely_Icon.png | Bin Agent.Installer.Win/{ => Assets}/favicon.ico | Bin Agent.Installer.Win/FodyWeavers.xml | 3 + Agent.Installer.Win/FodyWeavers.xsd | 111 ++++++++++++++++++ Agent.Installer.Win/MainWindow.xaml | 80 ++++++++++++- Agent.Installer.Win/MainWindow.xaml.cs | 23 +++- .../ViewModels/MainWindowViewModel.cs | 90 +++++++++++++- .../ViewModels/ViewModelBase.cs | 19 +++ ...Icon_Transparent.ico => Remotely_Icon.ico} | Bin Assets/Remotely_Icon.png | Bin 0 -> 4480 bytes Remotely.sln | 3 +- 13 files changed, 352 insertions(+), 9 deletions(-) rename Assets/Remotely_Icon_Transparent.png => Agent.Installer.Win/Assets/Remotely_Icon.png (100%) rename Agent.Installer.Win/{ => Assets}/favicon.ico (100%) create mode 100644 Agent.Installer.Win/FodyWeavers.xml create mode 100644 Agent.Installer.Win/FodyWeavers.xsd create mode 100644 Agent.Installer.Win/ViewModels/ViewModelBase.cs rename Assets/{Remotely_Icon_Transparent.ico => Remotely_Icon.ico} (100%) create mode 100644 Assets/Remotely_Icon.png diff --git a/Agent.Installer.Win/Agent.Installer.Win.csproj b/Agent.Installer.Win/Agent.Installer.Win.csproj index 8ee37629..a0495992 100644 --- a/Agent.Installer.Win/Agent.Installer.Win.csproj +++ b/Agent.Installer.Win/Agent.Installer.Win.csproj @@ -38,7 +38,7 @@ 4 - favicon.ico + Assets\favicon.ico app.manifest @@ -76,6 +76,7 @@ + MSBuild:Compile Designer @@ -118,9 +119,11 @@ - + + + + - diff --git a/Agent.Installer.Win/App.xaml b/Agent.Installer.Win/App.xaml index 724c4c15..4849b39c 100644 --- a/Agent.Installer.Win/App.xaml +++ b/Agent.Installer.Win/App.xaml @@ -4,6 +4,27 @@ xmlns:local="clr-namespace:Remotely.Agent.Installer.Win" StartupUri="MainWindow.xaml"> - + + + diff --git a/Assets/Remotely_Icon_Transparent.png b/Agent.Installer.Win/Assets/Remotely_Icon.png similarity index 100% rename from Assets/Remotely_Icon_Transparent.png rename to Agent.Installer.Win/Assets/Remotely_Icon.png diff --git a/Agent.Installer.Win/favicon.ico b/Agent.Installer.Win/Assets/favicon.ico similarity index 100% rename from Agent.Installer.Win/favicon.ico rename to Agent.Installer.Win/Assets/favicon.ico diff --git a/Agent.Installer.Win/FodyWeavers.xml b/Agent.Installer.Win/FodyWeavers.xml new file mode 100644 index 00000000..5029e706 --- /dev/null +++ b/Agent.Installer.Win/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Agent.Installer.Win/FodyWeavers.xsd b/Agent.Installer.Win/FodyWeavers.xsd new file mode 100644 index 00000000..44a53744 --- /dev/null +++ b/Agent.Installer.Win/FodyWeavers.xsd @@ -0,0 +1,111 @@ + + + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with line breaks. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with |. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/Agent.Installer.Win/MainWindow.xaml b/Agent.Installer.Win/MainWindow.xaml index 65759621..8874c8e5 100644 --- a/Agent.Installer.Win/MainWindow.xaml +++ b/Agent.Installer.Win/MainWindow.xaml @@ -3,10 +3,88 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:ViewModels="clr-namespace:Remotely.Agent.Installer.Win.ViewModels" xmlns:local="clr-namespace:Remotely.Agent.Installer.Win" mc:Ignorable="d" - Title="MainWindow" Height="450" Width="800" Icon="favicon.ico"> + WindowStyle="None" + ResizeMode="NoResize" + MouseLeftButtonDown="Window_MouseLeftButtonDown" + Loaded="Window_Loaded" + Title="Remotely Installer" Height="350" Width="500" Icon="Assets/favicon.ico"> + + + + + + + + + + + + + + + Remotely Installer + + + + diff --git a/Agent.Installer.Win/MainWindow.xaml.cs b/Agent.Installer.Win/MainWindow.xaml.cs index 35eba98e..edc885fc 100644 --- a/Agent.Installer.Win/MainWindow.xaml.cs +++ b/Agent.Installer.Win/MainWindow.xaml.cs @@ -1,4 +1,5 @@ -using System; +using Remotely.Agent.Installer.Win.ViewModels; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -24,5 +25,25 @@ namespace Remotely.Agent.Installer.Win { InitializeComponent(); } + + private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + DragMove(); + } + + private async void Window_Loaded(object sender, RoutedEventArgs e) + { + await (DataContext as MainWindowViewModel).Init(); + } + + private void CloseButton_Click(object sender, RoutedEventArgs e) + { + App.Current.Shutdown(); + } + + private void MinimizeButton_Click(object sender, RoutedEventArgs e) + { + this.WindowState = WindowState.Minimized; + } } } diff --git a/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs b/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs index 7ccd0f95..90a9eb7a 100644 --- a/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs +++ b/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs @@ -9,8 +9,96 @@ using System.Threading.Tasks; namespace Remotely.Agent.Installer.Win.ViewModels { - public class MainWindowViewModel + public class MainWindowViewModel : ViewModelBase { + private string headerMessage = "Install the Remotely service."; + private bool isServiceInstalled; + private bool isServiceMissing = true; + private string subMessage = "Installing the Remotely service will allow remote access by the above service provider."; + private string statusMessage; + private int progress = 50; + + public string HeaderMessage + { + get + { + return headerMessage; + } + set + { + headerMessage = value; + FirePropertyChanged(nameof(HeaderMessage)); + } + } + + + public int Progress + { + get + { + return progress; + } + set + { + progress = value; + FirePropertyChanged(nameof(Progress)); + } + } + + public bool IsServiceInstalled + { + get + { + return isServiceInstalled; + } + set + { + isServiceInstalled = value; + FirePropertyChanged(nameof(IsServiceInstalled)); + } + } + public bool IsServiceMissing + { + get + { + return isServiceMissing; + } + set + { + isServiceMissing = value; + FirePropertyChanged(nameof(IsServiceMissing)); + } + } + public string SubMessage + { + get + { + return subMessage; + } + set + { + subMessage = value; + FirePropertyChanged(nameof(SubMessage)); + } + } + + public string StatusMessage + { + get + { + return statusMessage; + } + set + { + statusMessage = value; + FirePropertyChanged(nameof(StatusMessage)); + } + } + public async Task Init() + { + + } + public InstallerSettings ReadInstallerSettings() { try diff --git a/Agent.Installer.Win/ViewModels/ViewModelBase.cs b/Agent.Installer.Win/ViewModels/ViewModelBase.cs new file mode 100644 index 00000000..a0591ef2 --- /dev/null +++ b/Agent.Installer.Win/ViewModels/ViewModelBase.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Remotely.Agent.Installer.Win.ViewModels +{ + public class ViewModelBase : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + + public void FirePropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/Assets/Remotely_Icon_Transparent.ico b/Assets/Remotely_Icon.ico similarity index 100% rename from Assets/Remotely_Icon_Transparent.ico rename to Assets/Remotely_Icon.ico diff --git a/Assets/Remotely_Icon.png b/Assets/Remotely_Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..987309020b03df48f3234728cfbac5073788fb3b GIT binary patch literal 4480 zcmeHK3s)1@7LI{P0|GTd;sZei!Yc+4ksv5lR9-R28+01N!`dn!GhjtQYCuID1W8n4 zO`#NdDBh4@)ub9pz)>Co_IBB+LMsdb+9C*eBNP?x$-Vs*ZD*~SoVCwB`@Ht|eLH7% z@q)}vmz$DEB=eBqZIL9>0-53czzA68-DvgT$9UhCom)sGMXA}lBnpXSMB2rT-VW?5 z&rgEyKhHlW@HaexxA2+A04SvFNM6+Z-}@m&O`AA^6rg4XCuEUG7A=N%fwgn!abR4U zy*)lV>fk5Yhm(-Kq|BtxGP2njd$U)qXM3`}Q-k6G<188u*|sG*hd=h?*zFa*%eEyc z=TY0Xjm>ZfmDwvgu&_K@pr{U&Jy$EM$>_>f=!kl*$Su_4Sp+j~h~KwMh*iL{ zd;EaREmUT%Xml9^xHs@*->H?AWb|W8)zs0av!!WOP)siDN1?y1K!)@LLgT)1#Fwz^ zG{i?WkasTZL!q14W~txniTyOL#f6R-1;Zyw0PB45yNT{>rdAh>oP#|n^rHPk*Ksu0 zMb24YHrmz5z(oS2K3=w8t-MG^Q@m8aygdrLP??WJ2Tp{!$Y;LZE!(YDipi*DEuz-z ziBKAMvvYYvq&X_3_o@2a&7gnAZAWx@t#LU5&*T$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