public static ContentView AsView(this PageType type) { ContentView view = null; switch (type) { case PageType.Analysis: view = new AnalysisView(); break; case PageType.Favorites: view = new FavoritesView(); break; case PageType.Gallery: view = new GalleryView(); break; case PageType.Home: view = new UploadView(); break; case PageType.Search: view = new SearchResultsView(); break; case PageType.Timeline: view = new TimelineView(); break; } return(view); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var movieRepository = new MovieRepository(); var movieView = new fMain(); var moviePresenter = new MoviePresenter(movieView, movieRepository); var favoriteRepository = new FavoritesRepository(); var favoriteView = new FavoritesView(); var favoritePresenter = new FavoritesPresenter(favoriteView, favoriteRepository); movieView.Presenter = moviePresenter; moviePresenter.View = movieView; movieView.FavoritesPresenter = favoritePresenter; favoritePresenter.Favorites = favoriteView; favoriteView.Presenter = favoritePresenter; Application.Run(movieView); }
protected override async void OnAppearing() { UserDialogs.Instance.ShowLoading(""); var preferences = TinyIoCContainer.Current.Resolve <IPreferences>(); await DataUpdater.UpdateDataIfNeeded(DependencyService.Get <IFileAccess>(), preferences); await RefreshData(); UserDialogs.Instance.HideLoading(); int row = 0, col = 0; int maxCol = grid.ColumnDefinitions.Count; grid.Children.Clear(); foreach (var busService in _viewModel.Routes) { var item = new RouteView(busService); item.OnServiceClicked += OnBusServiceSelected; grid.Children.Add(item, col, row); col++; row = col == maxCol ? row + 1 : row; col %= maxCol; } if (DateTime.TryParse(preferences.Get("rate_popup_last_shown", DateTime.MinValue.ToString()), out var ratePopupLastShown)) { if (!preferences.IsFirstLaunch && preferences.Get("rated", "0") != "1" && (DateTime.Today - ratePopupLastShown).TotalDays >= 5) { await Navigation.PushPopupAsync(new RatePopup(preferences)); } } else { preferences.Set("rate_popup_last_shown", DateTime.Today.ToString()); } await FavoritesView.RefreshView(); base.OnAppearing(); }
protected override UITableViewCell GetOrCreateCellFor(UITableView tableView, NSIndexPath indexPath, object item) { FavoritesView.RemoveLoadingScreen(); return(tableView.DequeueReusableCell(_cellId)); }
public void initGui() { //init widgets win = new Window("Home"); vBox = new VBox(false, 0); menuBar = new MenuBar(); menu = new Menu(); viewMenu = new MenuItem("View"); history = new MenuItem("History"); favorites = new MenuItem("Favorites"); home = new MenuItem("Homepage"); main = new MenuItem("Main"); view = new TextView(); buffer = view.Buffer; scroll = new ScrolledWindow(); hBox = new HBox(false, 0); backButton = new Button("<"); forwardButton = new Button(">"); reloadButton = new Button("\u27F3"); homeButton = new Button("\u2302"); favoriteButton = new Button(); searchBar = new Entry(); statusText = new Label(); homeView = new HomeView(userData); favoritesView = new FavoritesView(userData, updateStatusBar, setState, makeRequest); historyView = new HistoryView(userData, setButtonStates, setState, makeRequest); //set up main view view.Editable = false; scroll.Add(view); //set up serch bar layout hBox.PackStart(backButton, false, false, 0); hBox.PackStart(forwardButton, false, false, 0); hBox.PackStart(reloadButton, false, false, 0); hBox.PackStart(searchBar, true, true, 0); hBox.PackStart(homeButton, false, false, 0); hBox.PackStart(favoriteButton, false, false, 0); //set up menu viewMenu.Submenu = menu; menu.Add(home); menu.Add(favorites); menu.Add(history); menuBar.Append(viewMenu); //add event handlers win.DeleteEvent += (obj, args) => closeAndSave(); home.Activated += (obj, args) => setState(States.Home); main.Activated += (obj, args) => setState(States.Main); favorites.Activated += (obj, args) => setState(States.Favorites); history.Activated += (obj, args) => setState(States.History); favoriteButton.Clicked += (obj, args) => editFavorites(); homeButton.Clicked += (obj, args) => loadHomepage(); reloadButton.Clicked += (obj, args) => reloadCurrentUrl(); searchBar.Activated += (obj, args) => makeRequest(searchBar.Text, true); backButton.Clicked += (obj, args) => goBack(); forwardButton.Clicked += (obj, args) => goForward(); //set up the default layout vBox.PackStart(menuBar, false, false, 0); vBox.PackStart(hBox, false, false, 0); vBox.PackStart(scroll, true, true, 0); vBox.PackStart(statusText, false, false, 0); //finish up currentState = States.Main; win.SetDefaultSize(1000, 600); win.Add(vBox); win.ShowAll(); }
public void reloadFavorites() { favoritesView = new FavoritesView(userData, updateStatusBar, setState, makeRequest); }
//TODO: Abstract Application public static BootstrappedApplication Bootstrap(IToastMessageService toastMessageService, Application app) { CommandFactory.CommandFactoryInstance = new XamarinCommandFactory(); var mainEndpoint = "https://steamstatsapi.herokuapp.com/"; var configurationValues = new Dictionary <string, string>() { { "AvailableGames", $"{mainEndpoint}api/v1.0/availablegames" }, { "AvailableGamesCacheTime", $"{mainEndpoint}api/v1.0/cachedatetime/availablegames" }, { "GamePicture", $"{mainEndpoint}api/v1.0/appHeader" }, { "GamePictureCacheTime", $"{mainEndpoint}api/v1.0/cachedatetime/apppicture" }, { "PlayerCount", $"{mainEndpoint}/api/v1.0/playercount" } }; var stringSerializer = new StringSerializer(); var stringDeserializer = new StringDeserializer(); var networkChecker = new NetworkChecker(); var webGateway = new WebGateway(stringDeserializer, networkChecker); var configurationProvider = new ConfigurationProvider(configurationValues); new ConnectivityNotifier(networkChecker, toastMessageService); var storageProvider = new StorageProvider <LocalGameFavorites.GameFavoritesDao>(app, stringDeserializer, stringSerializer); var cachedAvailableGamesStorageProvider = new StorageProvider <CachedGameList>(app, stringDeserializer, stringSerializer); var gameFavoriter = new LocalGameFavorites(storageProvider, toastMessageService); var availableGamesCacheChecker = new AvailableGamesCacheChecker(configurationProvider, webGateway); var availableGameFetcher = new OnlineGameFetcher(configurationProvider, webGateway); var gameFetcherCache = new GameFetcherCache(availableGameFetcher, cachedAvailableGamesStorageProvider, availableGamesCacheChecker); var gameViewModelFetcher = new GamesViewModelFetcher(gameFetcherCache, gameFavoriter, gameFavoriter, gameFavoriter); var mainPaigeViewModel = new MainPageViewModel(gameViewModelFetcher, gameFavoriter, networkChecker); var pictureFetcher = new GamePictureFetcher(configurationProvider, webGateway); var pictureCacheChecker = new PictureCacheChecker(configurationProvider, webGateway); var cachedPictureStorageProvider = new StorageProvider <CachedGamePicture>(app, stringDeserializer, stringSerializer); var pictureCacheFetcher = new PictureFetcherCache(pictureFetcher, cachedPictureStorageProvider, pictureCacheChecker); var playerCountFetcher = new PlayerCountFetcher(configurationProvider, webGateway); var favoritesViewModelFetcher = new FavoriteGamesViewModelFetcher(gameFetcherCache, gameFavoriter, gameFavoriter, pictureCacheFetcher, playerCountFetcher); var favoritesViewModel = new FavoritesViewModel(favoritesViewModelFetcher, gameFavoriter, networkChecker); var favoritesView = new FavoritesView() { BindingContext = favoritesViewModel }; var gameListView = new MainPage { BindingContext = mainPaigeViewModel }; return(new BootstrappedApplication(new View[] { favoritesView, gameListView })); }