fix watcher, fix tray click
This commit is contained in:
parent
8ec0b67896
commit
868a13139d
5 changed files with 28 additions and 8 deletions
|
@ -21,6 +21,7 @@ namespace EnvyUpdate
|
||||||
private string onlineDriv = null;
|
private string onlineDriv = null;
|
||||||
private string gpuURL = null;
|
private string gpuURL = null;
|
||||||
private string skippedVer = null;
|
private string skippedVer = null;
|
||||||
|
private DateTime lastFileChanged = DateTime.MinValue;
|
||||||
|
|
||||||
public DashboardPage()
|
public DashboardPage()
|
||||||
{
|
{
|
||||||
|
@ -301,15 +302,19 @@ namespace EnvyUpdate
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverFileChanged(object sender, FileSystemEventArgs e)
|
void DriverFileChanged(object sender, FileSystemEventArgs e)
|
||||||
|
{
|
||||||
|
if (!GlobalVars.isInstalling && (DateTime.UtcNow.Subtract(lastFileChanged).TotalMinutes > 1))
|
||||||
{
|
{
|
||||||
Debug.LogToFile("INFO Watched driver file changed! Reloading data.");
|
Debug.LogToFile("INFO Watched driver file changed! Reloading data.");
|
||||||
System.Threading.Thread.Sleep(10000);
|
System.Threading.Thread.Sleep(10000);
|
||||||
|
lastFileChanged = DateTime.UtcNow;
|
||||||
Application.Current.Dispatcher.Invoke(delegate
|
Application.Current.Dispatcher.Invoke(delegate
|
||||||
{
|
{
|
||||||
UpdateLocalVer();
|
UpdateLocalVer();
|
||||||
Load();
|
Load();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CardOnline_Click(object sender, RoutedEventArgs e)
|
private void CardOnline_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -396,6 +401,7 @@ namespace EnvyUpdate
|
||||||
private void buttonInstall_Click(object sender, RoutedEventArgs e)
|
private void buttonInstall_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
buttonInstall.IsEnabled = false;
|
buttonInstall.IsEnabled = false;
|
||||||
|
GlobalVars.isInstalling = true;
|
||||||
string sevenZipPath = Util.GetSevenZip();
|
string sevenZipPath = Util.GetSevenZip();
|
||||||
|
|
||||||
ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Info, Wpf.Ui.Common.SymbolRegular.FolderZip24, Properties.Resources.info_extracting, Properties.Resources.info_extracting_title);
|
ShowSnackbar(Wpf.Ui.Common.ControlAppearance.Info, Wpf.Ui.Common.SymbolRegular.FolderZip24, Properties.Resources.info_extracting, Properties.Resources.info_extracting_title);
|
||||||
|
@ -463,6 +469,12 @@ namespace EnvyUpdate
|
||||||
|
|
||||||
File.Delete(Path.Combine(GlobalVars.exedirectory, onlineDriv + "-nvidia-installer.exe"));
|
File.Delete(Path.Combine(GlobalVars.exedirectory, onlineDriv + "-nvidia-installer.exe"));
|
||||||
Directory.Delete(Path.Combine(GlobalVars.exedirectory, onlineDriv + "-extracted"), true);
|
Directory.Delete(Path.Combine(GlobalVars.exedirectory, onlineDriv + "-extracted"), true);
|
||||||
|
GlobalVars.isInstalling = false;
|
||||||
|
Application.Current.Dispatcher.Invoke(delegate
|
||||||
|
{
|
||||||
|
UpdateLocalVer();
|
||||||
|
Load();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowSnackbar(Wpf.Ui.Common.ControlAppearance appearance, Wpf.Ui.Common.SymbolRegular icon, string message = "", string title = "")
|
private void ShowSnackbar(Wpf.Ui.Common.ControlAppearance appearance, Wpf.Ui.Common.SymbolRegular icon, string message = "", string title = "")
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace EnvyUpdate
|
||||||
public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
|
public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
|
||||||
public static bool monitoringInstall = false;
|
public static bool monitoringInstall = false;
|
||||||
public static bool startMinimized = false;
|
public static bool startMinimized = false;
|
||||||
|
public static bool isInstalling = false;
|
||||||
public static readonly string useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:115.0) Gecko/20100101 Firefox/115.0";
|
public static readonly string useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:115.0) Gecko/20100101 Firefox/115.0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,11 @@
|
||||||
Icon="/icon.ico">
|
Icon="/icon.ico">
|
||||||
<ui:TitleBar.Tray>
|
<ui:TitleBar.Tray>
|
||||||
<ui:NotifyIcon
|
<ui:NotifyIcon
|
||||||
FocusOnLeftClick="True"
|
LeftClick="NotifyIcon_LeftClick"
|
||||||
Icon="/icon.ico"
|
Icon="/icon.ico"
|
||||||
MenuOnRightClick="False"
|
MenuOnRightClick="False"
|
||||||
TooltipText="EnvyUpdate"></ui:NotifyIcon>
|
TooltipText="EnvyUpdate">
|
||||||
|
</ui:NotifyIcon>
|
||||||
</ui:TitleBar.Tray>
|
</ui:TitleBar.Tray>
|
||||||
</ui:TitleBar>
|
</ui:TitleBar>
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
|
|
|
@ -113,5 +113,10 @@ namespace EnvyUpdate
|
||||||
else
|
else
|
||||||
Wpf.Ui.Appearance.Theme.Apply(Wpf.Ui.Appearance.ThemeType.Light, Wpf.Ui.Appearance.BackgroundType.Mica);
|
Wpf.Ui.Appearance.Theme.Apply(Wpf.Ui.Appearance.ThemeType.Light, Wpf.Ui.Appearance.BackgroundType.Mica);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void NotifyIcon_LeftClick(Wpf.Ui.Controls.NotifyIcon sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Util.ShowMain();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -122,6 +122,7 @@ namespace EnvyUpdate
|
||||||
{
|
{
|
||||||
Application.Current.MainWindow.Show();
|
Application.Current.MainWindow.Show();
|
||||||
Application.Current.MainWindow.WindowState = WindowState.Normal;
|
Application.Current.MainWindow.WindowState = WindowState.Normal;
|
||||||
|
Application.Current.MainWindow.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Reference in a new issue