コード例 #1
0
 static public void Run()
 {
     if (TSviewCloud.ConsoleFunc.IsOutputRedirected)
     {
         return;
     }
     t = new System.Threading.Timer((o) =>
     {
         Console.Clear();
         var height  = Console.WindowHeight;
         var width   = Console.WindowWidth;
         var joblist = JobControler.JobList();
         var i       = 0;
         foreach (var j in joblist.Where(x => !x.IsHidden).OrderBy(x => x.Index))
         {
             Console.SetCursorPosition(0, i++);
             Console.Write(j.DisplayName);
             if (i > height - 1)
             {
                 break;
             }
             Console.SetCursorPosition(4, i++);
             Console.Write(j.ProgressStr);
             if (i > height - 1)
             {
                 break;
             }
         }
     }, null, 0, 1000);
 }
コード例 #2
0
 private void timer2_Tick(object sender, EventArgs e)
 {
     if (!Instance.Visible && (JobControler.JobList()?.Any(x => x.IsDelayShow) ?? false))
     {
         Instance.Show();
         Instance.BringToFront();
     }
 }
コード例 #3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            tic++;
            if (tic > 10000)
            {
                tic = 0;
            }
            listView1.Invalidate();
            if (tic % 10 != 0)
            {
                return;
            }

            var joblist = JobControler.JobList();

            if (joblist == null)
            {
                return;
            }
            var now = DateTime.Now;

            internalJobList = joblist.Where(x => !x.IsHidden)
                              .OrderBy(x => (x.IsInfo)? 0: (x.IsDone) ? 1 : (x.IsRunning) ? 2 : 3)
                              .ThenBy(x => x.Index)
                              .ThenBy(x => (x.StartTime == default(DateTime)) ? now : x.StartTime)
                              .ThenBy(x => x.QueueTime).ToArray();
            try
            {
                listView1.VirtualListSize = internalJobList.Length;
            }
            catch
            {
                return;
            }
            if (listView1.VirtualListSize > 0)
            {
                var str = new StringBuilder();
                str.AppendFormat("All:{0} ", internalJobList.Length);
                int d = JobControler.JobTypeCount(JobClass.Download);
                int u = JobControler.JobTypeCount(JobClass.Upload) + JobControler.JobTypeCount(JobClass.RemoteUpload);
                int p = JobControler.JobTypeCount(JobClass.PlayDownload);
                int o = internalJobList.Length - (d + u + p);
                if (d > 0)
                {
                    str.AppendFormat("Download:{0} ", d);
                }
                if (u > 0)
                {
                    str.AppendFormat("Upload:{0} ", u);
                }
                if (p > 0)
                {
                    str.AppendFormat("Play:{0} ", p);
                }
                if (o > 0)
                {
                    str.AppendFormat("Other:{0} ", o);
                }
                label1.Text = str.ToString();
            }
            else
            {
                label1.Text = "";
            }
            if (internalJobList.Length == 0)
            {
                Stop();
            }
        }