static bool ProgressCallback(ProgressCategory category, int progress, IntPtr userData) { // Don't interrupt verbose printing. if (s_verbose) { return(true); } if (progress == 0) { stopwatch.Restart(); } Console.Write($"\r {XAtlas.StringForEnum(category)} {progress}%"); for (int i = 0; i < 10; i++) { Console.Write(progress / ((i + 1) * 10) > 0 ? "*" : " "); } Console.Write($" {progress}%]"); if (progress == 100) { Console.WriteLine($"\n {stopwatch.Elapsed.TotalSeconds:0.00} seconds ({stopwatch.ElapsedMilliseconds} ms) elapsed"); } return(true); }
public ProgressWorker(ProgressOperation method, ProgressCategory category, ProgressOperationCompleted completedMethod, int progressSize, int progressTotal, IProgressHost progress) { WorkerMethod = method; _category = category; CompletedMethod = completedMethod; ProgressSize = progressSize; ParentProgress = progress; TotalProgressTicks = progressTotal; }
/// <summary> /// Initializes a new instance of the <see cref="ProgressType"/> class. /// You must initialize category, current, and max value of the progress. /// </summary> /// <param name="category">The category of progress that appeared on notification.</param> /// <param name="current">The current value of the progress.</param> /// <param name="max">The max value of the progress.</param> /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception> /// <since_tizen> 3 </since_tizen> public ProgressType(ProgressCategory category, double current, double max) { if (IsNegativeNumber(current)) { throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The current must be a positive integer."); } if (IsNegativeNumber(max)) { throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The max must be a positive integer."); } Category = category; ProgressCurrent = current; ProgressMax = max; }
public ProgressWorker(ProgressOperation method, ProgressCategory category, int progressSize, int progressTotal, IProgressHost progress) : this(method, category, null, progressSize, progressTotal, progress) { }
internal static extern NotificationError GetProgressType(NotificationSafeHandle handle, out ProgressCategory category);
public static string StringForEnum(ProgressCategory Category) { string ret = XAtlasPINVOKE.StringForEnum__SWIG_1((int)Category); return(ret); }
internal static extern ErrorCode GetOngoingType(NotificationSafeHandle handle, out ProgressCategory category);