Example #1
0
        public void Initialize(ViewRequest viewRequest)
        {
            var request = viewRequest as IssueViewRequest;

            scope = request.Scope;

            var issueId = request?.IssueId;

            if (issueId == 0)
            {
                issueId = null;
            }

            Observable.FromAsync(() => scope.LoadOrCreateAsync(issueId))
            .ObserveOnDispatcher()
            .Subscribe(issue =>
                       mapper.Map(issue, this));

            Observable.FromAsync(() => scope.GetRows())
            .ObserveOnDispatcher()
            .Subscribe(rows =>
            {
                AwailableRows.Clear();
                AwailableRows.AddRange(rows);
            });

            Observable.FromAsync(() => scope.GetColumns())
            .ObserveOnDispatcher()
            .Subscribe(columns =>
                       AwailableColumns.PublishCollection(columns));

            Title = $"Редактирование задачи {Head}";
        }
Example #2
0
        public void Initialize(ViewRequest viewRequest)
        {
            if (viewRequest is IssueViewRequest request)
            {
                scope = request.Scope;

                board = request.Board;

                mapper.Map(new LocalIssue(), this);

                IssueChanged = false;

                Observable.FromAsync(() => scope.GetRowsByBoardIdAsync(board.Id))
                .ObserveOnDispatcher()
                .Subscribe(rows =>
                {
                    AwailableRows.PublishCollection(rows);
                    Row = AwailableRows.First();
                });

                Observable.FromAsync(() => scope.GetColumnsByBoardIdAsync(board.Id))
                .ObserveOnDispatcher()
                .Subscribe(columns =>
                {
                    AwailableColumns.PublishCollection(columns);
                    Column = AwailableColumns.First();
                });

                var issueId = request.IssueId;

                if (issueId != null && issueId > 0)
                {
                    Observable.FromAsync(() => scope.LoadOrCreateIssueAsync(issueId))
                    .ObserveOnDispatcher()
                    .Subscribe(issue =>
                    {
                        mapper.Map(issue, this);
                        Row    = AwailableRows.First(r => r.Id == Row.Id);
                        Column = AwailableColumns.First(c => c.Id == Column.Id);
                    });
                }
            }

            Title    = $"Редактирование задачи {Head}";
            IsOpened = true;
        }
Example #3
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
        }
Example #4
0
        public void Initialize(ViewRequest viewRequest)
        {
            var request = viewRequest as WizardViewRequest;

            InExistedFile = (bool)request?.InExistedFile;

            if (InExistedFile)
            {
                var uri = request.Uri;
                FolderName = Path.GetDirectoryName(uri);
                FileName   = Path.GetFileName(uri);
                FullTitle  = $"Creating new board";
                FullTitle  = $"Creating new board in {uri}";
                scope      = appModel.CreateScope(uri);
                Observable.FromAsync(() => scope.GetAllBoardsInFileAsync())
                .ObserveOnDispatcher()
                .Subscribe(boards =>
                           BoardsInFile.PublishCollection(boards.Select(board => board.Name)));
            }
        }
Example #5
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));
            });
        }
Example #6
0
        public async Task Create() // todo:validate first wizard page again when creating?
        {
            var uri = FolderName + "\\" + FileName;

            if (!InExistedFile)
            {
                scope = appModel.CreateScope(uri);
            }

            else
            {
                var boards = await scope.GetAllBoardsInFileAsync();

                BoardsInFile.PublishCollection(boards.Select(board => board.Name));

                if (BoardsInFile.Contains(BoardName))
                {
                    await dialogCoordinator.ShowMessageAsync(this, "Can not create board",
                                                             "Board with such name already exists in file");

                    return;
                }
            }

            appModel.AddRecent(uri);

            appModel.SaveConfig();

            var newBoard = new BoardInfo()
            {
                Name     = BoardName,
                Created  = DateTime.Now,
                Modified = DateTime.Now
            };

            newBoard = await scope.CreateOrUpdateBoardAsync(newBoard);

            foreach (var colName in ColumnList.Select(column => column.Name))
            {
                await scope.CreateOrUpdateColumnAsync(new ColumnInfo
                {
                    Name  = colName,
                    Board = newBoard
                });
            }

            foreach (var rowName in RowList.Select(row => row.Name))
            {
                await scope.CreateOrUpdateRowAsync(new RowInfo
                {
                    Name  = rowName,
                    Board = newBoard
                });
            }

            Close();

            shell.ShowDistinctView <BoardView>(uri,
                                               viewRequest: new BoardViewRequest {
                Scope = scope, SelectedBoardName = BoardName
            },
                                               options: new UiShowOptions {
                Title = uri
            });
        }