parent
							
								
									f207c264d4
								
							
						
					
					
						commit
						9539e2b96c
					
				| 
						 | 
					@ -32,6 +32,7 @@ namespace DM_Weight
 | 
				
			||||||
    /// </summary>
 | 
					    /// </summary>
 | 
				
			||||||
    public partial class App : PrismApplication
 | 
					    public partial class App : PrismApplication
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        public static bool DbConnectionFail { get; set; } = false;
 | 
				
			||||||
        private readonly ILog logger = LogManager.GetLogger(typeof(App));
 | 
					        private readonly ILog logger = LogManager.GetLogger(typeof(App));
 | 
				
			||||||
        public App()
 | 
					        public App()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -58,6 +59,11 @@ namespace DM_Weight
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            logger.Error($"发生错误:{e.Exception.Message}");
 | 
					            logger.Error($"发生错误:{e.Exception.Message}");
 | 
				
			||||||
            e.Handled = true;
 | 
					            e.Handled = true;
 | 
				
			||||||
 | 
					            if (e.Exception.Message.Contains("连接数据库过程中发生错误"))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                DbConnectionFail = true;
 | 
				
			||||||
 | 
					                Container.Resolve<MainWindow>();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 | 
					        void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 | 
				
			||||||
| 
						 | 
					@ -245,6 +251,8 @@ namespace DM_Weight
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            containerRegistry.RegisterForNavigation<ShowMessageDialog, ShowMessageDialogViewModel>();
 | 
					            containerRegistry.RegisterForNavigation<ShowMessageDialog, ShowMessageDialogViewModel>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //紧急开锁页面
 | 
				
			||||||
 | 
					            containerRegistry.RegisterForNavigation<EmergencyWindow, EmergencyWindowViewModel>();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,82 @@
 | 
				
			||||||
 | 
					using DM_Weight.Models;
 | 
				
			||||||
 | 
					using DM_Weight.msg;
 | 
				
			||||||
 | 
					using DM_Weight.Port;
 | 
				
			||||||
 | 
					using DM_Weight.util;
 | 
				
			||||||
 | 
					using log4net;
 | 
				
			||||||
 | 
					using Prism.Commands;
 | 
				
			||||||
 | 
					using Prism.Events;
 | 
				
			||||||
 | 
					using Prism.Mvvm;
 | 
				
			||||||
 | 
					using Prism.Regions;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using System.Windows.Threading;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace DM_Weight.ViewModels
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class EmergencyWindowViewModel : BindableBase
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindowViewModel));
 | 
				
			||||||
 | 
					        IEventAggregator _eventAggregator;
 | 
				
			||||||
 | 
					        private PortUtil _portUtil;
 | 
				
			||||||
 | 
					        IRegionManager _regionManager;
 | 
				
			||||||
 | 
					        private bool _dbConnectionFail = !App.DbConnectionFail;
 | 
				
			||||||
 | 
					        public bool DBConnectionStatus { get => _dbConnectionFail; set => SetProperty(ref _dbConnectionFail, value); }
 | 
				
			||||||
 | 
					        private int _status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public int Status { get => _status; set => SetProperty(ref _status, value); }
 | 
				
			||||||
 | 
					        public EmergencyWindowViewModel(IRegionManager regionManager, PortUtil portUtil, IEventAggregator eventAggregator)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            _portUtil = portUtil;
 | 
				
			||||||
 | 
					            _eventAggregator = eventAggregator;
 | 
				
			||||||
 | 
					            _regionManager = regionManager;
 | 
				
			||||||
 | 
					            CheckDBConnect();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public DelegateCommand<string> OpenDrawer
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => new DelegateCommand<string>((DrawerNo) =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //应急开锁
 | 
				
			||||||
 | 
					                logger.Info($"应急开锁正在打开{DrawerNo}号抽屉");
 | 
				
			||||||
 | 
					                Status = 1;
 | 
				
			||||||
 | 
					                _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
 | 
				
			||||||
 | 
					                _portUtil.WindowName = "EmergencyWindow";
 | 
				
			||||||
 | 
					                _portUtil.BoardType = 1;
 | 
				
			||||||
 | 
					                _portUtil.ColNos = new int[] { 1 };
 | 
				
			||||||
 | 
					                _portUtil.DrawerNo = Convert.ToInt32(DrawerNo);
 | 
				
			||||||
 | 
					                Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal, () => _portUtil.OpenDrawer());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public DelegateCommand ReturnLoginDelegate
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => new DelegateCommand(() =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        //间隔1分钟查询数据库连接状态
 | 
				
			||||||
 | 
					        private void CheckDBConnect()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            new PromiseUtil<int>().taskAsyncLoop(60000, 0, async (options, next, stop) =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                try
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    var userList = SqlSugarHelper.Db.Queryable<UserList>()
 | 
				
			||||||
 | 
					                                        .First(u => u.UserName == "admin");
 | 
				
			||||||
 | 
					                    App.DbConnectionFail = false;
 | 
				
			||||||
 | 
					                    DBConnectionStatus = true;
 | 
				
			||||||
 | 
					                    stop();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                catch (Exception ex)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    next();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -330,7 +330,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            sb.Append(" left join pharmacy_info p1 on p1.pharmacy = i.in_pharmacy_id");
 | 
					            sb.Append(" left join pharmacy_info p1 on p1.pharmacy = i.in_pharmacy_id");
 | 
				
			||||||
            sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id");
 | 
					            sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id");
 | 
				
			||||||
            sb.Append(" where i.status=@Status ");
 | 
					            sb.Append(" where i.status=@Status ");
 | 
				
			||||||
            sb.Append(" and i.type!=@type ");
 | 
					            sb.Append(" and i.type=@type ");
 | 
				
			||||||
            sb.Append(" and i.cancel_flag=@CancelFlag ");
 | 
					            sb.Append(" and i.cancel_flag=@CancelFlag ");
 | 
				
			||||||
            if (OrderDate != null)
 | 
					            if (OrderDate != null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,8 +76,12 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            //_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(() =>
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					                if (App.DbConnectionFail)
 | 
				
			||||||
                _container.RegisterType<object, LoginWindow>("LoginWindow");
 | 
					                {
 | 
				
			||||||
 | 
					                    _regionManager.RequestNavigate("MainRegion", "EmergencyWindow");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                    _container.RegisterType<object, LoginWindow>("LoginWindow");
 | 
				
			||||||
                _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
					                _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }));
 | 
					            }));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,91 @@
 | 
				
			||||||
 | 
					<UserControl x:Class="DM_Weight.Views.EmergencyWindow"
 | 
				
			||||||
 | 
					             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"  
 | 
				
			||||||
 | 
					             xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"  
 | 
				
			||||||
 | 
					             xmlns:prism="http://prismlibrary.com/"
 | 
				
			||||||
 | 
					             prism:ViewModelLocator.AutoWireViewModel="True"
 | 
				
			||||||
 | 
					             xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
				
			||||||
 | 
					             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
 | 
				
			||||||
 | 
					    <Grid>
 | 
				
			||||||
 | 
					        <Grid.RowDefinitions>
 | 
				
			||||||
 | 
					            <RowDefinition Height="80"></RowDefinition>
 | 
				
			||||||
 | 
					            <RowDefinition></RowDefinition>
 | 
				
			||||||
 | 
					            <RowDefinition Height="Auto"></RowDefinition>
 | 
				
			||||||
 | 
					        </Grid.RowDefinitions>
 | 
				
			||||||
 | 
					        <Grid Background="#00bcd4">
 | 
				
			||||||
 | 
					            <Grid.ColumnDefinitions>
 | 
				
			||||||
 | 
					                <ColumnDefinition Width="Auto" />
 | 
				
			||||||
 | 
					                <ColumnDefinition />
 | 
				
			||||||
 | 
					            </Grid.ColumnDefinitions>
 | 
				
			||||||
 | 
					            <Image Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26"  Source="/Images/logo.png" />
 | 
				
			||||||
 | 
					        </Grid>
 | 
				
			||||||
 | 
					        <Grid Grid.Row="1" Margin="6">
 | 
				
			||||||
 | 
					            <Grid.ColumnDefinitions>
 | 
				
			||||||
 | 
					                <ColumnDefinition Width="Auto" />
 | 
				
			||||||
 | 
					                <ColumnDefinition Width="Auto" />
 | 
				
			||||||
 | 
					            </Grid.ColumnDefinitions>
 | 
				
			||||||
 | 
					            <Grid Margin="0" Grid.Column="0" Width="280"  Visibility="{Binding Is8Drawer, Converter={StaticResource BooleanToVisibilityConverter}}">
 | 
				
			||||||
 | 
					                <Grid.Background>
 | 
				
			||||||
 | 
					                    <ImageBrush ImageSource="/Images/box.png" />
 | 
				
			||||||
 | 
					                </Grid.Background>
 | 
				
			||||||
 | 
					                <Grid.RowDefinitions>
 | 
				
			||||||
 | 
					                    <RowDefinition Height="200" />
 | 
				
			||||||
 | 
					                    <RowDefinition />
 | 
				
			||||||
 | 
					                </Grid.RowDefinitions>
 | 
				
			||||||
 | 
					                <Grid Grid.Row="1" Height="470" Margin="0 50 0 0">
 | 
				
			||||||
 | 
					                    <Grid.RowDefinitions>
 | 
				
			||||||
 | 
					                        <RowDefinition />
 | 
				
			||||||
 | 
					                        <RowDefinition />
 | 
				
			||||||
 | 
					                        <RowDefinition />
 | 
				
			||||||
 | 
					                        <RowDefinition />
 | 
				
			||||||
 | 
					                        <RowDefinition />
 | 
				
			||||||
 | 
					                        <RowDefinition />
 | 
				
			||||||
 | 
					                        <RowDefinition />
 | 
				
			||||||
 | 
					                        <RowDefinition />
 | 
				
			||||||
 | 
					                    </Grid.RowDefinitions>
 | 
				
			||||||
 | 
					                    <Grid.Resources>
 | 
				
			||||||
 | 
					                        <Style TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignPaperLightButton}">
 | 
				
			||||||
 | 
					                            <Setter Property="Foreground" Value="#00a0ea" />
 | 
				
			||||||
 | 
					                            <Setter Property="BorderBrush" Value="#00a0ea" />
 | 
				
			||||||
 | 
					                        </Style>
 | 
				
			||||||
 | 
					                    </Grid.Resources>
 | 
				
			||||||
 | 
					                    <Button Grid.Row="0" Width="210" Content="1" Command="{Binding OpenDrawer}" CommandParameter="1" />
 | 
				
			||||||
 | 
					                    <Button Grid.Row="1" Width="210" Content="2" Command="{Binding OpenDrawer}" CommandParameter="2" />
 | 
				
			||||||
 | 
					                    <Button Grid.Row="2" Width="210" Content="3" Command="{Binding OpenDrawer}" CommandParameter="3" />
 | 
				
			||||||
 | 
					                    <Button Grid.Row="3" Width="210" Content="4" Command="{Binding OpenDrawer}" CommandParameter="4" />
 | 
				
			||||||
 | 
					                    <Button Grid.Row="4" Width="210" Content="5" Command="{Binding OpenDrawer}" CommandParameter="5" />
 | 
				
			||||||
 | 
					                    <Button Grid.Row="5" Width="210" Content="6" Command="{Binding OpenDrawer}" CommandParameter="6" />
 | 
				
			||||||
 | 
					                    <Button Grid.Row="6" Width="210" Content="7" Command="{Binding OpenDrawer}" CommandParameter="7" />
 | 
				
			||||||
 | 
					                    <Button Grid.Row="7" Width="210" Content="8" Command="{Binding OpenDrawer}" CommandParameter="8" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                </Grid>
 | 
				
			||||||
 | 
					            </Grid>
 | 
				
			||||||
 | 
					            <Grid Grid.Column="1">
 | 
				
			||||||
 | 
					                <Grid.RowDefinitions>
 | 
				
			||||||
 | 
					                    <RowDefinition Height="Auto"/>
 | 
				
			||||||
 | 
					                    <RowDefinition Height="Auto"/>
 | 
				
			||||||
 | 
					                </Grid.RowDefinitions>
 | 
				
			||||||
 | 
					                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
 | 
				
			||||||
 | 
					                    <Button  Margin="0 0 6 0" Content="返回登录" Command="{Binding ReturnLoginDelegate}" CommandParameter="0"
 | 
				
			||||||
 | 
					                    Visibility="{Binding DBConnectionStatus, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignOutlinedLightButton}"/>
 | 
				
			||||||
 | 
					                </StackPanel>
 | 
				
			||||||
 | 
					                <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="1">
 | 
				
			||||||
 | 
					                    <GroupBox Width="800px"
 | 
				
			||||||
 | 
					                          Header="重要提示"
 | 
				
			||||||
 | 
					                          Style="{StaticResource MaterialDesignGroupBox}"
 | 
				
			||||||
 | 
					                          Margin="16"
 | 
				
			||||||
 | 
					                          materialDesign:ColorZoneAssist.Mode="SecondaryMid">
 | 
				
			||||||
 | 
					                        <TextBlock Foreground="Red" FontWeight="Bold" FontSize="16" Text="数据库连接失败,此页面为紧急开锁页面!!!" />
 | 
				
			||||||
 | 
					                    </GroupBox>
 | 
				
			||||||
 | 
					                </StackPanel>
 | 
				
			||||||
 | 
					                <!--<materialDesign:Snackbar
 | 
				
			||||||
 | 
					            Background="{Binding SnackbarBackground}"
 | 
				
			||||||
 | 
					            MessageQueue="{Binding SnackbarMessageQueue}"/>-->
 | 
				
			||||||
 | 
					            </Grid>
 | 
				
			||||||
 | 
					        </Grid>
 | 
				
			||||||
 | 
					    </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>
 | 
				
			||||||
 | 
					    /// EmergencyWindow.xaml 的交互逻辑
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public partial class EmergencyWindow : UserControl
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public EmergencyWindow()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            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