Exemplo n.º 1
0
        /// <summary>
        /// refresh group
        /// </summary>
        /// <param name="work"></param>
        /// <param name="workflow"></param>
        /// <returns></returns>
        public WorkingCopyGroup RefreshGroup(WorkingCopy work, WorkFlowConfig workflow)
        {
            var currentSteps = Steps.ToList();

            currentSteps.ForEach(startStep =>
                                 Steps.AddRange(
                                     FindSteps(work, startStep, EndStepCode)
                                     .Where(newStep => !Steps.Any(step => step.Id == newStep.Id))
                                     )
                                 );

            // find all sub-groups(which end step belongs to this group)
            var currentGroups = Groups.ToList();

            Groups.AddRange(work.Groups
                            .Where(x => !string.Equals(x.Id, Id))
                            .Where(x => !currentGroups.Contains(x))
                            .Where(x => !(x?.BeginSteps?.Any(x1 => BeginSteps.Contains(x1)) == true &&
                                          x?.EndStepCode == EndStepCode)) // except groups which beginstep and endstep are equal to this
                            .Where(x =>
                                   x.EndSteps.Any(y => Steps.Contains(y))
                                   )
                            );

            Fulfilled = (Steps?.Any(x => !x.Cancelled && string.Equals(x.Code, EndStepCode, System.StringComparison.CurrentCultureIgnoreCase)) ?? false) &&
                        (Steps?.Where(x => !x.Cancelled).All(x => x.ActionFinished && (x.PostedNext || string.Equals(x.Code, EndStepCode, System.StringComparison.CurrentCultureIgnoreCase))) ?? false) &&
                        (Groups?.All(x => x.Finished) == true);

            return(this);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds steps relative to hot chocolate.
 /// </summary>
 protected sealed override void AddSteps()
 {
     base.AddSteps();
     Steps.AddRange(new List <string>
     {
         "Add drinking chocolate powder to the water",
         "Pour chocolate in the cup"
     });
 }
Exemplo n.º 3
0
        public TimeCounter Append(TimeCounter other)
        {
            if (other != null)
            {
                Steps.AddRange(other.Steps);
            }

            return(this);
        }         // Append
Exemplo n.º 4
0
 /// <summary>
 /// Adds steps relative to lemon tea.
 /// </summary>
 protected sealed override void AddSteps()
 {
     base.AddSteps();
     Steps.AddRange(new List <string>
     {
         "Steep the water in the tea",
         "Pour tea in the cup",
         "Add lemon"
     });
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds steps relative to coffee.
 /// </summary>
 protected sealed override void AddSteps()
 {
     base.AddSteps();
     Steps.AddRange(new List <string>
     {
         "Brew the coffee grounds",
         "Pour coffee in the cup",
         "Add sugar and milk"
     });
 }
Exemplo n.º 6
0
        public Line(string name, City start, City end, int time, float cost, bool oneWay = false, params Step[] steps) : this()
        {
            Name     = name;
            Start    = start;
            End      = end;
            OneWay   = oneWay;
            BaseTime = time;
            BaseCost = cost;

            Steps.AddRange(steps);
        }
Exemplo n.º 7
0
        public void OpenConfig(string path)
        {
            var man = new ConfigManager(path);

            man.Load();
            ConfigManager = man;

            ParameterViewModels.Apply(p => p.DealloateParent());
            ParameterViewModels.Clear();
            ParameterViewModels.AddRange(man.Config.Parameters.Select(p => new ParameterViewModel(p, this)));

            var currentStep = SelectedStep;

            Steps.Clear();
            Steps.AddRange(man.Config.Steps);
            SelectedStep = Steps.FirstOrDefault(s => s.Name == currentStep?.Name)
                           ?? Steps.FirstOrDefault(s => s.IsDefault)
                           ?? Steps.FirstOrDefault();

            Logger.LogSuccess("Config loaded: " + path);
        }