mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 08:56:15 +02:00
- Add null check for plugin result
- Minor code changes
This commit is contained in:
@@ -41,7 +41,7 @@ namespace DesktopMagic
|
||||
}
|
||||
|
||||
// Create Google Calendar API service.
|
||||
var service = new CalendarService(new BaseClientService.Initializer()
|
||||
CalendarService service = new CalendarService(new BaseClientService.Initializer()
|
||||
{
|
||||
HttpClientInitializer = credential,
|
||||
ApplicationName = ApplicationName,
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace DesktopMagic
|
||||
base.OnSourceInitialized(e);
|
||||
|
||||
//Set the window style to noactivate.
|
||||
var helper = new WindowInteropHelper(this);
|
||||
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace DesktopMagic
|
||||
base.OnSourceInitialized(e);
|
||||
|
||||
//Set the window style to noactivate.
|
||||
var helper = new WindowInteropHelper(this);
|
||||
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||
}
|
||||
@@ -88,9 +88,10 @@ namespace DesktopMagic
|
||||
|
||||
private void ValueTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
string cpuUsage = GetCpuUsage();
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
textBlock.Text = GetCpuUsage();
|
||||
textBlock.Text = cpuUsage;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace DesktopMagic
|
||||
base.OnSourceInitialized(e);
|
||||
|
||||
//Set the window style to noactivate.
|
||||
var helper = new WindowInteropHelper(this);
|
||||
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Grid.Column="1" Margin="2.5,0,0,0">
|
||||
<ComboBox x:Name="optionsComboBox" DockPanel.Dock="Top" Height="24" SelectedIndex="0" DisplayMemberPath="Item1" SelectionChanged="OptionsComboBox_SelectionChanged" Background="#FFECECEC" />
|
||||
<ComboBox x:Name="optionsComboBox" DockPanel.Dock="Top" Height="24" SelectedIndex="0" DisplayMemberPath="Item1" SelectionChanged="OptionsComboBox_SelectionChanged" Background="#FFECECEC" Padding="4" VerticalAlignment="Center"/>
|
||||
<ScrollViewer Background="#FFBBBBBB">
|
||||
<Grid>
|
||||
<StackPanel x:Name="optionsPanel" Margin="3,3,3,0" HorizontalAlignment="Stretch" Visibility="Collapsed" >
|
||||
|
||||
@@ -321,7 +321,7 @@ namespace DesktopMagic
|
||||
EditCheckBox_Click(null, null);
|
||||
this.ShowInTaskbar = false;
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
foreach (var item in Windows)
|
||||
foreach (Window item in Windows)
|
||||
{
|
||||
WindowPos.SendWpfWindowBack(item);
|
||||
WindowPos.SendWpfWindowBack(item);
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace DesktopMagic
|
||||
base.OnSourceInitialized(e);
|
||||
|
||||
//Set the window style to noactivate.
|
||||
var helper = new WindowInteropHelper(this);
|
||||
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace DesktopMagic
|
||||
Assembly dll = Assembly.Load(assemblyBytes);
|
||||
Type instanceType = dll.GetTypes().FirstOrDefault(type => type.GetTypeInfo().BaseType == typeof(Plugin));
|
||||
|
||||
foreach (var item in dll.GetTypes())
|
||||
foreach (Type item in dll.GetTypes())
|
||||
{
|
||||
Debug.WriteLine(item.Name);
|
||||
Debug.WriteLine(typeof(Plugin).Name);
|
||||
@@ -249,11 +249,14 @@ namespace DesktopMagic
|
||||
valueTimer.Stop();
|
||||
}
|
||||
|
||||
//Update Image
|
||||
Dispatcher.Invoke(() =>
|
||||
if (result is not null)
|
||||
{
|
||||
image.Source = BitmapToImageSource(result);
|
||||
});
|
||||
//Update Image
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
image.Source = BitmapToImageSource(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace DesktopMagic
|
||||
base.OnSourceInitialized(e);
|
||||
|
||||
//Set the window style to noactivate.
|
||||
var helper = new WindowInteropHelper(this);
|
||||
WindowInteropHelper helper = new WindowInteropHelper(this);
|
||||
WindowPos.SetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE,
|
||||
WindowPos.GetWindowLong(helper.Handle, WindowPos.GWL_EXSTYLE) | WindowPos.WS_EX_NOACTIVATE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user