Skip to content

Commit

Permalink
Update 3.5.0 ..
Browse files Browse the repository at this point in the history
- Created and Added MiToolzTimerService (this allows Windows Timer Resolution changes from default to 0.5ms) Enable/Disable, Install/Uninstall options added
- Created ServiceManager class in main project to deal with MiToolsTimerService
- Removed Open MSI Afterburner option as probably not needed now
- Moved Library dll's to their own folder and added probing privatePath to project instead
- Moved binaries to their own folder
- Image additions and updates
- Updated repo images to reflect new additions and changes
- Updated Readme
- Bump to v3.5.0
  • Loading branch information
SmokeyMcBong committed Jun 29, 2020
1 parent 9673bd5 commit 09a8a39
Show file tree
Hide file tree
Showing 29 changed files with 713 additions and 59 deletions.
6 changes: 6 additions & 0 deletions MiToolz.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiToolz", "MiToolz\MiToolz.csproj", "{09405820-5162-4AFE-882B-7052CF1381F4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiToolzTimerService", "MiToolzTimerService\MiToolzTimerService.csproj", "{58E4EF47-30A1-4292-9EBB-9B8EC045CBBA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{09405820-5162-4AFE-882B-7052CF1381F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09405820-5162-4AFE-882B-7052CF1381F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09405820-5162-4AFE-882B-7052CF1381F4}.Release|Any CPU.Build.0 = Release|Any CPU
{58E4EF47-30A1-4292-9EBB-9B8EC045CBBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58E4EF47-30A1-4292-9EBB-9B8EC045CBBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58E4EF47-30A1-4292-9EBB-9B8EC045CBBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58E4EF47-30A1-4292-9EBB-9B8EC045CBBA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 5 additions & 0 deletions MiToolz/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib"/>
</assemblyBinding>
</runtime>
</configuration>
4 changes: 2 additions & 2 deletions MiToolz/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<system:String x:Key="VersionNo"
xml:space="preserve"> MiToolz v3.0.0 </system:String>
xml:space="preserve"> MiToolz v3.5.0 </system:String>
<system:String x:Key="VersionDate"
xml:space="preserve"> Build Date : 03-06-2020 </system:String>
xml:space="preserve"> Build Date : 29-06-2020 </system:String>
</ResourceDictionary>
</Application.Resources>
</Application>
File renamed without changes.
2 changes: 1 addition & 1 deletion MiToolz/ListManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal IEnumerable<Tile> ControlsMainTiles
_mw.GpuTile,
_mw.PowerPlanTile,
_mw.AudioTile,
_mw.MsIabTile,
_mw.TimerResolutionTile,
_mw.AudioDeviceSwitchTile
};
return controlsMainTiles;
Expand Down
52 changes: 31 additions & 21 deletions MiToolz/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@
Height="130" />
</mah:Badged>
</mah:Tile>
<mah:Tile x:Name="MsIabTile"
Click="MsIabTile_OnClick"
Title="Open MSIAfterburner"
<mah:Tile x:Name="TimerResolutionTile"
Click="TimerResolutionTile_OnClick"
Title="Windows Timer Resolution"
TitleFontSize="14"
HorizontalTitleAlignment="Right"
Margin="267,217,0,0"
Expand All @@ -323,11 +323,18 @@
VerticalAlignment="Top"
HorizontalAlignment="Left"
IsTabStop="False">
<mah:Badged x:Name="TimerResolutionTileBadge"
Badge=""
BadgeForeground="Black"
BadgePlacementMode="Top"
BadgeBackground="DarkGray"
Height="76">
<Image VerticalAlignment="Center"
HorizontalAlignment="Center"
Source="pack://siteoforigin:,,,/Resources/Image_MSIab.png"
Width="119"
Source="pack://siteoforigin:,,,/Resources/Image_TimerResolution.png"
Width="119"
Height="71" />
</mah:Badged>
</mah:Tile>
<mah:Tile x:Name="AudioDeviceSwitchTile"
Click="AudioDeviceSwitchTile_OnClick"
Expand All @@ -352,8 +359,8 @@
<Image VerticalAlignment="Center"
HorizontalAlignment="Center"
Source="pack://siteoforigin:,,,/Resources/Image_DeviceSwitcher.png"
Width="68"
Height="62" />
Width="74"
Height="76" />
</mah:Badged>
</mah:Tile>

Expand Down Expand Up @@ -512,25 +519,13 @@
Width="226"
Margin="162,121,0,0">
<TextBlock TextWrapping="Wrap"
Text="About MiToolz"
Text="Timer Resolution Service"
TextAlignment="Center"
Background="{DynamicResource MahApps.Brushes.Accent}"
Margin="0,-1,-1,0"
Height="16"
VerticalAlignment="Top" />
</Border>
<Image Height="43"
VerticalAlignment="Top"
Margin="162,146,296,0"
Source="pack://siteoforigin:,,,/Resources/App_Icon.ico"
Cursor="Help"
ToolTip="Build Date : 26-06-2020" />
<TextBlock TextWrapping="Wrap"
Text="MiToolz v3.2.0"
TextAlignment="Center"
VerticalAlignment="Top"
Margin="165,194,296,0"
Height="16" />
<TextBlock HorizontalAlignment="Left"
TextWrapping="Wrap"
Text="Default
Expand Down Expand Up @@ -665,6 +660,22 @@
Cursor="Hand"
Margin="600,184,0,0"
IsTabStop="False" />
<Button x:Name="InstallServiceButton"
Content="Install Service"
Click="InstallServiceButton_OnClick"
Cursor="Hand"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="110"
Margin="225,149,0,0" />
<Button x:Name="UninstallServiceButton"
Content="Uninstall Service"
Click="UninstallServiceButton_OnClick"
Cursor="Hand"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="110"
Margin="225,183,0,0" />
</Grid>
</mah:CustomDialog>
</Grid>
Expand Down Expand Up @@ -767,6 +778,5 @@
</TransformGroup>
</Separator.RenderTransform>
</Separator>

</Grid>
</mah:MetroWindow>
87 changes: 76 additions & 11 deletions MiToolz/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ public partial class MainWindow
private string _gpuPower;
private string _cpuClock;
private string _cpuTemp;
//private const int DelayShort = 500;
private const int DelayLong = 1000;
private string _timerResolution;
private const int Delay = 1000;

public MainWindow()
{
//ignore Theme ResourceDictionary before initialize as setting whichever theme (_appTheme) saved in .ini
Application.Current.Resources.MergedDictionaries.RemoveAt(0);
InitializeComponent();

//add MainWindow event handlers
Closed += MainWindow_Closed;
Activated += MainWindow_Activated;

//run startup checks, read all config settings and set corresponding UI elements
StartupSetup();
SetAppTheme();
Expand All @@ -64,17 +68,15 @@ public MainWindow()
ShowDefaultAudioDevice();
SetupComboListSources();

//add MainWindow event handlers
Closed += MainWindow_Closed;
Activated += MainWindow_Activated;
//start Timer Resolution Monitoring
StartTimerMonitor();

//start OhM Monitoring
_thisPc = new Computer
{
IsGpuEnabled = true,
IsCpuEnabled = true
};

IsMonitorEnabled();
}

Expand Down Expand Up @@ -331,6 +333,25 @@ private void SetComboListIndexes()
ExitAppHotKey.SelectedIndex = hotKeyExitApp;
}

private void StartTimerMonitor()
{
Task.Factory.StartNew(async () =>
{
while (true)
{
_timerResolution = "Current Timer: " + ServiceManager.CurrentTimerRes() / 10000.0 + "ms";
Dispatcher.Invoke(() =>
{
if (TimerResolutionTileBadge.Badge.ToString() != _timerResolution)
{
TimerResolutionTileBadge.Badge = _timerResolution;
}
});
await Task.Delay(Delay);
}
});
}

private void StartOhMMonitor()
{
int roundValue;
Expand Down Expand Up @@ -529,7 +550,7 @@ private void StartOhMMonitor()
}
}
}
await Task.Delay(DelayLong);
await Task.Delay(Delay);
Dispatcher.Invoke(() =>
{
Expand Down Expand Up @@ -592,7 +613,7 @@ private void ApplyProfile(string profile)

Task.Factory.StartNew(async () =>
{
await Task.Delay(DelayLong);
await Task.Delay(Delay);
//after setting the profile terminate MSIAfterburner process
TerminateApp("MSIAfterburner");
Expand Down Expand Up @@ -682,7 +703,7 @@ private void AudioDeviceSwitchTile_OnClick(object sender, RoutedEventArgs e)
StartInfo = new ProcessStartInfo
{
CreateNoWindow = true,
FileName = "nircmdc.exe",
FileName = @"bin\nircmdc.exe",
Arguments = " setdefaultsounddevice " + "\"" + device + "\""
}
};
Expand Down Expand Up @@ -750,6 +771,20 @@ private static void MonitoringDecision(IEnumerable<Tile> controlsTiles, IEnumera
}
}

private void TimerResolutionTile_OnClick(object sender, RoutedEventArgs e)
{
ServiceManager.MiToolzService.Refresh();
if (!ServiceManager.ServiceExists())
{
var metroWindow = (Application.Current.MainWindow as MetroWindow);
metroWindow.ShowMessageAsync("Service Not Found..", "To change this, Install the Timer Resolution Service via Settings Panel");
}
else
{
ServiceManager.StartStopService();
}
}

private void Settings(object sender, RoutedEventArgs e)
{
switch (SettingsDialog.Visibility)
Expand All @@ -768,6 +803,7 @@ private void Settings(object sender, RoutedEventArgs e)
LabelSeparator2.Visibility = Visibility.Visible;
LabelSeparator3.Visibility = Visibility.Visible;
LabelSeparator4.Visibility = Visibility.Visible;
TimerResolutionTile.IsEnabled = true;
SettingsDialog.Visibility = Visibility.Collapsed;
SettingsButton.Content = "Settings ";
break;
Expand All @@ -782,12 +818,25 @@ private void Settings(object sender, RoutedEventArgs e)

}

if (ServiceManager.ServiceExists())
{
InstallServiceButton.IsEnabled = false;
UninstallServiceButton.IsEnabled = true;
}

else
{
InstallServiceButton.IsEnabled = true;
UninstallServiceButton.IsEnabled = false;
}

CpuMonitorLabel.Visibility = Visibility.Collapsed;
GpuMonitorLabel.Visibility = Visibility.Collapsed;
LabelSeparator1.Visibility = Visibility.Collapsed;
LabelSeparator2.Visibility = Visibility.Collapsed;
LabelSeparator3.Visibility = Visibility.Collapsed;
LabelSeparator4.Visibility = Visibility.Collapsed;
TimerResolutionTile.IsEnabled = false;
SettingsDialog.Visibility = Visibility.Visible;
break;
case Visibility.Hidden:
Expand Down Expand Up @@ -927,7 +976,7 @@ private void AudioDeviceHotKey_OnSelectionChanged(object sender, RoutedEventArgs
else
{
var metroWindow = (Application.Current.MainWindow as MetroWindow);
metroWindow.ShowMessageAsync("HotKey already assigned...", "Choose another HotKey for this task");
metroWindow.ShowMessageAsync("HotKey already assigned..", "Choose another HotKey for this task");
}
}

Expand All @@ -942,7 +991,7 @@ private void ExitAppHotKey_OnSelectionChanged(object sender, RoutedEventArgs e)
else
{
var metroWindow = (Application.Current.MainWindow as MetroWindow);
metroWindow.ShowMessageAsync("HotKey already assigned...", "Choose another HotKey for this task");
metroWindow.ShowMessageAsync("HotKey already assigned..", "Choose another HotKey for this task");
}
}

Expand All @@ -965,6 +1014,22 @@ private void HotKeyManager(object sender, KeyEventArgs e)
}
}

private void InstallServiceButton_OnClick(object sender, RoutedEventArgs e)
{
ServiceManager.MiToolzService.Refresh();
ServiceManager.InstallService();
InstallServiceButton.IsEnabled = false;
UninstallServiceButton.IsEnabled = true;
}

private void UninstallServiceButton_OnClick(object sender, RoutedEventArgs e)
{
ServiceManager.MiToolzService.Refresh();
ServiceManager.UninstallService();
InstallServiceButton.IsEnabled = true;
UninstallServiceButton.IsEnabled = false;
}

//reflect updated settings in UI when window is re-focused
private void MainWindow_Activated(object sender, EventArgs e)
{
Expand Down
Loading

0 comments on commit 09a8a39

Please sign in to comment.