Пример #1
0
        public static void Initialize <TArg>(this Application app, Action <TArg> actionOnArguments)
            where TArg : new()
        {
            HandleGlobalErrors();
            ThisThread.SetShortDateFormat("d MMM yyyy");
            TArg args = default(TArg);

            ExitOnError(() => args = new TArg(), "Parsing arguments");
            ExitOnError(() => actionOnArguments(args), "Consuming arguments");
        }
        public static void Initialize <TArg>(this Application app, Action <TArg> actionOnArguments)
            where TArg : new()
        {
            HandleGlobalErrors();
            ThisThread.SetShortDateFormat("d MMM yyyy");
            TArg args = default(TArg);

            SafeExecute(() => args = new TArg(), "Parsing arguments");
            SafeExecute(() => actionOnArguments(args), "Consuming arguments");

            //todo: find a place for this
            //app.Exit += (s, e) => RunOnExit(args);
            //AccessControlExtensions.OnUnauthorizedAccess = s => ShowNotAllowed(s);
        }
Пример #3
0
        public static void Initialize(this Application app, Action <AppArguments> onStartup)
        {
            HandleGlobalErrors();
            AccessControlExtensions.OnUnauthorizedAccess = s => ShowNotAllowed(s);

            ThisThread.SetShortDateFormat("d MMM yyyy");

            var args = CommandlineOptions.Parse();

            //Log.Logger = LogConfigs.ToLoggly(args);

            app.Exit += (s, e) => RunOnExit(args);

            //Log.Information("{User} launched {Exe}", args.UserName, args.ExeName);
            SafeExecute(onStartup, args);
        }
Пример #4
0
 public void Start()
 {
     ThisThread.Start();
 }