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 gpuURL = null;
|
||||
private string skippedVer = null;
|
||||
private DateTime lastFileChanged = DateTime.MinValue;
|
||||
|
||||
public DashboardPage()
|
||||
{
|
||||
|
@ -301,15 +302,19 @@ namespace EnvyUpdate
|
|||
}
|
||||
|
||||
void DriverFileChanged(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
if (!GlobalVars.isInstalling && (DateTime.UtcNow.Subtract(lastFileChanged).TotalMinutes > 1))
|
||||
{
|
||||
Debug.LogToFile("INFO Watched driver file changed! Reloading data.");
|
||||
System.Threading.Thread.Sleep(10000);
|
||||
lastFileChanged = DateTime.UtcNow;
|
||||
Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
UpdateLocalVer();
|
||||
Load();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void CardOnline_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
@ -396,6 +401,7 @@ namespace EnvyUpdate
|
|||
private void buttonInstall_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
buttonInstall.IsEnabled = false;
|
||||
GlobalVars.isInstalling = true;
|
||||
string sevenZipPath = Util.GetSevenZip();
|
||||
|
||||
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"));
|
||||
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 = "")
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace EnvyUpdate
|
|||
public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
|
||||
public static bool monitoringInstall = 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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,11 @@
|
|||
Icon="/icon.ico">
|
||||
<ui:TitleBar.Tray>
|
||||
<ui:NotifyIcon
|
||||
FocusOnLeftClick="True"
|
||||
LeftClick="NotifyIcon_LeftClick"
|
||||
Icon="/icon.ico"
|
||||
MenuOnRightClick="False"
|
||||
TooltipText="EnvyUpdate"></ui:NotifyIcon>
|
||||
TooltipText="EnvyUpdate">
|
||||
</ui:NotifyIcon>
|
||||
</ui:TitleBar.Tray>
|
||||
</ui:TitleBar>
|
||||
<Grid Grid.Row="1">
|
||||
|
|
|
@ -113,5 +113,10 @@ namespace EnvyUpdate
|
|||
else
|
||||
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.WindowState = WindowState.Normal;
|
||||
Application.Current.MainWindow.Activate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Reference in a new issue