/// <summary> /// Starts running the SessionGroup defined by the current DataModel. /// </summary> public virtual void Start() { if (DataModel != null && DataModel.Configuration != null && !m_backgroundWorker.IsBusy) { CanStart = false; CanStop = false; CanPause = false; SystemState = SystemState.MigrationProgress; Guid sessionGroupUniqueId = DataModel.Configuration.SessionGroupUniqueId; if (CurrentPipelineState == PipelineState.Paused) // is paused, resume TODO: State=Paused,Running,Stopped { m_currentPipelineState = PipelineState.Starting; NotificationBarViewModel.SetState(NotificationState.Info, DataModel.Configuration.SessionGroup.FriendlyName, Properties.Resources.StartingString); m_backgroundWorker.RunWorkerAsync(new BackgroundWorkerArgs(sessionGroupUniqueId, BackgroundWorkerTask.Resume)); } else { m_currentPipelineState = PipelineState.Starting; NotificationBarViewModel.SetState(NotificationState.Info, DataModel.Configuration.SessionGroup.FriendlyName, Properties.Resources.StartingString); m_backgroundWorker.RunWorkerAsync(new BackgroundWorkerArgs(sessionGroupUniqueId, BackgroundWorkerTask.Start)); } RaisePropertyChangedEvent("CurrentPipelineState"); RuntimeManager.EnableAutoRefresh(); } }
/// <summary> /// Pauses the SessionGroup defined by the current DataModel. /// </summary> public virtual void Pause() { if (DataModel != null && DataModel.Configuration != null) { CanStart = false; CanStop = false; CanPause = false; m_currentPipelineState = PipelineState.Pausing; RaisePropertyChangedEvent("CurrentPipelineState"); NotificationBarViewModel.SetState(NotificationState.Info, DataModel.Configuration.SessionGroup.FriendlyName, Properties.Resources.PausingString); Guid sessionGroupUniqueId = DataModel.Configuration.SessionGroupUniqueId; m_backgroundWorker.RunWorkerAsync(new BackgroundWorkerArgs(sessionGroupUniqueId, BackgroundWorkerTask.Pause)); RuntimeManager.EnableAutoRefresh(); } }
public void SetSessionGroupUniqueId(Guid sessionGroupUniqueId) { SessionGroupStatus = new SessionGroupStatus(sessionGroupUniqueId); ConflictManager = new ApplicationViewModel(this); ConflictManager.SetSessionGroupUniqueId(sessionGroupUniqueId, true); this.RuntimeManager.SetSessionGroupUniqueId(sessionGroupUniqueId, ConflictManager); Properties.Settings.Default.LastSessionGroupUniqueId = sessionGroupUniqueId; if (!GlobalConfiguration.UseWindowsService) { ISyncStateManager stateManager = SqlSyncStateManager.GetInstance(); stateManager.TryResetSessionGroupStates(sessionGroupUniqueId); RuntimeManager.DisableAutoRefresh(); } else { RuntimeManager.EnableAutoRefresh(); } Refresh(); }