public static Result Query(Result flags, string errormsg, string condition, string file)
{
var s = String.Format (condition, file);
int len = Math.Min (s.Length, Application.Cols-8);
var d = new Dialog (len, 8, "Error");
d.ErrorColors ();
d.Add (new Label (1, 1, errormsg));
d.Add (new Label (1, 2, String.Format (condition, file.Ellipsize (len-condition.Length))));
Result result = Result.Ignore;
Button b;
if ((flags & Result.Retry) == Result.Retry) {
b = new Button (0, 0, "Retry", true);
b.Clicked += delegate {
result = Result.Retry;
d.Running = false;
};
d.Add (b);
}
if ((flags & Result.Ignore) == Result.Ignore) {
b = new Button (0, 0, "Ignore", true);
b.Clicked += delegate {
result = Result.Ignore;
d.Running = false;
};
d.Add (b);
}
if ((flags & Result.Cancel) == Result.Cancel) {
b = new Button (0, 0, "Cancel", true);
b.Clicked += delegate {
result = Result.Cancel;
d.Running = false;
};
d.Add (b);
}
Application.Run (d);
return result;
}