示例#1
0
        public async override Task <bool> ActionAsync(string action)
        {
            bool result = base.Action(action);

            if (result && action == ACTION_FILTER)
            {
                using (LogPurgerForm dlg = new LogPurgerForm())
                {
                    if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(Core))
                        {
                            await Task.Run(() =>
                            {
                                this.purgeLogsWithFilterThreadMethod();
                            });
                        }
                    }
                }
            }
            else if (result && action == ACTION_QUICKPURGE)
            {
                using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(Core))
                {
                    await Task.Run(() =>
                    {
                        this.purgeLogsThreadMethod();
                    });
                }
            }
            return(result);
        }
示例#2
0
 public async override Task<bool> ActionAsync(string action)
 {
     bool result = base.Action(action);
     if (result && action == ACTION_FILTER)
     {
         using (LogPurgerForm dlg = new LogPurgerForm())
         {
             if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(Core))
                 {
                     await Task.Run(() =>
                         {
                             this.purgeLogsWithFilterThreadMethod();
                         });
                 }
             }
         }
     }
     else if (result && action == ACTION_QUICKPURGE)
     {
         using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(Core))
         {
             await Task.Run(() =>
             {
                 this.purgeLogsThreadMethod();
             });
         }
     }
     return result;
 }
示例#3
0
文件: LogPurger.cs 项目: RH-Code/GAPP
 public override bool Action(string action)
 {
     bool result = base.Action(action);
     if (result && action == ACTION_FILTER)
     {
         using (LogPurgerForm dlg = new LogPurgerForm())
         {
             if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(Core))
                 {
                     _actionReady = new ManualResetEvent(false);
                     Thread thrd = new Thread(new ThreadStart(this.purgeLogsWithFilterThreadMethod));
                     thrd.Start();
                     while (!_actionReady.WaitOne(10))
                     {
                         System.Windows.Forms.Application.DoEvents();
                     }
                     thrd.Join();
                     _actionReady.Dispose();
                     _actionReady = null;
                 }
             }
         }
     }
     else if (result && action == ACTION_QUICKPURGE)
     {
         using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(Core))
         {
             _actionReady = new ManualResetEvent(false);
             Thread thrd = new Thread(new ThreadStart(this.purgeLogsThreadMethod));
             thrd.Start();
             while (!_actionReady.WaitOne(10))
             {
                 System.Windows.Forms.Application.DoEvents();
             }
             thrd.Join();
             _actionReady.Dispose();
             _actionReady = null;
         }
     }
     return result;
 }