mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 00:46:12 +02:00
- Automatically send windows to back
- Fix auto updater
This commit is contained in:
@@ -13,7 +13,7 @@ namespace DesktopMagic
|
||||
{
|
||||
private Mutex _mutex;
|
||||
#if DEBUG
|
||||
private readonly Updater updater = new Updater(TimeSpan.FromHours(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/develop/update/updateInfo.json");
|
||||
private readonly Updater updater = new Updater(TimeSpan.FromDays(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/develop/update/updateInfo.json");
|
||||
#else
|
||||
private readonly Updater updater = new Updater(TimeSpan.FromHours(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/main/update/updateInfo.json");
|
||||
#endif
|
||||
|
||||
@@ -92,12 +92,12 @@ namespace DesktopMagic
|
||||
if (MainWindow.EditMode)
|
||||
{
|
||||
panel.Visibility = Visibility.Visible;
|
||||
new WindowPos().SetIsLocked(this, false);
|
||||
WindowPos.SetIsLocked(this, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.Visibility = Visibility.Collapsed;
|
||||
new WindowPos().SetIsLocked(this, true);
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
}
|
||||
if (MainWindow.GlobalFont != oldFont || MainWindow.GlobalColor != oldColor)
|
||||
{
|
||||
|
||||
@@ -73,12 +73,12 @@ namespace DesktopMagic
|
||||
if (MainWindow.EditMode)
|
||||
{
|
||||
panel.Visibility = Visibility.Visible;
|
||||
new WindowPos().SetIsLocked(this, false);
|
||||
WindowPos.SetIsLocked(this, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.Visibility = Visibility.Collapsed;
|
||||
new WindowPos().SetIsLocked(this, true);
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
}
|
||||
|
||||
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
||||
|
||||
@@ -60,12 +60,12 @@ namespace DesktopMagic
|
||||
if (MainWindow.EditMode)
|
||||
{
|
||||
panel.Visibility = Visibility.Visible;
|
||||
new WindowPos().SetIsLocked(this, false);
|
||||
WindowPos.SetIsLocked(this, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.Visibility = Visibility.Collapsed;
|
||||
new WindowPos().SetIsLocked(this, true);
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
}
|
||||
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
||||
textBlock.Foreground = MainWindow.GlobalColor;
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<Authors>Stone_Red</Authors>
|
||||
<Version>0.0.2.2</Version>
|
||||
<Version>0.0.2.3</Version>
|
||||
<PackageProjectUrl>https://github.com/Stone-Red-Code/DesktopMagic</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/Stone-Red-Code/DesktopMagic</RepositoryUrl>
|
||||
<AssemblyVersion>0.0.2.3</AssemblyVersion>
|
||||
<FileVersion>0.0.2.3</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -24,7 +26,7 @@
|
||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.1.0" />
|
||||
<PackageReference Include="Google.Apis.Calendar.v3" Version="1.55.0.2410" />
|
||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.1.0" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.0.0" />
|
||||
<PackageReference Include="NAudio" Version="2.0.1" />
|
||||
<PackageReference Include="Stone_Red-C-Sharp-Utilities" Version="1.0.2.1" />
|
||||
<PackageReference Include="System.Management" Version="5.0.0" />
|
||||
|
||||
@@ -197,6 +197,11 @@ namespace DesktopMagic
|
||||
{
|
||||
EditMode = (bool)EditCheckBox.IsChecked;
|
||||
SaveLayout();
|
||||
foreach (var item in Windows)
|
||||
{
|
||||
WindowPos.SendWpfWindowBack(item);
|
||||
WindowPos.SendWpfWindowBack(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckBox_Click(object sender, RoutedEventArgs e)
|
||||
@@ -263,6 +268,7 @@ namespace DesktopMagic
|
||||
|
||||
window.ShowInTaskbar = false;
|
||||
window.Show();
|
||||
window.ContentRendered += PluginWindow_ContentRendered;
|
||||
window.Closing += DisplayWindow_Closing;
|
||||
Windows.Add(window);
|
||||
WindowNames.Add(window.Title);
|
||||
@@ -283,6 +289,12 @@ namespace DesktopMagic
|
||||
SaveLayout();
|
||||
}
|
||||
|
||||
private void PluginWindow_ContentRendered(object sender, EventArgs e)
|
||||
{
|
||||
WindowPos.SendWpfWindowBack(sender as Window);
|
||||
WindowPos.SendWpfWindowBack(sender as Window);
|
||||
}
|
||||
|
||||
private void DisplayWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
e.Cancel = blockWindowsClosing;
|
||||
|
||||
@@ -88,12 +88,12 @@ namespace DesktopMagic
|
||||
if (MainWindow.EditMode)
|
||||
{
|
||||
panel.Visibility = Visibility.Visible;
|
||||
new WindowPos().SetIsLocked(this, false);
|
||||
WindowPos.SetIsLocked(this, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.Visibility = Visibility.Collapsed;
|
||||
new WindowPos().SetIsLocked(this, true);
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
}
|
||||
if (!this.IsLoaded)
|
||||
{
|
||||
|
||||
@@ -97,14 +97,14 @@ namespace DesktopMagic
|
||||
if (MainWindow.EditMode)
|
||||
{
|
||||
panel.Visibility = Visibility.Visible;
|
||||
new WindowPos().SetIsLocked(this, false);
|
||||
WindowPos.SetIsLocked(this, false);
|
||||
tileBar.CaptionHeight = tileBar.CaptionHeight = this.ActualHeight - 10 < 0 ? 0 : this.ActualHeight - 10;
|
||||
this.ResizeMode = ResizeMode.CanResize;
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.Visibility = Visibility.Collapsed;
|
||||
new WindowPos().SetIsLocked(this, true);
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
tileBar.CaptionHeight = 0;
|
||||
this.ResizeMode = ResizeMode.NoResize;
|
||||
}
|
||||
|
||||
@@ -60,12 +60,12 @@ namespace DesktopMagic
|
||||
if (MainWindow.EditMode)
|
||||
{
|
||||
panel.Visibility = Visibility.Visible;
|
||||
new WindowPos().SetIsLocked(this, false);
|
||||
WindowPos.SetIsLocked(this, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.Visibility = Visibility.Collapsed;
|
||||
new WindowPos().SetIsLocked(this, true);
|
||||
WindowPos.SetIsLocked(this, true);
|
||||
}
|
||||
|
||||
textBlock.FontFamily = new FontFamily(MainWindow.GlobalFont);
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace DesktopMagic
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int GetWindowRect(IntPtr hwnd, out Rectangle rect);
|
||||
|
||||
public void SendWpfWindowBack(Window window)
|
||||
public static void SendWpfWindowBack(Window window)
|
||||
{
|
||||
var hWnd = new WindowInteropHelper(window).Handle;
|
||||
SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE1 | SWP_NOMOVE1);
|
||||
@@ -51,7 +51,7 @@ namespace DesktopMagic
|
||||
return (bool)obj.GetValue(IsLockedProperty);
|
||||
}
|
||||
|
||||
public void SetIsLocked(DependencyObject obj, bool value)
|
||||
public static void SetIsLocked(DependencyObject obj, bool value)
|
||||
{
|
||||
obj.SetValue(IsLockedProperty, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user