private static void TaskSchedulerOnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs) { CoreDependencyService.GetService <ILogService, LogService>().LogException( unobservedTaskExceptionEventArgs.Exception, "MainApplication -TaskSchedulerOnUnobservedTaskException"); unobservedTaskExceptionEventArgs.Exception.ConsoleWrite(); }
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs) { var ex = unhandledExceptionEventArgs.ExceptionObject as Exception; CoreDependencyService.GetService <ILogService, LogService>().LogException( ex, "MainApplication -CurrentDomainOnUnhandledException"); ex.ConsoleWrite(); }
private void StartBackgroundingMethod(object obj) { if (BackgroundButtonTitle.StartsWith("Stop", System.StringComparison.OrdinalIgnoreCase)) { DataBLL.TimerService.Stop(); BackgroundButtonTitle = "Background Timer"; } else { var timerService = CoreDependencyService.GetService <IIntervalCallback, TimerCallbackService>(true); DataBLL.TimerService.Start(1, timerService); BackgroundButtonTitle = $"Stop {BackgroundButtonTitle}"; } }
protected override void OnAppearing() { base.OnAppearing(); var fileSrv = CoreDependencyService.GetService <IFileStore, FileStore>(); fileSrv?.GetAsync <InAppBillingPurchase>("adsRemoved").ContinueWith((t) => { var result = t.Result; if (result.Error != null) { if (AdBuddizHandler.Instance.IsReadyToShowAd) { AdBuddizHandler.Instance.ShowAd(); } } }); }
public AppointmentCell() { this.Height = 65; img = new CachedImage() { Margin = new Thickness(8, 0, 4, 0), HeightRequest = 32, WidthRequest = 32, DownsampleWidth = 32, DownsampleHeight = 32, DownsampleUseDipUnits = true, RetryCount = 0, RetryDelay = 250, LoadingPlaceholder = "placeholder.png", CacheDuration = TimeSpan.FromDays(10), Source = "calendar.png" }; lblTitle = new Label() { Margin = new Thickness(5, 5, 5, -5), }; lblFullDisplay = new Label() { Style = CoreStyles.AddressCell, }; var rightPanel = new StackLayout() { Padding = 0, Children = { lblTitle, lblFullDisplay } }; embeddedMenu = new MenuItem() { Text = "Embedded", IsDestructive = false }; embeddedMenu.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); ContextActions.Add(embeddedMenu); deleteMenu = new MenuItem() { Text = "Delete", IsDestructive = true, AutomationId = "deleteMenu", Command = new Command(async(obj) => { var appt = (Appointment)obj; appt.MarkedForDelete = true; var sqlite = CoreDependencyService.GetService <ISqliteDb, SqliteDb>(); var result = await sqlite.AddOrUpdate <Appointment>(appt); if (result.Success) { CoreDependencyService.SendViewModelMessage <DataExampleViewModel>(CoreSettings.RefreshAppoints, null); } }) }; deleteMenu.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); ContextActions.Add(deleteMenu); View = new StackContainer(true) { Orientation = StackOrientation.Horizontal, Children = { img, rightPanel } }; }