public MainWindowViewModel(Services.IDealerService dealerService, Services.IDialogService dialogService) { _dealerService = dealerService; _dialogService = dialogService; _random = new Random(); InitialiseDeck(); }
public ViewModelBase() { Settings = ServiceLocator.Current.GetInstance <ISettingsService>(); Network = ServiceLocator.Current.GetInstance <INetworkService>(); Navigator = ServiceLocator.Current.GetInstance <Services.INavigationService>(); DialogService = ServiceLocator.Current.GetInstance <Services.IDialogService>(); IsConnected = Network.IsConnected; Network.ConnectivityChanged += (s, e) => { DispatcherHelper.CheckBeginInvokeOnUI(() => IsConnected = Network.IsConnected); }; }
/// <summary> /// Nouveau ViewModel principal /// </summary> public MainViewModel(Services.IAstroService astroService, Services.IDialogService dialogService, Services.IResolverService resolverService) : base(astroService, dialogService, resolverService) { NewNatalChartCommand = new RelayCommand(async() => { await NewNatalChart(); }); LoadNatalChartCommand = new RelayCommand(async() => { await LoadNatalChart(); }); SaveNatalChartCommand = new RelayCommand(async() => { await SaveNatalChart(); }); SaveAsNatalChartCommand = new RelayCommand(async() => { await SaveAsNatalChart(); }); CalculateNatalChartCommand = new RelayCommand(async() => { await CalculateNatalChart(); }); }
/// <summary> /// Création d'un nouveau ViewModel /// </summary> public AppViewModel( Services.IAstroService astroService, Services.IDialogService dialogService, Services.IResolverService resolverService ) { if (astroService == null) { throw new ArgumentNullException("astroService"); } if (dialogService == null) { throw new ArgumentNullException("dialogService"); } if (resolverService == null) { throw new ArgumentNullException("resolverService"); } this.AstroService = astroService; this.DialogService = dialogService; CurrentNatalChart = resolverService.CreateViewModel <NatalChartViewModel>(); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(Services.IDataService dataService,Services.IDialogService dialogService) { _jobs = new System.Collections.ObjectModel.ObservableCollection<Model.Job>(); _favorites = new System.Collections.ObjectModel.ObservableCollection<string>(); _recents = new System.Collections.ObjectModel.ObservableCollection<string>(); _systemFolders = new System.Collections.ObjectModel.ObservableCollection<string>(); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register<Messaging.FilesDropped>(this, files_Dropped); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register<Messaging.FilesDroppedOnJob>(this, files_DroppedOnJob); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register<Messaging.FilesDroppedOnFolder>(this, files_DroppedOnFolder); _dataService = dataService; _dialogService = dialogService; _dataService.GetData( (item, error) => { if (item == null || error != null) { // Report error here return; } if (item.Jobs != null) item.Jobs.ToList().ForEach(j => _jobs.Add(j)); if (item.Favorites != null) item.Favorites.ToList().ForEach(f => _favorites.Add(f)); if (item.Recents != null) item.Recents.ToList().ForEach(r => _recents.Add(r)); if (item.SystemFolders != null) item.SystemFolders.ToList().ForEach(sf => _systemFolders.Add(sf)); if (_jobs.Count > 0) _selectedJob = _jobs[0]; }); //select the "favorites" _selectedTabIndex = 1; this.PropertyChanged += MainViewModel_PropertyChanged; }