wxr
2024-07-02 4ab5ecb0a4fa8ab66647427c4f90db9db302ea3b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
using System;
using Shared;
using com.hdl.on;
using System.Collections.Generic;
using System.Security;
using HDL_ON.UI.UI2.FuntionControlView.Music;
using HDL_ON.Entity;
 
namespace HDL_ON.UI.Music
{
    public class A31PlayMusicPage : FrameLayout
    {
        /// <summary>
        /// 当前对象构造函数
        /// </summary>
        public A31PlayMusicPage() { }
        /// <summary>
        /// 重写RemoveFromParent方法
        /// </summary>
        public override void RemoveFromParent()
        {
            base.RemoveFromParent();
            Volume.VolumeChange = null;
            if (timerThread != null)
            {
                try
                {
                    if (timerThread.IsAlive)
                    {
                        timerThread.Abort();
                    }
                }
                catch { }
            }
 
        }
        /// <summary>
        /// new布局界面
        /// </summary>
        View.PlayView playView = new View.PlayView();
        TopView topView;
        public void Show()
        {
 
            ///1秒定时更新状态
            TimerUpdateStatus();
            #region   ---界面布局---
            this.BackgroundColor = MusicColor.ViewColor;
            topView = new TopView();
            topView.setBtn.Visible = true;
            this.AddChidren(topView.TopFLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
            {
                RemoveFromParent();
            };
            topView.clickSetBtn.MouseUpEventHandler += (sender, e) =>
            {
                A31MusicSourcePage a31MusicSourcePage = new A31MusicSourcePage();
                MainPage.BasePageView.AddChidren(a31MusicSourcePage);
                a31MusicSourcePage.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            var middLayout = new FrameLayout
            {
                Y = topView.fLayout.Bottom,
                Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
            };
            this.AddChidren(middLayout);
            ///加载播放音乐界面的控件方法
            playView.viewFrameLayout(middLayout);
            #endregion
 
            #region   ---界面点击事件---
            //playView.collectIconBtn.Visible = false;//先暂时隐藏收藏功能
            //收藏图标事件
            playView.collectIconBtn.MouseUpEventHandler += (sender, e) =>
            {
                playView.collectIconBtn.IsSelected = !playView.collectIconBtn.IsSelected;
                if (playView.collectIconBtn.IsSelected)
                {
                    A31MusicModel.Current.functionMusic.collect = true;
                }
                else
                {
                    A31MusicModel.Current.functionMusic.collect = false;
                }
                A31MusicModel.Current.functionMusic.CollectFunction();
            };
            ///切换播放模式点击事件;
            playView.playOrderBtn.MouseUpEventHandler += (sender, e) =>
             {
                 string msg = Language.StringByID(StringId.switchTo);
                 //获取当前播放模式
                 string currModeKeyValue = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode);
                 //获取音乐播放模式列表
                 var attributes = A31MusicModel.Current.functionMusic.GetAttribute(KeyProperty.mode);
                 if (attributes == null)
                 {
                     attributes = new FunctionAttributes();
                 }
                 var attributesList = attributes.value;
                 //找到当前播放模式索引值
                 int currModeIndexe = attributesList.IndexOf(currModeKeyValue);
                 //记录选中的播放模式的索引值
                 int count = 0;
                 if (currModeIndexe >= attributesList.Count - 1)
                 {
                     //重置索引值
                     count = 0;
                 }
                 else
                 {
                     count = currModeIndexe + 1;
                 }
                 //通过索引值找到模式value值
                 string modeValueString = attributesList[count];
                 switch (modeValueString)
                 {
                     //list_cycle列表循环,single_cycle单曲循环,random随机播放;
                     case ValueProperty.list_cycle:
                         playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png";
                         msg += Language.StringByID(StringId.listMode);
                         break;
                     case ValueProperty.single_cycle:
                         playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single_cycle.png";
                         msg += Language.StringByID(StringId.singleCycleMode);
                         break;
                     case ValueProperty.random:
                         playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/random.png";
                         msg += Language.StringByID(StringId.randomMode);
                         break;
                     case ValueProperty.single:
                         playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single.png";
                         msg += Language.StringByID(StringId.single);
                         break;
                     case ValueProperty.order:
                         playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/order.png";
                         msg += Language.StringByID(StringId.orderMode);
                         break;
 
                 }
                 //写入缓存
                 A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.mode, modeValueString);
                 new PublicAssmebly().TipMsgAutoClose(msg, false, 1000);
                 Dictionary<string, string> dic = new Dictionary<string, string>();
                 dic.Add(KeyProperty.mode, modeValueString);
                 //发送控制指令
                 SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
             };
            ///添加喜爱点击事件;
            playView.loveBtn.MouseUpEventHandler += (sender, e) =>
            {
 
                var name = A31MusicModel.Current.functionMusic.GetAttribute("song_name").ToString();
                var songTime = A31MusicModel.Current.functionMusic.GetAttribute("song_time").ToString();
                playView.loveBtn.IsSelected = !playView.loveBtn.IsSelected;
                if (playView.loveBtn.IsSelected)
                {
                    if (null == A31MusicModel.Current.LoveMusicInfoList.Find((musicInfo) =>
                    {
                        return name == musicInfo.name;
                    }))
                    {
                        A31MusicModel.Current.LoveMusicInfoList.Add(new SongInfo { name = name, time = songTime });
                    }
                }
                else
                {
                    A31MusicModel.Current.LoveMusicInfoList.RemoveAll((musicInfo) =>
                    {
                        //也要加歌手名判断
                        return musicInfo.name == name;
                    });
                }
                A31MusicModel.Save();
            };
            ///我的列表点击事件
            playView.playlistBtn.MouseUpEventHandler += (sender, e) =>
            {
                #region  布局界面---
                Loading loading = new Loading();
                UI2.FuntionControlView.Music.View.MyListView myListView = new UI2.FuntionControlView.Music.View.MyListView();
                myListView.frameLayout(this, A31MusicModel.Current);
                myListView.dialogFra.AddChidren(loading);//dialogFra刷新图标父控件
                loading.Start();
                ///下拉刷新
                myListView.verticalScrolViewLayout.BeginHeaderRefreshingAction += () =>
                {
                    myListView.verticalScrolViewLayout.EndHeaderRefreshing(); //结束刷新
                    loading.Start();
                    System.Threading.Tasks.Task.Run((() =>
                    {
                        try
                        {
                            A31MusicModel.Current.CurrentPlayMusicInfoList.Clear();
                            if (A31MusicModel.Current.CurrentPlayMusicInfoList.Count == 0)
                            {
                                SendMethod.Current.GetCurrentPalyList(A31MusicModel.Current.functionMusic, () =>
                                {
 
                                    Application.RunOnMainThread(() =>
                                    {
                                        myListView.verticalScrolViewLayout.RemoveAll();
                                        var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name);
                                        var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source);
                                        var musicList = A31MusicModel.Current.GetSongList(listName);
                                        A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, source, myListView.popFra);
                                    });
                                });
 
                            }
                        }
                        catch
                        {
                        }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                loading.Hide();
                                //myListView.verticalScrolViewLayout.EndHeaderRefreshing();
                                //myListView.verticalScrolViewLayout.RemoveAll();
                                //var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name);
                                //var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source);
                                //var musicList = A31MusicModel.Current.GetSongList(listName);
 
                                //A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, source, myListView.popFra);
                            });
                        }
                    }));
 
                };
                ///移除界面
                EventHandler<MouseEventArgs> removeFromParentView = (sen, e1) =>
                 {
                     myListView.popFra.RemoveFromParent();
                 };
                myListView.backIextBtn.MouseUpEventHandler += removeFromParentView;
                //myListView.popFra.MouseUpEventHandler += removeFromParentView;
                #endregion
                //var listName = A31MusicModel.Current.functionMusic.GetAttribute("playlist_name").ToString();
                //var musicList = A31MusicModel.Current.GetSongList(listName);
                //new A31SongPlay { }.SongListView(myListView.verticalScrolViewLayout, musicList, listName);
 
                this.PlayListView(myListView.popFra, myListView.verticalScrolViewLayout, loading);
                this.UpdateSelectedMusic(myListView.popFra, myListView.verticalScrolViewLayout);
 
            };
            ///音量图标点击事件
            playView.volIconBtn.MouseUpEventHandler += (sender, e) =>
            {
 
            };
            ///音量进度条点击事件
            int startVolume = 0;//之前的音量
            //int endVolume = 0;//现在的音量
            EventHandler<int> progressClick = (sender, e) =>
            {
                playView.volValueBtn.Text = playView.volSeekBar.Progress + "%";
                if (startVolume != e)
                {
                    ///更新最新值
                    A31MusicModel.ProgressDateTime = DateTime.Now;
                    startVolume = e;
                    A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.volume, startVolume);
                    Dictionary<string, string> dic = new Dictionary<string, string>();
                    dic.Add(KeyProperty.volume, startVolume.ToString());
                    SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
 
                }
            };
            playView.volSeekBar.OnProgressChangedEvent += progressClick;
            playView.volSeekBar.OnStopTrackingTouchEvent += progressClick;
            ///上一曲点击事件
            playView.prevBtn.MouseDownEventHandler += (sender, e) =>
            {
                playView.prevBtn.IsSelected = true;
 
                A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step, ValueProperty.down);
                Dictionary<string, string> dic = new Dictionary<string, string>();
                dic.Add(KeyProperty.song_step, ValueProperty.up);
                SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
 
            };
            playView.prevBtn.MouseUpEventHandler += (sender, e) =>
            {
                playView.prevBtn.IsSelected = false;
            };
            ///暂停/播放点击事件
            playView.playBtn.MouseDownEventHandler += (sender, e) =>
            {
                string status = string.Empty;
                if (playView.playBtn.IsSelected)
                {
                    playView.playBtn.IsSelected = false;
                    status = ValueProperty.off;
 
                }
                else
                {
                    playView.playBtn.IsSelected = true;
                    status = ValueProperty.on;
                }
                A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.on_off, status);
                Dictionary<string, string> dic = new Dictionary<string, string>();
                dic.Add(KeyProperty.on_off, status);
                SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
            };
            ///下一曲点击事件
            playView.nextBtn.MouseDownEventHandler += (sender, e) =>
            {
                playView.nextBtn.IsSelected = true;
                A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step, ValueProperty.down);
                Dictionary<string, string> dic = new Dictionary<string, string>();
                dic.Add(KeyProperty.song_step, ValueProperty.down);
                SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
            };
            playView.nextBtn.MouseUpEventHandler += (sender, e) =>
            {
                playView.nextBtn.IsSelected = false;
            };
            /////物理按键的点击事件
            //Volume.VolumeChange = (volume) =>
            //{
            //    if (Application.DeviceType == Device.Ios && A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source) == "bluetooth")
            //    {
            //        return;
            //    }
            //    playView.volSeekBar.Progress = volume;
            //    if (startVolume != volume)
            //    {
            //        startVolume = volume;
            //        A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.volume, startVolume);
            //        Dictionary<string, string> dic = new Dictionary<string, string>();
            //        dic.Add(KeyProperty.volume, startVolume.ToString());
            //        SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic);
            //    }
            //};
            #endregion
        }
        /// <summary>
        /// 定义全局线程
        /// </summary>
        System.Threading.Thread timerThread;
        /// <summary>
        /// 定时更新状态
        /// </summary>       
        void TimerUpdateStatus()
        {
            timerThread = new System.Threading.Thread((obj) =>
            {
                while (true)
                {
                    Application.RunOnMainThread(() =>
                    {
                        try
                        {
                            //更新总时间                            
                            //总共有多少秒
                            int totalSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_time));
                            //分钟
                            int totalMusicMinute = totalSecond / 60;
                            //秒钟
                            int totalMusicSecond = totalSecond % 60;
                            //转化歌曲总时间时间格式
                            string totalTime = (totalMusicMinute.ToString().Length < 2 ? "0" + totalMusicMinute.ToString() : totalMusicMinute.ToString()) + ":" + (totalMusicSecond.ToString().Length < 2 ? "0" + totalMusicSecond.ToString() : totalMusicSecond.ToString());
                            //显示总时间
                            playView.endTimeBtn.Text = totalTime;
                            //显示播放器名称
                            topView.topNameBtn.Text = A31MusicModel.Current.functionMusic.name;
                            //显示播放模式图标
                            switch (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.mode))
                            {
                                case ValueProperty.list_cycle://列表循环
                                    playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/list.png";
                                    break;
                                case ValueProperty.single_cycle://单曲循环
                                    playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single_cycle.png";
                                    break;
                                case ValueProperty.random://随机播放
                                    playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/random.png";
                                    break;
                                case ValueProperty.single:// 单曲<single>
                                    playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/single.png";
                                    break;
                                case ValueProperty.order://循序循环
                                    playView.playOrderBtn.UnSelectedImagePath = "MusicIcon/order.png";
                                    break;
                            }
 
 
                            //if (A31MusicModel.Current.A31PlayStatus.Source == "RADIO-NETWORK")
                            //{
                            //    var v = A31MusicModel.Current.LoveRadioInfoList.Find((like) =>
                            //    {
                            //        return like.URL == A31MusicModel.Current.A31PlayStatus.TrackURL;
                            //    });
                            //    if (v != null)
                            //    {
                            //        playView.loveBtn.IsSelected = true;
                            //    }
                            //    else
                            //    {
                            //        playView.loveBtn.IsSelected = false;
                            //    }
                            //}
                            //else
                            //{
                            //    var v = A31MusicModel.Current.LoveMusicInfoList.Find((like) =>
                            //    {
                            //        return like.URL == A31MusicModel.Current.A31PlayStatus.TrackURL;
                            //    });
                            //    if (v != null)
                            //    {
                            //        playView.loveBtn.IsSelected = true;
                            //    }
                            //    else
                            //    {
                            //        playView.loveBtn.IsSelected = false;
                            //    }
                            //}
                            //显示播放器区域
                            playView.regionBtn.Text = A31MusicModel.Current.functionMusic.GetRoomListName();
                            //显示播放器收藏状态
                            if (A31MusicModel.Current.functionMusic.collect)
                            {
                                //收藏
                                playView.collectIconBtn.IsSelected = true;
                            }
                            else
                            {
                                //不收藏
                                playView.collectIconBtn.IsSelected = false;
                            }
                            //if (A31MusicModel.Current.A31PlayStatus.IsMute)
                            //{
                            //   // btnMute.IsSelected = true;//静音图标
                            //    playView.volSeekBar.Progress = 0;
                            //}
                            //else
                            //{
                            //   // btnMute.IsSelected = false;//静音图标
                            //    if (1000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds)
                            //    {
                            //        //声音进度条;
                            //        playView.volSeekBar.Progress = int.Parse(A31MusicModel.Current.A31PlayStatus.vol);
                            //        //显示当前音量值;
                            //        playView.volValueBtn.Text = A31MusicModel.Current.A31PlayStatus.vol + "%";
                            //    }
                            //}
                            //为了防止音量条跳动,延长更新时间(多加1s)
                            if (2000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds || A31MusicModel.ProgressDateTime == DateTime.MinValue)
                            {
                                //显示音量进度条值;
                                playView.volSeekBar.Progress = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume));
                                //显示当前音量值;
                                playView.volValueBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume) + "%";
                            }
                            //更新播放器音量给系统音量
                            //Volume.MusicVolume = playView.volSeekBar.Progress;
                            //当前播放音乐时间
                            //按道理不会为空,GetAttrState("playing_time")值可能为空,强制转换int.Parse()会出现异常,不过也做了异常处理了
                            int playSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playing_time));
                            //识别音乐状态是否在播放状态
                            if (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on)
                            {
                                //音乐在播放时,再计算播放时间(现在时间=原来时间+1秒)
                                //playSecond += (int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds;
                                playSecond += 1;//表示加上等待的时间1s
                                ///歌曲记录暂时时间写入缓存;
                                A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.playing_time, playSecond);
                            }
                            if (playSecond <= 0)
                            {
                                ///播放时间不能小于0;
                                playSecond = 0;
                            }
                            if (playSecond >= totalSecond)
                            {
                                ///播放时间不能超过总时间;
                                playSecond = totalSecond;
                            }
                            int playMusicMinute = playSecond / 60;
                            //秒钟
                            int playMusicSecond = playSecond % 60;
                            //转化播放时间时间格式
                            string playTime = (playMusicMinute.ToString().Length < 2 ? "0" + playMusicMinute.ToString() : playMusicMinute.ToString()) + ":" + (playMusicSecond.ToString().Length < 2 ? "0" + playMusicSecond.ToString() : playMusicSecond.ToString());
                            //显示播放时间                  
                            playView.startTimeBtn.Text = playTime;
                            //显示播放状态
                            if (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on)
                            {
                                //播放
                                playView.playBtn.IsSelected = true;
                            }
                            else
                            {
                                //暂停
                                playView.playBtn.IsSelected = false;
                                ///记录歌曲暂停时间;<LastDateTime 计算播放时间有用到>
                                A31MusicModel.Current.LastDateTime = DateTime.Now;
                            }
                            //显示进度条值
                            if (totalSecond == 0)
                            {
                                //歌曲播放进度
                                playView.diyArcSeekBar.Progress = 0;
                            }
                            else
                            {
                                //歌曲播放进度
                                playView.diyArcSeekBar.Progress = (int)(playSecond * 100.0 / totalSecond);//+1
                            }
                            //显示歌曲名称
                            playView.songNameTextView.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name) == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name);
                            //显示歌手名称
                            playView.singerBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name) == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name);
                            //更新源的界面
                            // showSourcePage();
                        }
                        catch (Exception e)
                        {
                            var ee = e.Message;
                        }
                    });
                    System.Threading.Thread.Sleep(1000 * 1);
                }
            })
            { IsBackground = true };
            timerThread.Start();
        }
        /// <summary>
        /// 更新不同音乐源界面图标状态
        /// </summary>
        void showSourcePage()
        {
            playView.loveBtn.Alpha = 1;
            playView.loveBtn.Enable = true;
 
            playView.playlistBtn.Alpha = 1;
            playView.playlistBtn.Enable = true;
 
            playView.prevBtn.Alpha = 1;
            playView.prevBtn.Enable = true;
 
            playView.nextBtn.Alpha = 1;
            playView.nextBtn.Enable = true;
 
            playView.playOrderBtn.Alpha = 1;
            playView.playOrderBtn.Enable = true;
 
 
            playView.diyArcSeekBar.IsClickable = true;
 
            switch (A31MusicModel.Current.functionMusic.GetAttrState("source"))
            {
                //sdcard/audio_in/ftp/radio/bluetooth
                case "SONGLIST-NETWORK"://本地音乐
                    break;
                case "SONGLIST-LOCAL"://USB
                    break;
                case "RADIO-NETWORK"://在线电台
                    playView.playlistBtn.Alpha = 1;
                    playView.playlistBtn.Enable = true;
 
                    playView.prevBtn.Alpha = 0.5f;
                    playView.prevBtn.Enable = false;
 
                    playView.nextBtn.Alpha = 0.5f;
                    playView.nextBtn.Enable = false;
 
                    playView.playOrderBtn.Alpha = 0.5f;
                    playView.playOrderBtn.Enable = false;
                    break;
                case "BLUETOOTH"://蓝牙
                case "LINE-IN"://线路输入
                    playView.loveBtn.Alpha = 0.5f;
                    playView.loveBtn.Enable = false;
 
                    playView.playlistBtn.Alpha = 0.5f;
                    playView.playlistBtn.Enable = false;
 
                    playView.prevBtn.Alpha = 0.5f;
                    playView.prevBtn.Enable = false;
 
                    playView.nextBtn.Alpha = 0.5f;
                    playView.nextBtn.Enable = false;
 
                    playView.playOrderBtn.Alpha = 0.5f;
                    playView.playOrderBtn.Enable = false;
 
                    break;
                default:
                    playView.diyArcSeekBar.IsClickable = false;
                    playView.loveBtn.Alpha = 0.5f;
                    playView.loveBtn.Enable = false;
 
                    playView.playlistBtn.Alpha = 0.5f;
                    playView.playlistBtn.Enable = false;
 
                    playView.prevBtn.Alpha = 0.5f;
                    playView.prevBtn.Enable = false;
 
                    playView.nextBtn.Alpha = 0.5f;
                    playView.nextBtn.Enable = false;
 
                    playView.playOrderBtn.Alpha = 0.5f;
                    playView.playOrderBtn.Enable = false;
                    break;
            }
        }
        /// <summary>
        /// 加载播放音乐列表View
        /// </summary>
        /// <param name="verticalScrolViewLayout"></param>
        private void PlayListView(FrameLayout frameLayout, VerticalRefreshLayout verticalScrolViewLayout, Loading loading)
        {
            verticalScrolViewLayout.RemoveAll();
            var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name);
            var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source);
            //获取缓存歌曲列表
            var musicList = A31MusicModel.Current.GetSongList(listName);
            loading.Start();
            if (musicList.Count == 0)
            {
                System.Threading.Tasks.Task.Run((() =>
                {
                    try
                    {
                        A31MusicModel.Current.CurrentPlayMusicInfoList.Clear();
                        if (A31MusicModel.Current.CurrentPlayMusicInfoList.Count == 0)
                        {
                            //获取歌曲列表
                            SendMethod.Current.GetCurrentPalyList(A31MusicModel.Current.functionMusic, () =>
                            {
 
                                Application.RunOnMainThread(() =>
                                {
                                    musicList = A31MusicModel.Current.GetSongList(listName);
                                    A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout);
 
                                });
                            });
 
                        }
                    }
                    catch
                    {
                    }
                    finally
                    {
                        Application.RunOnMainThread(() =>
                        {
                            loading.Hide();
                            //musicList = A31MusicModel.Current.GetSongList(listName);
                            //A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout);
                        });
                    }
                }));
            }
            else
            {
                Application.RunOnMainThread(() =>
                {
                    loading.Hide();
                    A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout);
                });
            }
        }
        /// <summary>
        /// 定时更新当前播放音乐
        /// </summary>
        private void UpdateSelectedMusic(FrameLayout frameLayout, VerticalRefreshLayout middViewLayout)
        {
            UpdateThread.updateCurrMusicThread(frameLayout, middViewLayout, A31MusicModel.Current);
        }
    }
}