Skip to content

Commit

Permalink
v1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeeex committed Feb 17, 2018
1 parent 3638c01 commit ff34bb8
Show file tree
Hide file tree
Showing 15 changed files with 561 additions and 369 deletions.
34 changes: 17 additions & 17 deletions XTR_Toolbox/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mD="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="XTR Toolbox "
Height="442" Width="560"
Expand All @@ -13,21 +13,21 @@
TextElement.FontSize="14"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
<materialDesign:DialogHost CloseOnClickAway="True" IsTabStop="False">
<materialDesign:DialogHost.DialogContent>
<mD:DialogHost CloseOnClickAway="True" IsTabStop="False">
<mD:DialogHost.DialogContent>
<StackPanel Margin="12" Orientation="Vertical" Width="400">
<TextBlock x:Name="TbTelemetry" Text="{Binding TelemetryText}" TextWrapping="Wrap"
FontSize="14" Margin="10,0" />
<Separator Margin="0,8" Background="{DynamicResource PrimaryHueMidBrush}" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="Yes" Style="{DynamicResource MaterialDesignFlatButton}"
Command="materialDesign:DialogHost.CloseDialogCommand"
Command="mD:DialogHost.CloseDialogCommand"
Width="100" Click="BtnTelemetryYes_Click" />
<Button Content="No" Style="{DynamicResource MaterialDesignFlatButton}" IsCancel="True"
IsDefault="True" Command="materialDesign:DialogHost.CloseDialogCommand" Width="100" />
IsDefault="True" Command="mD:DialogHost.CloseDialogCommand" Width="100" />
</StackPanel>
</StackPanel>
</materialDesign:DialogHost.DialogContent>
</mD:DialogHost.DialogContent>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="234" />
Expand All @@ -41,10 +41,10 @@
<GroupBox Grid.Row="0" Grid.Column="0" BorderThickness="1" Margin="10" Padding="5,8"
Style="{DynamicResource MaterialDesignCardGroupBox}"
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}"
materialDesign:ColorZoneAssist.Mode="PrimaryDark">
mD:ColorZoneAssist.Mode="PrimaryDark">
<GroupBox.Header>
<StackPanel Orientation="Horizontal" Margin="0,0,5,0" HorizontalAlignment="Center">
<materialDesign:PackIcon Kind="Speedometer" Width="22" Height="22" Margin="0,-3,5,0" />
<mD:PackIcon Kind="Speedometer" Width="22" Height="22" Margin="0,-3,5,0" />
<TextBlock Text="Quick Tools" FontSize="16" />
</StackPanel>
</GroupBox.Header>
Expand All @@ -65,10 +65,10 @@
<GroupBox BorderThickness="1" Grid.Row="1" Grid.Column="0" Margin="10" Padding="5,8"
Style="{DynamicResource MaterialDesignCardGroupBox}"
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}"
materialDesign:ColorZoneAssist.Mode="PrimaryDark">
mD:ColorZoneAssist.Mode="PrimaryDark">
<GroupBox.Header>
<StackPanel Orientation="Horizontal" Margin="0,0,5,0" HorizontalAlignment="Center">
<materialDesign:PackIcon Kind="Windows" Width="22" Height="22" Margin="0,-3,5,0" />
<mD:PackIcon Kind="Windows" Width="22" Height="22" Margin="0,-3,5,0" />
<TextBlock Text="Privacy Tools" FontSize="16" />
</StackPanel>
</GroupBox.Header>
Expand All @@ -80,16 +80,16 @@
<Button x:Name="BtnWinApps" Content="Windows Apps Manager..." Click="BtnMultiWindowOpener"
Height="Auto" Margin="5" />
<Button Grid.Row="1" Content="Remove Telemetry Updates" Height="Auto" Margin="5"
Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}" />
Command="{x:Static mD:DialogHost.OpenDialogCommand}" />
</Grid>
</GroupBox>
<GroupBox BorderThickness="1" Grid.Row="0" Grid.Column="1" Margin="10" Padding="5,8"
Style="{DynamicResource MaterialDesignCardGroupBox}"
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}"
materialDesign:ColorZoneAssist.Mode="PrimaryDark">
mD:ColorZoneAssist.Mode="PrimaryDark">
<GroupBox.Header>
<StackPanel Orientation="Horizontal" Margin="0,0,5,0" HorizontalAlignment="Center">
<materialDesign:PackIcon Kind="Menu" Width="22" Height="22" Margin="0,-3,5,0" />
<mD:PackIcon Kind="Menu" Width="22" Height="22" Margin="0,-3,5,0" />
<TextBlock Text="Other Tools" FontSize="16" />
</StackPanel>
</GroupBox.Header>
Expand All @@ -115,10 +115,10 @@
<GroupBox BorderThickness="1" Grid.Column="1" Grid.Row="1" Margin="10" Padding="5,8"
Style="{DynamicResource MaterialDesignCardGroupBox}"
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}"
materialDesign:ColorZoneAssist.Mode="PrimaryDark">
mD:ColorZoneAssist.Mode="PrimaryDark">
<GroupBox.Header>
<StackPanel Orientation="Horizontal" Margin="0,0,5,0" HorizontalAlignment="Center">
<materialDesign:PackIcon Kind="Broom" Width="22" Height="22" Margin="0,-3,5,0" />
<mD:PackIcon Kind="Broom" Width="22" Height="22" Margin="0,-3,5,0" />
<TextBlock Text="Cleanup Tools" FontSize="16" />
</StackPanel>
</GroupBox.Header>
Expand Down Expand Up @@ -149,7 +149,7 @@
NavigateUri="https://www.patreon.com/bePatron?u=4319301"
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}">
<InlineUIContainer>
<materialDesign:PackIcon Kind="Gift" />
<mD:PackIcon Kind="Gift" />
</InlineUIContainer>
<Run Text=" Become a Patron" />
</Hyperlink>
Expand All @@ -158,7 +158,7 @@
<TextBlock DockPanel.Dock="Right" />
</StatusBar>
</Grid>
</materialDesign:DialogHost>
</mD:DialogHost>
<Window.CommandBindings>
<CommandBinding Command="Close" Executed="OnCloseExecuted" />
</Window.CommandBindings>
Expand Down
2 changes: 1 addition & 1 deletion XTR_Toolbox/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace XTR_Toolbox
{
public partial class MainWindow
{
public const string XtrVer = "1.8";
public const string XtrVer = "1.9";
private readonly HttpClient _cl = new HttpClient();
private readonly TextModel _textBind = new TextModel();

Expand Down
38 changes: 28 additions & 10 deletions XTR_Toolbox/Shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static int StartProc(string file, string arg = "", ProcessWindowStyle sty
}
catch (Exception ex)
{
MessageBox.Show(exMsg + "Error: " + ex.Message);
MessageBox.Show($"{exMsg}Error: {ex.Message}");
}

return proc.ExitCode;
Expand Down Expand Up @@ -66,26 +66,44 @@ public static BitmapSource PathToIcon(string regIcon)
}
}

