Пример #1
0
        protected override void AppStartup(StartupEventArgs e, IDependencyResolverService resolver)
        {
            resolver.UseUnhandledExceptionHandler();
            resolver.ResolveView <MainWindow, MainWindowViewModel>().Show();

            if (e.Args.Any())
            {
                resolver.Resolve <AppLogger>().Info(string.Join('\n', e.Args));
                resolver.Resolve <IFileLoader>().Load(e.Args);
            }
        }
Пример #2
0
        public static TView ResolveView <TView, TViewModel>(this IDependencyResolverService container)
            where TView : FrameworkElement
            where TViewModel : BaseNotify
        {
            var view = container.Resolve <TView>();
            var vm   = container.Resolve <TViewModel>();

            view.DataContext = vm;
            view.Loaded     += (x, y) => vm.OnLoaded();
            view.Unloaded   += (x, y) => vm.OnUnloaded();

            return(view);
        }
 public static IDependencyResolverService RemoveUnhandledExceptionHandler(this IDependencyResolverService service)
 {
     service.Resolve <UnhandledExceptionHandler>().StopHandling();
     return(service);
 }