using System; using System.Collections.Generic; using Shared; namespace HDL_ON.UI.Music { public class A31USBMusicList : FrameLayout { public A31USBMusicList() { Tag = "Music"; } VerticalRefreshLayout middViewLayout; /// /// 先加载界面出来 /// public void UIView() { #region 界面布局------ this.BackgroundColor = MusicColor.ViewColor; var topView = new TopView(); this.AddChidren(topView.TopFLayoutView()); topView.topNameBtn.TextID = StringId.usb; topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; middViewLayout = new VerticalRefreshLayout { BackgroundColor = MusicColor.WhiteColor, Y = topView.fLayout.Bottom, Height = Application.GetRealHeight(H_W.H - H_W.T_Height), }; this.AddChidren(middViewLayout); middViewLayout.BeginHeaderRefreshingAction += () => { //System.Threading.Tasks.Task.Run(() => //{ // try // { // var list = SendMethod.GetUsbList(); // A31MusicModel.Current.USBList.Clear(); // A31MusicModel.Current.USBList.AddRange(list); // } // catch { } // finally // { // Application.RunOnMainThread(() => // { // Show(); // middViewLayout.EndHeaderRefreshing(); // }); // } //}); var list = SendMethod.GetUsbList(A31MusicModel.Current); A31MusicModel.Current.USBList.Clear(); A31MusicModel.Current.USBList.AddRange(list); Show(); middViewLayout.EndHeaderRefreshing(); }; #endregion } /// /// 加载数据的方法 /// public void Show() { middViewLayout.RemoveAll(); UI2.FuntionControlView.Music.UpdateThread.playMusuc(middViewLayout, "USB", "USBDiskQueue",A31MusicModel.Current.USBList, A31MusicModel.Current); } /// /// 定时更新当前播放音乐 /// public void UpdateSelectedMusic() { UI2.FuntionControlView.Music.UpdateThread.updateThread(this, middViewLayout, A31MusicModel.Current); } } }