Skip to content

Commit

Permalink
给播放窗口增加窗口标题信息以提高辨识度;升级UI依赖;升级VLC依赖
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Sep 12, 2024
1 parent 2c6c8a6 commit e9eabd5
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 9 deletions.
13 changes: 11 additions & 2 deletions Desktop/Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="LibVLCSharp.WPF" Version="3.8.5" />
<PackageReference Include="LibVLCSharp.WPF" Version="3.9.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2535.41" />
<PackageReference Include="Net.Codecrete.QrCodeGenerator" Version="2.0.5" />
<PackageReference Include="Notification.Wpf" Version="8.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.4" />
<PackageReference Include="WPF-UI" Version="3.0.4" />
<PackageReference Include="WPF-UI" Version="3.0.5" />
</ItemGroup>

<ItemGroup>
Expand All @@ -57,6 +57,11 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Update="Views\Control\CardControl.xaml.cs">
<SubType>Code</SubType>
</Compile>
Expand All @@ -80,6 +85,10 @@
<None Update="DDTV.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>

<ItemGroup>
Expand Down
26 changes: 26 additions & 0 deletions Desktop/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Desktop/Properties/Settings.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>
3 changes: 2 additions & 1 deletion Desktop/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"profiles": {
"Desktop": {
"commandName": "Project"
"commandName": "Project",
"nativeDebugging": false
}
}
}
13 changes: 7 additions & 6 deletions Desktop/Views/Windows/VlcPlayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public VlcPlayWindow(long uid)
vlcPlayModels.OnPropertyChanged("MessageText");
return;
}

this.Title = $"{roomCard.Name}({roomCard.RoomId}) - {roomCard.Title.Value}";
Log.Info(nameof(VlcPlayWindow), $"房间号:[{roomCard.RoomId}],打开播放器");

_libVLC = new LibVLC([$"--network-caching={new Random().Next(3000, 4000)} --no-cert-verification"]);
Expand Down Expand Up @@ -321,7 +323,6 @@ await Task.Run(() =>
if (_libVLC != null && !string.IsNullOrEmpty(Url))
{
var media = new Media(_libVLC, Url, FromType.FromLocation);
_mediaPlayer.Media = media;
_mediaPlayer?.Play();
}
Expand Down Expand Up @@ -406,9 +407,9 @@ private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
private void Grid_MouseWheel(object sender, MouseWheelEventArgs e)
{
int v = 0;
if (videoView != null && videoView.MediaPlayer != null)
if (_mediaPlayer != null)
{
videoView.Dispatcher.Invoke(() => v = videoView.MediaPlayer.Volume);
videoView.Dispatcher.Invoke(() => v = _mediaPlayer.Volume);
}
if (e.Delta > 0)
{
Expand Down Expand Up @@ -440,12 +441,12 @@ private void Grid_MouseWheel(object sender, MouseWheelEventArgs e)
/// <param name="i"></param>
private void SetVolume(int i)
{
if (videoView != null && videoView.MediaPlayer != null)
if (videoView != null && _mediaPlayer != null)
{

videoView.Dispatcher.Invoke(() =>
{
videoView.MediaPlayer.Volume = i;
_mediaPlayer.Volume = i;
vlcPlayModels.VolumeVisibility = Visibility.Visible;
vlcPlayModels.OnPropertyChanged("VolumeVisibility");
Task.Run(() =>
Expand Down Expand Up @@ -523,7 +524,7 @@ private void FluentWindow_KeyDown(object sender, System.Windows.Input.KeyEventAr
int v = 0;
if (videoView != null && videoView.MediaPlayer != null)
{
videoView.Dispatcher.Invoke(() => v = videoView.MediaPlayer.Volume);
videoView.Dispatcher.Invoke(() => v = _mediaPlayer.Volume);
}
//音量增加
if (e.KeyStates == Keyboard.GetKeyStates(Key.Up))
Expand Down

0 comments on commit e9eabd5

Please sign in to comment.