public SearchIssueViewModel() { Issues = new ObservableCollection <AddIssueViewModel>(); SearchCommand = new Command(async(parameter) => { try { // TokenAPI.CheckTokenValidation(Application.Current.Properties["token"].ToString()) if (true) { //var issues = await _issuesAPI //.SearchIssues(Application.Current.Properties["token"].ToString(), entryContext); var issues = new List <Models.Issues>(); issues.Add(new Models.Issues { IssuesTitle = "asdf3", IssuesStatusesTitle = "Invalid" }); issues.Add(new Models.Issues { IssuesTitle = "asdf3", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "a2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); var listView = parameter as ListView; foreach (var issue in issues) { var i = new AddIssueViewModel { IssueId = issue.IssueId, //IssuesCategoriesId = issue.IssuesCategoriesId, //IssuesDescription = issue.IssuesDescription, //IssuesExpectedBehavior = issue.IssuesExpectedBehavior, //IssuesPriorityId = issue.IssuesPriorityId, //IssuesProjectsId = issue.IssuesProjectsId, //IssuesSeverityId = issue.IssuesSeverityId, //AttachmentsView = issue.AttachmentsView, //Comments = issue.Comments, //IssuesStatusesId = issue.IssuesStatusesId, IssuesStatusesTitle = issue.IssuesStatusesTitle, IssuesTitle = issue.IssuesTitle }; i.StatusColor = IssueStatusColor(i.IssuesStatusesTitle); Issues.Add(i); } listView.ItemsSource = Issues; } } catch (Exception) { } }); }
public IssueListViewModel() { if (Issues == null) { Issues = new ObservableCollection <AddIssueViewModel>(); } Task.Run(async() => { try { var issues = new List <Models.Issues>(); issues.Add(new Models.Issues { IssueId = 7, IssuesTitle = "asdf", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Invalid" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Solved" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); //var issues = await _issuesAPI //.GetIssues(Application.Current.Properties["token"].ToString()); foreach (var issue in issues) { var i = new AddIssueViewModel { IssueId = issue.IssueId, //IssuesCategoriesId = issue.IssuesCategoriesId, //IssuesDescription = issue.IssuesDescription, //IssuesExpectedBehavior = issue.IssuesExpectedBehavior, //IssuesPriorityId = issue.IssuesPriorityId, //IssuesProjectsId = issue.IssuesProjectsId, //IssuesSeverityId = issue.IssuesSeverityId, //AttachmentsView = issue.AttachmentsView, //Comments = issue.Comments, //IssuesStatusesId = issue.IssuesStatusesId, IssuesStatusesTitle = issue.IssuesStatusesTitle, IssuesTitle = issue.IssuesTitle }; i.StatusColor = IssueStatusColor(i.IssuesStatusesTitle); Issues.Add(i); } } catch (Exception) { } }); SearchCommand = new Command(async() => { try { if (TokenAPI.CheckTokenValidation(Application.Current.Properties["token"].ToString())) { Issues.Clear(); //var issues = await _issuesAPI //.SearchIssues(Application.Current.Properties["token"].ToString(), EntryContext); var issues = new List <Models.Issues>(); issues.Add(new Models.Issues { IssuesTitle = "asdf3", IssuesStatusesTitle = "Invalid" }); issues.Add(new Models.Issues { IssuesTitle = "asdf3", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "a2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Open" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "In progress" }); issues.Add(new Models.Issues { IssuesTitle = "asdf2", IssuesStatusesTitle = "Close" }); foreach (var issue in issues) { var i = new AddIssueViewModel { IssueId = issue.IssueId, //IssuesCategoriesId = issue.IssuesCategoriesId, //IssuesDescription = issue.IssuesDescription, //IssuesExpectedBehavior = issue.IssuesExpectedBehavior, //IssuesPriorityId = issue.IssuesPriorityId, //IssuesProjectsId = issue.IssuesProjectsId, //IssuesSeverityId = issue.IssuesSeverityId, //AttachmentsView = issue.AttachmentsView, //Comments = issue.Comments, //IssuesStatusesId = issue.IssuesStatusesId, IssuesStatusesTitle = issue.IssuesStatusesTitle, IssuesTitle = issue.IssuesTitle }; i.StatusColor = IssueStatusColor(i.IssuesStatusesTitle); Issues.Add(i); } } } catch (Exception) { } }); }