コード例 #1
0
ファイル: InMemoryDb.cs プロジェクト: danielmahadi/JiraIt
        public void SaveIssue(Issue issue)
        {
            if (issue.Id == 0) {
                issue.Id = _issues.Any () ?
                    _issues.Max (x => x.Id) + 1
                    : 1;

                issue.Key = string.Format ("{0}-{1}", issue.Project.Key, issue.Id);

                _issues.Add (issue);
            } else {
                var dbIssue = _issues.First (x => x.Id == issue.Id);
                dbIssue.Summary = issue.Summary;
                dbIssue.Description = issue.Description;
            }
        }
コード例 #2
0
ファイル: IssueListPage.cs プロジェクト: danielmahadi/JiraIt
        public IssueListPage(Project project)
        {
            NavigationPage.SetHasNavigationBar (this, true);

            _project = project;

            Title = _project.Name;

            _listview = new ListView{
                RowHeight = 80,
                ItemTemplate = new DataTemplate (typeof(IssueItemCell))
            };

            UpdateList ();

            _listview.ItemSelected += (sender, e) => {
                var issue = (Issue) e.SelectedItem;

                var issuePage = new IssuePage(issue.Key);
                issuePage.BindingContext = issue;

                Navigation.PushAsync (issuePage);
            };

            Content = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = { _listview }
            };

            if (Device.OS == TargetPlatform.iOS) {
                var addMenu = new ToolbarItem("+", null, () => {
                    var issue = new Issue();
                    issue.Project = project;

                    var issuePage = new IssuePage("New Issue");
                    issuePage.BindingContext = issue;

                    Navigation.PushAsync (issuePage);
                }, 0, 0);

                ToolbarItems.Add(addMenu);
            }
        }
コード例 #3
0
ファイル: InMemoryDb.cs プロジェクト: danielmahadi/JiraIt
 public void DeleteIssue(Issue issue)
 {
     var toDelete = _issues.First (x => x.Id == issue.Id);
     _issues.Remove (toDelete);
 }