Esempio n. 1
0
        private bool On_MainVM_CommentAction(string cmdKey, MainWindowVM sender)
        {
            switch (cmdKey)
            {
            case MainWindowVM.CmdKey_Start:
                sender.Start();
                break;

            case MainWindowVM.CmdKey_Stop:
                sender.Stop();
                break;

            case MainWindowVM.CmdKey_Vote:
                VotingCenterVM votingCenter = sender.GetVotingCenter();
                if (votingCenter == null)
                {
                    return(false);
                }

                VotingCenterWindow voteWnd = new VotingCenterWindow(votingCenter);
                voteWnd.Owner = this;
                voteWnd.Show();

                break;

            case MainWindowVM.CmdKey_Puzzle:
                PuzzleCenterVM puzzleCenter = sender.GetPuzzleCenter();
                if (puzzleCenter == null)
                {
                    return(false);
                }

                PuzzleCenterWindow puzzleWnd = new PuzzleCenterWindow(puzzleCenter);
                puzzleWnd.Owner = this;
                puzzleWnd.Show();
                break;

            case MainWindowVM.CmdKey_ExportComment:
                sender.ExportComment();
                break;


            default:
                break;
            }

            return(true);
        }
Esempio n. 2
0
        private bool On_MainVM_CommentAction(string cmdKey, MainWindowVM sender)
        {
            switch (cmdKey)
            {
            case MainWindowVM.CmdKey_Start:
                sender.Start();
                break;

            case MainWindowVM.CmdKey_Stop:
                sender.Stop();
                break;

            case MainWindowVM.CmdKey_Vote:
                VotingCenterVM votingCenter = sender.CreateVotingCenter();
                if (votingCenter == null)
                {
                    return(false);
                }

                VotingCenterWindow voteWnd = new VotingCenterWindow(votingCenter);
                voteWnd.Owner   = this;
                voteWnd.Closed += (s, e) => { this.Activate(); };
                voteWnd.Show();

                break;

            case MainWindowVM.CmdKey_Puzzle:
                PuzzleCenterVM puzzleCenter = sender.CreatePuzzleCenter();
                if (puzzleCenter == null)
                {
                    return(false);
                }

                PuzzleCenterWindow puzzleWnd = new PuzzleCenterWindow(puzzleCenter);
                puzzleWnd.Owner   = this;
                puzzleWnd.Closed += (s, e) => { this.Activate(); };
                puzzleWnd.Show();
                break;

            case nameof(sender.CmdAssessment):
                AssessmentCenterVM assessmentCenter = sender.CreateAssessmentCenter();
                if (assessmentCenter == null)
                {
                    return(false);
                }

                AssessmentCenterWindow assessmentWnd = new AssessmentCenterWindow(assessmentCenter);
                assessmentWnd.Owner   = this;
                assessmentWnd.Closed += (s, e) => { this.Activate(); };
                assessmentWnd.Show();
                break;

            case MainWindowVM.CmdKey_ExportComment:
                sender.ExportComment();
                break;

            default:
                break;
            }

            return(true);
        }