Beispiel #1
0
        public void EditBoard(string boardId)
        {
            try
            {
                var board = FeudHostService.GetBoardForHost(boardId);

                BoardToEdit = new EditBoardViewModel
                {
                    Id       = board.Id,
                    Name     = board.Name,
                    Question = board.Question
                };

                for (var i = 0; i < board.Answers.Count; i++)
                {
                    BoardToEdit.Answers[i].Text   = board.Answers[i].Text;
                    BoardToEdit.Answers[i].Points = board.Answers[i].Points;
                }

                CurrentEditTab = Shared.EditBoard.TabKeys.Edit;

                InvokeAsync(StateHasChanged);
            }
            catch (Exception ex)
            {
                Program.Logger.Log(NLog.LogLevel.Error, ex);
                NavigationManager.NavigateTo("error");
            }
        }
Beispiel #2
0
        public async Task DeleteBoard(string boardId)
        {
            try
            {
                var confirmModal = Modal.Show <ConfirmBoardDeletion>("Delete Board?");
                var result       = await confirmModal.Result;

                if (!result.Cancelled)
                {
                    FeudHostService.DeleteBoard(boardId);

                    if (boardId == BoardToEdit.Id)
                    {
                        ResetBoardAfterEditing(null, null);
                    }
                    else
                    {
                        await InvokeAsync(StateHasChanged);
                    }
                }
            }
            catch (Exception ex)
            {
                Program.Logger.Log(NLog.LogLevel.Error, ex);
                NavigationManager.NavigateTo("error");
            }
        }
Beispiel #3
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                BoardToEdit = new EditBoardViewModel();

                await FeudHostService.LoadBoardsAsync();

                Boards = FeudHostService.GetBoardsForHost();

                Program.Logger.Log(NLog.LogLevel.Debug, $"FeudList.OnInitialized - adding event handlers");

                BoardEditingService.BoardChangesSaving    += SaveBoard;
                BoardEditingService.BoardChangesCancelled += ResetBoardAfterEditing;
            }
            catch (Exception ex)
            {
                Program.Logger.Log(NLog.LogLevel.Error, ex);
                NavigationManager.NavigateTo("error");
            }
        }