Esempio n. 1
0
        /// <summary>
        /// 加载列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tmi_load_list_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofdig = new OpenFileDialog();

            ofdig.InitialDirectory = Application.StartupPath + "/Download";
            if (ofdig.ShowDialog() == DialogResult.OK)
            {
                var path = ofdig.FileName;
                this.m_DownloadList = DownloadHelper.LoadList(path);

                AddFileToGridDataView(this.m_DownloadList);

                AddToPendingList(this.m_DownloadList);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 下载专辑
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmi_downAlbum_Click(object sender, EventArgs e)
        {
            var selectNode = this.tvPendingDownload.SelectedNode;

            if (selectNode.Name != "pendingNode")
            {
                var albumId = selectNode.Name;

                var lst = DownloadHelper.LoadAlbumList(albumId);

                if (lst != null)
                {
                    this.m_DownloadList = lst;

                    if (lst.All(a => a.isComplete))
                    {
                        MessageBox.Show("该专辑已全部下载完毕", "系统提示");
                    }
                    else
                    {
                        this.m_downlist.Rows.Clear();
                        this.AddFileToGridDataView(lst);

                        AddFileToGridDataView(lst);
                    }
                }
                else
                {
                    MessageBox.Show("找不到该专辑", "系统提示");
                }
            }
            else
            {
                MessageBox.Show("下载错误", "系统提示");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 开始新的下载
        /// </summary>
        private void StartNewWork()
        {
            try
            {
                SynFileInfo next = this.GetNext();
                if (next == null)
                {
                    var msg = "所有文件下载完毕!";
                    if (!IsDownload)
                    {
                        msg = "已停止下载";
                    }
                    MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }

                this.showinfo("分析:" + next.DocName);
                DownloadHelper.GetJsonInfo(next);
                next.RowObject.Cells["duration"].Value = (next.duration / 60).ToString() + "分钟";
                this.showinfo("下载:" + next.DocName);

                //如果专辑名称不一样,则保存起来
                if (next.Album != lastAlbum)
                {
                    lastAlbum = next.Album;
                    FileHelper.SaveAlbum(lastAlbum);
                }
                this.StartDownload(next);
            }
            catch (Exception exp)
            {
                var content = "下载出现错误,请重试!若仍有问题,请联系作者!";
                LogHelper.WriteLog("StartNewWork" + content + exp.Message);
                this.showinfo(content);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 停止下载
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_stop_down_Click(object sender, EventArgs e)
 {
     showinfo("已准备停止,下载完当前声音后会自动停止,请耐心等待……");
     IsDownload = false;
     DownloadHelper.UpdateList(this.m_DownloadList);
 }