mirror of
https://github.com/nomi-san/parsec-vdd.git
synced 2026-08-07 05:20:44 +00:00
fix driver query freezes app
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@
|
||||
<StackPanel Margin="25,0,0,20" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="230">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="./Resources/icon.ico" Width="20" Height="18" Margin="0,0,5,0" />
|
||||
<Label x:Name="xAppName" Content="ParsecVDisplay" FontSize="14" Cursor="Hand" MouseDown="QueryStatus">
|
||||
<Label x:Name="xDriver" Content="Parsec Virtual Display" FontSize="14" Cursor="Hand" MouseDown="QueryStatus">
|
||||
<Label.Style>
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
|
||||
+16
-7
@@ -21,7 +21,6 @@ namespace ParsecVDisplay
|
||||
{
|
||||
Instance = this;
|
||||
InitializeComponent();
|
||||
xAppName.Content += $" v{Program.AppVersion}";
|
||||
|
||||
// prevent frame history
|
||||
xFrame.Navigating += (_, e) => e.Cancel = e.NavigationMode != NavigationMode.New;
|
||||
@@ -29,6 +28,8 @@ namespace ParsecVDisplay
|
||||
|
||||
xDisplays.Children.Clear();
|
||||
xNoDisplay.Visibility = Visibility.Hidden;
|
||||
|
||||
this.IsVisibleChanged += delegate { UpdateDriverLabel(); };
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
@@ -40,7 +41,6 @@ namespace ParsecVDisplay
|
||||
|
||||
var source = HwndSource.FromHwnd(Handle);
|
||||
source.AddHook(new HwndSourceHook(WndProc));
|
||||
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
@@ -72,6 +72,8 @@ namespace ParsecVDisplay
|
||||
|
||||
SystemEvents.DisplaySettingsChanged += DisplayChanged;
|
||||
DisplayChanged(null, EventArgs.Empty);
|
||||
|
||||
UpdateDriverLabel();
|
||||
}
|
||||
|
||||
private void Window_Unloaded(object sender, RoutedEventArgs e)
|
||||
@@ -79,6 +81,13 @@ namespace ParsecVDisplay
|
||||
SystemEvents.DisplaySettingsChanged -= DisplayChanged;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
private void UpdateDriverLabel()
|
||||
{
|
||||
ParsecVDD.QueryVersion(out var dver);
|
||||
xDriver.Content = $"{ParsecVDD.NAME} v{dver}";
|
||||
}
|
||||
|
||||
private void DisplayChanged(object sender, EventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
@@ -128,14 +137,14 @@ namespace ParsecVDisplay
|
||||
xDisplays.Children.Clear();
|
||||
|
||||
DisplayChanged(null, null);
|
||||
UpdateDriverLabel();
|
||||
}
|
||||
|
||||
private void QueryStatus(object sender, EventArgs e)
|
||||
private void QueryStatus(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e is MouseEventArgs mbe)
|
||||
mbe.Handled = true;
|
||||
|
||||
Tray.Instance.Invoke(() => Tray.Instance.QueryDriver(null, null));
|
||||
e.Handled = true;
|
||||
UpdateDriverLabel();
|
||||
Tray.Instance?.QueryDriver(null, null);
|
||||
}
|
||||
|
||||
private void OpenRepoLink(object sender, MouseButtonEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user