コード例 #1
0
		private async Task SelectUser(BasicUserModel x)
		{
			if (SaveOnSelect)
			{
				try
				{
					IsSaving = true;
					var assignee = x != null ? x.Login : null;
					var updateReq = this.GetApplication().Client.Users[Username].Repositories[Repository].Issues[Id].UpdateAssignee(assignee);
					var newIssue = await this.GetApplication().Client.ExecuteAsync(updateReq);
					Messenger.Publish(new IssueEditMessage(this) { Issue = newIssue.Data });
		
				}
				catch (Exception e)
				{
                    DisplayAlert("Unable to assign issue to selected user! Please try again.");
				}
				finally
				{
					IsSaving = false;
				}
			}
			else
			{
				Messenger.Publish(new SelectedAssignedToMessage(this) { User = x });
			}

			ChangePresentation(new Cirrious.MvvmCross.ViewModels.MvxClosePresentationHint(this));
		}
コード例 #2
0
        private async Task SelectUser(BasicUserModel x)
        {
            if (SaveOnSelect)
            {
                try
                {
                    IsSaving = true;
                    var assignee  = x != null ? x.Login : null;
                    var updateReq = this.GetApplication().Client.Users[Username].Repositories[Repository].Issues[Id].UpdateAssignee(assignee);
                    var newIssue  = await this.GetApplication().Client.ExecuteAsync(updateReq);

                    _messageService.Send(new IssueEditMessage(newIssue.Data));
                }
                catch
                {
                    DisplayAlert("Unable to assign issue to selected user! Please try again.");
                }
                finally
                {
                    IsSaving = false;
                }
            }
            else
            {
                _messageService.Send(new SelectedAssignedToMessage(x));
            }

            ChangePresentation(new MvxClosePresentationHint(this));
        }
コード例 #3
0
        private async Task SelectUser(BasicUserModel x)
        {
            if (SaveOnSelect)
            {
                try
                {
                    IsSaving = true;
                    var assignee  = x != null ? x.Login : null;
                    var updateReq = this.GetApplication().Client.Users[Username].Repositories[Repository].Issues[Id].UpdateAssignee(assignee);
                    var newIssue  = await this.GetApplication().Client.ExecuteAsync(updateReq);

                    Messenger.Publish(new IssueEditMessage(this)
                    {
                        Issue = newIssue.Data
                    });
                }
                catch (Exception e)
                {
                    DisplayAlert("Unable to assign issue to selected user! Please try again.");
                }
                finally
                {
                    IsSaving = false;
                }
            }
            else
            {
                Messenger.Publish(new SelectedAssignedToMessage(this)
                {
                    User = x
                });
            }

            ChangePresentation(new Cirrious.MvvmCross.ViewModels.MvxClosePresentationHint(this));
        }
コード例 #4
0
        public IssueAssigneesViewController(string user, string repo)
        {
            Title             = "Assignees".t();
            NoItemsText       = "No Assignees".t();
            SearchPlaceholder = "Search Assignees".t();
            ViewModel         = new RepositoryCollaboratorsViewModel(user, repo);

            //Add a fake 'Unassigned' guy so we can always unassigned what we've done
            ViewModel.BindCollection(x => x.Collaborators, (ev) =>
            {
                var items       = ViewModel.Collaborators.ToList();
                var notAssigned = new BasicUserModel {
                    Id = 0, Login = "******"
                };
                items.Insert(0, notAssigned);

                RenderList(items, x => {
                    var e       = new UserElement(x.Login, string.Empty, string.Empty, x.AvatarUrl);
                    e.Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator;
                    e.Tapped   += () => {
                        if (SelectedUser != null)
                        {
                            SelectedUser(x == notAssigned ? null : x);
                        }
                    };
                    return(e);
                }, ViewModel.Collaborators.MoreItems);
            });
        }
コード例 #5
0
        protected Element CreateElement(BasicUserModel model)
        {
            StyledStringElement sse = new UserElement(model.Login, string.Empty, string.Empty, model.AvatarUrl);

            sse.Tapped += () => NavigationController.PushViewController(new ProfileViewController(model.Login), true);
            return(sse);
        }
コード例 #6
0
        private void PopulateRoot()
        {
            _title = new InputElement("Title", string.Empty, string.Empty);

            _assignedTo           = new StyledStringElement("Responsible", Unassigned, UITableViewCellStyle.Value1);
            _assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            _assignedTo.Tapped   += () => {
                var p = new IssueAssigneesViewController(Username, RepoSlug);
                p.SelectedUser = (x) => {
                    _selectedAssignee = x;
                    NavigationController.PopViewControllerAnimated(true);
                };
                NavigationController.PushViewController(p, true);
            };

            _milestone           = new StyledStringElement("Milestone".t(), None, UITableViewCellStyle.Value1);
            _milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            _milestone.Tapped   += () => {
                var p = new IssueMilestonesViewController(Username, RepoSlug);
                p.MilestoneSelected = (x) => {
                    _selectedMilestone = x;
                    NavigationController.PopViewControllerAnimated(true);
                };
                NavigationController.PushViewController(p, true);
            };

            _labels           = new StyledStringElement("Labels".t(), None, UITableViewCellStyle.Value1);
            _labels.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            _labels.Tapped   += () => {
                var p = new IssueLabelsViewController(Username, RepoSlug)
                {
                    SelectedLabels = _selectedLabels
                };
                NavigationController.PushViewController(p, true);
            };

            _state = new TrueFalseElement("Open", true);

            _content         = new MultilinedElement("Description");
            _content.Tapped += () =>
            {
                var composer = new Composer {
                    Title = "Issue Description", Text = _content.Value, ActionButtonText = "Save"
                };
                composer.NewComment(this, (text) => {
                    _content.Value = text;
                    composer.CloseComposer();
                });
            };

            var root = new RootElement(Title)
            {
                new Section {
                    _title, _assignedTo, _milestone, _labels
                }, new Section {
                    _content
                }
            };

            //See if it's an existing issue or not...
            if (ExistingIssue != null)
            {
                _title.Value       = ExistingIssue.Title;
                _selectedAssignee  = ExistingIssue.Assignee;
                _selectedMilestone = ExistingIssue.Milestone;
                _selectedLabels    = ExistingIssue.Labels;
                _content.Value     = ExistingIssue.Body;
                _state.Value       = ExistingIssue.State.Equals("open");

                //Insert the status thing inbetween title and assigned to elements
                root.Insert(1, new Section()
                {
                    _state
                });
            }

            Root = root;
        }
コード例 #7
0
 public SelectedAssignedToMessage(BasicUserModel user)
 {
     User = user;
 }