simplify notification
This commit is contained in:
parent
726adc7193
commit
452790d923
5 changed files with 17 additions and 22 deletions
|
@ -31,25 +31,16 @@ namespace EnvyUpdate
|
||||||
// TODO: Watch for theme changes and dynamically update
|
// TODO: Watch for theme changes and dynamically update
|
||||||
|
|
||||||
// Listen to notification activation
|
// Listen to notification activation
|
||||||
ToastNotificationManagerCompat.OnActivated += toastArgs =>
|
ToastNotificationManagerCompat.OnActivated += ToastNotificationManagerCompat_OnActivated;
|
||||||
{
|
}
|
||||||
// Obtain the arguments from the notification
|
|
||||||
ToastArguments args = ToastArguments.Parse(toastArgs.Argument);
|
|
||||||
|
|
||||||
|
private void ToastNotificationManagerCompat_OnActivated(ToastNotificationActivatedEventArgsCompat e)
|
||||||
|
{
|
||||||
// Need to dispatch to UI thread if performing UI operations
|
// Need to dispatch to UI thread if performing UI operations
|
||||||
Application.Current.Dispatcher.Invoke(delegate
|
Application.Current.Dispatcher.Invoke(delegate
|
||||||
{
|
{
|
||||||
switch (args.Get("action"))
|
|
||||||
{
|
|
||||||
case "download":
|
|
||||||
Process.Start(Util.GetGpuUrl());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Util.ShowMain();
|
Util.ShowMain();
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
<ui:Button x:Name="buttonSkipVersion" Margin="8,0,0,0" Grid.Column="1" Appearance="Secondary" Icon="ArrowForward24" Visibility="Collapsed" ToolTip="{x:Static p:Resources.ui_skipversion}" Click="buttonSkipVersion_Click" />
|
<ui:Button x:Name="buttonSkipVersion" Margin="8,0,0,0" Grid.Column="1" Appearance="Secondary" Icon="ArrowForward24" Visibility="Collapsed" ToolTip="{x:Static p:Resources.ui_skipversion}" Click="buttonSkipVersion_Click" />
|
||||||
|
|
||||||
<ui:Button x:Name="buttonDownload" Margin="8,0,0,0" MinWidth="100" Grid.Column="2" Appearance="Primary" Icon="ArrowDownload24" Visibility="Collapsed" Click="buttonDownload_Click" />
|
<ui:Button x:Name="buttonDownload" Margin="8,0,0,0" MinWidth="100" Grid.Column="2" Appearance="Primary" Icon="ArrowDownload24" Visibility="Collapsed" Click="buttonDownload_Click" />
|
||||||
|
<ui:Button x:Name="buttonInstall" Margin="8,0,0,0" MinWidth="100" Grid.Column="2" Appearance="Primary" Icon="AppsAddIn24" Visibility="Collapsed" Click="buttonInstall_Click" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<ProgressBar x:Name="progressbarDownload" Grid.Row="2" Value="0" Visibility="Collapsed"/>
|
<ProgressBar x:Name="progressbarDownload" Grid.Row="2" Value="0" Visibility="Collapsed"/>
|
||||||
|
|
|
@ -378,6 +378,8 @@ namespace EnvyUpdate
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke(new Action(() => {
|
Application.Current.Dispatcher.Invoke(new Action(() => {
|
||||||
showSnackbar(Wpf.Ui.Common.ControlAppearance.Success, Wpf.Ui.Common.SymbolRegular.CheckmarkCircle24, Properties.Resources.info_download_success, Properties.Resources.info_download_success_title);
|
showSnackbar(Wpf.Ui.Common.ControlAppearance.Success, Wpf.Ui.Common.SymbolRegular.CheckmarkCircle24, Properties.Resources.info_download_success, Properties.Resources.info_download_success_title);
|
||||||
|
buttonDownload.Visibility = Visibility.Collapsed;
|
||||||
|
buttonInstall.Visibility = Visibility.Visible;
|
||||||
}));
|
}));
|
||||||
if (File.Exists(Path.Combine(GlobalVars.exedirectory, "nvidia-installer.exe")))
|
if (File.Exists(Path.Combine(GlobalVars.exedirectory, "nvidia-installer.exe")))
|
||||||
File.Delete(Path.Combine(GlobalVars.exedirectory, "nvidia-installer.exe"));
|
File.Delete(Path.Combine(GlobalVars.exedirectory, "nvidia-installer.exe"));
|
||||||
|
@ -391,6 +393,10 @@ namespace EnvyUpdate
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void buttonInstall_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
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 = "")
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
ExtendsContentIntoTitleBar="True"
|
ExtendsContentIntoTitleBar="True"
|
||||||
WindowBackdropType="Mica"
|
WindowBackdropType="Mica"
|
||||||
|
|
||||||
Title="EnvyUpdate" MinHeight="450" Height="450" MinWidth="600" Width="600" Icon="icon.ico" StateChanged="Window_StateChanged" Closing="Window_Closing" ResizeMode="CanMinimize" Activated="UiWindow_Activated" WindowStyle="None">
|
Title="EnvyUpdate" MinHeight="500" Height="500" MinWidth="600" Width="600" Icon="icon.ico" StateChanged="Window_StateChanged" Closing="Window_Closing" ResizeMode="CanMinimize" Activated="UiWindow_Activated" WindowStyle="None">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
|
|
@ -8,9 +8,6 @@ namespace EnvyUpdate
|
||||||
{
|
{
|
||||||
var toast = new ToastContentBuilder();
|
var toast = new ToastContentBuilder();
|
||||||
toast.AddText(Properties.Resources.update_popup_message);
|
toast.AddText(Properties.Resources.update_popup_message);
|
||||||
toast.AddButton(new ToastButton()
|
|
||||||
.SetContent("Download")
|
|
||||||
.AddArgument("action", "download"));
|
|
||||||
toast.Show();
|
toast.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue