Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
WereDev committed Jul 20, 2019
2 parents 1f3260f + 0d70b59 commit e5c2f80
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 65 deletions.
2 changes: 1 addition & 1 deletion AdvancedInstaller/wu10man.aip
Expand Up @@ -19,7 +19,7 @@
<ROW Property="ProductCode" Value="1033:{ABB62A39-7068-4931-84D9-8BFC9FDD3CB7} " Type="16"/>
<ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="Wu10Man"/>
<ROW Property="ProductVersion" Value="3.0.0.0" Type="32" TargetFile="Wu10Man.exe"/>
<ROW Property="ProductVersion" Value="3.0.1.0" Type="32" TargetFile="Wu10Man.exe"/>
<ROW Property="REBOOT" MultiBuildValue="DefaultBuild:ReallySuppress"/>
<ROW Property="RUNAPPLICATION" Value="1" Type="4"/>
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND"/>
Expand Down
16 changes: 13 additions & 3 deletions Wu10Man/Editors/ServiceEditor.cs
@@ -1,8 +1,9 @@
using System;
using System.ComponentModel;
using System.Management;
using System.Security.Principal;
using System.ServiceProcess;


namespace WereDev.Utils.Wu10Man.Editors
{
internal class ServiceEditor : IDisposable
Expand Down Expand Up @@ -63,8 +64,17 @@ public bool EnableService()
}

public bool IsServiceEnabled()
{
return _serviceController.StartType != ServiceStartMode.Disabled;
{
try
{
return _serviceController.StartType != ServiceStartMode.Disabled;
}
catch (Win32Exception)
{
// Some .Net version seem to throw an exception at this point, but it is
// sort of a .Net thing because of file renames, so I can assume false.
return false;
}
}

public bool IsServiceRunAsLocalSystem()
Expand Down
4 changes: 2 additions & 2 deletions Wu10Man/Properties/AssemblyInfo.cs
Expand Up @@ -50,7 +50,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyVersion("3.0.1.0")]
[assembly: AssemblyFileVersion("3.0.1.0")]
[assembly: NeutralResourcesLanguage("en-US")]

10 changes: 5 additions & 5 deletions Wu10Man/UserControls/GroupPolicyControl.xaml
Expand Up @@ -5,11 +5,11 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
d:DesignHeight="363"
d:DesignWidth="578">
<Grid>
d:DesignHeight="353"
d:DesignWidth="558">
<Grid Background="LightGray">
<Label Content="Windows Update Group Policy" HorizontalAlignment="Center" VerticalAlignment="Top" ClipToBounds="True" FontSize="14" FontWeight="Bold"/>
<Grid Width="289" HorizontalAlignment="Left" Margin="0, 30, 0, 0">
<Grid Width="276" HorizontalAlignment="Left" Margin="5, 30, 5, 5" Background="#EEEEEE">
<Label>
<Label.Content>
<StackPanel>
Expand All @@ -33,7 +33,7 @@
</Label.Content>
</Label>
</Grid>
<Grid Width="289" HorizontalAlignment="Right" Margin="0, 30, 0, 0">
<Grid Width="276" HorizontalAlignment="Right" Margin="5, 30, 5, 5" Background="#EEEEEE">
<ComboBox x:Name="cmbGroupPolicies" HorizontalAlignment="Center" Margin="0,20,0,0" VerticalAlignment="Top" Width="240"
ItemsSource="{Binding PolicyOptions}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedItem="{Binding SelectedPolicyOption}" SelectionChanged="GroupPoliciesSelectionChanged" />
<Button x:Name="btnSetGroupPolicy" Content="Update Policy" HorizontalAlignment="Center" Margin="0,117,0,0" VerticalAlignment="Top" Width="99" Click="SetGroupPolicy"/>
Expand Down
46 changes: 33 additions & 13 deletions Wu10Man/UserControls/HostsFileControl.xaml
Expand Up @@ -5,15 +5,15 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wpfspark="clr-namespace:WPFSpark;assembly=WPFSpark"
mc:Ignorable="d"
d:DesignHeight="363"
d:DesignWidth="578">
<Grid>
d:DesignHeight="353"
d:DesignWidth="558">
<Grid Background="LightGray">
<Label Content="Windows Hosts File" HorizontalAlignment="Center" VerticalAlignment="Top" ClipToBounds="True" FontSize="14" FontWeight="Bold"/>
<Grid Width="289" HorizontalAlignment="Left" Margin="0, 30, 0, 0">
<Grid Width="276" HorizontalAlignment="Left" Margin="5, 30, 5, 5" Background="#EEEEEE">
<Label>
<Label.Content>
<StackPanel>
<TextBlock Width="270" TextWrapping="Wrap">
<TextBlock Margin="0" TextWrapping="Wrap">
Using the Windows Hosts file, you can specify to
which IP Address a Domain Name is routed to. The
default list of Domain Names are those associated
Expand All @@ -26,17 +26,37 @@
</Label.Content>
</Label>
</Grid>
<Grid Width="289" HorizontalAlignment="Right" Margin="0, 30, 0, 0">
<ListBox Height="290" Margin="0,0,0,0" VerticalAlignment="Top" Name="HostsListBox" ItemsSource="{Binding Path=HostStatus}" BorderThickness="0" Background="Transparent" HorizontalAlignment="Center" Width="280">
<ListBox.ItemTemplate>
<Grid Width="276" HorizontalAlignment="Right" Margin="5, 30, 5, 5" Background="#EEEEEE">
<ListView Height="290" Margin="0,0,0,0" VerticalAlignment="Top" Name="HostsListBox" ItemsSource="{Binding Path=HostStatus}" BorderThickness="0" Background="Transparent" HorizontalAlignment="Center" Width="280">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path= ServiceExists}" Value="False">
<Setter Property="Border.Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
<Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="34" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<ContentPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="30">
<Label Content="{Binding Host}" Width="190" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<wpfspark:ToggleSwitch IsChecked="{Binding IsActive}" CheckedToolTip="Access to host allowed." UncheckedToolTip="Access to host blocked." Width="40" Height="20" MinWidth="40" MinHeight="20" HorizontalAlignment="Right" VerticalAlignment="Center" Click="ToggleHostItem" />
<StackPanel Orientation="Horizontal" Margin="5">
<Label Content="{Binding Host}" Width="210" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<wpfspark:ToggleSwitch IsChecked="{Binding IsActive}" CheckedToolTip="Access to host allowed." UncheckedToolTip="Access to host blocked."
Width="40" Height="20" MinWidth="40" MinHeight="20" HorizontalAlignment="Right" VerticalAlignment="Center" Click="ToggleHostItem"
AccentMode="User" AccentBrush="#7fba00"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ListView.ItemTemplate>
</ListView>
<Button x:Name="UnblockAllHosts" Content="Unblock All Hosts" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10" Width="125" Click="UnblockAllHosts_Click"/>
<Button x:Name="BlockAllHosts" Content="Block All Hosts" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Width="125" Click="BlockAllHosts_Click"/>
</Grid>
Expand Down
11 changes: 5 additions & 6 deletions Wu10Man/UserControls/PauseUpdatesControl.xaml
Expand Up @@ -4,12 +4,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"

