public AboutViewModel() { AboutItems.Clear(); AboutItems.Add(new MenuItem { Name = "About this app", Icon = "icon_venue.png" }); InfoItems.AddRange(new[] { new MenuItem { Name = "Sponsors", Icon = "icon_venue.png", Parameter = "sponsors" }, new MenuItem { Name = "Event Map", Icon = "icon_venue.png", Parameter = "floor-maps" }, new MenuItem { Name = "Lunch Locations", Icon = "ic_restaurant_menu.png", Parameter = "lunch-locations" }, new MenuItem { Name = "Venue", Icon = "icon_venue.png", Parameter = "venue" }, }); accountItem = new MenuItem { Name = "Logged in as:" }; syncItem = new MenuItem { Name = "Last Sync:" }; UpdateItems(); AccountItems.Add(accountItem); AccountItems.Add(syncItem); //This will be triggered wen Settings.PropertyChanged += (sender, e) => { if (e.PropertyName == "Email" || e.PropertyName == "LastSync" || e.PropertyName == "PushNotificationsEnabled") { UpdateItems(); OnPropertyChanged("AccountItems"); } }; }
public AboutViewModel() { AboutItems.Clear(); AboutItems.Add(new MenuItem { Name = "About this app", Icon = "icon_venue.png" }); if (!FeatureFlags.SponsorsOnTabPage) { InfoItems.Add(new MenuItem { Name = "Friends", Icon = "icon_venue.png", Parameter = "sponsors" }); } // pushItem.Command = new Command( // () => // { // if (push.IsRegistered) // { // UpdateItems(); // return; // } // if (Settings.AttemptedPush) // { // MessagingService.Current.SendMessage<MessagingServiceQuestion>( // MessageKeys.Question, // new MessagingServiceQuestion // { // Title = "Push Notification", // Question = // "To enable push notifications, please go into Settings, Tap Notifications, and set Allow Notifications to on.", // Positive = "Settings", // Negative = "Maybe Later", // OnCompleted = (result) => // { // if (result) // { // push.OpenSettings(); // } // } // }); // return; // } // push.RegisterForNotifications(); // }); }
public AboutViewModel() { AboutItems.Clear(); AboutItems.Add(new MenuItem { Name = "About this app", Icon = "icon_venue.png" }); push = DependencyService.Get <IPushNotifications>(); if (!FeatureFlags.SponsorsOnTabPage) { InfoItems.Add(new MenuItem { Name = "Sponsors", Icon = "icon_venue.png", Parameter = "sponsors" }); } if (FeatureFlags.EvalEnabled) { InfoItems.Add(new MenuItem { Name = "Evaluations", Icon = "icon_venue.png", Parameter = "evaluations" }); } InfoItems.Add(new MenuItem { Name = "Venue", Icon = "icon_venue.png", Parameter = "venue" }); if (FeatureFlags.FloormapEnabled) { InfoItems.Add(new MenuItem { Name = "Conference Floor Maps", Icon = "icon_venue.png", Parameter = "floor-maps" }); } if (FeatureFlags.CodeOfConductEnabled) { InfoItems.Add(new MenuItem { Name = AboutThisApp.CodeOfConductPageTitle, Icon = "icon_code_of_conduct.png", Parameter = "code-of-conduct" }); } if (FeatureFlags.WifiEnabled) { InfoItems.Add(new MenuItem { Name = "Wi-Fi Information", Icon = "icon_wifi.png", Parameter = "wi-fi" }); } accountItem = new MenuItem { Name = "Logged in as:" }; syncItem = new MenuItem { Name = "Last Sync:" }; pushItem = new MenuItem { Name = "Enable push notifications" }; pushItem.Command = new Command(() => { if (push.IsRegistered) { UpdateItems(); return; } if (Settings.AttemptedPush) { MessagingService.Current.SendMessage <MessagingServiceQuestion>(MessageKeys.Question, new MessagingServiceQuestion { Title = "Push Notification", Question = "To enable push notifications, please go into Settings, Tap Notifications, and set Allow Notifications to on.", Positive = "Settings", Negative = "Maybe Later", OnCompleted = (result) => { if (result) { push.OpenSettings(); } } }); return; } push.RegisterForNotifications(); }); UpdateItems(); if (FeatureFlags.LoginEnabled) { AccountItems.Add(accountItem); } AccountItems.Add(syncItem); AccountItems.Add(pushItem); if (!FeatureFlags.LoginEnabled && FeatureFlags.AppToWebLinkingEnabled) { AccountItems.Add(new MenuItem { Name = "Link app data to website", Icon = "icon_linkapptoweb.png", Parameter = "mobiletowebsync" }); AccountItems.Add(new MenuItem { Name = "Link website data to app", Icon = "icon_linkapptoweb.png", Parameter = "webtomobilesync" }); } //This will be triggered wen Settings.PropertyChanged += (sender, e) => { if (e.PropertyName == "Email" || e.PropertyName == "LastSync" || e.PropertyName == "PushNotificationsEnabled") { UpdateItems(); OnPropertyChanged("AccountItems"); } }; }
public AboutViewModel(INavigationService navigationService, IEventAggregator eventAggregator, IStoreManager storeManager, IToast toast, IFavoriteService favoriteService, ILoggerFacade logger, ILaunchTwitter twitter, ISSOClient ssoClient, IPushNotifications pushNotifications, IReminderService reminderService, IPageDialogService pageDialogService) : base(navigationService, eventAggregator, storeManager, toast, favoriteService, logger, twitter, ssoClient, pushNotifications, reminderService, pageDialogService) { ToolBarItems.Add(new ToolbarItem { Text = LoginText, Command = LoginCommand }); AboutItems.Clear(); AboutItems.Add(new Models.MenuItem { Name = "About this app", Icon = "icon_venue.png" }); InfoItems.AddRange(new[] { new Models.MenuItem { Name = "Conference Feed", Icon = "menu_feed.png", Pagename = nameof(FeedPage) }, new Models.MenuItem { Name = "Sponsors", Icon = "menu_sponsors.png", Pagename = nameof(SponsorsPage) }, new Models.MenuItem { Name = "Venue", Icon = "menu_venue.png", Pagename = nameof(VenuePage) }, new Models.MenuItem { Name = "Floor Maps", Icon = "menu_plan.png", Pagename = nameof(FloorMapsPage) }, new Models.MenuItem { Name = "Conference Info", Icon = "menu_info.png", Pagename = nameof(ConferenceInformationPage) }, new Models.MenuItem { Name = "Settings", Icon = "menu_settings.png", Pagename = nameof(SettingsPage) } }); accountItem = new Models.MenuItem { Name = "Logged in as:" }; syncItem = new Models.MenuItem { Name = "Last Sync:" }; pushItem = new Models.MenuItem { Name = "Enable push notifications" }; pushItem.Command = DelegateCommand.FromAsyncHandler(async () => { if (PushNotifications.IsRegistered) { UpdateItems(); return; } if (Settings.AttemptedPush) { var response = await PageDialogService.DisplayAlertAsync("Push Notification", "To enable push notifications, please go into Settings, Tap Notifications, and set Allow Notifications to on.", "Settings", "Maybe Later"); if (response) { PushNotifications.OpenSettings(); } } await PushNotifications.RegisterForNotifications(); }); UpdateItems(); AccountItems.Add(accountItem); AccountItems.Add(syncItem); AccountItems.Add(pushItem); //This will be triggered wen Settings.PropertyChanged += (sender, e) => { if (e.PropertyName == "Email" || e.PropertyName == "LastSync" || e.PropertyName == "PushNotificationsEnabled") { UpdateItems(); OnPropertyChanged("AccountItems"); } }; AccountItems.CollectionChanged += (sender, e) => { AccountListHeightAdjustment = AccountItems.Count; }; AccountListHeightAdjustment = AccountItems.Count; _isRegistered = PushNotifications.IsRegistered; }