static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); TimerForm tf = new TimerForm(); tf.Show(); tf.Visible = false; Application.Run(); }
public timeCommand(TimerForm form, bool work) { this.form = form; this.work = work; string h = "(?<hour>[0-9]{1,2})", m = "(?<minute>[0-9]{1,2})", s = "(?<second>[0-9]{1,2})"; this.regex = new Regex(string.Format("({0}:)?{1}:{2}|{1}", h, m, s)); time.Validate(x => x.Length == 1, "Exactly one time only please"); time.ValidateEach(x => regex.IsMatch(x), "Invalid time format"); }
public MyCommand(TimerForm form) { this.form = form; SubCommands.Add("quit", () => { form.canclose = true; form.Close(); Application.Exit(); }); SubCommands.Add(WORK_COMMAND, new timeCommand(form, true)); SubCommands.Add(BREAK_COMMAND, new timeCommand(form, false)); SubCommands.Add(PAUSE_COMMAND, form.icon.Pause); }