Ejemplo n.º 1
0
        AddNewElement(string elementName)
        {
            if (elementName == "Задачу")
            {
                IssueViewModel.Initialize(new IssueViewRequest
                {
                    IssueId = 0,
                    Scope   = scope,
                    Board   = CurrentBoard
                });
            }

            else if (elementName == "Строку")
            {
                var newName = await ShowRowNameInput();

                if (!string.IsNullOrEmpty(newName))
                {
                    var newRow = new RowInfo {
                        Name = newName, Board = CurrentBoard
                    };
                    await scope.CreateOrUpdateRowAsync(newRow);
                }
            }

            else if (elementName == "Столбец")
            {
                var newName = await ShowColumnNameInput();

                if (!string.IsNullOrEmpty(newName))
                {
                    var newColumn = new ColumnInfo {
                        Name = newName, Board = CurrentBoard
                    };
                    await scope.CreateOrUpdateColumnAsync(newColumn);
                }
            }

            await RefreshContent();
        }
Ejemplo n.º 2
0
        private void UpdateCard(object o)
        {
            if (o is LocalIssue)
            {
                IssueViewModel.Initialize(new IssueViewRequest
                {
                    IssueId = SelectedIssue.Id,
                    Scope   = scope,
                    Board   = CurrentBoard
                });
            }

            else if (o is null)
            {
                IssueViewModel.Initialize(new IssueViewRequest
                {
                    IssueId = 0,
                    Scope   = scope,
                    Board   = CurrentBoard
                });
            }
        }
Ejemplo n.º 3
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));
            });
        }