-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
222 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System.Diagnostics; | ||
using System.Reflection; | ||
using NotifyIcon = NotifyIconEx.NotifyIcon; | ||
|
||
namespace WiceApp1; | ||
|
||
internal class App : Wice.Application | ||
{ | ||
public App() | ||
{ | ||
var notifyIcon = new NotifyIcon() | ||
{ | ||
Text = "NotifyIcon", | ||
Icon = Icon.ExtractAssociatedIcon(Process.GetCurrentProcess().MainModule?.FileName!)!, | ||
}; | ||
notifyIcon.AddMenu("MenuItem1", new Bitmap(ResourceHelper.GetStream("NotifyIcon.Demo.Wice.Assets.Images.Lock.png"))); | ||
var toDisableItem = notifyIcon.AddMenu("MenuItem2", new Bitmap(ResourceHelper.GetStream("NotifyIcon.Demo.Wice.Assets.Images.Lock.png"))); | ||
notifyIcon.AddMenu("-"); | ||
notifyIcon.AddMenu("MenuItem3"); | ||
notifyIcon.AddMenu("MenuItem4", true); | ||
notifyIcon.AddMenu("MenuItem5", OnClick); | ||
notifyIcon.AddMenu("-"); | ||
notifyIcon.AddMenu("SubMenu", null!, | ||
[ | ||
new ToolStripMenuItem("SubMenuItem1"), | ||
new ToolStripMenuItem("SubMenuItem2"), | ||
new ToolStripMenuItem("SubMenuItem3"), | ||
new ToolStripMenuItem("SubSubMenu", null!, | ||
[ | ||
new ToolStripMenuItem("SubSubMenuItem1"), | ||
new ToolStripMenuItem("SubSubMenuItem2"), | ||
new ToolStripMenuItem("SubSubMenuItem3") | ||
]) | ||
]); | ||
notifyIcon.AddMenu("-"); | ||
notifyIcon.AddMenu("Exit", (_, _) => Environment.Exit(0)); | ||
notifyIcon.BalloonTipShown += OnBalloonTipShown; | ||
|
||
toDisableItem.Enabled = false; | ||
|
||
void OnBalloonTipShown(object? sender, EventArgs e) | ||
{ | ||
Debug.WriteLine("OnBalloonTipShown"); | ||
} | ||
|
||
void OnClick(object? sender, EventArgs e) | ||
{ | ||
notifyIcon.BalloonTipTitle = "Title"; | ||
notifyIcon.BalloonTipText = "This Balloon Tips"; | ||
notifyIcon.ShowBalloonTip(5); | ||
} | ||
} | ||
} | ||
|
||
file static class ResourceHelper | ||
{ | ||
public static Stream GetStream(string name, Assembly assembly = null!) | ||
{ | ||
Stream stream = (assembly ?? Assembly.GetExecutingAssembly()).GetManifestResourceStream(name)!; | ||
return stream; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using DirectN; | ||
using Wice; | ||
using Wice.Effects; | ||
|
||
namespace WiceApp1; | ||
|
||
public class MainWindow : Window, IDisposable | ||
{ | ||
public MainWindow() | ||
{ | ||
// we draw our own titlebar using Wice itself | ||
WindowsFrameMode = WindowsFrameMode.None; | ||
|
||
// resize to 66% of the screen | ||
var monitor = GetMonitor().Bounds; | ||
ResizeClient(monitor.Width * 2 / 3, monitor.Height * 2 / 3); | ||
|
||
// the EnableBlurBehind call may be necessary when using the Windows' acrylic depending on Windows version | ||
// otherwise the window will be (almost) black | ||
Native.EnableBlurBehind(); | ||
RenderBrush = AcrylicBrush.CreateAcrylicBrush( | ||
CompositionDevice, | ||
_D3DCOLORVALUE.White, | ||
0.2f, | ||
useWindowsAcrylic: true | ||
); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net472</TargetFramework> | ||
<LangVersion>12.0</LangVersion> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
<ApplicationManifest>app.manifest</ApplicationManifest> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Resource Include="Assets\Images\*.png" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="Assets\Images\*.png" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="DirectN" Version="1.16.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Wice"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>packages\Wice.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Windows.SDK.Contracts"> | ||
<Version>10.0.26100.1</Version> | ||
</PackageReference> | ||
<PackageReference Include="System.Numerics.Vectors"> | ||
<Version>4.5.0</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\NotifyIcon\NotifyIcon.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace WiceApp1; | ||
|
||
internal class Program | ||
{ | ||
public static void Main() | ||
{ | ||
using var dw = new App(); | ||
using var win = new MainWindow(); | ||
win.Center(); | ||
win.Show(); | ||
dw.Run(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<assemblyIdentity version="1.0.0.0" name="Wice.Samples.Gallery"/> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||
<security> | ||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<!-- UAC Manifest Options | ||
If you want to change the Windows User Account Control level replace the | ||
requestedExecutionLevel node with one of the following. | ||
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> | ||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> | ||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" /> | ||
Specifying requestedExecutionLevel element will disable file and registry virtualization. | ||
Remove this element if your application requires this virtualization for backwards | ||
compatibility. | ||
--> | ||
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> | ||
</requestedPrivileges> | ||
</security> | ||
</trustInfo> | ||
|
||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||
<application> | ||
<!-- Windows 10 --> | ||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> | ||
</application> | ||
</compatibility> | ||
|
||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher | ||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need | ||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should | ||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. --> | ||
|
||
<application xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<windowsSettings> | ||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> | ||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> | ||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware> | ||
</windowsSettings> | ||
</application> | ||
|
||
|
||
<dependency> | ||
<dependentAssembly> | ||
<assemblyIdentity | ||
type="win32" | ||
name="Microsoft.Windows.Common-Controls" | ||
version="6.0.0.0" | ||
processorArchitecture="*" | ||
publicKeyToken="6595b64144ccf1df" | ||
language="*" | ||
/> | ||
</dependentAssembly> | ||
</dependency> | ||
|
||
|
||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters