Exemplo n.º 1
0
 public override void OnUpdate()
 {
     if (Visible)
     {
         PrinterObject selectedPrinter = MainWindow.GetSelectedPrinter();
         if (selectedPrinter == null)
         {
             MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page0_StartupPage, new Mangage3DInkStageDetails(Manage3DInkMainWindow.Mode.None));
             return;
         }
         if ((selectedPrinter.Info.Status == PrinterStatus.Firmware_Ready || selectedPrinter.Info.Status == PrinterStatus.Firmware_Idle || selectedPrinter.Info.Status == PrinterStatus.Firmware_PrintingPaused) && !selectedPrinter.WaitingForCommandToComplete && ((CurrentDetails.waitCondition != null ? (CurrentDetails.waitCondition() ? 1 : 0) : 1) != 0 && !finishedWaiting))
         {
             if (CurrentDetails.pageAfterWait == Manage3DInkMainWindow.PageID.Page0_StartupPage)
             {
                 if (selectedPrinter.LockStatus == PrinterLockStatus.Unlocked)
                 {
                     finishedWaiting = true;
                     var num = (int)selectedPrinter.AcquireLock(new AsyncCallback(DoStartUpSequenceCallsAfterLock), selectedPrinter);
                 }
                 else if (selectedPrinter.LockStatus == PrinterLockStatus.WeOwnLocked)
                 {
                     finishedWaiting = true;
                     DoStartUpSequence(selectedPrinter);
                 }
                 else
                 {
                     MainWindow.ActivateFrame(CurrentDetails.pageAfterWait, CurrentDetails);
                 }
             }
             else
             {
                 finishedWaiting = true;
                 MainWindow.ActivateFrame(CurrentDetails.pageAfterWait, CurrentDetails);
             }
         }
         else if (!selectedPrinter.WaitingForCommandToComplete && CurrentDetails.waitCondition == null)
         {
             MainWindow.ActivateFrame(CurrentDetails.pageAfterWait, CurrentDetails);
         }
         else if (selectedPrinter.Info.Status == PrinterStatus.Firmware_Idle)
         {
             if (!m_osIdleStopwatchTimer.IsRunning)
             {
                 m_osIdleStopwatchTimer.Restart();
             }
             else if (m_osIdleStopwatchTimer.ElapsedMilliseconds > 3000L)
             {
                 var num = (int)selectedPrinter.BreakLock(null, null);
                 finishedWaiting = true;
             }
         }
     }
     base.OnUpdate();
 }