コード例 #1
0
ファイル: FrmSynchronous.cs プロジェクト: zanderzhg/STO.Print
 /// <summary>
 /// 全部同步
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSync_Click(object sender, EventArgs e)
 {
     try
     {
         //if (BaseSystemInfo.Synchronized)
         //{
         Stopwatch stopWatch = new Stopwatch();
         stopWatch.Start();
         gridView1.GroupPanelText = @"开始同步";
         btnSync.Enabled          = false;
         SyncArea();
         SyncPrintMark();
         BaseSystemInfo.Synchronized = true;
         stopWatch.Stop();
         TimeSpan ts          = stopWatch.Elapsed;
         string   elapsedTime = string.Format("{0}h{1}m{2}s{3}ms", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
         gridView1.GroupPanelText = string.Format("同步完成,耗时:{0}", elapsedTime);
         BillPrintHelper.SetSyncTime();
         InitSyncTime();
         //}
         //else
         //{
         //    XtraMessageBox.Show(@"后台正在同步,请稍后", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
         //}
     }
     catch (Exception exception)
     {
         gridView1.GroupPanelText = @"同步失败";
         ProcessException(exception);
     }
     finally
     {
         btnSync.Enabled = true;
     }
 }
コード例 #2
0
 private void timer_Tick(object sender, EventArgs e)
 {
     try
     {
         RefreshDelegate refresh = Refresh;
         Invoke(refresh);
         if (BaseSystemInfo.Synchronized)
         {
             _timer.Stop();
             BillPrintHelper.SetSyncTime();
             Close();
         }
     }
     catch (Exception exception)
     {
         _timer.Stop();
         LogUtil.WriteException(exception);
         Close();
     }
 }