Пример #1
0
 public void QueryForIssues()
 {
     Task.Factory.StartNew(() => Proxy.Query(CurrentProjectShortName, CurrentQuery)).ContinueWith(
         r =>
     {
         Application.Current.Dispatcher.Invoke(new Action(() => Issues.Clear()));
         foreach (var issue in r.Result)
         {
             Application.Current.Dispatcher.Invoke(new Action(() => Issues.Add(issue)));
         }
     });
 }
Пример #2
0
        private async Task RefreshContent()
        {
            Issues.Clear();

            VerticalDimension = null;
            VerticalDimension = await scope.GetRowHeadersAsync();

            HorizontalDimension = null;
            HorizontalDimension = await scope.GetColumnHeadersAsync();

            CardContent = scope.GetCardContent();

            Issues.PublishCollection(await scope.GetIssuesAsync());
        }
Пример #3
0
    private void OnUserChanged()
    {
        Issues.Clear();

        string name          = this.User;
        Issues fetchedIssues = new Issues();

        var issuesList = fetchedIssues.FetchIssues(name);         // returns the list of Issues in a type of --> IQueryable<Issue>

        foreach (var issue in issuesList)
        {
            Issues.Add(issue);
        }
    }
Пример #4
0
        private async Task <bool> OnRefreshContent()
        {
            Issues.Clear();
            if (LocationId <= 0 || App.Client.LoggedIn == false)
            {
                await App.Client.ShowSelectLocation();

                LocationId = App.Client.GetCurrentLocationId();
                return(false);
            }

            return(await Task.Run(
                       () =>
            {
                try
                {
                    UserDialogs.Instance.ShowLoading("Loading events...", MaskType.Clear);

                    var items = App.Client.GetIssues(LocationId);
                    foreach (IssueModel Item in items)
                    {
                        Issues.Add(Item);
                    }

                    RefeshNeeded = false;

                    UserDialogs.Instance.HideLoading();

                    return true;
                }
                catch (UnauthorizedException exception)
                {
                    Debug.WriteLine(exception);
                    RefeshNeeded = false;
                    UserDialogs.Instance.HideLoading();
                    UserDialogs.Instance.Alert(
                        "Not Unauthorized\nLogin with another account or change location");
                    return false;
                }
                catch (Exception exception)
                {
                    Debug.WriteLine(exception + "Unknown error while retrieving data");
                    RefeshNeeded = false;
                    UserDialogs.Instance.HideLoading();
                    UserDialogs.Instance.Alert("Failed. Unknown error while getting issues..");
                    return false;
                }
            }));
        }
Пример #5
0
        private async Task DoRefresh()
        {
            using (var busyContext = GetBusyContext())
            {
                var filters = BuildFilters();

                var data = await Task
                           .Run(() => model.LoadData(filters))
                           .ConfigureAwait(true);

                Issues.Clear();
                VerticalDimension   = data.VerticalDimension;
                HorizontalDimension = data.HorizontalDimension;
                CardContent         = data.CardElements;
                CardsColors         = data.CardsColors;
                Issues.AddRange(data.Issues);
            }
        }
Пример #6
0
        } //TODO: add some logic preventing empty name

        public void Initialize(ViewRequest viewRequest)
        {
            scope = (viewRequest as BoardViewRequest).Scope;

            Issues.Clear();

            Observable.FromAsync(() => scope.GetRowHeadersAsync())
            .ObserveOnDispatcher()
            .Subscribe(vert => VerticalDimension = vert);

            Observable.FromAsync(() => scope.GetColumnHeadersAsync())
            .ObserveOnDispatcher()
            .Subscribe(horiz => HorizontalDimension = horiz);

            CardContent = scope.GetCardContent();

            Observable.FromAsync(() => scope.GetIssuesAsync())
            .ObserveOnDispatcher()
            .Subscribe(issues => Issues.AddRange(issues));     // TODO: make initialize works
        }
        private void Initialize(LogTimeMessage arguments)
        {
            Issues.Clear();
            var issuesFromProject = arguments.UserProject.Issues;

            foreach (var issue in issuesFromProject)
            {
                Issues.Add(issue);
            }
            SelectedIssue = Issues.FirstOrDefault();
            var activities = arguments.UserProject.Activities;

            Activities.Clear();
            foreach (var activity in activities)
            {
                Activities.Add(activity);
            }
            SelectedDate = arguments.Period.StartDate;
            Period       = arguments.Period;
        }
Пример #8
0
        } //TODO: add some logic preventing empty name

        public void Initialize(ViewRequest viewRequest)
        {
            var request = viewRequest as BoardViewRequest;

            IssueViewModel = new IssueViewModel();

            scope = request.Scope;

            Observable.FromAsync(() => scope.GetAllBoardsInFileAsync())
            .ObserveOnDispatcher()
            .Subscribe(boards =>
            {
                BoardsInFile.PublishCollection(boards);

                CurrentBoard = !string.IsNullOrEmpty(request.SelectedBoardName)
                        ? BoardsInFile.First(board => board.Name == request.SelectedBoardName)
                        : BoardsInFile.First();

                Issues.Clear();

                Observable.FromAsync(() => scope.GetRowHeadersAsync(CurrentBoard.Id))
                .ObserveOnDispatcher()
                .Subscribe(vert => VerticalDimension = vert);

                Observable.FromAsync(() => scope.GetColumnHeadersAsync(CurrentBoard.Id))
                .ObserveOnDispatcher()
                .Subscribe(horiz => HorizontalDimension = horiz);

                CardContent = scope.GetCardContent();

                Observable.FromAsync(() => scope.GetIssuesByBoardIdAsync(CurrentBoard.Id))
                .ObserveOnDispatcher()
                .Subscribe(issues =>
                           Issues.AddRange(issues));
            });
        }
Пример #9
0
 public void Clear()
 {
     Issues.Clear();
 }
Пример #10
0
        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)
                {
                }
            });
        }