Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var viewModel = new MainViewModel();
            var proxy = CreateProxy(viewModel);
            proxy.InitializeCommand();
            var view = new MainView(proxy);
            new Window { Content = view, Topmost = true, Width = 300, Height = 200 }.Show();
        }
Пример #2
0
        public MainViewModelInterceptor(MainViewModel mainViewModel)
        {
            _mainViewModel = mainViewModel;

            RaisePropertyChanged = _mainViewModel.GetType().GetMethod(
                "RaisePropertyChanged",
                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                null,
                new[] { typeof(string) },
                null);
        }
Пример #3
0
 MainViewModel CreateProxy(MainViewModel mainViewModel)
 {
     var proxyFactory = new ProxyFactory();
     return proxyFactory.CreateProxy<MainViewModel>(new MainViewModelWrapper(mainViewModel));
 }