更新菜单标题
This commit is contained in:
parent
8bbdcaa2b9
commit
b317584153
@ -13,26 +13,25 @@ namespace FastGithub.UI
|
|||||||
{
|
{
|
||||||
private readonly System.Windows.Forms.NotifyIcon notifyIcon;
|
private readonly System.Windows.Forms.NotifyIcon notifyIcon;
|
||||||
private const string FASTGITHUB_UI = "FastGithub.UI";
|
private const string FASTGITHUB_UI = "FastGithub.UI";
|
||||||
private const string PROJECT_URI = "https://github.com/dotnetcore/FastGithub";
|
private const string RELEASES_URI = "https://github.com/dotnetcore/FastGithub/releases";
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
var about = new System.Windows.Forms.MenuItem("关于(&A)");
|
var upgrade = new System.Windows.Forms.MenuItem("检测更新(&U)");
|
||||||
about.Click += (s, e) => Process.Start(PROJECT_URI);
|
upgrade.Click += (s, e) => Process.Start(RELEASES_URI);
|
||||||
|
|
||||||
var exit = new System.Windows.Forms.MenuItem("退出(&C)");
|
var exit = new System.Windows.Forms.MenuItem("关闭应用(&C)");
|
||||||
exit.Click += (s, e) => this.Close();
|
exit.Click += (s, e) => this.Close();
|
||||||
|
|
||||||
var version = this.GetType().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
var version = this.GetType().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
||||||
|
|
||||||
this.Title = $"{FASTGITHUB_UI} v{version}";
|
this.Title = $"{FASTGITHUB_UI} v{version}";
|
||||||
this.notifyIcon = new System.Windows.Forms.NotifyIcon
|
this.notifyIcon = new System.Windows.Forms.NotifyIcon
|
||||||
{
|
{
|
||||||
Visible = true,
|
Visible = true,
|
||||||
Text = FASTGITHUB_UI,
|
Text = FASTGITHUB_UI,
|
||||||
ContextMenu = new System.Windows.Forms.ContextMenu(new[] { about, exit }),
|
ContextMenu = new System.Windows.Forms.ContextMenu(new[] { upgrade, exit }),
|
||||||
Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath)
|
Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user