跳转登录页面时先跳转EmptyWindow避免不执行OnNavigatedFrom方法
This commit is contained in:
		
							parent
							
								
									58a6035add
								
							
						
					
					
						commit
						714a037b71
					
				| 
						 | 
					@ -37,7 +37,7 @@
 | 
				
			||||||
		<!-- 按处方还药或者按取药记录还药 1:处方(ReturnDrugWindow2)2:药品(ReturnDrugWindow)-->
 | 
							<!-- 按处方还药或者按取药记录还药 1:处方(ReturnDrugWindow2)2:药品(ReturnDrugWindow)-->
 | 
				
			||||||
		<add key="returnDrugMode" value="1" />
 | 
							<add key="returnDrugMode" value="1" />
 | 
				
			||||||
		<!-- 自动退出时间,单位秒,为0时不自动退出 -->
 | 
							<!-- 自动退出时间,单位秒,为0时不自动退出 -->
 | 
				
			||||||
		<add key="autoExit" value="0"/>
 | 
							<add key="autoExit" value="5"/>
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
 | 
							<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
 | 
				
			||||||
		<add key="stopRecord" value="180"/>
 | 
							<add key="stopRecord" value="180"/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -256,6 +256,9 @@ namespace DM_Weight
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            containerRegistry.RegisterForNavigation<ShowMessageDialog, ShowMessageDialogViewModel>();
 | 
					            containerRegistry.RegisterForNavigation<ShowMessageDialog, ShowMessageDialogViewModel>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            containerRegistry.RegisterForNavigation<EmptyWindow, EmptyWindowViewModel>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,6 +71,7 @@
 | 
				
			||||||
    <PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
 | 
					    <PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
 | 
				
			||||||
    <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
 | 
					    <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
 | 
				
			||||||
    <PackageReference Include="Prism.Unity" Version="8.1.97" />
 | 
					    <PackageReference Include="Prism.Unity" Version="8.1.97" />
 | 
				
			||||||
 | 
					    <PackageReference Include="SharpPromise" Version="1.7.0" />
 | 
				
			||||||
    <PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
 | 
					    <PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
 | 
				
			||||||
    <PackageReference Include="SuperSimpleTcp" Version="3.0.10" />
 | 
					    <PackageReference Include="SuperSimpleTcp" Version="3.0.10" />
 | 
				
			||||||
    <PackageReference Include="System.Drawing.Common" Version="7.0.0" />
 | 
					    <PackageReference Include="System.Drawing.Common" Version="7.0.0" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1338,6 +1338,7 @@ namespace DM_Weight.Port
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					                logger.Info($"写数量:{drawerNo}-{colNo}:{quantity}");
 | 
				
			||||||
                canBusSerial.DiscardInBuffer();
 | 
					                canBusSerial.DiscardInBuffer();
 | 
				
			||||||
                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
					                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
				
			||||||
                string strQuantity = quantity.ToString("X");
 | 
					                string strQuantity = quantity.ToString("X");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -436,7 +436,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                                //newStock.NeedNum = 0;
 | 
					                                                //newStock.NeedNum = 0;
 | 
				
			||||||
                                                //newStock.Quantity = jiaoStock.Quantity + csStock.TakeQuantity;
 | 
					                                                //newStock.Quantity = jiaoStock.Quantity + csStock.TakeQuantity;
 | 
				
			||||||
                                                UpdateJJStock.Add(newStock);
 | 
					                                                UpdateJJStock.Add(newStock);
 | 
				
			||||||
                                                csStock.TakeQuantity = 0;
 | 
					                                                csStockList[j].TakeQuantity = 0;
 | 
				
			||||||
                                                jiaoStock.NeedNum = jiaoStock.NeedNum - csStock.TakeQuantity;
 | 
					                                                jiaoStock.NeedNum = jiaoStock.NeedNum - csStock.TakeQuantity;
 | 
				
			||||||
                                            }
 | 
					                                            }
 | 
				
			||||||
                                            else
 | 
					                                            else
 | 
				
			||||||
