protected override void OnAppearing() { base.OnAppearing(); try { if (XamarinAppSettings.PageName != "MusicAllPage") { XamarinAppSettings.PageName = "MusicAllPage"; } else { //check playing bool bPlay = simplePlay.IsPlaying(); if (bPlay) { UpdatePlayState(); } else { progress.Progress = simplePlay.GetCurrentPosition() * 1.0f / simplePlay.GetPosition(); } totalTime.Text = simplePlay.GetTotalTimeDisplay(); currentTime.Text = simplePlay.GetCurrentTimeDisplay(); } } catch { App.WriteString("MusicAllPage OnAppearing Failed"); } }
private async void TapGestureRecognizer_TappedNextPlayMusic(object sender, EventArgs e) { try { await Task.Delay(500); if (musicList.Count == 0) { return; } CurrentPlayIndex++; if (CurrentPlayIndex > (musicList.Count - 1)) { CurrentPlayIndex = 0; } Play(CurrentPlayIndex); UpdatePlayState(); } catch { App.WriteString("MusicList TapGestureRecognizer_TappedNextPlayMusic Failed"); } }
protected override void OnAppearing() { base.OnAppearing(); try { //Debug.WriteLine("PageName: " + XamarinAppSettings.PageName); //Debug.WriteLine("PageName: " + App.CurrentIndex); if (App.CurrentIndex > 0) { foreach (Page page in this.Children) { int index = this.Children.IndexOf(page); if (index == App.CurrentIndex) { //Debug.WriteLine(this.Children[index]); CurrentPage = page; break; } } } } catch { App.WriteString("MainPage OnAppearing Failed"); } }
public MusicAllPage() { InitializeComponent(); try { BackgroundColor = Color.FromHex("#253648"); InitImageButton(); simplePlay.PlayMp3CompletedNotice += SimplePlay_PlayMp3CompletedNotice; musicAllList = null; musicAllList = new List <MusicAllFile>(); MusicAllList.ItemsSource = musicAllList; MusicAllList.ItemTapped += MusicAllList_ItemTapped; LoadData(); MusicAllList.IsVisible = true; actIndicator.IsRunning = false; actIndicatorStackLayout.IsVisible = false; } catch { App.WriteString("MusicAllPage MusicAllPage Failed"); } }
private async void TapGestureRecognizer_TappedPlay(object sender, EventArgs e) { try { await Task.Delay(500); simplePlay.Pause(); UpdatePlayState(); } catch { App.WriteString("MusicList TapGestureRecognizer_TappedPlay Failed"); } }
protected override void OnDisappearing() { base.OnDisappearing(); try { App.CurrentIndex = 0; XamarinAppSettings.PageName = "MusicFolderPage"; } catch { App.WriteString("MusicFolderPage OnDisappearing Failed"); } }
protected override void OnCurrentPageChanged() { base.OnCurrentPageChanged(); try { var pageIndex = this.Children.IndexOf(this.CurrentPage); Debug.WriteLine("Page Index: " + pageIndex); } catch { App.WriteString("MainPage OnCurrentPageChanged Failed"); } }
protected override void OnAppearing() { base.OnAppearing(); try { if (XamarinAppSettings.PageName != "MusicFolderPage") { XamarinAppSettings.PageName = "MusicFolderPage"; } } catch { App.WriteString("MusicFolderPage OnAppearing Failed"); } }
private async void LoadMusic(string sPath) { await Task.Factory.StartNew(() => { try { var colList = simplePlay.GetMp3List(sPath); foreach (string item in colList) { musicList.Add(new MusicFile(item.ToString(), GetFileName(item.ToString()))); } isReady = true; } catch { App.WriteString("MusicList LoadMusic Failed"); } }); }
public MusicFolderPage() { InitializeComponent(); try { BackgroundColor = Color.FromHex("#FF4081"); musicFolder = null; musicFolder = new List <MusicFolder>(); MusicFolderList.ItemsSource = musicFolder; MusicFolderList.ItemTapped += MusicFolderList_ItemTapped; LoadData(); } catch { App.WriteString("MusicFolderPage MusicFolderPage Failed"); } }
async void LoadAni() { try { LogoImageAni.IsVisible = true; await Animate.BallAnimate(LogoImage, 50, 10, 5, dX, dY); //hide await LogoImageAni.FadeTo(0, 1000); LogoImageAni.IsVisible = false; //show await LogoImageAni.FadeTo(1, 1000); } catch { App.WriteString("MusicList LoadAni Failed"); } }
private void MusicListview_ItemTapped(object sender, ItemTappedEventArgs e) { try { if (e.Item == null || !isReady) { return; } var Music = (MusicFile)e.Item; CurrentPlayIndex = musicList.IndexOf(Music); Play(CurrentPlayIndex); UpdatePlayState(); ((ListView)sender).SelectedItem = null; } catch { App.WriteString("MusicList MusicListview_ItemTapped Failed"); } }
private async void btnTakePicture_Clicked(object sender, EventArgs e) { try { if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) { return; } var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions { Directory = "photo", Name = "bg.jpg", PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium }); if (file == null) { return; } imagePath = file.Path; bgImage.Source = ImageSource.FromStream(() => { var stream = file.GetStream(); file.Dispose(); return(stream); }); if (imagePath != "") { XamarinAppSettings.BackgroundImage = imagePath; } } catch { App.WriteString("PicturePage btnTakePicture_Clicked Failed"); } }
private async void btnPickPicture_Clicked(object sender, EventArgs e) { try { if (!CrossMedia.Current.IsPickPhotoSupported) { return; } var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions { PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium }); if (file == null) { return; } imagePath = file.Path; bgImage.Source = ImageSource.FromStream(() => { var stream = file.GetStream(); file.Dispose(); return(stream); }); if (imagePath != "") { XamarinAppSettings.BackgroundImage = imagePath; } } catch { App.WriteString("PicturePage btnPickPicture_Clicked Failed"); } }
private void MusicFolderList_ItemTapped(object sender, ItemTappedEventArgs e) { try { if (e.Item == null || !isReady) { return; } var Music = (MusicFolder)e.Item; int CurrentPlayIndex = musicFolder.IndexOf(Music); if (!App.LoadMusicPage) { App.LoadMusicPage = true; Navigation.PushModalAsync(new MusicList(Music.sName), true); } ((ListView)sender).SelectedItem = null; } catch { App.WriteString("MusicFolderPage MusicFolderList_ItemTapped Failed"); } }