public static TemplateWorkStepElement New(Type[] workSteps, CoordinationMode mode) { var attributes = new List <WorkStepAttribute>(); foreach (var step in workSteps) { AddStep(step, out var attribute); attributes.Add(attribute); } return(new TemplateWorkStepElement() { Mode = mode, Steps = attributes.Select(ta => ta.UniqueId).ToArray(), }); }
public GpsPosition(int value, CoordinationMode mode) { this.Mode = mode; this.Value = value; this.Side = this.Mode == CoordinationMode.Longitude ? this.Value > 0 ? CoordinationSide.North : CoordinationSide.South : this.Value > 0 ? CoordinationSide.East : CoordinationSide.West; this.Standard = Math.Abs((decimal)this.Value) / 10000000; this.Seconds = (int)Math.Round(this.Standard * 3600); this.Degrees = this.Seconds / 3600; this.Seconds = Math.Abs(this.Seconds % 3600); this.Minutes = this.Seconds / 60; this.Seconds %= 60; }
public GpsPosition(int value,CoordinationMode mode) { this.Mode=mode; this.Value = value; this.Side = this.Mode==CoordinationMode.Longitude ? this.Value > 0 ? CoordinationSide.North : CoordinationSide.South : this.Value > 0 ? CoordinationSide.East : CoordinationSide.West; this.Standard = Math.Abs((decimal)this.Value) / 10000000; this.Seconds = (int)Math.Round(this.Standard * 3600); this.Degrees = this.Seconds / 3600; this.Seconds = Math.Abs(this.Seconds % 3600); this.Minutes = this.Seconds / 60; this.Seconds %= 60; }
/// <summary> /// 移动到下一容器中,这个容器可以有多个工作单位,并且只有所有的工作步骤完成后才能移动到下一节点 /// </summary> /// <param name="workSteps">The work steps.</param> /// <param name="mode">是否为同时完成才算完成当前步骤</param> /// <returns></returns> public Template Next(Type[] workSteps, CoordinationMode mode = CoordinationMode.Any) { if (workSteps == null) { return(this); } if (workSteps.All(o => o == null)) { return(this); } if (this.Ending) { throw new ArgumentException("该模板已经结束了"); } var step = TemplateWorkStep.New(workSteps, mode); step.Order = this.workSteps.Count; this.workSteps.Add(step); return(this); }
/// <summary> /// 移动到下一容器中,这个容器可以有多个工作单位,并且只有所有的工作步骤完成后才能移动到下一节点 /// </summary> /// <typeparam name="TWorkStep1">工作步骤</typeparam> /// <typeparam name="TWorkStep2">工作步骤</typeparam> /// <typeparam name="TWorkStep3">工作步骤</typeparam> /// <typeparam name="TWorkStep4">工作步骤</typeparam> /// <typeparam name="TWorkStep5">工作步骤</typeparam> /// <typeparam name="TWorkStep6">工作步骤</typeparam> /// <typeparam name="TWorkStep7">工作步骤</typeparam> /// <typeparam name="TWorkStep8">工作步骤</typeparam> /// <param name="mode">是否为同时完成才算完成当前步骤</param> /// <returns></returns> public Template Next <TWorkStep1, TWorkStep2, TWorkStep3, TWorkStep4, TWorkStep5, TWorkStep6, TWorkStep7, TWorkStep8>(CoordinationMode mode = CoordinationMode.Any) where TWorkStep1 : IWorkStep where TWorkStep2 : IWorkStep where TWorkStep3 : IWorkStep where TWorkStep4 : IWorkStep where TWorkStep5 : IWorkStep where TWorkStep6 : IWorkStep where TWorkStep7 : IWorkStep where TWorkStep8 : IWorkStep { return(this.Next(new[] { typeof(TWorkStep1), typeof(TWorkStep2), typeof(TWorkStep3), typeof(TWorkStep4), typeof(TWorkStep5), typeof(TWorkStep6), typeof(TWorkStep7), typeof(TWorkStep8) }, mode)); }
/// <summary> /// 移动到下一容器中,这个容器可以有多个工作单位,并且只有所有的工作步骤完成后才能移动到下一节点 /// </summary> /// <typeparam name="TWorkStep1">工作步骤</typeparam> /// <typeparam name="TWorkStep2">工作步骤</typeparam> /// <typeparam name="TWorkStep3">工作步骤</typeparam> /// <typeparam name="TWorkStep4">工作步骤</typeparam> /// <param name="mode">是否为同时完成才算完成当前步骤</param> /// <returns></returns> public Template Next <TWorkStep1, TWorkStep2, TWorkStep3, TWorkStep4>(CoordinationMode mode = CoordinationMode.Any) where TWorkStep1 : IWorkStep where TWorkStep2 : IWorkStep where TWorkStep3 : IWorkStep where TWorkStep4 : IWorkStep { return(this.Next(new[] { typeof(TWorkStep1), typeof(TWorkStep2), typeof(TWorkStep3), typeof(TWorkStep4) }, mode)); }