添加抽屉状态是打开则不能退出及操作其他菜单
This commit is contained in:
parent
948f91212c
commit
465b21a32c
|
@ -24,6 +24,8 @@ using Newtonsoft.Json.Linq;
|
||||||
using DM_Weight.msg;
|
using DM_Weight.msg;
|
||||||
using DM_Weight.HIKVISION;
|
using DM_Weight.HIKVISION;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MaterialDesignThemes.Wpf;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -34,8 +36,8 @@ namespace DM_Weight.ViewModels
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private UserList? _userList;
|
private UserList? _userList;
|
||||||
private UserList? _userList2;
|
private UserList? _userList2;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 冰箱温度
|
/// 冰箱温度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -50,6 +52,21 @@ namespace DM_Weight.ViewModels
|
||||||
get => loginMode == 2;
|
get => loginMode == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SolidColorBrush _colorBrush;
|
||||||
|
|
||||||
|
public SolidColorBrush SnackbarBackground
|
||||||
|
{
|
||||||
|
get => _colorBrush;
|
||||||
|
set => SetProperty(ref _colorBrush, value);
|
||||||
|
}
|
||||||
|
private ISnackbarMessageQueue _snackbarMessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(3));
|
||||||
|
|
||||||
|
public ISnackbarMessageQueue SnackbarMessageQueue
|
||||||
|
{
|
||||||
|
get => _snackbarMessageQueue;
|
||||||
|
set => SetProperty(ref _snackbarMessageQueue, value);
|
||||||
|
}
|
||||||
|
|
||||||
private PremissionDm? _selectedMenu;
|
private PremissionDm? _selectedMenu;
|
||||||
|
|
||||||
private PremissionDm? _selectedChildMenu;
|
private PremissionDm? _selectedChildMenu;
|
||||||
|
@ -153,7 +170,16 @@ namespace DM_Weight.ViewModels
|
||||||
// SelectedChildMenu = value.Children[0];
|
// SelectedChildMenu = value.Children[0];
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
SetProperty(ref _selectedMenu, value);
|
if (!_portUtil.Operate)
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedMenu, value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Info($"未关闭抽屉切换菜单");
|
||||||
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||||
|
SnackbarMessageQueue.Enqueue("请关闭抽屉后再切换菜单");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,12 +193,21 @@ namespace DM_Weight.ViewModels
|
||||||
SelectedMenu = viewName.SelectedItem as PremissionDm;
|
SelectedMenu = viewName.SelectedItem as PremissionDm;
|
||||||
if (SelectedMenu.PremissionName == "退出")
|
if (SelectedMenu.PremissionName == "退出")
|
||||||
{
|
{
|
||||||
|
if (!_portUtil.Operate)
|
||||||
_chkFunction.HIKStopDVRRecord();
|
{
|
||||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
_chkFunction.HIKStopDVRRecord();
|
||||||
Operator = null;
|
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||||
Reviewer = null;
|
Operator = null;
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
Reviewer = null;
|
||||||
|
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Info($"未关闭抽屉操作退出");
|
||||||
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||||
|
SnackbarMessageQueue.Enqueue("请关闭抽屉后再退出");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -353,7 +388,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
|
||||||
//指定时间内无人操作鼠标键盘则停止录像
|
//指定时间内无人操作鼠标键盘则停止录像
|
||||||
if (!_portUtil.Operate && CheckComputerFreeState.GetLastInputTime() > stopRecord)
|
if (!_portUtil.Operate && CheckComputerFreeState.GetLastInputTime() > stopRecord)
|
||||||
{
|
{
|
||||||
_chkFunction.HIKStopDVRRecord();
|
_chkFunction.HIKStopDVRRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,8 @@
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<materialDesign:Snackbar HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
|
Background="{Binding SnackbarBackground}"
|
||||||
|
MessageQueue="{Binding SnackbarMessageQueue}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
Loading…
Reference in New Issue