コード例 #1
0
 bool SendUpdate(IssueUpdateData Update)
 {
     try
     {
         RESTApi.PUT <IssueUpdateData>(ApiUrl, String.Format("issues/{0}", Update.Id), Update);
         return(true);
     }
     catch (Exception Ex)
     {
         LogWriter.WriteException(Ex, "Failed with exception.");
         LastStatusMessage = String.Format("Failed to send update: ({0})", Ex.ToString());
         return(false);
     }
 }
コード例 #2
0
        public void PostUpdate(IssueUpdateData Update)
        {
            bool bUpdatedIssues;

            lock (LockObject)
            {
                PendingUpdates.Add(Update);
                bUpdatedIssues = ApplyPendingUpdate(Issues, Update);
            }

            RefreshEvent.Set();

            if (bUpdatedIssues)
            {
                OnIssuesChanged?.Invoke();
            }
        }
コード例 #3
0
        static bool ApplyPendingUpdate(List <IssueData> Issues, IssueUpdateData Update)
        {
            bool bUpdated = false;

            for (int Idx = 0; Idx < Issues.Count; Idx++)
            {
                IssueData Issue = Issues[Idx];
                if (Update.Id == Issue.Id)
                {
                    if (Update.Owner != null && Update.Owner != Issue.Owner)
                    {
                        Issue.Owner = Update.Owner;
                        bUpdated    = true;
                    }
                    if (Update.NominatedBy != null && Update.NominatedBy != Issue.NominatedBy)
                    {
                        Issue.NominatedBy = Update.NominatedBy;
                        bUpdated          = true;
                    }
                    if (Update.Acknowledged.HasValue && Update.Acknowledged.Value != Issue.AcknowledgedAt.HasValue)
                    {
                        Issue.AcknowledgedAt = Update.Acknowledged.Value? (DateTime?)DateTime.UtcNow : null;
                        bUpdated             = true;
                    }
                    if (Update.FixChange.HasValue)
                    {
                        Issue.FixChange = Update.FixChange.Value;
                        if (Issue.FixChange != 0)
                        {
                            Issues.RemoveAt(Idx);
                        }
                        bUpdated = true;
                    }
                    break;
                }
            }
            return(bUpdated);
        }