Esempio n. 1
0
        protected void AdvancedHudActionForRow(int row)
        {
            switch (row)
            {
            case 0:
                hud.SetCaption("This HUD will auto-hide in 2 seconds.");
                hud.BlockTouches = true;
                hud.Show();
                hud.HideAfter(2.0);
                break;

            case 1:
                hud.SetCaption("This HUD will update in 2 seconds.");
                hud.BlockTouches = true;
                hud.SetActivity(true);
                hud.Show();
                NSTimer.CreateScheduledTimer(2.0, () => { UpdatedHud(); });
                break;

            case 2:
            {
                float progress = 0.08f;

                //NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:.02 target:self selector:@selector(tick:) userInfo:nil repeats:YES];
                //[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

                NSTimer timer = new NSTimer();
                timer = NSTimer.CreateRepeatingScheduledTimer(0.02, () => {
                        progress += 0.01f;
                        hud.SetProgress(progress);
                        if (progress >= 1)
                        {
                            progress = 0;
                            timer.Invalidate();
                            hud.Hide();

                            NSTimer.CreateScheduledTimer(0.2, () => { ResetProgress(); });
                        }
                    });

                hud.SetCaption("Performing operation...");
                hud.SetProgress(0.08f);
                hud.BlockTouches = true;
                hud.Show();
                break;
            }

            case 3:
            {
                var item1 = new ATMHudQueueItem {
                    Caption = "Display #1", AccessoryPosition = ATMHudAccessoryPosition.ATMHudAccessoryPositionBottom
                };
                var item2 = new ATMHudQueueItem {
                    Caption = "Display #2", AccessoryPosition = ATMHudAccessoryPosition.ATMHudAccessoryPositionRight, ShowActivity = true
                };
                var item3 = new ATMHudQueueItem {
                    Caption = "Display #3", Image = UIImage.FromBundle("19-check"), AccessoryPosition = ATMHudAccessoryPosition.ATMHudAccessoryPositionBottom
                };

                hud.AddToQueue(new ATMHudQueueItem[] { item1, item2, item3 });
                hud.StartQueue();

                NSTimer.CreateScheduledTimer(2.0, () => { ShowNextDisplayInQueue(); });
                break;
            }
            }
        }
Esempio n. 2
0
        protected void AdvancedHudActionForRow(int row)
        {
            switch (row)
            {
            case 0:
                hud.SetCaption("This HUD will auto-hide in 2 seconds.");
                hud.BlockTouches = true;
                hud.Show();
                hud.HideAfter(2.0);
                break;

            case 1:
                hud.SetCaption("This HUD will update in 2 seconds.");
                hud.BlockTouches = true;
                hud.SetActivity(true);
                hud.Show();
                NSTimer.CreateScheduledTimer(2.0, () => { UpdatedHud(); });
                break;

            case 2:
            {
                float progress = 0.08f;

                //NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:.02 target:self selector:@selector(tick:) userInfo:nil repeats:YES];
                //[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

                NSTimer timer = new NSTimer();
                timer = NSTimer.CreateRepeatingScheduledTimer(0.02, () => {
                        progress += 0.01f;
                        hud.SetProgress(progress);
                        if (progress >= 1)
                        {
                            progress = 0;
                            timer.Invalidate();
                            hud.Hide();

                            NSTimer.CreateScheduledTimer(0.2, () => { ResetProgress(); });
                        }
                    });

                hud.SetCaption("Performing operation...");
                hud.SetProgress(0.08f);
                hud.BlockTouches = true;
                hud.Show();
                break;
            }

            case 3:
            {
                string[] captions = new [] { "Display #1", "Display #2", "Display #3" };
                // Would love to just use UIImage but breaks when using a "null" image.
                NSArray    images    = NSArray.FromObjects("", "", UIImage.FromBundle("19-check"));
                NSNumber[] positions = new NSNumber[] { new NSNumber(2), new NSNumber(1), new NSNumber(2) };
                NSNumber[] flags     = new NSNumber[] { new NSNumber(false), new NSNumber(true), new NSNumber(false) };

                hud.AddToQueue(captions, images, positions, flags);
                hud.StartQueue();

                NSTimer.CreateScheduledTimer(2.0, () => { ShowNextDisplayInQueue(); });
                break;
            }
            }
        }