예제 #1
0
        private static UserControl CreateNewScreen(ScreenViewModel vm)
        {
            if (vm is BoardsListingModel)
            {
                return new BoardsListing((BoardsListingModel)vm);
            }
            else if (vm is BoardCatalogModel)
            {
                return new BoardCatalog((BoardCatalogModel)vm);
            }
            else if (vm is ThreadViewModel)
            {
                return new ThreadPage((ThreadViewModel)vm);
            }
            else if (vm is ThreadImageModel)
            {
                return new ThreadImageScreen((ThreadImageModel)vm);
            }
            else if (vm is Settings.SettingsScreenModel)
            {
                return new Settings.SettingsScreen((Settings.SettingsScreenModel)vm);
            }

            throw new Exception("Unknown view model!");
        }
 public override void CloseScreen(ScreenViewModel screen)
 {
     if (screen == BoardsScreen)
         return;
     base.CloseScreen(screen);
 }
 public ScreenRemovedArgs(ScreenViewModel screen)
 {
     Screen = screen;
 }
 public CurrentScreenChangedArgs(ScreenViewModel previous, ScreenViewModel current)
 {
     Previous = previous;
     Current = current;
 }
예제 #5
0
 private UserControl GetViewForViewModel(ScreenViewModel vm)
 {
     UserControl view;
     if (!_screenViews.TryGetValue(vm, out view))
     {
         view = CreateNewScreen(vm);
         _screenViews.Add(vm, view);
     }
     return view;
 }
예제 #6
0
 private void DisplayScreen(ScreenViewModel vm)
 {
     var view = GetViewForViewModel(vm);
     ContentContainer.Children.Clear();
     ContentContainer.Children.Add(view);
 }