Browse Source

remove unused code.

pull/6610/head
Dan Walmsley 5 years ago
parent
commit
35dc6ced03
  1. 32
      src/Windows/Avalonia.Win32/TrayIconImpl.cs

32
src/Windows/Avalonia.Win32/TrayIconImpl.cs

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives.PopupPositioning; using Avalonia.Controls.Primitives.PopupPositioning;
using Avalonia.Platform; using Avalonia.Platform;
@ -24,7 +21,7 @@ namespace Avalonia.Win32
internal static void ProcWnd(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam) internal static void ProcWnd(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{ {
if(msg == (int)CustomWindowsMessage.WM_TRAYMOUSE && s_trayIcons.ContainsKey(wParam.ToInt32())) if (msg == (int)CustomWindowsMessage.WM_TRAYMOUSE && s_trayIcons.ContainsKey(wParam.ToInt32()))
{ {
s_trayIcons[wParam.ToInt32()].WndProc(hWnd, msg, wParam, lParam); s_trayIcons[wParam.ToInt32()].WndProc(hWnd, msg, wParam, lParam);
} }
@ -63,14 +60,8 @@ namespace Avalonia.Win32
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
/// <summary>
/// Custom Win32 window messages for the NotifyIcon
/// </summary>
public enum CustomWindowsMessage : uint
{
WM_TRAYICON = WindowsMessage.WM_APP + 1024,
WM_TRAYMOUSE = WindowsMessage.WM_USER + 1024
}
private void UpdateIcon(bool remove = false) private void UpdateIcon(bool remove = false)
{ {
var iconData = new NOTIFYICONDATA() var iconData = new NOTIFYICONDATA()
@ -106,23 +97,15 @@ namespace Avalonia.Win32
private IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam) private IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{ {
Debug.WriteLine(wParam);
if (msg == (uint)CustomWindowsMessage.WM_TRAYMOUSE) if (msg == (uint)CustomWindowsMessage.WM_TRAYMOUSE)
{ {
// Determine the type of message and call the matching event handlers // Determine the type of message and call the matching event handlers
switch (lParam.ToInt32()) switch (lParam.ToInt32())
{ {
case (int)WindowsMessage.WM_LBUTTONUP: case (int)WindowsMessage.WM_LBUTTONUP:
//if (!_doubleClick)
//{
// Click?.Invoke(this, new EventArgs());
//}
//_doubleClick = false;
break; break;
case (int)WindowsMessage.WM_LBUTTONDBLCLK: case (int)WindowsMessage.WM_LBUTTONDBLCLK:
//DoubleClick?.Invoke(this, new EventArgs());
//_doubleClick = true;
break; break;
case (int)WindowsMessage.WM_RBUTTONUP: case (int)WindowsMessage.WM_RBUTTONUP:
@ -169,6 +152,15 @@ namespace Avalonia.Win32
_trayMenu.Show(); _trayMenu.Show();
} }
/// <summary>
/// Custom Win32 window messages for the NotifyIcon
/// </summary>
enum CustomWindowsMessage : uint
{
WM_TRAYICON = WindowsMessage.WM_APP + 1024,
WM_TRAYMOUSE = WindowsMessage.WM_USER + 1024
}
class TrayPopupRoot : Window class TrayPopupRoot : Window
{ {
private ManagedPopupPositioner _positioner; private ManagedPopupPositioner _positioner;

Loading…
Cancel
Save