public static void ServiceRestarter(string serviceName, bool serviceRestart)
public static bool ServiceRestarter(string name, bool isStart)
{
ServiceController serCont = new ServiceController(serviceName);
ServiceController service = new ServiceController(name);
try
{
if (serCont.Status.Equals(ServiceControllerStatus.Running) ||
serCont.Status.Equals(ServiceControllerStatus.StartPending))
if (service.Status.Equals(ServiceControllerStatus.Running) ||
service.Status.Equals(ServiceControllerStatus.StartPending))
{
serCont.Stop();
serCont.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(8));
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));
if (!service.Status.Equals(ServiceControllerStatus.Stopped) &&
!service.Status.Equals(ServiceControllerStatus.StopPending))
{
MessageBox.Show($"Service: {service.DisplayName} can\'t be stopped.");
return false;
}
}

if (!serviceRestart) return;
serCont.Start();
serCont.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(8));
if (isStart)
{
service.Start();
service.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));
if (!service.Status.Equals(ServiceControllerStatus.Running) &&
!service.Status.Equals(ServiceControllerStatus.StartPending))
{
MessageBox.Show($"Service: {service.DisplayName} can\'t be started.");
return false;
}
}

return true;
}
catch
{
//ignored
}

return false;
}

public static void ServiceStartType(string serviceName, string startType, string delayed = null)
Expand Down
6 changes: 3 additions & 3 deletions XTR_Toolbox/W1_WinApps.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mD="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:self="clr-namespace:XTR_Toolbox"
mc:Ignorable="d"
Title="Manage Windows Apps" Height="495" Width="570"
Expand Down Expand Up @@ -44,12 +44,12 @@
<Button Command="self:WinAppsCmd.DeleteApps"
Style="{DynamicResource MaterialDesignFloatingActionLightButton}"
ToolTip="Uninstall Selected Apps [Ctrl + D]" Margin="10,0,5,0">
<materialDesign:PackIcon Kind="DeleteSweep" Width="24" Height="24" />
<mD:PackIcon Kind="DeleteSweep" Width="24" Height="24" />
</Button>
<Button Command="self:WinAppsCmd.ReturnApps"
Style="{DynamicResource MaterialDesignFloatingActionLightButton}"
ToolTip="Reinstall All Apps [Ctrl + R]" Margin="5,0,10,0">
<materialDesign:PackIcon Kind="BackupRestore" Width="24" Height="24" />
<mD:PackIcon Kind="BackupRestore" Width="24" Height="24" />
</Button>
</StackPanel>
</DockPanel>
Expand Down
Loading

0 comments on commit ff34bb8

Please sign in to comment.