Exemplo n.º 1
0
 public DownloadViewModel(IDownloadInfoExpand packet)
 {
     _downloadInfo    = packet.DownloadInfo;
     _all             = packet.TimePeriodsAll;
     _downloaded      = packet.TimePeriodsCompleted;
     GuidCode         = packet.GuidCode;
     Quality          = packet.Quality;
     Size             = getByteLengthString(packet.Size);
     IPAddress        = packet.DownloadInfo.SourceIp;
     BeginTime        = GlobalProcess.TimeFormatOfCn(packet.DownloadInfo.BeginTime);
     EndTime          = GlobalProcess.TimeFormatOfCn(packet.DownloadInfo.EndTime);
     DownloadTimeSpan = (packet.DownloadInfo.EndTime - packet.DownloadInfo.BeginTime).ToString();
     updateStatus(packet.DownloadStatus);
     IsLocalDownload = packet.IsLocalDownload;
     updateSlider();
     ErrorInfo = packet.ErrorInfo;
     updatedLastestTime(packet.UpdatedLastestTime);
     updateSpeed(packet.Speed);
     PlayingCommand   = new CommandDelegate(_ => Play());
     DeleteCommand    = new CommandDelegate(_ => Delete());
     GoTopCommand     = new CommandDelegate(_ => GoTop());
     OpenCommand      = new CommandDelegate(_ => Open());
     PropertyChanged += onPropertyChanged;
     if (packet.DownloadInfo.VideoName != null)
     {
         Name = string.Format("{0} ({1})", packet.DownloadInfo.VideoName, packet.Name);
     }
     else
     {
         Name = packet.Name;
     }
 }
Exemplo n.º 2
0
        public void TestGlobalProcess_TimeFormatOfCn()
        {
            string cn = GlobalProcess.TimeFormatOfCn(new DateTime(2016, 5, 6, 10, 14, 15, 1));

            Assert.AreEqual("2016年05月06日10时14分15秒", cn);
        }