Skip to content

Commit

Permalink
增加播放窗口双击在全屏和窗口化切换的功能
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Oct 19, 2024
1 parent 796c362 commit 831f8d2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Core/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,10 @@ public string _MainDomainName
}
}

private static string HTTP_UA = $"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0";
private static string HTTP_UA = $"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0";
/// <summary>
/// 请求是默认使用的UA(字符串)
/// 默认值:$"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0"
/// 默认值:$"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0"
/// </summary>
public string _HTTP_UA { get { return HTTP_UA; } }

Expand Down
34 changes: 34 additions & 0 deletions Desktop/Views/Windows/VlcPlayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Key = System.Windows.Input.Key;
using MenuItem = Wpf.Ui.Controls.MenuItem;


namespace Desktop.Views.Windows
{
/// <summary>
Expand Down Expand Up @@ -60,6 +61,10 @@ public partial class VlcPlayWindow : FluentWindow
/// 宽高比是否初始化
/// </summary>
public bool InitializeAspectRatio = false;
/// <summary>
/// 用于跟踪当前是否为全屏状态
/// </summary>
public bool isFullScreen = false;
public class DanMuOrbitInfo
{
public string Text { get; set; }
Expand Down Expand Up @@ -398,10 +403,37 @@ private void FluentWindow_Closing(object sender, System.ComponentModel.CancelEve
}
}

private DateTime lastClickTime = DateTime.MinValue; // 上次点击的时间

private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
DateTime now = DateTime.Now;
// 检查是否为双击(两次点击间隔小于系统双击时间)
if ((now - lastClickTime).TotalMilliseconds <= SystemInformation.DoubleClickTime)
{
ToggleFullScreen();
}
lastClickTime = now;
}
private void ToggleFullScreen()
{
if (!isFullScreen)
{
// 切换到全屏模式
this.WindowStyle = WindowStyle.None;
this.WindowState = WindowState.Maximized;
this.ResizeMode = ResizeMode.NoResize;
isFullScreen = true;
}
else
{
// 切换回窗口模式
this.WindowStyle = WindowStyle.SingleBorderWindow;
this.WindowState = WindowState.Normal;
this.ResizeMode = ResizeMode.CanResize;
isFullScreen = false;
}
}

private void Grid_MouseWheel(object sender, MouseWheelEventArgs e)
Expand Down Expand Up @@ -682,5 +714,7 @@ private void MenuItem_OpenLiveUlr_Click(object sender, RoutedEventArgs e)
};
Process.Start(psi);
}


}
}

0 comments on commit 831f8d2

Please sign in to comment.