public override void DidFinishLaunching(NSNotification notification) { ApplicationArgs appArgs = GetApplicationArgs(); ExceptionsHandler.SetExceptionHandlers(appArgs.IsTestingMode); ThreadWaiterBuilder.Initialize(new MacApplicationTimerBuilder()); WindowHandler.Initialize(this); GuiMessage.Initialize(new MacOsGuiMessage()); NSApplication.SharedApplication.ActivateIgnoringOtherApps(true); if (appArgs.IsTestingMode) { InstallTestAssembliesResolver(appArgs.PathToAssemblies); } // Tip: you could launch different windows depending on the // argument flags. WindowHandler.LaunchApplicationWindow(); if (appArgs.IsTestingMode) { RemotingHack.ApplyRemotingConfigurationWorkaround(); WindowHandler.LaunchTest(appArgs.TestInfoFile, appArgs.PathToAssemblies); } }
ApplicationArgs GetApplicationArgs() { string[] args = NSProcessInfo.ProcessInfo.Arguments; // NSProcessInfo.ProcessInfo.Arguments contains the executable // path. Just remove it. string[] result = new string[args.Length - 1]; Array.Copy(args, 1, result, 0, args.Length - 1); return(ApplicationArgs.Parse(result)); }
void EventsManager_OnApplication_InitializeComplete(object sender, ApplicationArgs e) { ODataConventionModelBuilder builder = new ODataConventionModelBuilder(); builder.EntitySet <Member>("Members"); builder.EntitySet <MemberExtend>("MemberExtends"); System.Web.Http.GlobalConfiguration.Configure(config => { //config.EnableQuerySupport(); config.MapODataServiceRoute(routeName: "OData", routePrefix: "odata", model: builder.GetEdmModel()); }); }
static void Main(string[] args) { try { ApplicationArgs appArgs = ApplicationArgs.Parse(args); ExceptionsHandler.SetExceptionHandlers(appArgs.IsTestingMode); ProcessNameSetter.SetProcessName("linux"); ThreadWaiterBuilder.Initialize(new GtkApplicationTimerBuilder()); GuiMessage.Initialize(new GtkGuiMessage()); if (appArgs.IsTestingMode) { InstallTestAssembliesResolver(appArgs.PathToAssemblies); } // Tip: you could launch different windows depending on the // argument flags. Application.Init(); WindowHandler.LaunchApplicationWindow(); if (appArgs.IsTestingMode) { WindowHandler.LaunchTest(appArgs.TestInfoFile, appArgs.PathToAssemblies); } Application.Run(); } catch (Exception ex) { // You would track the exception here Console.Error.WriteLine($"{ex.GetType()}: {ex.Message}"); Console.Error.WriteLine(ex.StackTrace); ExitCode = 1; Application.Quit(); } finally { // You would dispose everything you need here. Environment.Exit(ExitCode); } }
public void EnsureCommandIsParsedCorrectly() { var applicationArgs = new ApplicationArgs(); var dictionary = new Dictionary <string, CommandLineArgument> { { "execute", new CommandLineArgument { Name = "execute" } }, { "path", new CommandLineArgument { Name = "path", Value = "C:\\temp" } } }; var commandMapper = new CommandMapper <ApplicationArgs>(Setup.EngineFactory().Done()); var result = commandMapper.Map(dictionary, applicationArgs); result.Execute.Should().NotBeNull(); }
static void Main(string[] args) { try { ApplicationArgs appArgs = ApplicationArgs.Parse(args); ExceptionsHandler.SetExceptionHandlers(appArgs.IsTestingMode); ThreadWaiterBuilder.Initialize(new WinPlasticTimerBuilder()); GuiMessage.Initialize(new WindowsGuiMessage()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (appArgs.IsTestingMode) { InstallTestAssembliesResolver(appArgs.PathToAssemblies); } // Tip: you could launch different windows depending on the // argument flags. WindowHandler.LaunchApplicationWindow(); if (appArgs.IsTestingMode) { WindowHandler.LaunchTest(appArgs.TestInfoFile, appArgs.PathToAssemblies); } Application.Run(); } catch { // You would track the exception here. ExitCode = 1; Application.Exit(); } finally { // You would dispose everything you need here. Environment.Exit(ExitCode); } }
void EventsManager_OnApplication_InitializeComplete(object sender, ApplicationArgs e) { // BundleConfig.RegisterBundles(BundleTable.Bundles); }