d:DesignHeight="363"
d:DesignWidth="578">
<Grid>
d:DesignHeight="353"
d:DesignWidth="558">
<Grid Background="LightGray">
<Label Content="Windows Update Pause and Defer" HorizontalAlignment="Center" VerticalAlignment="Top" ClipToBounds="True" FontSize="14" FontWeight="Bold"/>
<Grid Width="289" HorizontalAlignment="Left" Margin="0, 30, 0, 0">
<Grid Width="276" HorizontalAlignment="Left" Margin="5, 30, 5, 5" Background="#EEEEEE">
<Label>
<Label.Content>
<StackPanel>
Expand Down Expand Up @@ -42,7 +41,7 @@
</Label.Content>
</Label>
</Grid>
<Grid Width="289" HorizontalAlignment="Right" Margin="0, 30, 0, 0">
<Grid Width="276" HorizontalAlignment="Right" Margin="5, 30, 5, 5" Background="#EEEEEE">
<StackPanel>
<Label HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Top" Width="240" Content="Feature Updates" FontWeight="Bold" />
<Label HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Top" Width="240" Content="Pause updates until:"/>
Expand Down
45 changes: 32 additions & 13 deletions Wu10Man/UserControls/WindowsServicesControl.xaml
Expand Up @@ -5,15 +5,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wpfspark="clr-namespace:WPFSpark;assembly=WPFSpark"
mc:Ignorable="d"
d:DesignHeight="363"
d:DesignWidth="578"
>
d:DesignHeight="353"
d:DesignWidth="558">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"></BooleanToVisibilityConverter>
</UserControl.Resources>
<Grid>
<Grid Background="LightGray">
<Label Content="Windows Services" HorizontalAlignment="Center" VerticalAlignment="Top" ClipToBounds="True" FontSize="14" FontWeight="Bold"/>
<Grid Width="289" HorizontalAlignment="Left" Margin="0, 30, 0, 0">
<Grid Width="276" HorizontalAlignment="Left" Margin="5, 30, 5, 5" Background="#EEEEEE">
<Label>
<Label.Content>
<StackPanel>
Expand Down Expand Up @@ -48,17 +47,37 @@
</Label.Content>
</Label>
</Grid>
<Grid Width="289" HorizontalAlignment="Right" Margin="0, 30, 0, 0">
<ListBox Height="275" Margin="0,0,0,0" VerticalAlignment="Top" Name="ServicesListBox" ItemsSource="{Binding Path=Services}" BorderThickness="0" Background="Transparent" HorizontalAlignment="Center" Width="280">
<ListBox.ItemTemplate>
<Grid Width="276" HorizontalAlignment="Right" Margin="5, 30, 5, 5" Background="#EEEEEE">
<ListView Height="289" Margin="0,0,0,0" VerticalAlignment="Top" Name="ServicesListBox" ItemsSource="{Binding Path=Services}" BorderThickness="0" Background="Transparent" HorizontalAlignment="Center" Width="280">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path= ServiceExists}" Value="False">
<Setter Property="Border.Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
<Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="34" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<ContentPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="30" Visibility="{Binding Path=ServiceExists, Converter={StaticResource ResourceKey=BoolToVisibilityConverter}}">
<Label Content="{Binding DisplayName}" Width="190" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<wpfspark:ToggleSwitch IsChecked="{Binding IsServiceEnabled}" CheckedToolTip="Service enabled." UncheckedToolTip="Service disabled." Width="40" Height="20" MinWidth="40" MinHeight="20" HorizontalAlignment="Right" VerticalAlignment="Center" Click="ToggleService" />
<StackPanel Orientation="Horizontal" Margin="5">
<Label Content="{Binding DisplayName}" Width="210" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<wpfspark:ToggleSwitch IsChecked="{Binding IsServiceEnabled}" CheckedToolTip="Service enabled." UncheckedToolTip="Service disabled."
Width="40" Height="20" MinWidth="40" MinHeight="20" HorizontalAlignment="Right" VerticalAlignment="Center"
Click="ToggleService" AccentMode="User" AccentBrush="#f25022"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Grid>
</UserControl>
18 changes: 5 additions & 13 deletions Wu10Man/UserControls/WindowsServicesControl.xaml.cs
@@ -1,5 +1,4 @@
using System;
using System.ComponentModel;
using System.ComponentModel;
using System.Linq;
using System.Windows.Controls;
using WereDev.Utils.Wu10Man.Helpers;
Expand Down Expand Up @@ -46,18 +45,11 @@ private void BuildServiceStatus()
private void SetServiceStatus(string serviceName)
{
var serviceModel = _model.Services.Single(x => x.ServiceName == serviceName);
try
serviceModel.ServiceExists = _windowsServiceHelper.ServiceExists(serviceName);
if (serviceModel.ServiceExists)
{
serviceModel.ServiceExists = _windowsServiceHelper.ServiceExists(serviceName);
if (serviceModel.ServiceExists)
{
serviceModel.DisplayName = _windowsServiceHelper.GetServiceDisplayName(serviceName);
serviceModel.IsServiceEnabled = _windowsServiceHelper.IsServiceEnabled(serviceName);
}
}
catch (Exception ex)
{
Wu10Logger.LogError(ex);
serviceModel.DisplayName = _windowsServiceHelper.GetServiceDisplayName(serviceName);
serviceModel.IsServiceEnabled = _windowsServiceHelper.IsServiceEnabled(serviceName);
}
}

