Example #1
0
        public override Task ExecuteAsync(string receiver, WebHookHandlerContext context)
        {
            if (Common.IsBitBucketReceiver(receiver))
            {
                var dataJObject = context.GetDataOrDefault <JObject>();
                var action      = context.Actions.First();

                var processActivities = new ProcessActivities(dataJObject, action);
                processActivities.Process();
            }

            return(Task.FromResult(true));
        }
Example #2
0
        private void SmartUpDate(bool isFullUpdate, List<ProcessActivity> processes)
        {
            if (isFullUpdate)
            {
                ProcessActivities = new ObservableCollection<ProcessActivity>(processes);
                return;
            }

            for (int i = 0; i < ProcessActivities.Count; i++)
            {
                if (ProcessActivities.Count == processes.Count && ProcessActivities[i].LinkProcess.Name == processes[i].LinkProcess.Name)
                {
                    for (int j = 0; j < ProcessActivities[i].GroundWorkStates.Count; j++)
                    {
                        if (ProcessActivities[i].GroundWorkStates[j].Title != processes[i].GroundWorkStates[j].Title)
                        {
                            ProcessActivities[i].GroundWorkStates[j].Title = processes[i].GroundWorkStates[j].Title;
                        }
                    }

                    if (ProcessActivities[i].GroundWorkStates.Count < processes[i].GroundWorkStates.Count)
                    {
                        foreach (var gws in processes[i].GroundWorkStates.Skip(ProcessActivities[i].GroundWorkStates.Count))
                        {
                            ProcessActivities[i].GroundWorkStates.Add(gws);
                        }
                    }

                    ProcessActivities[i].Start = processes[i].Start;
                    ProcessActivities[i].End = processes[i].End;
                }
                else
                {
                    ProcessActivities = new ObservableCollection<ProcessActivity>(processes);
                    return;
                }
            }

            foreach (var process in processes.Skip(ProcessActivities.Count))
            {
                ProcessActivities.Add(process);
            }
        }