Skip to content

Commit

Permalink
增加主窗口位置记忆
Browse files Browse the repository at this point in the history
调整配置文件保存时机
  • Loading branch information
pdone committed Jan 12, 2024
1 parent 84631c6 commit 99ba399
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 15 deletions.
19 changes: 17 additions & 2 deletions FreeControl/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,12 @@ public void InitPdone()
}
// 提取资源
ExtractResource(reload);

if (_Setting.MainWindowX != 0 || _Setting.MainWindowY != 0)
{
// 主窗口位置
StartPosition = FormStartPosition.Manual;
Location = new Point(_Setting.MainWindowX, _Setting.MainWindowY);
}
#region 事件绑定
// 退出时保存用户配置数据
Application.ApplicationExit += (sender, e) =>
Expand All @@ -198,17 +203,24 @@ public void InitPdone()
FormClosed += (sender, e) => Application.Exit();
// 窗口拖动
MouseDown += (sender, e) => Extend.DragWindow(Handle);
// 窗口位置改变
LocationChanged += (sender, e) =>
{
_Setting.MainWindowX = Location.X;
_Setting.MainWindowY = Location.Y;
};
ledTitle.MouseDown += (sender, e) => Extend.DragWindow(Handle);
tabHome.MouseDown += (sender, e) => Extend.DragWindow(Handle);
tabSetting.MouseDown += (sender, e) => Extend.DragWindow(Handle);
uiLabel1.MouseDown += (sender, e) => Extend.DragWindow(Handle);
// 关闭按钮和最小化按钮
btnClose.Click += (sender, e) => Close();
btnMini.Click += (sender, e) => WindowState = FormWindowState.Minimized;
// 启动按钮
btnStart.Click += StartButtonClick;
// 深色模式切换
switchDarkMode.ValueChanged += SwitchDarkMode_ValueChanged;
// 窗口大小设置
// scrcpy窗口大小设置
updownHeight.ValueChanged += (sender, e) => _Setting.WindowHeight = updownHeight.Value;
updownWidth.ValueChanged += (sender, e) => _Setting.WindowWidth = updownWidth.Value;
rbtnShortcuts.ValueChanged += RbtnShortcuts_ValueChanged;
Expand Down Expand Up @@ -440,6 +452,7 @@ private void ADBConnectCallback(IAsyncResult ar)
/// </summary>
private void RunScrcpy()
{
SetUserData(_Setting);// 启动前保存一下配置文件
Logger.Info("scrcpy running...");
string args = "";
StartParameters.ForEach(x =>
Expand Down Expand Up @@ -487,6 +500,7 @@ private void RunScrcpy()
};
scrcpy.Exited += (ss, ee) =>
{
SetUserData(_Setting);// 关闭scrcpy后保存一下配置文件
string strOriginIme = _Setting.IMEOrigin;
if (_Setting.IME != 0 && _Setting.IMEOrigin.IsNotNull())
{
Expand Down Expand Up @@ -573,6 +587,7 @@ private void FromHandle(bool isStart)
_Controller?.Dispose();
Show();
Activate();
Focus();
}
};
Invoke(action);
Expand Down
10 changes: 5 additions & 5 deletions FreeControl/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("在PC上控制Android设备")]//在PC上控制Android设备。
[assembly: AssemblyDescription("在PC上控制Android设备。")]
[assembly: AssemblyTitle("在PC上控制Android设备")]//在PC上控制Android设备。
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Pdone Technology Ltd.")]
[assembly: AssemblyProduct("Free Control")]
[assembly: AssemblyCopyright("Copyright © 2023 awaw.cc")]
[assembly: AssemblyCopyright("Copyright © 2024 awaw.cc")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -33,5 +33,5 @@
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.6.6")]
[assembly: AssemblyVersion("1.6.6")]
[assembly: AssemblyFileVersion("1.6.7")]
[assembly: AssemblyVersion("1.6.7")]
13 changes: 11 additions & 2 deletions FreeControl/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ public class Setting
public bool AudioEnabled { get; set; } = true;

/// <summary>
/// 窗口高度
/// Scrcpy 窗口高度
/// </summary>
public int WindowHeight { get; set; } = 0;
/// <summary>
/// 窗口宽度
/// Scrcpy 窗口宽度
/// </summary>
public int WindowWidth { get; set; } = 0;

Expand Down Expand Up @@ -187,5 +187,14 @@ public List<string> ControllerButton
/// 界面语言
/// </summary>
public Lang Language { get; set; } = Lang.zh_cn;

/// <summary>
/// 主窗口 x坐标
/// </summary>
public int MainWindowX { get; set; } = 0;
/// <summary>
/// 主窗口 y坐标
/// </summary>
public int MainWindowY { get; set; } = 0;
}
}
4 changes: 4 additions & 0 deletions FreeControl/Update.en.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Free Control Update Record

## v1.6.7
- Add main window location memory
- Adjust profile save time

## v1.6.6
- Add i18n
- Based on scrcpy v2.3.1(x64)
Expand Down
4 changes: 4 additions & 0 deletions FreeControl/Update.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Free Control 更新记录

## v1.6.7
- 增加主窗口位置记忆
- 调整配置文件保存时机

## v1.6.6
- 增加多语言支持
- 基于scrcpy v2.3.1(x64)
Expand Down
Binary file modified FreeControl/en.FreeControl.resources.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Based on the open source project [**scrcpy**](https://github.com/Genymobile/scrc

https://github.com/pdone/FreeControl/releases/latest/download/FreeControl.exe

### ghproxy
### My Proxy

https://mirror.ghproxy.com/github.com/pdone/FreeControl/releases/latest/download/FreeControl.exe
https://cdn.awaw.cc/gh/pdone/FreeControl/releases/latest/download/FreeControl.exe

## Code Repository

Expand Down Expand Up @@ -203,4 +203,4 @@ If you think this project is helpful, please invite the author to have a cup of
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg?style=for-the-badge)](https://paypal.me/alexpdone)

## Stargazers Over Time
[![Stargazers over time](https://starchart.cc/pdone/FreeControl.svg)](https://starchart.cc/pdone/FreeControl)
[![Stargazers over time](https://starchart.cc/pdone/FreeControl.svg?variant=adaptive)](https://starchart.cc/pdone/FreeControl)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@

https://github.com/pdone/FreeControl/releases/latest/download/FreeControl.exe

### ghproxy
### My Proxy

https://mirror.ghproxy.com/github.com/pdone/FreeControl/releases/latest/download/FreeControl.exe
https://cdn.awaw.cc/gh/pdone/FreeControl/releases/latest/download/FreeControl.exe

## 代码存储库

Expand Down Expand Up @@ -219,4 +219,4 @@ Android 11 及更高版本支持使用 Android 调试桥 (adb) 从工作站以
</details>

## Stargazers Over Time
[![Stargazers over time](https://starchart.cc/pdone/FreeControl.svg)](https://starchart.cc/pdone/FreeControl)
[![Stargazers over time](https://starchart.cc/pdone/FreeControl.svg?variant=adaptive)](https://starchart.cc/pdone/FreeControl)

0 comments on commit 99ba399

Please sign in to comment.