using System; using Shared; using HDL_ON.UI.Music; namespace HDL_ON.UI.UI2.FuntionControlView.Music { public class UpdateThread : FrameLayout { public UpdateThread() { } public static void updateThread(FrameLayout frame, VerticalRefreshLayout middViewLayout) { System.Threading.Thread updateSelectedMusicThread = new System.Threading.Thread(() => { while (frame.Parent != null) { System.Threading.Thread.Sleep(1000); Application.RunOnMainThread(() => { try { for (int i = 0; i < middViewLayout.ChildrenCount; i++) { FrameLayout view = (FrameLayout)middViewLayout.GetChildren(i); var volIconBtn = (Button)view.GetChildren(0);//直接FrameLayout父控件找到该控件Button var songNameBtn = (Button)view.GetChildren(1);//直接FrameLayout父控件找到该控件Button var artistNameBtn = (Button)view.GetChildren(2);//直接FrameLayout父控件找到该控件Button if (A31MusicModel.Current.A31PlayStatus.TrackURL == songNameBtn.Tag.ToString()) { volIconBtn.Visible = true; songNameBtn.TextColor = UI.Music.Color.SelectedColor; songNameBtn.X = Application.GetRealWidth(48); artistNameBtn.X = songNameBtn.Right; artistNameBtn.TextColor = UI.Music.Color.SelectedColor; } else { volIconBtn.Visible = false; songNameBtn.TextColor = UI.Music.Color.MusicTxet14Color; songNameBtn.X = Application.GetRealWidth(16); artistNameBtn.X = songNameBtn.Right; artistNameBtn.TextColor = UI.Music.Color.MusicNoTxetColor; } } } catch { } }); } }); updateSelectedMusicThread.Start(); } } }