Esempio n. 1
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            PlayButton.SetBackgroundImage(UIImage.FromFile("images/play.png"), UIControlState.Normal);
            PlayButton.SetBackgroundImage(UIImage.FromFile("images/play_black.png"), UIControlState.Focused);

            PreviousButton.SetBackgroundImage(UIImage.FromFile("images/previous.png"), UIControlState.Normal);
            PreviousButton.SetBackgroundImage(UIImage.FromFile("images/previous_black.png"), UIControlState.Focused);

            NextButton.SetBackgroundImage(UIImage.FromFile("images/next.png"), UIControlState.Normal);
            NextButton.SetBackgroundImage(UIImage.FromFile("images/next_black.png"), UIControlState.Focused);

            PlayButton.AdjustsImageWhenHighlighted     = true;
            PreviousButton.AdjustsImageWhenHighlighted = true;
            NextButton.AdjustsImageWhenHighlighted     = true;

            PlayButton.AdjustsImageWhenDisabled     = true;
            PreviousButton.AdjustsImageWhenDisabled = true;
            NextButton.AdjustsImageWhenDisabled     = true;

            PlayButton.Enabled     = false;
            PreviousButton.Enabled = false;
            NextButton.Enabled     = false;

            PlayButton.PrimaryActionTriggered     += PlayButton_PrimaryActionTriggered;
            PreviousButton.PrimaryActionTriggered += PreviousButton_PrimaryActionTriggered;
            NextButton.PrimaryActionTriggered     += NextButton_PrimaryActionTriggered;

            UIVisualEffect     blurEffect       = UIBlurEffect.FromStyle(UIBlurEffectStyle.Light);
            UIVisualEffectView visualEffectView = new UIVisualEffectView(blurEffect);

            visualEffectView.Frame = new CoreGraphics.CGRect(0, -100, 1920, 1200);
            BackgroundImage.AddSubview(visualEffectView);

            CloudService.Instance.Init(new User()
            {
                TwitterId = "fakeId",
                Name      = "Fake user"
            });
            CloudService.Instance.Connected += Instance_Connected;

            DataService.Instance.Dispatcher = new DispatcherWrapper(this);
        }
Esempio n. 2
0
        private void UpdateButtonViews()
        {
            if (player != null)
            {
                if (player.Rate == 0)
                {
                    PlayButton.SetBackgroundImage(UIImage.FromFile("images/play.png"), UIControlState.Normal);
                    PlayButton.SetBackgroundImage(UIImage.FromFile("images/play_black.png"), UIControlState.Focused);
                }
                else
                {
                    PlayButton.SetBackgroundImage(UIImage.FromFile("images/pause.png"), UIControlState.Normal);
                    PlayButton.SetBackgroundImage(UIImage.FromFile("images/pause_black.png"), UIControlState.Focused);
                }

                PlayButton.Enabled = true;
            }
            else
            {
                PlayButton.SetBackgroundImage(UIImage.FromFile("images/play.png"), UIControlState.Normal);
                PlayButton.SetBackgroundImage(UIImage.FromFile("images/play_black.png"), UIControlState.Focused);
                PlayButton.Enabled = false;
            }

            if (DataService.Instance.Playlist != null && DataService.Instance.Playlist.Count > 0 && currentSong != null)
            {
                var index = DataService.Instance.Playlist.IndexOf(currentSong);

                if (index > -1)
                {
                    NextButton.Enabled     = index < DataService.Instance.Playlist.Count - 1;
                    PreviousButton.Enabled = index > 0;
                    return;
                }
            }

            NextButton.Enabled     = false;
            PreviousButton.Enabled = false;
        }