抽屉打开_portUtil.Operate为true则不能操作菜单及退出按钮
This commit is contained in:
parent
5babb44a9a
commit
4185776306
|
@ -24,6 +24,8 @@ using Newtonsoft.Json.Linq;
|
|||
using DM_Weight.msg;
|
||||
using DM_Weight.HIKVISION;
|
||||
using System.Threading;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -54,6 +56,20 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -169,7 +185,14 @@ namespace DM_Weight.ViewModels
|
|||
// 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("请关闭抽屉后再切换菜单");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,12 +206,21 @@ namespace DM_Weight.ViewModels
|
|||
SelectedMenu = viewName.SelectedItem as PremissionDm;
|
||||
if (SelectedMenu.PremissionName == "退出")
|
||||
{
|
||||
|
||||
_chkFunction.HIKStopDVRRecord();
|
||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
if (!_portUtil.Operate)
|
||||
{
|
||||
_chkFunction.HIKStopDVRRecord();
|
||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Info($"未关闭抽屉操作退出");
|
||||
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||
SnackbarMessageQueue.Enqueue("请关闭抽屉后再退出");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -124,7 +124,9 @@
|
|||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
<materialDesign:Snackbar HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Background="{Binding SnackbarBackground}"
|
||||
MessageQueue="{Binding SnackbarMessageQueue}"/>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
Loading…
Reference in New Issue