public StepStatus SetStepValue(int sourceParameter, int stepNumber) { bool valid = true; foreach (ControlledParameterTemplate template in controlledParameters.Where(x => x.ControllerParameter == sourceParameter)) { //See if any steps fail valid &= template.CouldStepTo(stepNumber); } if (!valid) { //Report failure to step return(StepStatus.OutOfBounds); } StepStatus valueStatus = StepStatus.Success; foreach (ControlledParameterTemplate template in controlledParameters.Where(x => x.ControllerParameter == sourceParameter)) { valueStatus |= template.StepTo(stepNumber); } return(valueStatus); }
public void RunStepMethod() { if (this._status != StepStatus.WaitingRun) { throw new PXException(TX.Error.INVALID_STEP_STATUS_RUNNING_STEPMETHOD, this.Name); } this._status = StepStatus.Running; if (this.ParentJob.Canceled == true) { return; } try { this.StepMethod(this.Parm); } catch (Exception e) { this.SetStepError(e, this._status); if (e is ThreadAbortException) { throw e; } } }
public StepButton() { FlatStyle = System.Windows.Forms.FlatStyle.Flat; Status = StepStatus.Inactive; TabStop = false; GotFocus += new EventHandler(StepButton_GotFocus); Enabled = false; }
internal void Start() { this.Status = StepStatus.RUNNING; if (DoStart != null) { DoStart(this, new EventArgs()); } }
internal void Fail() { this.Status = StepStatus.FAILED; if (DoFail != null) { DoFail(this, new EventArgs()); } }
internal void Pass() { this.Status = StepStatus.PASSED; if (DoPass != null) { DoPass(this, new EventArgs()); } }
internal void Skip() { this.Status = StepStatus.SKIPPED; if (DoSkip != null) { DoSkip(this, new EventArgs()); } }
internal void Abort() { this.Status = StepStatus.ABORTED; if (DoAbort != null) { DoAbort(this, new EventArgs()); } }
internal void Play() { this.Status = StepStatus.RESUMED; if (DoPlay != null) { DoPlay(this, new EventArgs()); } }
internal void Pause() { this.Status = StepStatus.PAUSED; if (DoPause != null) { DoPause(this, new EventArgs()); } }
public static IContainerStatus container_status_with(int step, StepStatus status) { var mock = new Mock <IContainerStatus>(); mock.SetupGet(_ => _.IsBuildContainer).Returns(true); mock.SetupGet(_ => _.Step).Returns(new StepId(step, 0, "test")); mock.SetupGet(_ => _.Status).Returns(status); return(mock.Object); }
/// <summary> /// This method is used to create the station information /// </summary> /// <param name="name">The name</param> /// <param name="toArrival">To arrival</param> /// <param name="toDistance">To distance</param> /// <returns>Date time</returns> public TrainStationModel CreateStationInfo(string name, string toArrival, double toDistance) { DateTime dateTimeArr; DateTime toStartTime; if (DateTime.TryParse("7:00:00 AM", out toStartTime)) { // Do Nothing } DateTime toEndTime; if (DateTime.TryParse("7:00:00 PM", out toEndTime)) { // Do Nothing } StepStatus currentStatus = StepStatus.NotStarted; if (DateTime.TryParse(toArrival, out dateTimeArr)) { // Do Nothing } dateTimeArr = this.SetTrainTiming(dateTimeArr); if (this.lastStationStatus == StepStatus.Completed) { currentStatus = StepStatus.InProgress; } if (dateTimeArr <= DateTime.Now) { currentStatus = StepStatus.Completed; } this.lastStationStatus = currentStatus; var station = new TrainStationModel() { Name = name, Arrival = dateTimeArr.TimeOfDay.ToString().Remove(5), Departure = dateTimeArr.AddMinutes(2).TimeOfDay.ToString().Remove(5), ArrivalDateTime = dateTimeArr, DepartureDateTime = dateTimeArr.AddMinutes(2), Distance = "Station at " + toDistance.ToString(CultureInfo.CurrentCulture) + " km", Status = currentStatus, }; if (station.Status == StepStatus.Completed) { station.ProgressedDistance = 100; } return(station); }
public Step(string name, StepProcessingType processingType, Job parentJob) { this.Name = name; this._processingType = processingType; this.ParentJob = parentJob; this._status = StepStatus.WaitingRun; this.StepMethod = null; this.CheckStepResultMethod = null; }
public void SubmitTrialResult(bool correct) { ++trial; int stepDiff = 0; if (correct) { incorrectCount = 0; if (++correctCount >= CorrectToStepDown) { stepDiff = GetStepDownSize(); } } else { correctCount = 0; if (++incorrectCount >= WrongToStepUp) { stepDiff = -1 * GetStepUpSize(); } } if (stepDiff != 0) { if (lastStep != 0 && (stepDiff > 0) != (lastStep > 0)) { if (InFinalReversalStage()) { reversalValues.Add(stepValue); } reversals++; } if (lastStep != 0 || stepDiff > 0) { lastStep = stepDiff; } StepStatus stepStatus = SetStepValue(0, stepValue + stepDiff); if (stepStatus == StepStatus.Success) { stepValue += stepDiff; correctCount = 0; incorrectCount = 0; } else { ++reversals; } } }
public Station CreateStationInfo(string name, string toArrrival, double toDistance, string froArrrival, int index, double froDistance = 0) { DateTime dateTimeArr; DateTime toStartTime; DateTime.TryParse("7:00:00 AM", CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.None, out toStartTime); DateTime toEndTime; DateTime.TryParse("7:00:00 PM", CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.None, out toEndTime); StepStatus currentStatus = StepStatus.NotStarted; DateTime.TryParse(toArrrival, CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.None, out dateTimeArr); dateTimeArr = SetTrainTiming(dateTimeArr); if (lastStationStatus == StepStatus.Completed) { currentStatus = StepStatus.InProgress; } if (dateTimeArr <= DateTime.Now) { currentStatus = StepStatus.Completed; } lastStationStatus = currentStatus; station = new Station() { Name = name, Arrival = dateTimeArr.TimeOfDay.ToString().Remove(5), Depature = dateTimeArr.AddMinutes(2).TimeOfDay.ToString().Remove(5), ArrivalDateTime = dateTimeArr, DepatureDateTime = dateTimeArr.AddMinutes(2), Distance = "Station at " + toDistance.ToString() + " Miles", Status = currentStatus }; if (station.Status == StepStatus.Completed) { station.ProgressedDistance = 100; } else if (station.Status == StepStatus.InProgress) { CalcuateProgressedPercentage(dateTimeArr, station, index); } else { station.ProgressedDistance = 0; } previousStationDepaturedTime = dateTimeArr.AddMinutes(2); return(station); }
/// <summary> /// Gets the next step in the creation process. /// </summary> /// <param name="current">The current (just executed step)</param> /// <param name="previousStatus">Whether the current step passed or failed</param> /// <returns>The next step in the character creation process, or null if it is finished</returns> public override CharacterCreationSubState GetNextStep(CharacterCreationSubState current, StepStatus previousStatus) { // If there is no state yet, set up the initial character creation state. if (current == null) { return new ConfirmCreationEntryState(this.Session); } // Otherwise either go forward to the next state, or back to the previous state if requested. return previousStatus == StepStatus.Success ? this.AdvanceState(current) : this.RegressState(current); }
public void Test() { var gpsMock = new GpsMock(); gpsMock.SetSteps(5000); var service = new PhoneService(new ConnectionMock(), gpsMock, null); StepStatus met = service.NumberOfStepsMet(); Assert.AreEqual(met, StepStatus.Met); }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="title"></param> public StepInfo(string title) { this.title = title; this.parentTitle = ""; this.stepStatus = StepStatus.none; this.GetActionInfo = new ActionInfo(); this.PostActionInfo = new ActionInfo(); this.Children = new List<StepInfo>(); this.HasContent = true; this.IsInstanze = true; this.Expand = false; }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="title"></param> public StepInfo(string title) { this.title = title; this.parentTitle = ""; this.stepStatus = StepStatus.none; this.GetActionInfo = new ActionInfo(); this.PostActionInfo = new ActionInfo(); this.Children = new List <StepInfo>(); this.HasContent = true; this.IsInstanze = true; this.Expand = false; }
public Step CreateStepInfo(string description, StepStatus status, int progress, string taskDescription) { Step step = new Step() { Description = description, Status = status, ProgressValue = progress, TaskDescription = taskDescription }; return(step); }
/// <summary> /// Processes the next step in the character creation chain, or completes /// the process if there are no more steps. /// </summary> /// <param name="step">The current step</param> /// <param name="result">The result of the current step</param> public void HandleNextStep(CharacterCreationSubState step, StepStatus result) { this.CurrentStep = this.GetNextStep(step, result); // If there were no remaining steps found, we're done. if (this.CurrentStep == null) { this.OnCreationComplete(); return; } this.CurrentStep.StateMachine = this; this.Session.WritePrompt(); }
public static void LogStepStatus(StepStatus stepStatus, string Message) { try { StepCount++; Status status = (Status)stepStatus; scenario.Log(status, Message); Console.WriteLine(StepCount); } catch (Exception stepexception) { throw new Exception(stepexception.Message); } }
/// <summary> /// Method to select the template based on status and index. /// </summary> /// <param name="item">stepview item.</param> /// <param name="container">step progress bar.</param> /// <returns>data template.</returns> public override DataTemplate SelectTemplate(object item, DependencyObject container) { StepViewItem stepViewItem = item as StepViewItem; if (stepViewItem != null) { ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(stepViewItem); int index = itemsControl.ItemContainerGenerator.IndexFromContainer(stepViewItem); StepStatus stepStatus = stepViewItem.Status; stepViewItem.MarkerWidth = 50; stepViewItem.MarkerHeight = 50; if (stepStatus == StepStatus.Inactive && index == 0) { return(stepViewItem.FindResource("InactiveFirstStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Indeterminate && index == 0) { return(stepViewItem.FindResource("IndeterminateFirstStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Active && index == 0) { return(stepViewItem.FindResource("ActiveFirstStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Inactive && index == 1) { return(stepViewItem.FindResource("InactiveSecondStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Indeterminate && index == 1) { return(stepViewItem.FindResource("IndeterminateSecondStepTemplate") as DataTemplate); } if (stepStatus == StepStatus.Active && index == 1) { return(stepViewItem.FindResource("ActiveSecondStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Inactive && index == 2) { return(stepViewItem.FindResource("InactiveThirdStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Indeterminate && index == 2) { return(stepViewItem.FindResource("IndeterminateThirdStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Active && index == 2) { return(stepViewItem.FindResource("ActiveThirdStepTemplate") as DataTemplate); } } return(null); }
/// <summary>Processes the next step in the character creation chain, or completes the process if there are no more steps.</summary> /// <param name="step">The current step</param> /// <param name="result">The result of the current step</param> public void HandleNextStep(CharacterCreationSubState step, StepStatus result) { this.CurrentStep = this.GetNextStep(step, result); // If there were no remaining steps found, we're done. if (this.CurrentStep == null) { this.OnCreationComplete(); return; } this.CurrentStep.StateMachine = this; this.Session.WritePrompt(); }
public void OnStepMethodCompleted() { if (this._status != StepStatus.Running) { throw new PXException(TX.Error.INVALID_STEP_STATUS_RUNNING_ONSTEPMETHODCOMPLETED, this.Name); } if (this.CheckStepResultMethod != null) { this.CheckStepResultMethod(this.Parm); } this._status = StepStatus.Done; }
public void ChangeStatus(StepStatus newStatus) { if (status == newStatus) { return; } status = newStatus; EventHandler handler = StatusChanged; if (handler != null) { handler(this, EventArgs.Empty); } }
public void Test() { var gpsMock = new GpsMock(); gpsMock.SetSteps(5000); var service = new PhoneServiceBuilder() .WithConnection(new ConnectionMock()) .WithGps(gpsMock) .Build(); StepStatus met = service.NumberOfStepsMet(); Assert.AreEqual(StepStatus.Met, met); }
public void SetStepError(Exception e, StepStatus newStatus) { if (this._status != StepStatus.WaitingRun && this._status != StepStatus.Running) { throw new PXException(TX.Error.INVALID_STEP_STATUS_RUNNING_SETERROR, this.Name); } this._status = newStatus; if (this.Parm.Exception == null) { this.Parm.Exception = e; } }
/// <summary> /// Gets the step status. /// </summary> /// <param name="stepType">Type of the step.</param> /// <param name="action">The action.</param> /// <param name="errorMessage">The error message.</param> /// <returns></returns> private StepStatus GetStepStatus(StepType stepType, WorkflowAction action, out string errorMessage) { errorMessage = string.Empty; StepStatus stepStatus = null; var stepStatusValue = GetLavaAttributeValue(action, AttributeKey.StepProgramStepStatus); if (stepType == null || stepType.StepProgram == null || stepType.StepProgram.StepStatuses == null) { errorMessage = "The step type is required to include the step program and statuses"; return(null); } // Check if the value is a guid. This method works for stepProgram|stepStatus or simply just step status guid StepProgramStepStatusFieldType.ParseDelimitedGuids(stepStatusValue, out var unused2, out var stepStatusGuid); if (stepStatusGuid.HasValue) { stepStatus = stepType.StepProgram.StepStatuses.FirstOrDefault(ss => ss.Guid == stepStatusGuid.Value); if (stepStatus == null) { errorMessage = $"The step status with the guid '{stepStatusGuid.Value}' was not found in '{stepType.StepProgram.Name}'"; return(null); } } // Try to get a step status with a step status id if (stepStatus == null) { var stepStatusId = stepStatusValue.AsIntegerOrNull(); if (!stepStatusId.HasValue) { errorMessage = "The step status identifier is required but was missing"; return(null); } stepStatus = stepType.StepProgram.StepStatuses.FirstOrDefault(ss => ss.Id == stepStatusId.Value); if (stepStatus == null) { errorMessage = $"The step status with the id '{stepStatusId.Value}' was not found in '{stepType.StepProgram.Name}'"; return(null); } } return(stepStatus); }
private StepStatus AddStepStatusToStepProgram(StepProgram program, Guid guid, string name, bool isCompleteStatus, string colorCode, int order) { var newStatus = new StepStatus(); newStatus.Guid = guid; newStatus.Name = name; newStatus.IsActive = true; newStatus.Order = order; newStatus.IsCompleteStatus = isCompleteStatus; newStatus.StatusColor = colorCode; newStatus.ForeignKey = _SampleDataForeignKey; program.StepStatuses.Add(newStatus); return(newStatus); }
/// <summary> /// Gets the next step in the creation process. /// </summary> /// <param name="current"> /// The current (just executed step) /// </param> /// <param name="previousStatus"> /// Whether the current step passed or failed /// </param> /// <returns> /// The next step in the character creation process, or null if it is finished /// </returns> public override CharacterCreationSubState GetNextStep(CharacterCreationSubState current, StepStatus previousStatus) { // entry point of the state machine if (current == null) { return new ConfirmCreationEntryState(this.Session); } if (previousStatus == StepStatus.Success) { return this.AdvanceState(current); } else { return this.RegressState(current); } }
/// <summary>Processes the next step in the character creation chain, or completes the process if there are no more steps.</summary> /// <param name="step">The current step.</param> /// <param name="result">The result of the current step.</param> public void HandleNextStep(CharacterCreationSubState step, StepStatus result) { CurrentStep = GetNextStep(step, result); // If there were no remaining steps found, we're done. if (CurrentStep == null) { OnCreationComplete(); return; } else { CurrentStep.Begin(); } CurrentStep.StateMachine = this; }
void stepReadyTimer_Tick(object sender, EventArgs e) { stepReadyTimer.Stop(); StepStatus stepStatus = _parentForm.GetStepStatus(); if (stepStatus == StepStatus.Ready) { _parentForm.Controls["btnNext"].Visible = true; _parentForm.Controls["btnNext"].Enabled = true; _parentForm.Controls["btnNewSession"].Enabled = true; } else { stepReadyTimer.Interval = interval; stepReadyTimer.Start(); System.Windows.Forms.Application.DoEvents(); } }
private ConsoleColor Colorize(StepStatus status) { switch (status) { case StepStatus.None: return(ConsoleColor.Gray); case StepStatus.InProgress: return(ConsoleColor.White); case StepStatus.Failed: return(ConsoleColor.Red); case StepStatus.Complete: return(ConsoleColor.Green); default: throw new ArgumentException("Unknown value was received.", "status"); } }
public StepStatus GetStepStatus() { StepStatus stepStatus = StepStatus.NotReady; try { WebRequest request = HttpWebRequest.Create(string.Format("{0}/GetStepState?sessionID={1}", _baseUri, Session)); WebResponse response = request.GetResponse(); DataContractSerializer serializer = new DataContractSerializer(typeof(StepStatus)); using (XmlReader reader = XmlReader.Create(response.GetResponseStream())) { stepStatus = (StepStatus)serializer.ReadObject(reader, false); } } catch (Exception ex) { stepStatus = StepStatus.NotReady; } return(stepStatus); }
private ConsoleColor Colorize(StepStatus status) { switch (status) { case StepStatus.None: return ConsoleColor.Gray; case StepStatus.InProgress: return ConsoleColor.White; case StepStatus.Failed: return ConsoleColor.Red; case StepStatus.Complete: return ConsoleColor.Green; default: throw new ArgumentException("Unknown value was received.", "status"); } }
private void OpenTab(StepStatus stepStatus) { if (stepStatus == StepStatus.Init) return; var openNewDocStep = this.actions.Steps["OpenDocumentTab"]; var openClinicalStep = this.actions.Steps["OpenClinicalTab"]; var openImageStep = this.actions.Steps["OpenImageTab"]; if (this.account == AccountTypes.Admin) { var script = File.ReadAllText(Path.Combine("Scripts", openNewDocStep.Script)); this.webView.ExecuteScriptAsync(script); } if (this.account == AccountTypes.Clinical) { var script = File.ReadAllText(Path.Combine("Scripts", openClinicalStep.Script)); this.webView.ExecuteScriptAsync(script); } if (this.account == AccountTypes.Image) { var script = File.ReadAllText(Path.Combine("Scripts", openImageStep.Script)); this.webView.ExecuteScriptAsync(script); } this.currentStatus = stepStatus; }
private void WebViewOnFrameLoadEnd(object sender, FrameLoadEndEventArgs frameLoadEndEventArgs) { DataFile file = null; this.Invoke(new Action(() => { file = this.lstCategory.SelectedItem as DataFile; })); this.webView.ExecuteScriptAsync(Resources.RunTime); try { if (file == null) { throw new NullReferenceException("Selected file is null"); } foreach (var step in this.actions.Steps) { if (frameLoadEndEventArgs.Url.Contains(step.Value.FrameUrlKey) && this.currentStatus == step.Value.PreStatus) { var scriptFile = step.Value.Script.Replace(@"{Parameter}", file.Parameter); var script = File.ReadAllText(Path.Combine("Scripts", scriptFile)); if (step.Value.HasData) { if (step.Value.DataIncrease) currentIndex++; if (currentIndex >= selectedRows.Count) { this.CloseLoading(); return; } var row = selectedRows[currentIndex]; script = this.selectedColumns.Aggregate(script, (c, column) => c.Replace("{" + column + "}", row[column].ToString())); script = script.Replace(@"{Status}", file.ModifyStep.ToString()); script = script.Replace(@"{Parameter}", file.Parameter); } this.webView.EvaluateScriptAsync(script).Wait(); this.currentStatus = step.Value.NextStatus; } } } catch (Exception) { this.CloseLoading(); throw; } }
private void WebViewOnLoginFrameLoadEnd(object sender, FrameLoadEndEventArgs frameLoadEndEventArgs) { if (Settings.Default.DebugTool) { this.webView.ShowDevTools(); } // Only for development, auto enter user name and password if (frameLoadEndEventArgs.Url.Contains("login/ssoLogin")) { this.webView.ExecuteScriptAsync("document.getElementById('form').scrollIntoView(false);"); if (Settings.Default.AutoTextUserName) { this.webView.ExecuteScriptAsync(File.ReadAllText(Path.Combine("Scripts", "Login.js"))); } this.Invoke( new Action(() => this.CmbAccountSelectedIndexChanged(this.cmbAccount, new EventArgs()))); this.currentStatus = 0; // Initialize } else if (frameLoadEndEventArgs.Url.Contains(this.actions.Steps["Login"].FrameUrlKey)) { this.webView.EvaluateScriptAsync(Resources.RunTime).Wait(); var step = this.actions.Steps["Login"]; var script = File.ReadAllText(Path.Combine("Scripts", step.Script)); this.webView.EvaluateScriptAsync(script).Wait(); } }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="status"></param> public void SetStatus(StepStatus status) { this.stepStatus = status; }
/// <summary> /// Gets the next step. /// </summary> /// <param name="current">The current.</param> /// <param name="previousStatus">The previous status.</param> /// <returns></returns> public abstract CharacterCreationSubState GetNextStep(CharacterCreationSubState current, StepStatus previousStatus);