예제 #1
0
 /// <summary>
 /// 读取一个xml文件,并获得BeatMap列表。
 /// </summary>
 /// <returns></returns>
 public List<BeatMapViewModel> ReadXmlToList(string path)
 {
     List<BeatMapViewModel> bms = new List<BeatMapViewModel>();
     XElement xDoc = xmlHelper.LoadXml(path);
     var beatMaps = xDoc.Descendants("BeatMap");
     foreach (var d in beatMaps)
     {
         BeatMapViewModel bmvmTemp = new BeatMapViewModel();
         bmvmTemp.Beat_Map.Id = Int32.Parse(d.Element("Id").Value);  //此处强制转换可能发生异常
         bmvmTemp.Beat_Map.Title = d.Element("Title").Value;
         bmvmTemp.Beat_Map.Artist = d.Element("Artist").Value;
         bmvmTemp.Beat_Map.Mapper = d.Element("Mapper").Value;
         bmvmTemp.Beat_Map.Styles = d.Element("Styles").Value;
         bmvmTemp.Beat_Map.Language = d.Element("Language").Value;
         bmvmTemp.Beat_Map.Sb = d.Element("Sb").Value;
     }
     return bms;
 }
예제 #2
0
        private void C_AddBeatMapToDown(BeatMapViewModel p)
        {
            string bmDnUrl = p.Beat_Map.DownUrl_osz_so.ToString();  //��ȡҪ���ŵ�BeatMap�ĵ�ַ
            bool isInDownList = downList.Contains(bmDnUrl);

            if (isInDownList)
            {
                MessageBoxResult result = MessageBox.Show("���ִ˶�����������������б���Ƿ�������ӣ�", "�ظ�������ʾ", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
                if (result == MessageBoxResult.No)
                    return;
            }
            downList.Add(bmDnUrl);
            var file = new DownloadItemViewModel(bmDnUrl);
            DownloadFileList.Add(file);
        }
예제 #3
0
 private void C_PlaySongTaste(BeatMapViewModel p)
 {
     string id = p.Beat_Map.Id.ToString();  //��ȡҪ���ŵ�BeatMap��Id
     if (this.NowPlayingId == id)
     {
         this.SongTaste_PlayOrPause();
     }
     else
     {
         this.NowPlayingId = id;
         this.SongTaste_Play(id);
     }
 }
예제 #4
0
 /// <summary>
 /// �ӹ����ϻ�ȡ����Ranked�б������BeatMap�������ݸ�ViewModel�µĶ���
 /// </summary>
 private void Action_GetNewRankedBeatMapListByWeb()
 {
     this.PrograssBar_Value = 30;
     var beatMaps = zXPath2Model.GetBeatMaps(ConfigMain);  //�ӹ�����ȡ����Ranked�б�
     this.PrograssBar_Value = 90;
     List<BeatMapViewModel> temps = new List<BeatMapViewModel>();
     foreach (var beatmap in beatMaps)
     {
         BeatMapViewModel item = new BeatMapViewModel();
         item.Beat_Map = beatmap;
         temps.Add(item);
     }
     BeatMapsNewRankList = new List<BeatMapViewModel>();
     BeatMapsNewRankList = temps;
     this.PrograssBar_Value = 100;
 }