fix: publishing in VS (cherrypicked from 2.6.0)

This commit is contained in:
pizzaboxer 2024-02-23 02:44:48 +00:00
parent 880c076fcd
commit 48db881ceb
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
7 changed files with 45 additions and 4 deletions

View File

@ -2,8 +2,10 @@
using System.Windows;
using System.Windows.Threading;
#if !DEBUG_ROSLYN_PUBLISH
using Windows.Win32;
using Windows.Win32.Foundation;
#endif
namespace Bloxstrap
{
@ -198,7 +200,9 @@ namespace Bloxstrap
{
var handle = menuProcess.MainWindowHandle;
Logger.WriteLine(LOG_IDENT, $"Found an already existing menu window with handle {handle}");
#if !DEBUG_ROSLYN_PUBLISH
PInvoke.SetForegroundWindow((HWND)handle);
#endif
}
else
{

View File

@ -10,6 +10,7 @@
<Version>2.5.4</Version>
<FileVersion>2.5.4.0</FileVersion>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
@ -40,11 +41,10 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageReference Include="DiscordRichPresence" Version="1.2.1.24" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.18-beta">
<!--<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.49-beta">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="securifybv.ShellLink" Version="0.1.0" />
</ItemGroup>
<ItemGroup>
@ -60,4 +60,25 @@
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="NativeMethods.txt" />
<!-- Provide the path to the winmds used as input into the analyzer. -->
<CompilerVisibleProperty Include="CsWin32InputMetadataPaths" />
<CompilerVisibleProperty Include="CsWin32InputDocPaths" />
</ItemGroup>
<Target Name="AssembleCsWin32InputPaths" BeforeTargets="GenerateMSBuildEditorConfigFileCore">
<!-- Roslyn only allows source generators to see msbuild properties, to lift msbuild items into semicolon-delimited properties. -->
<PropertyGroup>
<CsWin32InputMetadataPaths>@(ProjectionMetadataWinmd->'%(FullPath)','|')</CsWin32InputMetadataPaths>
<CsWin32InputDocPaths>@(ProjectionDocs->'%(FullPath)','|')</CsWin32InputDocPaths>
</PropertyGroup>
</Target>
<Target Name="FixMds" BeforeTargets="CoreCompile" Condition="'@(ProjectionMetadataWinmd)'==''">
<ItemGroup>
<ProjectionMetadataWinmd Include="$(UserProfile)\.nuget\packages\microsoft.windows.sdk.win32metadata\55.0.45-preview\Windows.Win32.winmd" />
</ItemGroup>
</Target>
</Project>

View File

@ -2,4 +2,4 @@
FlashWindow
GetWindowLong
SetWindowLong
EnumDisplaySettings
EnumDisplaySettings

View File

@ -6,9 +6,11 @@ using Wpf.Ui.Appearance;
using Wpf.Ui.Mvvm.Contracts;
using Wpf.Ui.Mvvm.Services;
#if !DEBUG_ROSLYN_PUBLISH
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
#endif
using Bloxstrap.Integrations;
@ -90,11 +92,13 @@ namespace Bloxstrap.UI.Elements.ContextMenu
// this is done to register the context menu wrapper as a tool window so it doesnt appear in the alt+tab switcher
// https://stackoverflow.com/a/551847/11852173
#if !DEBUG_ROSLYN_PUBLISH
HWND hWnd = (HWND)new WindowInteropHelper(this).Handle;
int exStyle = PInvoke.GetWindowLong(hWnd, WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE);
exStyle |= 0x00000080; //NativeMethods.WS_EX_TOOLWINDOW;
PInvoke.SetWindowLong(hWnd, WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE, exStyle);
#endif
}
private void Window_Closed(object sender, EventArgs e) => App.Logger.WriteLine("MenuContainer::Window_Closed", "Context menu container closed");

View File

@ -1,8 +1,10 @@
using System.Media;
using System.Windows.Interop;
#if !DEBUG_ROSLYN_PUBLISH
using Windows.Win32;
using Windows.Win32.Foundation;
#endif
namespace Bloxstrap.UI.Elements.Dialogs
{
@ -33,7 +35,9 @@ namespace Bloxstrap.UI.Elements.Dialogs
Loaded += delegate
{
var hWnd = new WindowInteropHelper(this).Handle;
#if !DEBUG_ROSLYN_PUBLISH
PInvoke.FlashWindow((HWND)hWnd, true);
#endif
};
}

View File

@ -2,8 +2,10 @@
using System.Windows;
using System.Windows.Interop;
#if !DEBUG_ROSLYN_PUBLISH
using Windows.Win32;
using Windows.Win32.Foundation;
#endif
namespace Bloxstrap.UI.Elements.Dialogs
{
@ -61,7 +63,9 @@ namespace Bloxstrap.UI.Elements.Dialogs
Loaded += delegate
{
IntPtr hWnd = new WindowInteropHelper(this).Handle;
#if !DEBUG_ROSLYN_PUBLISH
PInvoke.FlashWindow((HWND)hWnd, true);
#endif
};
}

View File

@ -4,8 +4,10 @@ using System.Windows.Controls;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
#if !DEBUG_ROSLYN_PUBLISH
using Windows.Win32;
using Windows.Win32.Foundation;
#endif
using Bloxstrap.UI.Utility;
@ -111,7 +113,9 @@ namespace Bloxstrap.UI.Elements.Dialogs
Loaded += delegate
{
var hWnd = new WindowInteropHelper(this).Handle;
#if !DEBUG_ROSLYN_PUBLISH
PInvoke.FlashWindow((HWND)hWnd, true);
#endif
};
}