Exemple #1
0
        public Login()
        {
            Tracks = App.Player.TrackList[2];
            App.Player.PlayEvent += PlayEvent;

            var refreshIcon = new Views.ClickableIcon(ImageSource.FromFile("ic_refresh_grey600_36dp.png"), (i, e) => { Tracks.Clear(); LoadTracks(); })
            {
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            LoginButton.Clicked     += OnButtonClick;
            LogoutButton.Clicked    += OnLogOutButtonClick;
            LoginButton.Text         = "Войти";
            LogoutButton.Text        = "Выйти";
            UserName.Placeholder     = "Почта/Телефон";
            UserPassword.Placeholder = "Пароль";

            listView = new Views.AudioDownloadList(
                (i, e) => { var item = ((Image)i).BindingContext as IAudio; App.trackManager.LoadTrack(item, App.Player.TrackList[1]); },
                Tracks, App.Player.TrackList[1],
                (i, e) => { var item = ((Image)i).BindingContext as IAudio; try { App.UserLogin.Data.Music.DeleteTrack(item); Tracks.Remove(item); } catch { DisplayAlert("Ошибка", "Комманда не может быть выполнена!", "OK"); } },
                false
                );
            listView.Header         = refreshIcon;
            listView.ItemAppearing += OnItemAppearing;
            listView.ItemTapped    += OnItemTapped;
            listView.Footer         = indicator;
            TryLogin();
        }
Exemple #2
0
        /// <summary>
        /// Download Cell Constructor
        /// </summary>
        /// <param name="download">Download Click Event.</param>
        /// <param name="check">Collection for check is track already downloaded.</param>
        /// <param name="add">Add\Remove Click event</param>
        /// <param name="icon">Add\Remove icon (true - plus (add), false - munus (remove))</param>
        public DownloadCell(EventHandler download, ObservableCollection <IAudio> check, EventHandler add, bool icon)
        {
            EventHandler[] EventsLoad = { ClickLoad, download };
            EventHandler[] EventsAdd  = { ClickLoad, add };
            var            sl         = new StackLayout
            {
                Padding     = new Thickness(5, 0),
                Orientation = StackOrientation.Horizontal
            };

            loadIcon = new ClickableIcon(DownloadPicSource, EventsLoad);
            addIcon  = new ClickableIcon(icon ? AddPicSource : RemovePicSource, EventsAdd);

            sl.Children.Add(new AudioInfoView());

            var IconMenu = new StackLayout {
                Children = { addIcon, loadIcon }, HorizontalOptions = LayoutOptions.EndAndExpand, Orientation = StackOrientation.Horizontal
            };

            sl.Children.Add(IconMenu);

            BindingContextChanged += (i, e) => {
                if (BindingContext == null)
                {
                    return;
                }
                var res = ((IAudio)BindingContext);
                if (check.FirstOrDefault(x => x.ID == res.ID) != null)
                {
                    loadIcon.IsVisible = false;
                }
            };



            View = sl;
        }
Exemple #3
0
        public AudioPlayerView(Algh.interfaces.IPlayer p, View menu)
        {
            player      = p;
            NextImage   = new ClickableIcon(next, NextClick);
            BackImage   = new ClickableIcon(prev, BackClick);
            PlayImage   = new ClickableHashIcon(play, PlayPauseClick);
            RepeatImage = new ClickableHashIcon(repeaton, (i, e) => { player.Repeat = !player.Repeat; });

            Orientation = StackOrientation.Vertical;

            Children.Add(slider);

            CommandPanel.Children.Add(BackImage);
            CommandPanel.Children.Add(PlayImage);
            CommandPanel.Children.Add(NextImage);
            CommandPanel.Children.Add(RepeatImage);

            Children.Add(CommandPanel);
            if (menu != null)
            {
                CommandPanel.Children.Add(menu);
            }
            //------------------------------------------------
            if (player.IsPlay)
            {
                PlayEvent(player, true);
            }
            if (player.Repeat)
            {
                RepeatImage.Source = repeatoff;
            }
            //------------------------------------------------
            player.PlayEvent         += PlayEvent;
            player.SeekEvent         += SeekEvent;
            slider.ValueChangeByUser += SeekChange;
        }