public int Count(string sql = "") { if (string.IsNullOrEmpty(sql)) { sql = TableName; } int count = QueryStatistics(sql, "count(1)"); X1LogHelper.Verbose($"Count {sql} [{count}]"); return(count); }
void File_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { System.Diagnostics.Debug.WriteLine("[Property changed] " + e.PropertyName + " -> " + sender?.GetType().GetProperty(e.PropertyName)?.GetValue(sender, null)); // Update UI text-fields var downloadFile = ((IDownloadFile)sender); if (downloadFile == null) { return; } // Update UI text-fields switch (e.PropertyName) { case nameof(IDownloadFile.Status): X1LogHelper.Log($"{downloadFile.Url} [status]: {downloadFile.Status}"); break; case nameof(IDownloadFile.TotalBytesExpected): X1LogHelper.Verbose($"{downloadFile.Url} [Total length]: {downloadFile.TotalBytesExpected}"); break; case nameof(IDownloadFile.TotalBytesWritten): X1LogHelper.Verbose($"{downloadFile.Url} [downloaded]: {downloadFile.TotalBytesWritten}"); break; } // Update UI if download-status changed. if (e.PropertyName == "Status") { switch (((IDownloadFile)sender).Status) { case DownloadFileStatus.COMPLETED: { X1LogHelper.Log($"{downloadFile.Url} [downloaded as ]: [{downloadFile.DestinationPathName}]"); var path = downloadFile.DestinationPathName; if (path.StartsWith(BaobaoModel.LocalPathPrefix)) { path = path.Substring(BaobaoModel.LocalPathPrefix.Length); } OnFileAvailable?.Invoke(this, new StringEventArgs(path)); } break; } } }