mirror of
https://github.com/chylex/Code-Statistics.git
synced 2024-11-24 21:42:45 +01:00
28 lines
713 B
C#
28 lines
713 B
C#
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace CodeStatistics.Forms.Utils{
|
|
static class ControlExtensions{
|
|
public static void InvokeSafe(this Control control, Action func){
|
|
if (control.InvokeRequired){
|
|
control.Invoke(func);
|
|
}
|
|
else{
|
|
func();
|
|
}
|
|
}
|
|
|
|
public static void SetValueInstant(this ProgressBar bar, int value){
|
|
if (value == bar.Maximum){
|
|
bar.Value = value;
|
|
bar.Value = value-1;
|
|
bar.Value = value;
|
|
}
|
|
else{
|
|
bar.Value = value+1;
|
|
bar.Value = value;
|
|
}
|
|
}
|
|
}
|
|
}
|