예제 #1
0
        public bool CreateToClient(MusicLogInfo info)
        {
            List <MusicLogInfo> list = GetClient();

            if (null == list)
            {
                list = new List <MusicLogInfo>();
            }
            if (null == info.CreateDate)
            {
                info.CreateDate = DateTime.Now;
            }
            list.Add(info);
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(list);

            return(Tool.DocHelper.Write(GetLogFileFullName(), json));
        }
예제 #2
0
파일: Form1.cs 프로젝트: linhuaxia/BGA
        private void Listbox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var CurrentControl = (ListBox)sender;
            int index          = CurrentControl.IndexFromPoint(e.Location);

            if (index == System.Windows.Forms.ListBox.NoMatches)
            {
                CurrentControl.SelectedIndex = -1;
                return;
            }

            var formFinishConfirm = new FormFinishConfirm(true);

            formFinishConfirm.StartPosition = FormStartPosition.CenterParent;
            var confirmResult = formFinishConfirm.ShowDialog();//  MessageBox.Show("是否确认已将音源输入切换至电脑?","切换提醒",MessageBoxButtons.OKCancel); //执行双击事件

            var infoMusic = listCategory.SelectMany(c => c.MusicInfo).FirstOrDefault(a => a.Name == CurrentControl.SelectedItem.ToString());

            if (null == infoMusic)
            {
                MessageBox.Show("音频文件已下架,请重新打开app"); //
                return;
            }
            axWindowsMediaPlayer1.URL = GetCurrentMusicDirectory() +
                                        infoMusic.CategoryInfo.Name +
                                        "\\" +
                                        infoMusic.SRC.Substring(infoMusic.SRC.LastIndexOf("/") + 1);
            axWindowsMediaPlayer1.settings.playCount = infoMusic.PlayTime;
            axWindowsMediaPlayer1.Ctlcontrols.play();
            labelStatus.Text = "现时播放音乐:" + infoMusic.Name;


            MusicLogInfo infoMusicLog = new MusicLogInfo();

            infoMusicLog.StoreID           = new StoreHelper().GetLoginInfo().ID;
            infoMusicLog.MusicName         = infoMusic.Name;
            infoMusicLog.CategoryName      = infoMusic.CategoryInfo.Name;
            infoMusicLog.CreateDate        = DateTime.Now;
            infoMusicLog.FinishConfirmTime = DicInfo.DateZone;
            if (infoMusicLog.StoreID > 0)
            {
                new MusicLogClient().CreateToClient(infoMusicLog);
            }
        }