tidstagning/Tidstagning/Program.cs

38 lines
971 B
C#
Raw Normal View History

using CommandLine;
using System;
using System.Collections.Generic;
2020-04-21 15:47:38 +00:00
using System.Windows.Forms;
namespace Tidstagning
{
static class Program
{
public class Options
{
[Option('c', "config", Required = false, HelpText = "Enable configuration menu.")]
public bool Config { get; set; }
}
2020-04-21 15:47:38 +00:00
[STAThread]
static void Main(string[] args)
{
CommandLine.Parser.Default.ParseArguments<Options>(args)
.WithParsed(RunOptions)
.WithNotParsed(HandleParseError);
}
static void RunOptions(Options opts)
2020-04-21 15:47:38 +00:00
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainUI(opts.Config));
2020-04-21 15:47:38 +00:00
}
static void HandleParseError(IEnumerable<Error> errs)
{
MessageBox.Show("Failed to start\n" + errs.ToString());
}
2020-04-21 15:47:38 +00:00
}
}