/// <summary> /// Set the next delete on server step, if possible. /// </summary> public void SetDeleteRemotelyStep(KwsDeleteRemotelyStep step) { if (m_deleteRemotelyStep >= step) { return; } m_deleteRemotelyStep = step; RequestRun("set server delete step to " + step); }
/// <summary> /// Request a switch to the task specified, if possible. 'Ex' is /// non-null if the task switch is occurring because an error occurred. /// </summary> public void RequestTaskSwitch(KwsTask task, Exception ex) { WmSm.LockNotif(); try { // Validate. if (m_taskSwitchFlag || task == KwsTask.Stop && !CanStop() || task == KwsTask.Spawn && !CanSpawn() || task == KwsTask.Rebuild && !CanRebuild() || task == KwsTask.WorkOffline && !CanWorkOffline() || task == KwsTask.WorkOnline && !CanWorkOnline() || task == KwsTask.DeleteLocally && !CanDeleteLocally() || task == KwsTask.DeleteRemotely && !CanDeleteRemotely()) { KLogging.Log("Request to switch to task " + task + " ignored."); return; } KLogging.Log("Switching to task " + task + "."); // Update some state prior to the task switch. if (task == KwsTask.Rebuild) { m_cd.MainStatus = KwsMainStatus.RebuildRequired; m_rebuildStep = KwsRebuildTaskStep.None; } else if (task == KwsTask.WorkOnline) { ResetKcdFailureState(); } else if (task == KwsTask.DeleteLocally) { m_cd.MainStatus = KwsMainStatus.OnTheWayOut; m_kws.AddToKwsRemoveTree(); m_kws.OnStateChange(WmStateChange.Permanent); } else if (task == KwsTask.DeleteRemotely) { ResetKcdFailureState(); m_deleteRemotelyStep = KwsDeleteRemotelyStep.ConnectedAndLoggedOut; } if (task == KwsTask.Spawn || task == KwsTask.Rebuild || task == KwsTask.WorkOffline || task == KwsTask.WorkOnline) { m_cd.LastException = null; m_kws.OnStateChange(WmStateChange.Permanent); } // Perform the task switch, if required. if (task != m_cd.CurrentTask) { SwitchTask(task, ex); } } catch (Exception ex2) { KBase.HandleException(ex2, true); } finally { WmSm.UnlockNotif(); } }
/// <summary> /// Set the next delete on server step, if possible. /// </summary> public void SetDeleteRemotelyStep(KwsDeleteRemotelyStep step) { if (m_deleteRemotelyStep >= step) return; m_deleteRemotelyStep = step; RequestRun("set server delete step to " + step); }
/// <summary> /// Request a switch to the task specified, if possible. 'Ex' is /// non-null if the task switch is occurring because an error occurred. /// </summary> public void RequestTaskSwitch(KwsTask task, Exception ex) { WmSm.LockNotif(); try { // Validate. if (m_taskSwitchFlag || task == KwsTask.Stop && !CanStop() || task == KwsTask.Spawn && !CanSpawn() || task == KwsTask.Rebuild && !CanRebuild() || task == KwsTask.WorkOffline && !CanWorkOffline() || task == KwsTask.WorkOnline && !CanWorkOnline() || task == KwsTask.DeleteLocally && !CanDeleteLocally() || task == KwsTask.DeleteRemotely && !CanDeleteRemotely()) { KLogging.Log("Request to switch to task " + task + " ignored."); return; } KLogging.Log("Switching to task " + task + "."); // Update some state prior to the task switch. if (task == KwsTask.Rebuild) { m_cd.MainStatus = KwsMainStatus.RebuildRequired; m_rebuildStep = KwsRebuildTaskStep.None; } else if (task == KwsTask.WorkOnline) { ResetKcdFailureState(); } else if (task == KwsTask.DeleteLocally) { m_cd.MainStatus = KwsMainStatus.OnTheWayOut; m_kws.AddToKwsRemoveTree(); m_kws.OnStateChange(WmStateChange.Permanent); } else if (task == KwsTask.DeleteRemotely) { ResetKcdFailureState(); m_deleteRemotelyStep = KwsDeleteRemotelyStep.ConnectedAndLoggedOut; } if (task == KwsTask.Spawn || task == KwsTask.Rebuild || task == KwsTask.WorkOffline || task == KwsTask.WorkOnline) { m_cd.LastException = null; m_kws.OnStateChange(WmStateChange.Permanent); } // Perform the task switch, if required. if (task != m_cd.CurrentTask) SwitchTask(task, ex); } catch (Exception ex2) { KBase.HandleException(ex2, true); } finally { WmSm.UnlockNotif(); } }