예제 #1
0
        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);
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
        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)
     });
 }
예제 #6
0
 void Toast(ToastEvent @event)
 {
     UserDialogs.Instance.Toast(new ToastConfig(@event, "Test Toast")
     {
         Duration = TimeSpan.FromSeconds(3),
         Action   = () => this.lblResult.Text = "Toast Pressed"
     });
 }
예제 #7
0
 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")
     })
                        ));
 }
예제 #8
0
        protected async virtual Task StartJob()
        {
            watch.Start();

            await JobEvent.StartJob(jobDescription, jobMaxProgress);

            LogEvent.LogMessage(JobStartMessage);
            if (!string.IsNullOrEmpty(jobTitle))
            {
                ToastEvent.ShowToast(JobStartMessage, ToastType.INFO);
            }
        }
예제 #9
0
#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);
                }
            }
        }
예제 #10
0
 void _OnToastUpdated(ToastEvent e)
 {
     toast_text.text = e.message;
     StartCoroutine(Toast(ease_duration, show_duration));
 }
예제 #11
0
		void Toast(ToastEvent @event) {
            UserDialogs.Instance.Toast(new ToastConfig(@event, "Test Toast") {
                Duration = TimeSpan.FromSeconds(3),
                Action = () => this.Result("Toast Pressed")
            });
        }
예제 #12
0
		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 message, int timeoutMillis)
 {
     this.Toast(new ToastConfig(toastEvent, message) {
         Duration = TimeSpan.FromMilliseconds(timeoutMillis)
     });
 }
예제 #14
0
		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);
		    }
		}
예제 #15
0
 public virtual void Toast(ToastEvent toastEvent, string title, string description, int timeoutMillis) {
     this.Toast(new ToastConfig(toastEvent, title) {
         Description = description,
         Duration = TimeSpan.FromMilliseconds(timeoutMillis)
     });
 }