Skip to content

Commit

Permalink
给标题栏增加了工作状态
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Dec 14, 2024
1 parent ea9a5a5 commit 9d06d4c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Core/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public virtual void OnPropertyChanged([System.Runtime.CompilerServices.CallerMem
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

public string ProgramTitle { get; set; } = "";
public string DefaultPageTitle { get; set; } = "首页";
public string DataPageTitle { get; set; } = "房间列表";
public string HistoryPageTitle { get; set; } = "录制历史";
Expand Down
2 changes: 1 addition & 1 deletion Desktop/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

</ui:NavigationView>

<ui:TitleBar Margin="0,2,0,0" Name="UI_TitleBar" Height="30" Title="DDTV5-Desktop" Grid.Row="0" Icon="pack://application:,,,/DDTV.ico" />
<ui:TitleBar Margin="0,2,0,0" Name="UI_TitleBar" Height="30" Title="{Binding ProgramTitle}" Grid.Row="0" Icon="pack://application:,,,/DDTV.ico" />
</Grid>
<Grid>
<ui:SnackbarPresenter Height="150" Name="MainSnackbar" VerticalAlignment="Bottom"></ui:SnackbarPresenter>
Expand Down
16 changes: 12 additions & 4 deletions Desktop/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Desktop.Models;
using Desktop.Views.Pages;
using Desktop.Views.Windows;
using LibVLCSharp.Shared;
using Microsoft.Extensions.DependencyInjection;
using Notification.Wpf;
using System.Diagnostics;
Expand Down Expand Up @@ -52,6 +53,9 @@ public partial class MainWindow : FluentWindow

public static Config.RunConfig configViewModel { get; set; } = new();

public static string P_Title = string.Empty;



public MainWindow()
{
Expand Down Expand Up @@ -115,7 +119,7 @@ public void Init()
WindowsAPI.OpenWindowsHibernation();
}
//更新目录房间列表录制中数量
IpvDetectionTimer = new Timer(UpdateNumberRecordedRoomsInDirectoryRoomList, null, 1, 5000);
IpvDetectionTimer = new Timer(UpdateNumberRecordedRoomsInDirectoryRoomList, null, 1, 1000);
}

private void InitializeTitleMode()
Expand Down Expand Up @@ -150,13 +154,14 @@ private void InitializeTitleMode()
if (Core.Init.Ver != doki.Ver)
{
MainWindow.SnackbarService.Show("远程版本不一致", $"检测到远程模式下远程版本与本地Desktop版本不一致!这可能会造成未知的问题,请尽快更新双端到最新版本!\n本地Desktop版本号:【{Core.Init.Ver}】|远程版本号:【{doki.Ver}】", ControlAppearance.Danger, new SymbolIcon(SymbolRegular.ErrorCircle24), TimeSpan.FromSeconds(5));
this.Title = $"{doki.InitType}|本地 {Core.Init.Ver}|远程 {doki.Ver}|{Enum.GetName(typeof(Config.Mode), doki.StartMode)}{doki.CompilationMode}】(编译时间:{doki.CompiledVersion}){(ToConnectToRemoteServer ? "【远程模式】" : "")}";
this.Title = $"{doki.InitType}|本地 {Core.Init.Ver}|远程 {doki.Ver}| %%% |{Enum.GetName(typeof(Config.Mode), doki.StartMode)}{doki.CompilationMode}】(编译时间:{doki.CompiledVersion}){(ToConnectToRemoteServer ? "【远程模式】" : "")}";
}
else
{
this.Title = $"{doki.InitType}|{doki.Ver}|{Enum.GetName(typeof(Config.Mode), doki.StartMode)}{doki.CompilationMode}】(编译时间:{doki.CompiledVersion}){(ToConnectToRemoteServer ? "【远程模式】" : "")}";
this.Title = $"{doki.InitType}|{doki.Ver}| %%% |{Enum.GetName(typeof(Config.Mode), doki.StartMode)}{doki.CompilationMode}】(编译时间:{doki.CompiledVersion}){(ToConnectToRemoteServer ? "【远程模式】" : "")}";
}
UI_TitleBar.Title = this.Title;
P_Title = this.Title;
//UI_TitleBar.Title = P_Title.Replace("%%%","正在初始化");
});
}
}
Expand Down Expand Up @@ -360,6 +365,9 @@ public static void UpdateNumberRecordedRoomsInDirectoryRoomList(object state)
(int MonitoringCount, int LiveCount, int RecCount) count = NetWork.Post.PostBody<(int MonitoringCount, int LiveCount, int RecCount)>($"{Config.Core_RunConfig._DesktopIP}:{Config.Core_RunConfig._DesktopPort}/api/get_rooms/room_statistics").Result;
configViewModel.DataPageTitle = $"房间列表 ({count.RecCount})";
configViewModel.OnPropertyChanged("DataPageTitle");

configViewModel.ProgramTitle = P_Title.Replace("%%%",$"{count.RecCount}录制中|{count.LiveCount}开播中|{count.MonitoringCount}监控中");
configViewModel.OnPropertyChanged("ProgramTitle");
}
catch (Exception ex)
{
Expand Down

0 comments on commit 9d06d4c

Please sign in to comment.