public AutoSuspendHelper(NSApplicationDelegate appDelegate) { Reflection.ThrowIfMethodsNotOverloaded("AutoSuspendHelper", appDelegate, "ApplicationShouldTerminate", "DidFinishLaunching", "DidResignActive", "DidBecomeActive", "DidHide"); RxApp.SuspensionHost.IsLaunchingNew = Observable.Never<Unit>(); RxApp.SuspensionHost.IsResuming = isResuming; RxApp.SuspensionHost.IsUnpausing = isUnpausing; RxApp.SuspensionHost.ShouldPersistState = shouldPersistState; var untimelyDemise = new Subject<Unit>(); AppDomain.CurrentDomain.UnhandledException += (o, e) => untimelyDemise.OnNext(Unit.Default); RxApp.SuspensionHost.ShouldInvalidateState = untimelyDemise; }
/// <summary> /// Mac-specific implementation. /// </summary> partial void OSInitialize() { // There's an annoying mono-ism that can occur that seems innocuous. // See discussion here: http://forums.xamarin.com/discussion/2065/assertion-at-debugger-agent-c // Since it seems harmless, going to keep this mechanism that disables the attempt to // generate a compiled assembly on-the-fly put away for now. // Environment.SetEnvironmentVariable("MONO_XMLSERIALIZER_THS", "no"); TheDelegate = this.Delegate; var mainBundle = NSBundle.MainBundle; PluginsLocation = GetPluginsDirectory(); var shouldShowSplashScreen = true; var shouldShowSplashScreenString = mainBundle.GetEnvironmentValue <string>(ShowSplashScreenName); if (!string.IsNullOrEmpty(shouldShowSplashScreenString)) { bool environmentValue; if (!bool.TryParse(shouldShowSplashScreenString, out environmentValue)) { shouldShowSplashScreen = string.Compare(shouldShowSplashScreenString, "yes", true) == 0; } else { shouldShowSplashScreen = environmentValue; } } if (shouldShowSplashScreen) { SplashScreen = SplashScreen.Show(_splashScreenResource); } _programDirectory = System.IO.Path.GetDirectoryName(mainBundle.BundlePath); #if !__UNIFIED__ WillTerminate += HandleWillTerminate; this.ApplicationShouldTerminateAfterLastWindowClosed = ApplicationShouldTerminateAfterLastWindowClosedPredicate; WillPresentError = OnWillPresentError; #endif // !__UNIFIED__ AddObserver(this, (NSString)MainWindowValueName, NSKeyValueObservingOptions.New | NSKeyValueObservingOptions.Initial, this.Handle); }
public MvxMacViewPresenter(NSApplicationDelegate applicationDelegate, NSWindow window) { _applicationDelegate = applicationDelegate; _window = window; }