public TutorState(EPuzzleWindow window, EPuzzleTutor tutor) : base(window) { Trace.WriteLine(_sortType); _tutor = tutor; _kirokuBox = new KirokuBox2() { Position = DrawingObjectPosition.Absolute, Left = 10, Top = 60, Width = 280, Height = 200, UserInfo = Window.EPuzzleData.CurrentUserInfo, }; Action0 += (sender, e) => { var chumonButton = CurrentItem as ChumonButton; if (null != chumonButton) { Chumonを開始する(chumonButton.Chumon, this); return; } var button = CurrentItem as EigoTestButtonItem; if (null != button) { switch (button.Name) { case "upButton" : _helpWithScroll.ScrollUp(); return; case "downButton" : _helpWithScroll.ScrollDown(); return; /* case "orderByGradeStringsButton" : OrderByGradeStrings = !OrderByGradeStrings; Refresh(); return;*/ case "mottoyaruButton" : もっとやる係数++; Refresh(); return; case "backToStartGameStateButton" : MoveToStartGameState(); return; case "byGracePriodButton" : { _sortType = TutorStateSortType.GracePriod; Refresh(); return; } case "byDateYouDidThemButton" : { _sortType = TutorStateSortType.DateYouDidThem; Refresh(); return; } case "byGradeButton" : { _sortType = TutorStateSortType.Grade; Refresh(); return; } default: return; } } }; ActionUp += (sender, e) => { _helpWithScroll.ScrollUp(); }; ActionDown += (sender, e) => { _helpWithScroll.ScrollDown(); }; PropertyChanged += (sender, e) => { if ("CurrentItem" != e.PropertyName) return; var chumonButton = CurrentItem as ChumonButton; _kirokuBox.Chumon = null == chumonButton ? null : chumonButton.Chumon; }; EventHandler updateScreen = (sender, e) => { Refresh(); }; _dateYouDidThemScrollHelper.UpdateScreen += updateScreen; _gracePriodScrollHelper.UpdateScreen += updateScreen; _gradeScrollHelper.UpdateScreen += updateScreen; Refresh(); }
private Chumon[] GetChumons(EPuzzleTutor tutor, TutorStateSortType sortType) { IEnumerable<Chumon> chumons = null; switch (sortType) { case TutorStateSortType.GracePriod : { chumons = tutor.GetChumons(false); break; } case TutorStateSortType.DateYouDidThem : { chumons = tutor.SortChumonsByDateYouDidThem(); break; } case TutorStateSortType.Grade : { chumons = tutor.GetChumons(true); break; } default : throw new ApplicationException("never reach here."); } return chumons.ToArray(); }