Exemplo n.º 1
0
 private void Core_SpeedChange(Helper.DownCore core, double e)
 {
     if (core.Tag != null)
     {
         lock (core.Tag)
         {
             Frm.Downitem item = core.Tag as Frm.Downitem;
             if (item != null)
             {
                 item.Invoke(new Action(() =>
                 {
                     item.size.Text = core.Value.CountSize() + "/" + core.MaxValue.CountSize() + "   " + e.CountSize() + " /s";
                 }));
             }
         }
     }
 }
Exemplo n.º 2
0
 private void Core_TimeChange(Helper.DownCore core, string e)
 {
     if (core.Tag != null)
     {
         lock (core.Tag)
         {
             Frm.Downitem item = core.Tag as Frm.Downitem;
             if (item != null)
             {
                 item.Invoke(new Action(() =>
                 {
                     item.time.Text = "预计还需 " + e;
                 }));
             }
         }
     }
 }
Exemplo n.º 3
0
        private void Core_StateChange(Helper.DownCore core, Helper.DownCore.DownState e)
        {
            if (core.Tag != null)
            {
                lock (core.Tag)
                {
                    Frm.Downitem item = core.Tag as Frm.Downitem;

                    if (item != null)
                    {
                        switch (e)
                        {
                        case Helper.DownCore.DownState.Complete:
                            item.Invoke(new Action(() =>
                            {
                                item.state.ForeColor    = Color.FromArgb(80, 227, 194);
                                item.state.Text         = "下载完成";
                                item.time.Text          = null;
                                item.size.Text          = core.MaxValue.CountSize();
                                item.link_retry.Visible = item.link_del.Visible = false;

                                item.link_open.Visible = true;
                            }));
                            break;

                        case Helper.DownCore.DownState.Downloading:
                            item.Invoke(new Action(() =>
                            {
                                item.state.ForeColor = Color.Black;
                                item.state.Text      = "下载中";

                                item.link_retry.Visible = item.link_open.Visible = false;
                                item.link_del.Visible   = true;
                            }));
                            break;

                        case Helper.DownCore.DownState.Fail:
                            item.Invoke(new Action(() =>
                            {
                                item.state.ForeColor = Color.FromArgb(235, 17, 35);
                                item.state.Text      = "下载失败";
                                item.time.Text       = item.size.Text = null;

                                item.link_open.Visible  = false;
                                item.link_retry.Visible = item.link_del.Visible = true;
                            }));
                            break;

                        case Helper.DownCore.DownState.Ready:
                            item.Invoke(new Action(() =>
                            {
                                item.state.ForeColor = Color.DimGray;
                                item.state.Text      = "准备中";

                                item.link_del.Visible = item.link_retry.Visible = item.link_open.Visible = false;
                            }));
                            break;

                        case Helper.DownCore.DownState.Stop:
                            item.Invoke(new Action(() =>
                            {
                                item.state.ForeColor = Color.OrangeRed;
                                item.state.Text      = "已停止";
                                item.time.Text       = null;

                                item.link_retry.Visible = item.link_open.Visible = false;
                                item.link_del.Visible   = true;
                            }));
                            break;
                        }
                    }
                }
            }
        }