mirror of
https://github.com/2dust/v2rayN.git
synced 2026-07-26 09:52:05 +03:00
Fixed the issue with RefreshIcon's call in the desktop version.
This commit is contained in:
@@ -45,8 +45,7 @@ public partial class StatusBarView : ReactiveUserControl<StatusBarViewModel>
|
|||||||
|
|
||||||
ViewModel.DispatcherRefreshIconInteraction.RegisterHandler(interaction =>
|
ViewModel.DispatcherRefreshIconInteraction.RegisterHandler(interaction =>
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(RefreshIcon,
|
Dispatcher.UIThread.Post(RefreshIcon, DispatcherPriority.Default);
|
||||||
DispatcherPriority.Default);
|
|
||||||
interaction.SetOutput(Unit.Default);
|
interaction.SetOutput(Unit.Default);
|
||||||
}).DisposeWith(disposables);
|
}).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
@@ -57,6 +56,9 @@ public partial class StatusBarView : ReactiveUserControl<StatusBarViewModel>
|
|||||||
{
|
{
|
||||||
cmbSystemProxy.Items.RemoveAt(cmbSystemProxy.Items.Count - 1);
|
cmbSystemProxy.Items.RemoveAt(cmbSystemProxy.Items.Count - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Because this view has not yet been initialized when DispatcherRefreshIconInteraction is first called.
|
||||||
|
RefreshIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshIcon()
|
private void RefreshIcon()
|
||||||
|
|||||||
@@ -71,16 +71,18 @@ public partial class StatusBarView
|
|||||||
|
|
||||||
ViewModel.DispatcherRefreshIconInteraction.RegisterHandler(interaction =>
|
ViewModel.DispatcherRefreshIconInteraction.RegisterHandler(interaction =>
|
||||||
{
|
{
|
||||||
Application.Current?.Dispatcher.Invoke(async () =>
|
Application.Current?.Dispatcher.Invoke(async () => await RefreshIcon(), DispatcherPriority.Normal);
|
||||||
{
|
|
||||||
tbNotify.Icon = await WindowsManager.Instance.GetNotifyIcon(_config);
|
|
||||||
Application.Current.MainWindow?.Icon = WindowsManager.Instance.GetAppIcon(_config);
|
|
||||||
}, DispatcherPriority.Normal);
|
|
||||||
interaction.SetOutput(Unit.Default);
|
interaction.SetOutput(Unit.Default);
|
||||||
}).DisposeWith(disposables);
|
}).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task RefreshIcon()
|
||||||
|
{
|
||||||
|
tbNotify.Icon = await WindowsManager.Instance.GetNotifyIcon(_config);
|
||||||
|
Application.Current.MainWindow?.Icon = WindowsManager.Instance.GetAppIcon(_config);
|
||||||
|
}
|
||||||
|
|
||||||
private async void menuExit_Click(object sender, RoutedEventArgs e)
|
private async void menuExit_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
tbNotify.Dispose();
|
tbNotify.Dispose();
|
||||||
|
|||||||
Reference in New Issue
Block a user