Exemplo n.º 1
0
 private void _pivotalNotifier_OnStartedTask(Story story)
 {
     ShowStory(story, "Tarefa iniciada");
 }
Exemplo n.º 2
0
 void _pivotalNotifier_OnDeliveredTask(Story story)
 {
     ShowStory(story, "Tarefa entregue");
 }
Exemplo n.º 3
0
 void _pivotalNotifier_OnFinishedTask(Story story)
 {
     ShowStory(story, "Tarefa finalizada");
 }
Exemplo n.º 4
0
 private void _pivotalNotifier_OnCreatedTask(Story story)
 {
     ShowStory(story, "Tarefa criada");
 }
Exemplo n.º 5
0
 void _pivotalNotifier_OnDeletedTask(Story story)
 {
     ShowStory(story, "Tarefa deletada");
 }
Exemplo n.º 6
0
        private void ShowStory(Story story, string oQueAconteceu)
        {
            Action acao = () =>
            {
                lblAcao.Text = string.Format("{0} - Exibido em {1}", oQueAconteceu, DateTime.Now.ToString("dd/MM/yyyy - HH:mm:ss"));
                extendedNotifyIcon_OnShowWindow();
                lblNome.Text = story.Name;
                lblPontos.Text = story.Estimate.ToString();
                lblTipo.Source = new BitmapImage(new Uri(string.Format("/Images/{0}.png", (int)story.Type),UriKind.Relative));
                lblDescricao.Text = story.Description;

                if (story.Labels.Any())
                    foreach (var label in story.Labels)
                        lblLabels.Text += string.Format("{0},", label);
                else
                    lblLabels.Text = string.Empty;

                if (story.Notes.Any())
                    foreach (var note in story.Notes)
                        lblComentarios.Text += note.ToMyString();
                else
                    lblComentarios.Text = string.Empty;

                if (story.Tasks.Any())
                    foreach (var task in story.Tasks)
                        lblTask.Text += task.Description + "\n";
                else
                    lblTask.Text = string.Empty;
                var timer = new Timer(5000);
                timer.Start();
                timer.Elapsed += (x, y) => Dispatcher.Invoke(new Action(() =>
                                                                            {
                                                                                extendedNotifyIcon_OnHideWindow();
                                                                                timer.Stop();
                                                                            }));
            };
            Dispatcher.Invoke(acao);
        }
        internal static Story CreateStory(StoryXmlResponse e)
        {
            var lStory = new Story()
                             {
                                 AcceptedDate = e.accepted_at,
                                 //Attachments =
                                 CreatedDate = e.created_at,
                                 UpdatedDate = e.updated_at,
                                 CurrentState = (StoryStateEnum) Enum.Parse(typeof (StoryStateEnum), e.current_state, true),
                                 Description = e.description,
                                 Estimate =  e.estimate,
                                 Id = e.id,
                                 Name = e.name,
                                 //Notes =
                                 OwnedBy = e.owned_by,
                                 ProjectId = e.project_id,
                                 RequestedBy = e.requested_by,
                                 //Tasks =
                                 Type = (StoryTypeEnum)Enum.Parse(typeof(StoryTypeEnum), e.story_type, true),
                                 Url = new Uri(e.url)
                             };

            if (e.attachments != null)
                e.attachments.ToList().ForEach(a => lStory.Attachments.Add(a));

            if (e.notes != null)
                e.notes.ToList().ForEach(a => lStory.Notes.Add(new Note()
                {
                    Id = a.id,
                    Author = a.author,
                    Description = a.text,
                    NoteDate = a.noted_at == null ? null : a.noted_at.DateTime
                }));

            if (e.tasks != null)
                e.tasks.ToList().ForEach(a => lStory.Tasks.Add(a));

            return lStory;
        }
        public Story UpdateStory(Story story)
        {
            var path = string.Format("/projects/{0}/stories/{1}", story.ProjectId, story.Id);
            var s = new StoryXmlRequest
                        {
                            current_state = story.CurrentState.ToString().ToLowerInvariant(),
                            description = story.Description,
                            labels = story.Labels.Count == 0 ? "" : story.Labels.Aggregate((a, b) => a+b),
                            name = story.Name,
                            owned_by = story.OwnedBy,
                            story_type = story.Type.ToString().ToLowerInvariant(),
                            requested_by = story.RequestedBy,
                        };
            if (story.Estimate > 0)
                s.estimate = story.Estimate;

            var e = this.RequestPivotal<StoryXmlResponse>(path, s, "PUT");
            return CreateStory(e);
        }
		public Story UpdateStory(Story story, bool isBugAndChoresEstimables)
		{
			var path = string.Format("/projects/{0}/stories/{1}", story.ProjectId, story.Id);
			var s = new StoryXmlRequest
						{
							current_state = story.CurrentState.ToString().ToLowerInvariant(),
							description = story.Description,
							labels = story.Labels.Count == 0 ? "" : story.Labels.Aggregate((a, b) => a + ", " + b),
							name = story.Name,
							owned_by = story.OwnedBy,
							story_type = story.Type.ToString().ToLowerInvariant(),
							requested_by = story.RequestedBy,
						};

			// Check if we should set an estimate
			if (story.Estimate >= -1)
			{
				switch (story.Type)
				{
					case StoryTypeEnum.Chore:
					case StoryTypeEnum.Bug:
						if (isBugAndChoresEstimables)
							s.estimate = story.Estimate;
						else
							s.estimate = -1;
						break;

					default:
						s.estimate = story.Estimate;
						break;
				}
			}


			var e = this.RequestPivotal<StoryXmlResponse>(path, s, "PUT");
			return CreateStory(e);

		}
		internal static Story CreateStory(StoryXmlResponse e)
		{

			var lStory = new Story()
							 {
								 AcceptedDate = e.accepted_at,
								 //Attachments =
								 CreatedDate = e.created_at,
								 UpdatedDate = e.updated_at,
                                 Deadline = e.deadline,
								 CurrentState = (StoryStateEnum) Enum.Parse(typeof (StoryStateEnum), e.current_state, true),
								 Description = e.description,
								 Estimate =  e.estimate,
								 Id = e.id,
								 Name = e.name,
								 //Notes =
								 OwnedBy = e.owned_by,
								 ProjectId = e.project_id,
								 RequestedBy = e.requested_by,
								 //Tasks =
								 Type = (StoryTypeEnum)Enum.Parse(typeof(StoryTypeEnum), e.story_type, true),
								 Url = new Uri(e.url)
							 };

			if (e.attachments != null)
				e.attachments.ToList().ForEach(a => lStory.Attachments.Add(a));

			if (e.labels != null)
			{
				var labels = e.labels.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
				labels.ToList().ForEach(a => lStory.Labels.Add(a));
			}

			if (e.notes != null)
				e.notes.ToList().ForEach(a => lStory.Notes.Add(new Note()
				{
					Id = a.id,
					Author = a.author,
					Description = a.text,
					NoteDate = a.noted_at == null ? null : a.noted_at.DateTime
				}));

			if (e.tasks != null)
				e.tasks.ToList().ForEach(a => lStory.Tasks.Add(new Task()
				{
					Id = a.id,
					Description = a.description,
					Position = a.position,
					IsCompleted = a.complete,
					CreatedDate = a.created_at == null ? null : a.created_at.DateTime
				}));

			return lStory;
		}