private async Task <bool> CheckPermissionsGetCalendarAsync(bool alert = true) { var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Calendar); if (status != PermissionStatus.Granted) { var request = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Calendar); if (!request.ContainsKey(Permission.Calendar) || request[Permission.Calendar] != PermissionStatus.Granted) { if (alert) { if (Device.OS == TargetPlatform.iOS) { var result = await _pageDialogService.DisplayAlertAsync("Calendar Permission", $"Unable to set reminders as the Calendar permission was not granted. Please go into Settings and turn on Calendars for Developer Open Space 2016.", "Settings", "Maybe Later"); if (result) { _pushNotificationService.OpenSettings(); } } else { await _pageDialogService.DisplayAlertAsync("Calendar Permission", $"Unable to set reminders as the Calendar permission was not granted, please check your settings and try again.", "OK"); } } return(false); } } var currentCalendar = await GetOrCreateDevopenspaceCalendarAsync(); if (currentCalendar == null) { if (alert) { await _pageDialogService.DisplayAlertAsync("No Calendar", $"We were unable to get or create the Developer Open Space calendar, please check your calendar app and try again.", "OK"); } return(false); } return(true); }
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() { AboutItems.Clear(); //AboutItems.Add(new MenuItem { Name = "About this app", Icon = "icon_venue.png" }); push = DependencyService.Get <IPushNotifications>(); InfoItems.AddRange(new [] { new MenuItem { Name = "Sponsorlar", Icon = "icon_venue.png", Parameter = "sponsors" }, //new MenuItem { Name = "Evaluations", Icon = "icon_venue.png", Parameter="evaluations"}, new MenuItem { Name = "Etkinlik Alanı", Icon = "icon_venue.png", Parameter = "venue" }, new MenuItem { Name = "Kat Planı", Icon = "icon_venue.png", Parameter = "floor-maps" }, new MenuItem { Name = "Code of Conduct", Icon = "icon_code_of_conduct.png", Parameter = "code-of-conduct" }, new MenuItem { Name = "Wi-Fi Bilgisi", Icon = "icon_wifi.png", Parameter = "wi-fi" }, }); //accountItem = new MenuItem // { // Name = "Logged in as:" // }; //syncItem = new MenuItem //{ // Name = "Last Sync:" //}; pushItem = new MenuItem { Name = "Bildirimleri Etkinleştir" }; pushItem.Command = new Command(() => { if (push.IsRegistered) { UpdateItems(); return; } if (Settings.AttemptedPush) { MessagingService.Current.SendMessage <MessagingServiceQuestion>(MessageKeys.Question, new MessagingServiceQuestion { Title = "Bildirimler", 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(); //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"); } }; }
public AboutViewModel() { AboutItems.Clear(); // AboutItems.Add(new MenuItem { Name = "About this app", Icon = "icon_venue.png" }); push = DependencyService.Get <IPushNotifications>(); //InfoItems.AddRange(new [] // { // new MenuItem { Name = "News", Icon = "icon_venue.png", Parameter="news"}, // new MenuItem { Name = "Notifications", Icon = "icon_venue.png", Parameter="notifications"},//binny // new MenuItem { Name = "Feedback & Ratings", Icon = "icon_venue.png", Parameter="feedback-ratings"}, // new MenuItem { Name = "Maps", Icon = "icon_venue.png", Parameter = "maps"}, // new MenuItem { Name = "Restaurant Floor Plans", Icon = "icon_venue.png", Parameter = "restaurant-maps"}, // new MenuItem { Name = "Sealegs Promise", Icon = "icon_code_of_conduct.png", Parameter="sealegs-promise" }, // 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(() => { 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(); } } }); push.RegisterForNotifications(); pushItem.Name = "Push notifications enabled"; return; }); // 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(); // RaisePropertyChanged("AccountItems"); // } // }; }
public AboutViewModel(IDevice device) { this.DeviceName = device.Name; this.DeviceFirmwareVersion = device.FirmwareVersion; this.DeviceHardwareVersion = device.HardwareVersion; this.DeviceManufacturer = device.Manufacturer; AboutItems.Clear (); AboutItems.Add(new MenuItem { Name = "About this app", Icon = "icon_venue.png" }); push = DependencyService.Get<IPushNotifications>(); InfoItems.AddRange(new [] { new MenuItem { Name = "Sponsors", Icon = "icon_venue.png", Parameter="sponsors"}, new MenuItem { Name = "Evaluations", Icon = "icon_venue.png", Parameter="evaluations"}, new MenuItem { Name = "Venue", Icon = "icon_venue.png", Parameter = "venue"}, new MenuItem { Name = "Conference Floor Maps", Icon = "icon_venue.png", Parameter = "floor-maps"}, new MenuItem { Name = "Code of Conduct", Icon = "icon_code_of_conduct.png", Parameter="code-of-conduct" }, 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(); 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"); } }; }