protected override bool PrepareAndCheckIfCanRun(object[] args) { if (ConfigurationManager.Config.ShouldUpdateOnlyUnfinishedEntries) { animes = animeService.GetCustom(e => e.Status != ContentStatus.FINISHED); mangas = mangaService.GetCustom(e => e.Status != ContentStatus.FINISHED); } else { animes = animeService.GetAll(); mangas = mangaService.GetAll(); } if (!animes.Any() && !mangas.Any()) { ToastEvent.ShowToast( ConfigurationManager.Config.ShouldUpdateOnlyUnfinishedEntries ? "Update didn't start - No unfinished animes or mangas to update." : "Update didn't start - No animes or mangas to update.", ToastType.WARNING); return(false); } jobTitle = "Animes and mangas update"; jobMaxProgress = (animes.Count() + mangas.Count()) * 2; jobDescription = "Updating saved animes and mangas with latest info from anilst"; return(true); }
public ToastConfig(ToastEvent @event, string title, string description = null) { this.Event = @event; this.Title = title; this.Description = description; this.Duration = DefaultDuration; switch (@event) { case ToastEvent.Info: this.BackgroundColor = InfoBackgroundColor; this.TextColor = InfoTextColor; this.Icon = WarnIcon; break; case ToastEvent.Success: this.BackgroundColor = SuccessBackgroundColor; this.TextColor = SuccessTextColor; this.Icon = SuccessIcon; break; case ToastEvent.Warn: this.BackgroundColor = WarnBackgroundColor; this.TextColor = WarnTextColor; this.Icon = WarnIcon; break; case ToastEvent.Error: this.BackgroundColor = ErrorBackgroundColor; this.TextColor = ErrorTextColor; this.Icon = ErrorIcon; break; } }
public ToastConfig(ToastEvent @event, string title, string description = null) { this.Event = @event; this.Title = title; this.Description = description; this.Duration = DefaultDuration; switch (@event) { case ToastEvent.Info: this.BackgroundColor = InfoBackgroundColor; this.TextColor = InfoTextColor; this.Icon = InfoIcon; break; case ToastEvent.Success: this.BackgroundColor = SuccessBackgroundColor; this.TextColor = SuccessTextColor; this.Icon = SuccessIcon; break; case ToastEvent.Warn: this.BackgroundColor = WarnBackgroundColor; this.TextColor = WarnTextColor; this.Icon = WarnIcon; break; case ToastEvent.Error: this.BackgroundColor = ErrorBackgroundColor; this.TextColor = ErrorTextColor; this.Icon = ErrorIcon; break; } }
void Toast(ToastEvent @event) { UserDialogs.Instance.Toast(new ToastConfig(@event, @event.ToString(), "Testing toast functionality....fun!") { Duration = TimeSpan.FromSeconds(3), Action = () => this.Result("Toast Pressed") }); }
public virtual void Toast(ToastEvent toastEvent, string title, string description, int timeoutMillis) { this.Toast(new ToastConfig(toastEvent, title) { Description = description, Duration = TimeSpan.FromMilliseconds(timeoutMillis) }); }
void Toast(ToastEvent @event) { UserDialogs.Instance.Toast(new ToastConfig(@event, "Test Toast") { Duration = TimeSpan.FromSeconds(3), Action = () => this.lblResult.Text = "Toast Pressed" }); }
ICommand ToastCommand(ToastEvent @event) { return(new Command(() => this.Dialogs.Toast(new ToastConfig(@event, @event.ToString(), "Testing toast functionality....fun!") { Duration = TimeSpan.FromSeconds(3), Action = () => this.Result("Toast Pressed") }) )); }
protected async virtual Task StartJob() { watch.Start(); await JobEvent.StartJob(jobDescription, jobMaxProgress); LogEvent.LogMessage(JobStartMessage); if (!string.IsNullOrEmpty(jobTitle)) { ToastEvent.ShowToast(JobStartMessage, ToastType.INFO); } }
#pragma warning restore CS1998 protected async virtual Task EndJob(Exception ex = null) { watch.Stop(); await JobEvent.EndJob(); if (ex == null) { LogEvent.LogMessage($"{JobSuccessMessage} Elapsed time: {watch.Elapsed}."); if (!string.IsNullOrEmpty(jobTitle)) { ToastEvent.ShowToast(JobSuccessMessage, ToastType.SUCCESS); } } else { LogEvent.LogError(ex, $"{JobFailMessage} Elapsed time: {watch.Elapsed}."); if (!string.IsNullOrEmpty(jobTitle)) { ToastEvent.ShowToast($"{JobFailMessage} Reason: {ex.Message}.", ToastType.DANGER); } } }
void _OnToastUpdated(ToastEvent e) { toast_text.text = e.message; StartCoroutine(Toast(ease_duration, show_duration)); }
void Toast(ToastEvent @event) { UserDialogs.Instance.Toast(new ToastConfig(@event, "Test Toast") { Duration = TimeSpan.FromSeconds(3), Action = () => this.Result("Toast Pressed") }); }
public virtual void Toast(ToastEvent toastEvent, string message, int timeoutMillis) { this.Toast(new ToastConfig(toastEvent, message) { Duration = TimeSpan.FromMilliseconds(timeoutMillis) }); }
void Toast(ToastEvent @event) { try { UserDialogs.Instance.Toast(new ToastConfig(@event, @event.ToString(), "Testing toast functionality....fun!") { Duration = TimeSpan.FromSeconds(3), Action = () => this.Result("Toast Pressed") }); } catch (Exception ex) { Debug.WriteLine(ex.Message + " : " + ex.StackTrace); } }