parent
b40ff6d6ee
commit
8c2edd69ff
Binary file not shown.
Binary file not shown.
@ -0,0 +1,25 @@
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/vscode,dotnetcore
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=vscode,dotnetcore
|
||||
|
||||
### DotnetCore ###
|
||||
# .NET Core build folders
|
||||
bin/
|
||||
obj/
|
||||
|
||||
# Common node modules locations
|
||||
/node_modules
|
||||
/wwwroot/node_modules
|
||||
|
||||
### vscode ###
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/vscode,dotnetcore
|
||||
|
||||
# ignore logs
|
||||
logs/
|
@ -0,0 +1,13 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:UserInterface"
|
||||
x:Class="UserInterface.App">
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator/>
|
||||
</Application.DataTemplates>
|
||||
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
After Width: | Height: | Size: 69 KiB |
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>False</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\hass-workstation-logo.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.9.12" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.9.12" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.12" />
|
||||
<PackageReference Include="Avalonia.Win32" Version="0.9.12" />
|
||||
<PackageReference Include="JKang.IpcServiceFramework.Client.NamedPipe" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\hass-workstation-service\hass-workstation-service.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\BrokerSettings\BrokerSettings.axaml.cs">
|
||||
<DependentUpon>%(Filename)</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_LastSelectedProfileId>C:\Users\Maurits\Documents\Repo\hass-desktop-service\UserInterface\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -0,0 +1,32 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using System;
|
||||
using UserInterface.ViewModels;
|
||||
|
||||
namespace UserInterface
|
||||
{
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
public bool SupportsRecycling => false;
|
||||
|
||||
public IControl Build(object data)
|
||||
{
|
||||
var name = data.GetType().FullName.Replace("ViewModel", "View");
|
||||
var type = Type.GetType(name);
|
||||
|
||||
if (type != null)
|
||||
{
|
||||
return (Control)Activator.CreateInstance(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new TextBlock { Text = "Not Found: " + name };
|
||||
}
|
||||
}
|
||||
|
||||
public bool Match(object data)
|
||||
{
|
||||
return data is ViewModelBase;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="UserInterface.Views.BrokerSettings">
|
||||
<StackPanel Margin="30" HorizontalAlignment="Left">
|
||||
<ContentControl FontSize="18" FontWeight="Bold">Mqtt broker</ContentControl>
|
||||
<ContentControl FontSize="18" Margin="0 30 0 10">IP or hostname</ContentControl>
|
||||
<TextBox Text="{Binding Host}" HorizontalAlignment="Left" Width="100" Watermark="192.168.1.200"/>
|
||||
<ContentControl FontSize="18" Margin="0 30 0 10">Username</ContentControl>
|
||||
<TextBox Text="{Binding Username}" Width="200"/>
|
||||
<ContentControl FontSize="18" Margin="0 30 0 10">Password</ContentControl>
|
||||
<TextBox Text="{Binding Password}" Width="200" PasswordChar="•"/>
|
||||
<Button Width="75" HorizontalAlignment="Right" Margin="0 40 0 10" Click="Configure">Save</Button>
|
||||
</StackPanel>
|
||||
</UserControl>
|
@ -0,0 +1,20 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:UserInterface.ViewModels;assembly=UserInterface"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:views="clr-namespace:UserInterface.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="UserInterface.Views.MainWindow"
|
||||
Icon="/Assets/hass-workstation-logo.ico"
|
||||
Title="UserInterface">
|
||||
|
||||
<Design.DataContext>
|
||||
<vm:MainWindowViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
<views:BrokerSettings/>
|
||||
<!--<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
|
||||
|
||||
|
||||
</Window>
|
@ -0,0 +1,61 @@
|
||||
namespace MangaReader.Avalonia.Platform.Win.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// Flags that define the icon that is shown on a balloon
|
||||
/// tooltip.
|
||||
/// </summary>
|
||||
public enum BalloonFlags
|
||||
{
|
||||
/// <summary>
|
||||
/// No icon is displayed.
|
||||
/// </summary>
|
||||
None = 0x00,
|
||||
|
||||
/// <summary>
|
||||
/// An information icon is displayed.
|
||||
/// </summary>
|
||||
Info = 0x01,
|
||||
|
||||
/// <summary>
|
||||
/// A warning icon is displayed.
|
||||
/// </summary>
|
||||
Warning = 0x02,
|
||||
|
||||
/// <summary>
|
||||
/// An error icon is displayed.
|
||||
/// </summary>
|
||||
Error = 0x03,
|
||||
|
||||
/// <summary>
|
||||
/// Windows XP Service Pack 2 (SP2) and later.
|
||||
/// Use a custom icon as the title icon.
|
||||
/// </summary>
|
||||
User = 0x04,
|
||||
|
||||
/// <summary>
|
||||
/// Windows XP (Shell32.dll version 6.0) and later.
|
||||
/// Do not play the associated sound. Applies only to balloon ToolTips.
|
||||
/// </summary>
|
||||
NoSound = 0x10,
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista (Shell32.dll version 6.0.6) and later. The large version
|
||||
/// of the icon should be used as the balloon icon. This corresponds to the
|
||||
/// icon with dimensions SM_CXICON x SM_CYICON. If this flag is not set,
|
||||
/// the icon with dimensions XM_CXSMICON x SM_CYSMICON is used.<br/>
|
||||
/// - This flag can be used with all stock icons.<br/>
|
||||
/// - Applications that use older customized icons (NIIF_USER with hIcon) must
|
||||
/// provide a new SM_CXICON x SM_CYICON version in the tray icon (hIcon). These
|
||||
/// icons are scaled down when they are displayed in the System Tray or
|
||||
/// System Control Area (SCA).<br/>
|
||||
/// - New customized icons (NIIF_USER with hBalloonIcon) must supply an
|
||||
/// SM_CXICON x SM_CYICON version in the supplied icon (hBalloonIcon).
|
||||
/// </summary>
|
||||
LargeIcon = 0x20,
|
||||
|
||||
/// <summary>
|
||||
/// Windows 7 and later.
|
||||
/// </summary>
|
||||
RespectQuietTime = 0x80
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
using System;
|
||||
|
||||
namespace MangaReader.Avalonia.Platform.Win.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates which members of a <see cref="NotifyIconData"/> structure
|
||||
/// were set, and thus contain valid data or provide additional information
|
||||
/// to the ToolTip as to how it should display.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum IconDataMembers
|
||||
{
|
||||
/// <summary>
|
||||
/// The message ID is set.
|
||||
/// </summary>
|
||||
Message = 0x01,
|
||||
|
||||
/// <summary>
|
||||
/// The notification icon is set.
|
||||
/// </summary>
|
||||
Icon = 0x02,
|
||||
|
||||
/// <summary>
|
||||
/// The tooltip is set.
|
||||
/// </summary>
|
||||
Tip = 0x04,
|
||||
|
||||
/// <summary>
|
||||
/// State information (<see cref="IconState"/>) is set. This
|
||||
/// applies to both <see cref="NotifyIconData.IconState"/> and
|
||||
/// <see cref="NotifyIconData.StateMask"/>.
|
||||
/// </summary>
|
||||
State = 0x08,
|
||||
|
||||
/// <summary>
|
||||
/// The balloon ToolTip is set. Accordingly, the following
|
||||
/// members are set: <see cref="NotifyIconData.BalloonText"/>,
|
||||
/// <see cref="NotifyIconData.BalloonTitle"/>, <see cref="NotifyIconData.BalloonFlags"/>,
|
||||
/// and <see cref="NotifyIconData.VersionOrTimeout"/>.
|
||||
/// </summary>
|
||||
Info = 0x10,
|
||||
|
||||
// Internal identifier is set. Reserved, thus commented out.
|
||||
//Guid = 0x20,
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista (Shell32.dll version 6.0.6) and later. If the ToolTip
|
||||
/// cannot be displayed immediately, discard it.<br/>
|
||||
/// Use this flag for ToolTips that represent real-time information which
|
||||
/// would be meaningless or misleading if displayed at a later time.
|
||||
/// For example, a message that states "Your telephone is ringing."<br/>
|
||||
/// This modifies and must be combined with the <see cref="Info"/> flag.
|
||||
/// </summary>
|
||||
Realtime = 0x40,
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista (Shell32.dll version 6.0.6) and later.
|
||||
/// Use the standard ToolTip. Normally, when uVersion is set
|
||||
/// to NOTIFYICON_VERSION_4, the standard ToolTip is replaced
|
||||
/// by the application-drawn pop-up user interface (UI).
|
||||
/// If the application wants to show the standard tooltip
|
||||
/// in that case, regardless of whether the on-hover UI is showing,
|
||||
/// it can specify NIF_SHOWTIP to indicate the standard tooltip
|
||||
/// should still be shown.<br/>
|
||||
/// Note that the NIF_SHOWTIP flag is effective until the next call
|
||||
/// to Shell_NotifyIcon.
|
||||
/// </summary>
|
||||
UseLegacyToolTips = 0x80
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
namespace MangaReader.Avalonia.Platform.Win.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// The state of the icon - can be set to
|
||||
/// hide the icon.
|
||||
/// </summary>
|
||||
public enum IconState
|
||||
{
|
||||
/// <summary>
|
||||
/// The icon is visible.
|
||||
/// </summary>
|
||||
Visible = 0x00,
|
||||
|
||||
/// <summary>
|
||||
/// Hide the icon.
|
||||
/// </summary>
|
||||
Hidden = 0x01,
|
||||
|
||||
// The icon is shared - currently not supported, thus commented out.
|
||||
//Shared = 0x02
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
namespace MangaReader.Avalonia.Platform.Win.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// Main operations performed on the
|
||||
/// <see cref="WinApi.Shell_NotifyIcon"/> function.
|
||||
/// </summary>
|
||||
public enum NotifyCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// The taskbar icon is being created.
|
||||
/// </summary>
|
||||
Add = 0x00,
|
||||
|
||||
/// <summary>
|
||||
/// The settings of the taskbar icon are being updated.
|
||||
/// </summary>
|
||||
Modify = 0x01,
|
||||
|
||||
/// <summary>
|
||||
/// The taskbar icon is deleted.
|
||||
/// </summary>
|
||||
Delete = 0x02,
|
||||
|
||||
/// <summary>
|
||||
/// Focus is returned to the taskbar icon. Currently not in use.
|
||||
/// </summary>
|
||||
SetFocus = 0x03,
|
||||
|
||||
/// <summary>
|
||||
/// Shell32.dll version 5.0 and later only. Instructs the taskbar
|
||||
/// to behave according to the version number specified in the
|
||||
/// uVersion member of the structure pointed to by lpdata.
|
||||
/// This message allows you to specify whether you want the version
|
||||
/// 5.0 behavior found on Microsoft Windows 2000 systems, or the
|
||||
/// behavior found on earlier Shell versions. The default value for
|
||||
/// uVersion is zero, indicating that the original Windows 95 notify
|
||||
/// icon behavior should be used.
|
||||
/// </summary>
|
||||
SetVersion = 0x04
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MangaReader.Avalonia.Platform.Win.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// A struct that is submitted in order to configure
|
||||
/// the taskbar icon. Provides various members that
|
||||
/// can be configured partially, according to the
|
||||
/// values of the <see cref="IconDataMembers"/>
|
||||
/// that were defined.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
public struct NotifyIconData
|
||||
{
|
||||
/// <summary>
|
||||
/// Size of this structure, in bytes.
|
||||
/// </summary>
|
||||
public uint cbSize;
|
||||
|
||||
/// <summary>
|
||||
/// Handle to the window that receives notification messages associated with an icon in the
|
||||
/// taskbar status area. The Shell uses hWnd and uID to identify which icon to operate on
|
||||
/// when Shell_NotifyIcon is invoked.
|
||||
/// </summary>
|
||||
public IntPtr WindowHandle;
|
||||
|
||||
/// <summary>
|
||||
/// Application-defined identifier of the taskbar icon. The Shell uses hWnd and uID to identify
|
||||
/// which icon to operate on when Shell_NotifyIcon is invoked. You can have multiple icons
|
||||
/// associated with a single hWnd by assigning each a different uID. This feature, however
|
||||
/// is currently not used.
|
||||
/// </summary>
|
||||
public uint TaskbarIconId;
|
||||
|
||||
/// <summary>
|
||||
/// Flags that indicate which of the other members contain valid data. This member can be
|
||||
/// a combination of the NIF_XXX constants.
|
||||
/// </summary>
|
||||
public IconDataMembers ValidMembers;
|
||||
|
||||
/// <summary>
|
||||
/// Application-defined message identifier. The system uses this identifier to send
|
||||
/// notifications to the window identified in hWnd.
|
||||
/// </summary>
|
||||
public uint CallbackMessageId;
|
||||
|
||||
/// <summary>
|
||||
/// A handle to the icon that should be displayed. Just
|
||||
/// <c>Icon.Handle</c>.
|
||||
/// </summary>
|
||||
public IntPtr IconHandle;
|
||||
|
||||
/// <summary>
|
||||
/// String with the text for a standard ToolTip. It can have a maximum of 64 characters including
|
||||
/// the terminating NULL. For Version 5.0 and later, szTip can have a maximum of
|
||||
/// 128 characters, including the terminating NULL.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||
public string ToolTipText;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// State of the icon. Remember to also set the <see cref="StateMask"/>.
|
||||
/// </summary>
|
||||
public IconState IconState;
|
||||
|
||||
/// <summary>
|
||||
/// A value that specifies which bits of the state member are retrieved or modified.
|
||||
/// For example, setting this member to <see cref="Interop.IconState.Hidden"/>
|
||||
/// causes only the item's hidden
|
||||
/// state to be retrieved.
|
||||
/// </summary>
|
||||
public IconState StateMask;
|
||||
|
||||
/// <summary>
|
||||
/// String with the text for a balloon ToolTip. It can have a maximum of 255 characters.
|
||||
/// To remove the ToolTip, set the NIF_INFO flag in uFlags and set szInfo to an empty string.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string BalloonText;
|
||||
|
||||
/// <summary>
|
||||
/// Mainly used to set the version when <see cref="WinApi.Shell_NotifyIcon"/> is invoked
|
||||
/// with <see cref="NotifyCommand.SetVersion"/>. However, for legacy operations,
|
||||
/// the same member is also used to set timeouts for balloon ToolTips.
|
||||
/// </summary>
|
||||
public uint VersionOrTimeout;
|
||||
|
||||
/// <summary>
|
||||
/// String containing a title for a balloon ToolTip. This title appears in boldface
|
||||
/// above the text. It can have a maximum of 63 characters.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
|
||||
public string BalloonTitle;
|
||||
|
||||
/// <summary>
|
||||
/// Adds an icon to a balloon ToolTip, which is placed to the left of the title. If the
|
||||
/// <see cref="BalloonTitle"/> member is zero-length, the icon is not shown.
|
||||
/// </summary>
|
||||
public BalloonFlags BalloonFlags;
|
||||
|
||||
/// <summary>
|
||||
/// Windows XP (Shell32.dll version 6.0) and later.<br/>
|
||||
/// - Windows 7 and later: A registered GUID that identifies the icon.
|
||||
/// This value overrides uID and is the recommended method of identifying the icon.<br/>
|
||||
/// - Windows XP through Windows Vista: Reserved.
|
||||
/// </summary>
|
||||
public Guid TaskbarIconGuid;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista (Shell32.dll version 6.0.6) and later. The handle of a customized
|
||||
/// balloon icon provided by the application that should be used independently
|
||||
/// of the tray icon. If this member is non-NULL and the <see cref="Interop.BalloonFlags.User"/>
|
||||
/// flag is set, this icon is used as the balloon icon.<br/>
|
||||
/// If this member is NULL, the legacy behavior is carried out.
|
||||
/// </summary>
|
||||
public IntPtr CustomBalloonIconHandle;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a default data structure that provides
|
||||
/// a hidden taskbar icon without the icon being set.
|
||||
/// </summary>
|
||||
/// <param name="handle"></param>
|
||||
/// <returns>NotifyIconData</returns>
|
||||
public static NotifyIconData CreateDefault(IntPtr handle)
|
||||
{
|
||||
var data = new NotifyIconData();
|
||||
|
||||
//use the current size
|
||||
data.cbSize = (uint) Marshal.SizeOf(data);
|
||||
|
||||
data.WindowHandle = handle;
|
||||
data.TaskbarIconId = 0x0;
|
||||
data.CallbackMessageId = WindowMessageSink.CallbackMessageId;
|
||||
data.VersionOrTimeout = (uint) NotifyIconVersion.Vista;
|
||||
|
||||
data.IconHandle = IntPtr.Zero;
|
||||
|
||||
//hide initially
|
||||
data.IconState = IconState.Hidden;
|
||||
data.StateMask = IconState.Hidden;
|
||||
|
||||
//set flags
|
||||
data.ValidMembers = IconDataMembers.Message | IconDataMembers.Icon | IconDataMembers.Tip | IconDataMembers.UseLegacyToolTips;
|
||||
|
||||
//reset strings
|
||||
data.ToolTipText = data.BalloonText = data.BalloonTitle = string.Empty;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MangaReader.Avalonia.Platform.Win.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// Win32 API imports.
|
||||
/// </summary>
|
||||
internal static class WinApi
|
||||
{
|
||||
private const string User32 = "user32.dll";
|
||||
|
||||
/// <summary>
|
||||
/// Creates, updates or deletes the taskbar icon.
|
||||
/// </summary>
|
||||
[DllImport("shell32.Dll", CharSet = CharSet.Unicode)]
|
||||
public static extern bool Shell_NotifyIcon(NotifyCommand cmd, [In] ref NotifyIconData data);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates the helper window that receives messages from the taskar icon.
|
||||
/// </summary>
|
||||
[DllImport(User32, EntryPoint = "CreateWindowExW", SetLastError = true)]
|
||||
public static extern IntPtr CreateWindowEx(int dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, int dwStyle, int x, int y,
|
||||
int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance,
|
||||
IntPtr lpParam);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Processes a default windows procedure.
|
||||
/// </summary>
|
||||
[DllImport(User32)]
|
||||
public static extern IntPtr DefWindowProc(IntPtr hWnd, uint msg, IntPtr wparam, IntPtr lparam);
|
||||
|
||||
/// <summary>
|
||||
/// Registers the helper window class.
|
||||
/// </summary>
|
||||
[DllImport(User32, EntryPoint = "RegisterClassW", SetLastError = true)]
|
||||
public static extern short RegisterClass(ref WindowClass lpWndClass);
|
||||
|
||||
/// <summary>
|
||||
/// Registers a listener for a window message.
|
||||
/// </summary>
|
||||
/// <param name="lpString"></param>
|
||||
/// <returns>uint</returns>
|
||||
[DllImport(User32, EntryPoint = "RegisterWindowMessageW")]
|
||||
public static extern uint RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString);
|
||||
|
||||
/// <summary>
|
||||
/// Used to destroy the hidden helper window that receives messages from the
|
||||
/// taskbar icon.
|
||||
/// </summary>
|
||||
/// <param name="hWnd"></param>
|
||||
/// <returns>bool</returns>
|
||||
[DllImport(User32, SetLastError = true)]
|
||||
public static extern bool DestroyWindow(IntPtr hWnd);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
To use the Avalonia CI feed to get unstable packages, move this file to the root of your solution.
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="AvaloniaCI" value="https://www.myget.org/F/avalonia-ci/api/v2" />
|
||||
</packageSources>
|
||||
</configuration>
|
Loading…
Reference in new issue