public WherigoModel() { Core = new WFCoreAdapter(); // Store CartridgeStore = new CartridgeStore(); }
public WherigoModel() { Core = new WFCoreAdapter(); CartridgeStore = new CartridgeStore(); History = Models.History.FromCacheOrCreate(); }
public WherigoModel() { Settings = new Models.Settings(); Settings.PropertyChanged += OnSettingsPropertyChanged; Core = new WFCoreAdapter(); CartridgeStore = new CartridgeStore() { AutoSyncProvidersOnLink = Settings.SyncOnStartUp }; History = Models.History.FromCacheOrCreate(); }
/// <summary> /// Initializes a new instance of the <see cref="WF.Player.CartridgeListPage"/> class. /// </summary> /// <param name="cartridges">Cartridges to show.</param> public CartridgeListPage(CartridgeStore store) { this.cartridges = store; this.cartridges.CollectionChanged += HandleCartridgesCollectionChanged; // If the store is empty, than update it if (this.cartridges.Count == 0) { UpdateCartridges(); } this.BindingContext = this; Title = Catalog.GetString("Cartridges"); NavigationPage.SetTitleIcon(this, "HomeIcon.png"); NavigationPage.SetBackButtonTitle(this, string.Empty); // Only show settings, if device is Android #if __ANDROID__ this.ToolbarItems.Add(new ToolbarItem(Catalog.GetString("Settings"), null, () => { App.Navigation.Popped += HandleSettingsClosed; App.Navigation.Navigation.PushAsync(new SettingsPage.SettingsPage()); }, ToolbarItemOrder.Secondary)); this.ToolbarItems.Add(new ToolbarItem(Catalog.GetString("Feedback"), null, () => HockeyApp.FeedbackManager.ShowFeedbackActivity(Forms.Context), ToolbarItemOrder.Secondary)); this.ToolbarItems.Add(new ToolbarItem(Catalog.GetString("About"), null, () => { App.Navigation.Navigation.PushAsync(new SettingsPage.AboutPage()); }, ToolbarItemOrder.Secondary)); this.ToolbarItems.Add(new ToolbarItem(Catalog.GetString("Quit"), null, () => { DependencyService.Get<IExit>().ExitApp(0); }, ToolbarItemOrder.Secondary)); #endif #if __IOS__ var toolbarMenu = new ToolbarItem(Catalog.GetString("Menu"), null, () => { //"IconMenu.png", () => { App.Click(); App.Navigation.Popped += HandleSettingsClosed; var cfg = new WF.Player.Services.UserDialogs.ActionSheetConfig().SetTitle(Catalog.GetString("Main Menu")); cfg.Add(Catalog.GetString("Settings"), () => App.Navigation.Navigation.PushAsync(new SettingsPage.SettingsPage())); cfg.Add(Catalog.GetString("Feedback"), () => HockeyApp.BITHockeyManager.SharedHockeyManager.FeedbackManager.ShowFeedbackListView()); cfg.Add(Catalog.GetString("About"), () => App.Navigation.Navigation.PushAsync(new SettingsPage.AboutPage())); cfg.Cancel = new WF.Player.Services.UserDialogs.ActionSheetOption(Catalog.GetString("Cancel"), App.Click); UserDialogs.Instance.ActionSheet(cfg); }); this.ToolbarItems.Add (toolbarMenu); #endif layout = new StackLayout() { BackgroundColor = App.Colors.Background, VerticalOptions = LayoutOptions.FillAndExpand, }; var listCellHeight = (int)(((DependencyService.Get<IScreen>().Width * 0.25) - 20) * 1.25 + 30); list = new ListView() { BackgroundColor = App.Colors.Background, RowHeight = Device.OnPlatform<int>(110, 120, 120), HasUnevenRows = false, SeparatorColor = App.Colors.SeparatorLine, ItemsSource = cartridges, ItemTemplate = new DataTemplate(typeof(CartridgeListCell)), IsPullToRefreshEnabled = true, RefreshCommand = this.RefreshCommand, }; // list.SetBinding<CartridgeListPage> (ListView.IsRefreshingProperty, vm => vm.IsBusy); list.ItemSelected += async (sender, e) => { if (e.SelectedItem == null) { return; } App.Click(); var cartridgeTag = (CartridgeTag)e.SelectedItem; var cartridgeDetailPage = new CartridgeDetailPage(new CartridgeDetailViewModel(cartridgeTag)); await App.Navigation.PushAsync(cartridgeDetailPage, true); // Clear selection, so it is possible later select the same item list.SelectedItem = null; }; layout.Children.Add(list); Content = layout; }
/// <summary> /// Gets the main page. /// </summary> /// <returns>The main page.</returns> public static Page GetMainPage() { CheckFolder(); var cartridges = new CartridgeStore(); Settings.Current.AddOrUpdateValue<int>(Settings.TextSizeKey, 20); // Create content page for cartridge list App.Navigation = new ExtendedNavigationPage(new CartridgeListPage(cartridges), true) { BackgroundColor = App.Colors.Background, BarTextColor = App.Colors.BarText, BarBackgroundColor = App.Colors.Bar, ShowBackButton = true, }; // ((ExtendedNavigationPage)App.Navigation).BackgroundColor = App.Colors.Bar; // ((ExtendedNavigationPage)App.Navigation).BarTextColor = App.Colors.BarText; return App.Navigation; }