| 
						 | 
					@ -454,13 +454,13 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                                newStock.ManuNo = jiaoStock.ManuNo;
 | 
					                                                newStock.ManuNo = jiaoStock.ManuNo;
 | 
				
			||||||
                                                newStock.DrawerNo = jiaoStock.DrawerNo;
 | 
					                                                newStock.DrawerNo = jiaoStock.DrawerNo;
 | 
				
			||||||
                                                newStock.DrugId = jiaoStock.DrugId;
 | 
					                                                newStock.DrugId = jiaoStock.DrugId;
 | 
				
			||||||
                                                newStock.AddToJJNum = addNum;
 | 
					                                                newStock.AddToJJNum = jiaoStock.NeedNum; 
 | 
				
			||||||
                                                newStock.Id = jjStockManuNo.Id;
 | 
					                                                newStock.Id = jjStockManuNo.Id;
 | 
				
			||||||
                                                //newStock.MachineId = jiaoStock.MachineId;
 | 
					                                                //newStock.MachineId = jiaoStock.MachineId;
 | 
				
			||||||
                                                //newStock.NeedNum = 0;
 | 
					                                                //newStock.NeedNum = 0;
 | 
				
			||||||
                                                //newStock.Quantity = jiaoStock.Quantity + csStock.TakeQuantity;
 | 
					                                                //newStock.Quantity = jiaoStock.Quantity + csStock.TakeQuantity;
 | 
				
			||||||
                                                UpdateJJStock.Add(newStock);
 | 
					                                                UpdateJJStock.Add(newStock);
 | 
				
			||||||
                                                csStock.TakeQuantity = csStock.TakeQuantity - jiaoStock.NeedNum;
 | 
					                                                csStockList[j].TakeQuantity = csStock.TakeQuantity - jiaoStock.NeedNum;
 | 
				
			||||||
                                                jiaoStock.NeedNum = 0;
 | 
					                                                jiaoStock.NeedNum = 0;
 | 
				
			||||||
                                                break;
 | 
					                                                break;
 | 
				
			||||||
                                            }
 | 
					                                            }
 | 
				
			||||||
