示例#1
0
 public SliderModel()
 {
     BerechneSummeCommand = new OneParameterCommand(p =>
     {
         int summe = Slider1 + Slider2 + Slider3;
         ShowAlert?.Invoke(this, summe.ToString());
     });
 }
示例#2
0
 private void ShowAlert_Tick(object sender, EventArgs e)
 {
     if (this.Top < 60)
     {
         this.Top += interval;
         interval += 2;
     }
     else
     {
         ShowAlert.Stop();
     }
 }
示例#3
0
        /// <summary>
        /// Shows the download action view.
        /// </summary>
        /// <param name="publication">Publication.</param>
        /// <param name="startDownload">Start download.</param>
        /// <param name="cancelDownloadAlert">Cancel download alert.</param>
        /// <param name="hasFailed">If set to <c>true</c> has failed.</param>
        public void ShowDownloadActionView(Publication publication, DoPublicationDownload startDownload, ShowAlert cancelDownloadAlert, bool hasFailed = false)
        {
            RemoveActionSubview();
            if (publication.PublicationStatus == PublicationStatusEnum.NotDownloaded)
            {
                UIImageView downloadImageView = hasFailed ? new UIImageView(new UIImage("Images/Publication/Cover/DownloadFailed.png")) : new UIImageView(new UIImage("Images/Publication/Cover/CloudInstall.png"));
                if (!hasFailed)
                {
                    downloadImageView.Frame = new CGRect(0, 0, ACTION_VIEW_WIDTH, ACTION_VIEW_WIDTH);
                }
                else
                {
                    TriangleBackgroundColor = UIColor.FromRGB(253, 59, 47);
                    SetNeedsDisplay();
                }

                downloadImageView.UserInteractionEnabled = false;
                ActionView.AddSubview(downloadImageView);
            }


            ActionView.AddGestureRecognizer(new UITapGestureRecognizer(delegate() {
                startDownload(publication, (PublicationView)Superview);
                ShowDownloadProgressView();
            }));
            ActionView.UserInteractionEnabled = true;

            this.publication         = publication;
            this.cancelDownloadAlert = cancelDownloadAlert;

            if (ActionLabel != null)
            {
                ActionLabel.Hidden = false;
                ActionLabel.AddGestureRecognizer(new UITapGestureRecognizer(delegate() {
                    startDownload(publication, (PublicationView)Superview);
                    ShowDownloadProgressView();
                }));
            }
        }
示例#4
0
        public static PublicationView CreatePublicationView(Publication publication, DoPublicationDownload startDownload, ShowAlert cancelDownloadAlert, float zoomRate = 1.0f)
        {
            PublicationView publicationView = new PublicationView();

            publicationView.ZoomRate          = zoomRate;
            publicationView.StartDownload     = startDownload;
            publicationView.ShowDownloadAlert = cancelDownloadAlert;

            PublicationCover cover = CreatePublicationCover(publication);

            publicationView.AddCover(cover);
            publicationView.DrawPublicationActionView();

            publicationView.P = publication;

            return(publicationView);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UpcomingMoviesListViewModel"/> class.
        /// </summary>
        /// <param name="mainThreadScheduler">The scheduler to use for main thread operations.</param>
        /// <param name="taskPoolScheduler">The scheduler to use for task pool operations.</param>
        /// <param name="movieService">The service to use to retrieve movie information.</param>
        /// <param name="hostScreen">The screen to use for routing operations.</param>
        public UpcomingMoviesListViewModel(
            IScheduler mainThreadScheduler = null,
            IScheduler taskPoolScheduler   = null,
            IMovieService movieService     = null,
            IScreen hostScreen             = null)
            : base("Upcoming Movies", mainThreadScheduler, taskPoolScheduler, hostScreen)
        {
            IMovieService movieService1 = movieService ?? Locator.Current.GetService <IMovieService>();

            LoadMovies    = ReactiveCommand.CreateFromObservable <int, Unit>(count => movieService1.LoadUpcomingMovies(count));
            OpenAboutView = ReactiveCommand.CreateFromObservable <Unit, IRoutableViewModel>(_ => HostScreen
                                                                                            .Router
                                                                                            .Navigate
                                                                                            .Execute(new AboutViewModel(mainThreadScheduler, taskPoolScheduler, hostScreen)));

            movieService1
            .UpcomingMovies
            .Connect()
            .SubscribeOn(TaskPoolScheduler)
            .ObserveOn(TaskPoolScheduler)
            .Transform(movie => new UpcomingMoviesCellViewModel(movie))
            .DisposeMany()
            .ObserveOn(MainThreadScheduler)
            .Bind(out _movies)
            .Subscribe();


            LoadMovies.Subscribe();
            OpenAboutView.Subscribe();

            this
            .WhenAnyValue(x => x.SelectedItem)
            .Where(x => x != null)
            .SelectMany(x => HostScreen
                        .Router
                        .Navigate
                        .Execute(new MovieDetailViewModel(x.Movie)))
            .Subscribe();

            LoadMovies
            .ThrownExceptions
            .ObserveOn(MainThreadScheduler)
            .SelectMany(ex => ShowAlert.Handle(new AlertViewModel("Oops", ex.Message, "Ok")))
            .Subscribe();

            _isRefreshing =
                LoadMovies
                .IsExecuting
                .ToProperty(this, x => x.IsRefreshing, true);

            this
            .WhenAnyValue(x => x.ItemAppearing)
            .Select(item =>
            {
                int offset = -1;

                var itemIndex = Movies.IndexOf(item);
                if (itemIndex == Movies.Count - 8)
                {
                    offset = Movies.Count;
                }

                return(offset);
            })
            .Where(index => index > 0)
            .InvokeCommand(LoadMovies);
        }
示例#6
0
 private void AlertForm1_Load(object sender, EventArgs e)
 {
     this.Top  = -1 * (this.Height);
     this.Left = Screen.PrimaryScreen.Bounds.Width - this.Width - 60;
     ShowAlert.Start();
 }