예제 #1
0
 public MainViewModel(IMainController controller, IViewModelFactory factory)
 {
     if (controller == null)
     {
         throw new ArgumentNullException("controller");
     }
     this.controller = controller;
     if (factory == null)
     {
         throw new ArgumentNullException(typeof(IMainFactory).ToString());
     }
     this.SyncProgressViewModel = factory.CreateISyncProgressViewModel(controller);
     if (this.SyncProgressViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(ISyncProgressViewModel).ToString());
     }
     this.StorageGaugeViewModel = factory.CreateIStorageGaugeViewModel(controller);
     if (this.StorageGaugeViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(IStorageGaugeViewModel).ToString());
     }
     this.ContentViewModel = factory.CreateIMediaContentViewModel(controller);
     if (this.ContentViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(IMediaContentViewModel).ToString());
     }
     this.DeviceViewModel = factory.CreateIDeviceViewModel(controller);
     if (this.DeviceViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(IDeviceViewModel).ToString());
     }
     this.DeviceSettingsViewModel = factory.CreateDeviceSettingsViewModel(controller);
     if (this.DeviceSettingsViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(Microsoft.WPSync.UI.ViewModels.DeviceSettingsViewModel).ToString());
     }
     this.AppSettingsViewModel = factory.CreateAppSettingsViewModel(controller);
     if (this.AppSettingsViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(Microsoft.WPSync.UI.ViewModels.AppSettingsViewModel).ToString());
     }
     this.AppSettingsViewModel.Init();
     controller.PropertyChanged += new PropertyChangedEventHandler(this.OnControllerPropertyChanged);
 }
예제 #2
0
 public MainViewModel(IMainController controller, IViewModelFactory factory)
 {
     if (controller == null)
     {
         throw new ArgumentNullException("controller");
     }
     this.controller = controller;
     if (factory == null)
     {
         throw new ArgumentNullException(typeof(IMainFactory).ToString());
     }
     this.SyncProgressViewModel = factory.CreateISyncProgressViewModel(controller);
     if (this.SyncProgressViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(ISyncProgressViewModel).ToString());
     }
     this.StorageGaugeViewModel = factory.CreateIStorageGaugeViewModel(controller);
     if (this.StorageGaugeViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(IStorageGaugeViewModel).ToString());
     }
     this.ContentViewModel = factory.CreateIMediaContentViewModel(controller);
     if (this.ContentViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(IMediaContentViewModel).ToString());
     }
     this.DeviceViewModel = factory.CreateIDeviceViewModel(controller);
     if (this.DeviceViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(IDeviceViewModel).ToString());
     }
     this.DeviceSettingsViewModel = factory.CreateDeviceSettingsViewModel(controller);
     if (this.DeviceSettingsViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(Microsoft.WPSync.UI.ViewModels.DeviceSettingsViewModel).ToString());
     }
     this.AppSettingsViewModel = factory.CreateAppSettingsViewModel(controller);
     if (this.AppSettingsViewModel == null)
     {
         throw new ApplicationInitializationException(typeof(Microsoft.WPSync.UI.ViewModels.AppSettingsViewModel).ToString());
     }
     this.AppSettingsViewModel.Init();
     controller.PropertyChanged += new PropertyChangedEventHandler(this.OnControllerPropertyChanged);
 }