protected override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { Setup setup = new Setup(rootFrame); setup.Initialize(); Core.IParametersManager parametersManager = Mvx.Resolve <Core.IParametersManager>(); parametersManager.Set(Core.Parameters.LaunchedTileId, e.TileId); IMvxAppStart app = Mvx.Resolve <IMvxAppStart>(); app.Start(); } Window.Current.Activate(); }
public override void DidFinishLaunching(NSNotification notification) { MvxMacSetupSingleton.EnsureSingletonAvailable((IMvxApplicationDelegate)this, MainWindow).EnsureInitialized(); IMvxAppStart mvxAppStart = Mvx.Resolve <IMvxAppStart>(); if (mvxAppStart.IsStarted) { return; } mvxAppStart.Start(this.GetAppStartHint(notification)); }
public override void Initialize() { this.CreatableTypes().EndingWith("Service").AsInterfaces().RegisterAsLazySingleton(); this.CreatableTypes().EndingWith("Module").AsInterfaces().RegisterAsLazySingleton(); Mvx.ConstructAndRegisterSingleton<IMvxAppStart, AppStart>(); IMvxAppStart appStart = Mvx.Resolve<IMvxAppStart>(); this.RegisterAppStart(appStart); }
/// <summary> /// Does the setup. /// </summary> private void DoSetup() { var presenter = new MultiWindowPresenter(MainWindow); Setup setup = new Setup(Dispatcher, presenter); setup.Initialize(); IMvxAppStart start = Mvx.Resolve <IMvxAppStart>(); start.Start(); setupComplete = true; }
/// <summary> /// Finished the launching. /// </summary> /// <param name="app">The app.</param> /// <param name="options">The options.</param> /// <returns>True or false.</returns> public override bool FinishedLaunching(UIApplication app, NSDictionary options) { this.window = new UIWindow(UIScreen.MainScreen.Bounds); Setup setup = new Setup(this, this.window); setup.Initialize(); IMvxAppStart startup = Mvx.Resolve <IMvxAppStart>(); startup.Start(); this.window.MakeKeyAndVisible(); return(true); }
//public static string MainStoryboard { get; private set; } public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { Window = new UIWindow(UIScreen.MainScreen.Bounds); var setup = new Setup(this, Window); setup.Initialize(); IMvxAppStart startup = Mvx.Resolve <IMvxAppStart>(); startup.Start(); Window.MakeKeyAndVisible(); SetupDependencyInjection(); return(true); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); MvxModalNavSupportTouchViewPresenter presenter = new MvxModalNavSupportTouchViewPresenter(this, window); Setup setup = new Setup(this, presenter); setup.Initialize(); IMvxAppStart startup = Mvx.Resolve <IMvxAppStart>(); startup.Start(); window.MakeKeyAndVisible(); return(true); }
/// <summary> /// Does the setup. /// </summary> private void DoSetup() { LogViewerPresenter presenter = new LogViewerPresenter((ContentControl)MainWindow.FindName("mainContentControl"), (ContentControl)MainWindow.FindName("sidebarContentControl"), (ContentControl)MainWindow.FindName("statusBarContentControl")); Setup setup = new Setup(Dispatcher, presenter); setup.Initialize(); setup.RegisterTypes(); //Register Singletons Mvx.RegisterSingleton <IMvxWpfViewPresenter>(presenter); IMvxAppStart start = Mvx.Resolve <IMvxAppStart>(); start.Start(); this.setupComplete = true; }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); MvxTouchViewPresenter presenter = new MvxTouchViewPresenter(this, this.window); // MvxTouchViewPresenter, MvxModalSupportTouchViewPresenter Setup setup = new Setup(this, presenter); setup.Initialize(); IMvxAppStart startup = Mvx.Resolve <IMvxAppStart>(); startup.Start(); // make the window visible window.MakeKeyAndVisible(); return(true); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter Setup setup = new Setup(rootFrame); setup.Initialize(); IMvxAppStart start = Mvx.Resolve <IMvxAppStart>(); start.Start(); } // Ensure the current window is active Window.Current.Activate(); }
protected void RegisterAppStart(IMvxAppStart appStart) { Mvx.IoCProvider.RegisterSingleton(appStart); }
/// <summary> /// 在程序的Application的OnStartup方法中使用 /// </summary> /// <param name="mvxViewPresenter">呈现控制器</param> /// <param name="mvxSetup">启动流程控制器</param> /// <param name="mvxApplication">ViewModelCore当中的</param> /// <param name="mvxAppStart">程序启动控制</param> /// <param name="viewAssemblies">视图程序集</param> /// <param name="viewModelAssemblies">ViewModel程序集</param> /// <param name="serviceAssemblies">提供服务工具的程序集,更具服务工具的接口注册为单例(服务的名称必须以Service结尾)</param> public static void Init <TMainWindow, TViewModel>(MvxWpfViewPresenter mvxViewPresenter = null, IMvxWpfSetup mvxSetup = null, IMvxApplication mvxApplication = null, IMvxAppStart mvxAppStart = null, Assembly[] viewAssemblies = null, Assembly[] viewModelAssemblies = null, Assembly[] serviceAssemblies = null) where TMainWindow : Window where TViewModel : MvxViewModel { var mainWindow = Activator.CreateInstance <TMainWindow>(); if (mvxViewPresenter == null) { mvxViewPresenter = new MvxWpfViewPresenter(mainWindow); } if (mvxSetup == null) { mvxSetup = new BaseSetup <TMainWindow, TViewModel>(viewAssemblies, viewModelAssemblies); } mvxSetup.PlatformInitialize(Application.Current.Dispatcher, mvxViewPresenter); mvxSetup.InitializePrimary(); mvxSetup.InitializeSecondary(); if (serviceAssemblies != null) { foreach (var serviceAssembly in serviceAssemblies) { serviceAssembly.CreatableTypes() .EndingWith("Service") .AsInterfaces() .RegisterAsLazySingleton(); } } var start = Mvx.IoCProvider.Resolve <IMvxAppStart>(); //如果是默认的启动页,则不调用启动方法 if (!(start is BaseAppStart <TViewModel>)) { start.Start(); } else { var request = new MvxViewModelInstanceRequest(typeof(TViewModel)); var viewModel = Mvx.IoCProvider.GetSingleton <IMvxViewModelLoader>().LoadViewModel(request, null); mainWindow.DataContext = viewModel; } mainWindow.Show(); }
protected void RegisterAppStart(IMvxAppStart appStart) { Mvx.RegisterSingleton <IMvxAppStart>(appStart); }
public HomeViewModel() { IMvxAppStart start = Mvx.IoCProvider.Resolve <IMvxAppStart>(); TestString = (start as AppStart).AppState as string; }
protected override void RunAppStart(object hint = null) { IMvxAppStart start = Mvx.IoCProvider.Resolve <IMvxAppStart>(); start.StartAsync("here can go any object"); }