指纹登录添加连不上数据库跳转紧急开锁页面
This commit is contained in:
parent
3254fcd621
commit
36b573c12b
|
@ -18,7 +18,7 @@ using System.Windows.Threading;
|
|||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
public class EmergencyWindowViewModel : BindableBase
|
||||
public class EmergencyWindowViewModel : BindableBase, IRegionMemberLifetime, INavigationAware
|
||||
{
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindowViewModel));
|
||||
IEventAggregator _eventAggregator;
|
||||
|
@ -34,7 +34,6 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil = portUtil;
|
||||
_eventAggregator = eventAggregator;
|
||||
_regionManager = regionManager;
|
||||
CheckDBConnect();
|
||||
}
|
||||
public DelegateCommand<string> OpenDrawer
|
||||
{
|
||||
|
@ -86,5 +85,21 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
});
|
||||
}
|
||||
public bool KeepAlive => false;
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
DBConnectionStatus = !App.DbConnectionFail;
|
||||
CheckDBConnect();
|
||||
}
|
||||
|
||||
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -375,6 +375,10 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
logger.Info($"msg.Message:{msg.Message};{msg.Message.Equals("LOGIN")}");
|
||||
if (msg.Message.Equals("LOGIN"))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
UserList userList = new UserList();
|
||||
userList = SqlSugarHelper.Db.Queryable<UserList>()
|
||||
.Includes<RoleDm>(u => u.Role)
|
||||
|
@ -434,6 +438,16 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
SetUser(userList);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.Message.Contains("连接数据库过程中发生错误"))
|
||||
{
|
||||
App.DbConnectionFail = true;
|
||||
_regionManager.RequestNavigate("MainRegion", "EmergencyWindow");
|
||||
}
|
||||
logger.Info(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Margin="0" Grid.Column="0" Width="280" Visibility="{Binding Is8Drawer, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Grid Margin="0" Grid.Column="0" Width="280">
|
||||
<Grid.Background>
|
||||
<ImageBrush ImageSource="/Images/box.png" />
|
||||
</Grid.Background>
|
||||
|
|
Loading…
Reference in New Issue