| 
						 | 
					@ -500,7 +500,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                                newStock.MachineId = jiaoStock.MachineId;
 | 
					                                                newStock.MachineId = jiaoStock.MachineId;
 | 
				
			||||||
                                                newStock.DrawerType = 1;
 | 
					                                                newStock.DrawerType = 1;
 | 
				
			||||||
                                                AddJJStock.Add(newStock);
 | 
					                                                AddJJStock.Add(newStock);
 | 
				
			||||||
                                                csStock.TakeQuantity = csStock.TakeQuantity - newStock.AddToJJNum;
 | 
					                                                csStockList[j].TakeQuantity = csStock.TakeQuantity - newStock.AddToJJNum;
 | 
				
			||||||
                                                break;
 | 
					                                                break;
 | 
				
			||||||
                                            }
 | 
					                                            }
 | 
				
			||||||
                                        }
 | 
					                                        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -470,6 +470,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            //}
 | 
					            //}
 | 
				
			||||||
            //MessageBox.Show("返回值:" + dialogResult.Result.ToString());
 | 
					            //MessageBox.Show("返回值:" + dialogResult.Result.ToString());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        int AddToJiaoJieClickNum = 1;
 | 
				
			||||||
        //设置选中药箱的复选框状态
 | 
					        //设置选中药箱的复选框状态
 | 
				
			||||||
        private void SetIsSelected(ChannelStock channelStock)
 | 
					        private void SetIsSelected(ChannelStock channelStock)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace DM_Weight.ViewModels
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    internal class EmptyWindowViewModel
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -215,10 +215,12 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                logger.Info($"用户【{Operator?.Nickname}】退出登录");
 | 
					                logger.Info($"用户【{Operator?.Nickname}】退出登录");
 | 
				
			||||||
                Operator = null;
 | 
					                Operator = null;
 | 
				
			||||||
                Reviewer = null;
 | 
					                Reviewer = null;
 | 
				
			||||||
                System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
					                //System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
				
			||||||
                {
 | 
					                //{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                _regionManager.RequestNavigate("ContentRegion", "EmptyWindow");
 | 
				
			||||||
                _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
					                _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
				
			||||||
                }));
 | 
					                //}));
 | 
				
			||||||
                //_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
 | 
					                //_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -522,6 +524,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                Reviewer = null;
 | 
					                Reviewer = null;
 | 
				
			||||||
                Application.Current.Dispatcher.Invoke(() =>
 | 
					                Application.Current.Dispatcher.Invoke(() =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    _regionManager.RequestNavigate("ContentRegion", "EmptyWindow");
 | 
				
			||||||
                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
					                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                AlertMsg alertMsg = new AlertMsg
 | 
					                AlertMsg alertMsg = new AlertMsg
 | 
				
			||||||
| 
						 | 
					@ -539,35 +542,58 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            SelectedChildMenu = premissions[0].Children[0];
 | 
					            SelectedChildMenu = premissions[0].Children[0];
 | 
				
			||||||
            _regionManager.RequestNavigate("ContentRegion", premissions[0].Children[0].PremissionPath);
 | 
					            _regionManager.RequestNavigate("ContentRegion", premissions[0].Children[0].PremissionPath);
 | 
				
			||||||
            FindDrawerCount();
 | 
					            FindDrawerCount();
 | 
				
			||||||
 | 
					 | 
				
			||||||
            int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0");
 | 
					            int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0");
 | 
				
			||||||
            int stopRecord = Convert.ToInt32(ConfigurationManager.AppSettings["stopRecord"] ?? "0");
 | 
					 | 
				
			||||||
            if (autoExit > 0)
 | 
					            if (autoExit > 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                System.Timers.Timer timer = new System.Timers.Timer();
 | 
					                //int interval = autoExit * 1000;
 | 
				
			||||||
                timer.Interval = 1000;
 | 
					                new PromiseUtil<int>().taskAsyncLoop(1000, 0, async (options, next, stop) =>
 | 
				
			||||||
                timer.Elapsed += (sender, e) =>
 | 
					                {
 | 
				
			||||||
 | 
					                    try
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                    // 串口无人操作
 | 
					 | 
				
			||||||
                        if (!_portUtil.Operate)
 | 
					                        if (!_portUtil.Operate)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                        // 30秒内无人操作鼠标键盘
 | 
					                            // 无人操作鼠标键盘
 | 
				
			||||||
                            if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
 | 
					                            if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                            logger.Info($"设备30秒内无人操作,用户【{Operator?.Nickname}】自动退出登录");
 | 
					                                logger.Info($"设备{autoExit}内无人操作,用户【{Operator?.Nickname}】自动退出登录,_portUtil.Operate:{_portUtil.Operate},totalSecond:{(DateTime.Now - _portUtil.dateTime).TotalSeconds},lastInputTime:{CheckComputerFreeState.GetLastInputTime()},autoExit:{autoExit}");
 | 
				
			||||||
                            //_chkFunction.HIKStopDVRRecord();
 | 
					
 | 
				
			||||||
                                Operator = null;
 | 
					                                Operator = null;
 | 
				
			||||||
                                Reviewer = null;
 | 
					                                Reviewer = null;
 | 
				
			||||||
                            Application.Current.Dispatcher.Invoke(() =>
 | 
					                                //Application.Current.Dispatcher.Invoke(() =>
 | 
				
			||||||
 | 
					                                //{
 | 
				
			||||||
 | 
					                                stop();
 | 
				
			||||||
 | 
					                                System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
				
			||||||
                                {
 | 
					                                {
 | 
				
			||||||
 | 
					                                    _regionManager.RequestNavigate("ContentRegion", "EmptyWindow");
 | 
				
			||||||
                                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
					                                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
				
			||||||
                                timer.Stop();
 | 
					                                }));
 | 
				
			||||||
 | 
					                                //});
 | 
				
			||||||
 | 
					                                //timer.Dispose();
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            else
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                if (Operator == null)
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                    stop();
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                                else
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                    next();
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        else
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            _portUtil.dateTime = DateTime.Now;
 | 
				
			||||||
 | 
					                            next();
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    catch (Exception ex)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        logger.Info($"自动退出异常:{ex.Message}");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                };
 | 
					 | 
				
			||||||
                timer.Start();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            //#region 温度查询定时
 | 
					            //#region 温度查询定时
 | 
				
			||||||
            //int interval = Convert.ToInt32(ConfigurationManager.AppSettings["Interval"]);
 | 
					            //int interval = Convert.ToInt32(ConfigurationManager.AppSettings["Interval"]);
 | 
				
			||||||
            //if (interval > 0)
 | 
					            //if (interval > 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,7 +117,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            //_chkFunction= chcFunction;
 | 
					            //_chkFunction= chcFunction;
 | 
				
			||||||
            _regionManager = regionManager;
 | 
					            _regionManager = regionManager;
 | 
				
			||||||
            _eventAggregator = eventAggregator;
 | 
					            _eventAggregator = eventAggregator;
 | 
				
			||||||
            _eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
 | 
					            //_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        private DelegateCommand? _loginCommand;
 | 
					        private DelegateCommand? _loginCommand;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -257,6 +257,7 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
				
			||||||
                keys.Add("operator", user);
 | 
					                keys.Add("operator", user);
 | 
				
			||||||
                //System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
					                //System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
				
			||||||
                //{
 | 
					                //{
 | 
				
			||||||
 | 
					                logger.Info("跳转home页面");
 | 
				
			||||||
                _regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
 | 
					                _regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
 | 
				
			||||||
                //}));
 | 
					                //}));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -368,8 +369,10 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                FingerMsg = !msg.Result;
 | 
					                FingerMsg = !msg.Result;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            logger.Info($"LoginBtnEnable:{LoginBtnEnable}");
 | 
				
			||||||
            if (LoginBtnEnable)
 | 
					            if (LoginBtnEnable)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					                logger.Info($"msg.Message:{msg.Message};{msg.Message.Equals("LOGIN")}");
 | 
				
			||||||
                if (msg.Message.Equals("LOGIN"))
 | 
					                if (msg.Message.Equals("LOGIN"))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    UserList userList = new UserList();
 | 
					                    UserList userList = new UserList();
 | 
				
			||||||
| 
						 | 
					@ -380,7 +383,7 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
				
			||||||
                    //.First(u => u.Id == msg.Id && u.MachineId == ConfigurationManager.AppSettings["machineId"].ToString());
 | 
					                    //.First(u => u.Id == msg.Id && u.MachineId == ConfigurationManager.AppSettings["machineId"].ToString());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    logger.Info($"userList==null?{userList == null}");
 | 
				
			||||||
                    if (userList == null)
 | 
					                    if (userList == null)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        AlertMsg alertMsg = new AlertMsg
 | 
					                        AlertMsg alertMsg = new AlertMsg
 | 
				
			||||||
| 
						 | 
					@ -447,7 +450,7 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
				
			||||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
					        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            //FingerMsg = !_fingerprintUtil.bIsConnected;
 | 
					            //FingerMsg = !_fingerprintUtil.bIsConnected;
 | 
				
			||||||
            //_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
 | 
					            _eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,13 +73,15 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            _regionManager = regionManager;
 | 
					            _regionManager = regionManager;
 | 
				
			||||||
            _container = container;
 | 
					            _container = container;
 | 
				
			||||||
            //_cHKFunction = cHKFunction;
 | 
					            //_cHKFunction = cHKFunction;
 | 
				
			||||||
            //System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
					            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
				
			||||||
            //{
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                _container.RegisterType<object, LoginWindow>("LoginWindow");
 | 
					                //_container.RegisterType<object, LoginWindow>("LoginWindow");
 | 
				
			||||||
                _regionManager.RegisterViewWithRegion("MainRegion", "LoginWindow");
 | 
					                //_regionManager.RegisterViewWithRegion("MainRegion", "LoginWindow");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //}));
 | 
					                _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void doMyPrismEvent2(AlertMsg msg)
 | 
					        void doMyPrismEvent2(AlertMsg msg)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					<UserControl x:Class="DM_Weight.Views.EmptyWindow"
 | 
				
			||||||
 | 
					             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 | 
				
			||||||
 | 
					             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
				
			||||||
 | 
					             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
 | 
				
			||||||
 | 
					             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
 | 
				
			||||||
 | 
					             xmlns:local="clr-namespace:DM_Weight.Views"
 | 
				
			||||||
 | 
					             mc:Ignorable="d" 
 | 
				
			||||||
 | 
					             d:DesignHeight="450" d:DesignWidth="800">
 | 
				
			||||||
 | 
					    <Grid>
 | 
				
			||||||
 | 
					        <!--空白页面,用于退出登录时先跳转该页面再退出登录,ContentRegion先跳转到该页面,让上一个页面先进OnNavigatedFrom。-->
 | 
				
			||||||
 | 
					    </Grid>
 | 
				
			||||||
 | 
					</UserControl>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,28 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using System.Windows;
 | 
				
			||||||
 | 
					using System.Windows.Controls;
 | 
				
			||||||
 | 
					using System.Windows.Data;
 | 
				
			||||||
 | 
					using System.Windows.Documents;
 | 
				
			||||||
 | 
					using System.Windows.Input;
 | 
				
			||||||
 | 
					using System.Windows.Media;
 | 
				
			||||||
 | 
					using System.Windows.Media.Imaging;
 | 
				
			||||||
 | 
					using System.Windows.Navigation;
 | 
				
			||||||
 | 
					using System.Windows.Shapes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace DM_Weight.Views
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// EmptyWindow.xaml 的交互逻辑
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public partial class EmptyWindow : UserControl
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public EmptyWindow()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            InitializeComponent();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,41 @@
 | 
				
			||||||
 | 
					using SharpPromise;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace DM_Weight.util
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class PromiseUtil<T>
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public int _delay { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public T? _data { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public async Task taskAsyncLoop(int delay, T data, Action<PromiseUtil<T>, Action, Action> action)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            _data = data;
 | 
				
			||||||
 | 
					            _delay = 0;
 | 
				
			||||||
 | 
					            while (_delay >= 0)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                await new Promise(async (Action onResolve, Action onReject) =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    await Task.Delay(_delay);
 | 
				
			||||||
 | 
					                    try
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        await Task.Run(() => action(this, onResolve, onReject));
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    catch (Exception ex)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        onReject();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }).Then(() =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    _delay = delay;
 | 
				
			||||||
 | 
					                }).Catch((Exception e) =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    _delay = -1;
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue