|
|
|
|
using SlnMesnac.Model.AirportApiEntity;
|
|
|
|
|
using SlnMesnac.TouchSocket;
|
|
|
|
|
using SlnMesnac.WPF.ViewModel;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace SlnMesnac.WPF
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
{
|
|
|
|
|
//托盘
|
|
|
|
|
NotifyIcon trayIcon;
|
|
|
|
|
//注册AreaIcon属性,用于托盘的图标
|
|
|
|
|
public static readonly DependencyProperty AreaIconProperty =
|
|
|
|
|
DependencyProperty.Register("AreaIcon", typeof(ImageSource), typeof(MainWindow));
|
|
|
|
|
//注册AreaText属性,用于鼠标滑到托盘图标时显示的文字
|
|
|
|
|
public static readonly DependencyProperty AreaTextProperty =
|
|
|
|
|
DependencyProperty.Register("AreaText", typeof(string), typeof(MainWindow));
|
|
|
|
|
//注册AreaVisibility属性,用于显示隐藏托盘图标
|
|
|
|
|
public static readonly DependencyProperty AreaVisibilityProperty =
|
|
|
|
|
DependencyProperty.Register("AreaVisibility", typeof(bool), typeof(MainWindow));
|
|
|
|
|
//注册AreaMenuItems属性,用于托盘右键在单的列表
|
|
|
|
|
public static readonly DependencyProperty AreaMenuItemsProperty =
|
|
|
|
|
DependencyProperty.Register("AreaMenuItems", typeof(List<MenuItem>), typeof(MainWindow), new PropertyMetadata(new List<MenuItem>()));
|
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
this.DataContext = new MainWindowViewModel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddTrayIcon()
|
|
|
|
|
{
|
|
|
|
|
if (trayIcon != null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trayIcon = new NotifyIcon
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|