mirror of https://github.com/2dust/v2rayN
Remember the size and position of the main window
parent
7b2bd8876d
commit
ab025b39f4
|
@ -52,6 +52,14 @@ namespace v2rayN.Forms
|
||||||
v2rayHandler = new V2rayHandler();
|
v2rayHandler = new V2rayHandler();
|
||||||
v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent;
|
v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent;
|
||||||
|
|
||||||
|
if(!config.formMainSize.IsEmpty) {
|
||||||
|
this.Left = config.formMainSize.X;
|
||||||
|
this.Top = config.formMainSize.Y;
|
||||||
|
this.Width = config.formMainSize.Width;
|
||||||
|
this.Height = config.formMainSize.Height;
|
||||||
|
}
|
||||||
|
this.WindowState = config.windowState;
|
||||||
|
|
||||||
if (config.enableStatistics)
|
if (config.enableStatistics)
|
||||||
{
|
{
|
||||||
statistics = new StatisticsHandler(config, UpdateStatisticsHandler);
|
statistics = new StatisticsHandler(config, UpdateStatisticsHandler);
|
||||||
|
@ -87,6 +95,10 @@ namespace v2rayN.Forms
|
||||||
{
|
{
|
||||||
if (e.CloseReason == CloseReason.UserClosing)
|
if (e.CloseReason == CloseReason.UserClosing)
|
||||||
{
|
{
|
||||||
|
if (this.WindowState != FormWindowState.Maximized)
|
||||||
|
config.formMainSize = new Rectangle(this.Left, this.Top, this.Width, this.Height);
|
||||||
|
config.windowState = this.WindowState;
|
||||||
|
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
HideForm();
|
HideForm();
|
||||||
return;
|
return;
|
||||||
|
@ -973,7 +985,6 @@ namespace v2rayN.Forms
|
||||||
|
|
||||||
private void menuExit_Click(object sender, EventArgs e)
|
private void menuExit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.Visible = false;
|
this.Visible = false;
|
||||||
this.Close();
|
this.Close();
|
||||||
|
|
||||||
|
@ -984,7 +995,7 @@ namespace v2rayN.Forms
|
||||||
private void ShowForm()
|
private void ShowForm()
|
||||||
{
|
{
|
||||||
this.Show();
|
this.Show();
|
||||||
this.WindowState = FormWindowState.Normal;
|
//this.WindowState = config.windowState;
|
||||||
this.Activate();
|
this.Activate();
|
||||||
//this.notifyIcon1.Visible = false;
|
//this.notifyIcon1.Visible = false;
|
||||||
this.ShowInTaskbar = true;
|
this.ShowInTaskbar = true;
|
||||||
|
|
|
@ -36,6 +36,17 @@ namespace v2rayN.Mode
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主窗口的大小和位置
|
||||||
|
/// </summary>
|
||||||
|
public System.Drawing.Rectangle formMainSize
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public System.Windows.Forms.FormWindowState windowState
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 活动配置序号
|
/// 活动配置序号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue