private bool On_PuzzleCenter_CommandAction(string cmdKey, PuzzleCenterVM sender)
        {
            switch (cmdKey)
            {
            case PuzzleCenterVM.CmdKey_AddAnswer:

                InputAnswerWindow dlg = new InputAnswerWindow();
                dlg.Owner = this;
                dlg.ShowDialog();
                if (dlg.DialogResult == true)
                {
                    PuzzleAnswerVM ans = new PuzzleAnswerVM();
                    ans.Answer        = dlg.Result;
                    ans.CommandAction = On_PuzzleAnswer_CommandAction;
                    _vm.AddAnswer(ans);
                }
                break;

            case PuzzleCenterVM.CmdKey_Start:
                _vm.Start();
                break;

            case PuzzleCenterVM.CmdKey_Stop:
                _vm.Stop();
                break;

            default:
                break;
            }

            return(true);
        }
        public PuzzleCenterWindow(PuzzleCenterVM vm)
        {
            InitializeComponent();

            _vm = vm;
            _vm.CommandAction     = On_PuzzleCenter_CommandAction;
            this.DataContext      = _vm;
            LV_Answer.ItemsSource = _vm.AnsColle;
        }
예제 #3
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);
        }
예제 #4
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);
        }