Пример #1
0
 public GameScreenSelectViewModel(List <Rectangle> rectList, SelectGameWindowAction dg)
 {
     this.rectList = rectList;
     this.dg       = dg;
     // プロパティを設定
     PageInfoStr    = RectIndex.Select(x => $"[{x + 1}/{rectList.Count}] {Utility.GetRectStr(rectList[x])}").ToReadOnlyReactiveProperty();
     GameWindowPage = RectIndex.Select(x => (BitmapSource)ScreenShotProvider.GetScreenBitmap(rectList[x]).ToImageSource()).ToReadOnlyReactiveProperty();
     // コマンドを設定
     PrevPageCommand.Subscribe(_ => {
         RectIndex.Value = (rectList.Count + RectIndex.Value - 1) % rectList.Count;
     });
     NextPageCommand.Subscribe(_ => {
         RectIndex.Value = (rectList.Count + RectIndex.Value + 1) % rectList.Count;
     });
     SelectPageCommand.Subscribe(_ => {
         dg(rectList[RectIndex.Value]);
         CloseWindow.Value = true;
     });
     CancelCommand.Subscribe(_ => {
         dg(null);
         CloseWindow.Value = true;
     });
 }
Пример #2
0
 public Page2ViewModel(INavigationService navigationService)
 {
     PrevPageCommand.Subscribe(async _ => await navigationService.GoBackAsync());
     FirstPageCommand.Subscribe(async _ => await navigationService.GoBackToRootAsync());
 }