Expand Down
16 changes: 8 additions & 8 deletions Wu10Man/UserWindows/MainWindow.xaml
Expand Up @@ -32,23 +32,23 @@
<Grid Margin="0,20,0,0">
<TabControl HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" >
<TabItem Header="Windows Services">
<Grid Background="#FFE5E5E5">
<usercontrols:WindowsServicesControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
<Grid Background="#f25022">
<usercontrols:WindowsServicesControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="5" />
</Grid>
</TabItem>
<TabItem Header="Hosts File">
<Grid Background="#FFE5E5E5">
<usercontrols:HostsFileControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
<Grid Background="#7fba00">
<usercontrols:HostsFileControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="5" />
</Grid>
</TabItem>
<TabItem Header="Pause Updates">
<Grid Background="#FFE5E5E5">
<usercontrols:PauseUpdatesControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
<Grid Background="#01a4ef">
<usercontrols:PauseUpdatesControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="5" />
</Grid>
</TabItem>
<TabItem Header="Group Policy">
<Grid Background="#FFE5E5E5">
<usercontrols:GroupPolicyControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
<Grid Background="#ffb901">
<usercontrols:GroupPolicyControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="5" />
</Grid>
</TabItem>
</TabControl>
Expand Down
2 changes: 1 addition & 1 deletion Wu10Man/Wu10Man.csproj
Expand Up @@ -27,7 +27,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>3.0.0.0</ApplicationVersion>
<ApplicationVersion>3.0.1.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand Down

0 comments on commit e5c2f80

Please sign in to comment.