public StaffingResourceSearchViewModel(IUnitOfWorkManager <IResourceMgtUnitOfWork> unitOfWorkManager) { EventFns.Subscribe(this); _unitOfWorkManager = unitOfWorkManager; Busy = new BusyWatcher(); }
public ShellViewModel(DossierViewModel dossierViewModel, BusyWatcher busyWatcher, IApplicationService applicationService, IDecoratorService decoratorService, IFileService fileService, IDialogService dialogService, IWindowManager windowManager) { this._dossierViewModel = dossierViewModel; this._busyWatcher = busyWatcher; this._applicationService = applicationService; this._decoratorService = decoratorService; this._fileService = fileService; this._dialogService = dialogService; this._windowManager = windowManager; this._busyWatcher.BusyChanged += (sender, e) => { IsBusy = this._busyWatcher.IsBusy; }; this._currentDossier = this._decoratorService.Decorate(new Dossier()); this._dossierViewModel.Dossier = this._currentDossier; ActivateItem(this._dossierViewModel); this._dossierViewModel.ModelChanged += (sender, e) => IsModelDirty = true; UpdateDisplayName(); }
protected StatViewModelBase() { GameMode = String.Empty; using (var reg = new StatRegistrySettings(GetType())) { ShowWinRatio = reg.ShowWinRatio; ShowWinRatioCoin = reg.ShowWinRatioCoin; ShowWinRatioNoCoin = reg.ShowWinRatioNoCoin; ShowWins = reg.ShowWins; ShowWinsCoin = reg.ShowWinsCoin; ShowWinsNoCoin = reg.ShowWinsNoCoin; ShowTotalGames = reg.ShowTotalGames; ShowTotalGamesByCoin = reg.ShowTotalGamesByCoin; ShowPlayedVsRatio = reg.ShowPlayedVsRatio; } if (IsLastSelected(false, 0)) { ShowWinRatio = true; ShowWins = true; ShowTotalGames = true; } Busy = new BusyWatcher(); PropertyChanged += OnPropertyChanged; }
public EditGameFlyoutViewModel( IDialogManager dialogManager, IEventAggregator events, IRepository <ArenaSession> arenaRepository, IRepository <GameResult> gameRepository, IDeckManager deckManager, GameManager.GameManager gameManager) { this.dialogManager = dialogManager; this.events = events; this.arenaRepository = arenaRepository; this.gameRepository = gameRepository; this.deckManager = deckManager; this.gameManager = gameManager; Name = Flyouts.EditGame; Header = displayName_new; SetPosition(Position.Right); heroes = new BindableCollection <Hero>(); events.Subscribe(this); GameMode = GameMode.Practice; StartTime = DateTime.Now; EndTime = DateTime.Now; PropertyChanged += OnPropertyChanged; lastIsOpen = IsOpen; // yeah lol :p gameModes.Remove(GameMode.Arena); selectedServer = servers.Default; Busy = new BusyWatcher(); }
public ChartsViewModel( IEventAggregator events, Func <HearthStatsDbContext> dbContext, IRepository <GameResult> gameRepository, IRepository <ArenaSession> arenaRepository, IDeckManager deckManager, [ImportMany] IEnumerable <IChartTab> chartTabs) { this.events = events; this.dbContext = dbContext; this.gameRepository = gameRepository; this.arenaRepository = arenaRepository; this.deckManager = deckManager; Order = 4; DisplayName = "Charts"; Busy = new BusyWatcher(); servers.Insert(0, new ServerItemModel("")); Items.AddRange(chartTabs.OrderBy(x => x.Order)); ActivateItem(Items.FirstOrDefault()); dateFilter.From = DateTime.Now.AddMonths(-1).SetToBeginOfDay(); dateFilter.DateChanged += DateFilterOnPropertyChanged; PropertyChanged += OnPropertyChanged; }
public ShellViewModel(TrainSetViewModel trainSetViewModel, BusyWatcher busyWatcher, IApplicationService applicationService, IFileService fileService, IDialogService dialogService, IWindowManager windowManager) { Contract.Requires <ArgumentNullException>(busyWatcher != null); this._trainSetViewModel = trainSetViewModel; this._busyWatcher = busyWatcher; this._fileService = fileService; this._applicationService = applicationService; this._dialogService = dialogService; this._windowManager = windowManager; this._busyWatcher.BusyChanged += (sender, e) => { IsBusy = this._busyWatcher.IsBusy; }; this._trainSetViewModel.TrainSet = new TrainSet(); ActivateItem(this._trainSetViewModel); this._trainSetViewModel.ModelChanged += (sender, e) => IsModelDirty = true; UpdateDisplayName(); }
public ArenaSessionsViewModel( IEventAggregator events, IRepository <ArenaSession> arenaRepository, IRepository <GameResult> gameRepository, Func <HearthStatsDbContext> dbContext, GameManager.GameManager gameManager) { IsNotifying = false; this.events = events; this.arenaRepository = arenaRepository; this.gameRepository = gameRepository; this.dbContext = dbContext; this.gameManager = gameManager; Order = 2; DisplayName = "Arenas"; this.events.Subscribe(this); ArenaSessions = CollectionViewSource.GetDefaultView(arenaSessions); ArenaSessions.SortDescriptions.Add(new SortDescription("StartDate", ListSortDirection.Descending)); dateFilter.From = DateTime.Now.AddMonths(-1).SetToBeginOfDay(); totals = new ArenaSessionTotalsModel(); servers.Insert(0, new ServerItemModel("")); Busy = new BusyWatcher(); ItemsDragDropCommand = new RelayCommand <DataGridDragDropEventArgs>( args => DragDropItem(args), args => args != null && args.TargetObject != null && args.DroppedObject != null && args.Effects != DragDropEffects.None); PropertyChanged += OnPropertyChanged; }
public void Obtaining_A_Ticket_Should_Make_BusyWatcher_Busy() { var busyWatcher = new BusyWatcher(); var dummy = busyWatcher.GetTicket(); busyWatcher.IsBusy.ShouldBeTrue(); }
public void Obtaining_Multiple_Tickets_Should_Make_BusyWatcher_Busy() { var busyWatcher = new BusyWatcher(); var dummy1 = busyWatcher.GetTicket(); var dummy2 = busyWatcher.GetTicket(); busyWatcher.IsBusy.ShouldBeTrue(); }
public void BusyWatcher_Should_Throw_When_RemoveWatch_Called_Without_AddWatch() { var busyWatcher = new BusyWatcher(); Should.Throw <InvalidOperationException>(() => { busyWatcher.RemoveWatch(); }); }
public void ShouldIncrementDecrementBusyCounter() { var busyWatcher = new BusyWatcher(); busyWatcher.AddWatch(); Assert.IsTrue(busyWatcher.IsBusy); busyWatcher.RemoveWatch(); Assert.IsFalse(busyWatcher.IsBusy); }
public void ShouldBeBusyInsideScope() { var busyWatcher = new BusyWatcher(); using (busyWatcher.GetTicket()) { Assert.IsTrue(busyWatcher.IsBusy); } Assert.IsFalse(busyWatcher.IsBusy); }
public void Handle(CustomerChangedMessage message) { Orders.Clear(); if (message.Customer != null && !string.IsNullOrEmpty(message.Customer.CustomerID)) { var ticket = BusyWatcher.GetTicket(); Task.Factory.StartNew(() => Orders.AddRange(_repository.GetOrdersFromCustomer(message.Customer.CustomerID))).ContinueWith((x) => ticket.Dispose()); OrderDetails = string.Format("Order Details for customer {0}", message.Customer.ContactName); } }
public StaffingResourceDetailViewModel(IUnitOfWorkManager <IResourceMgtUnitOfWork> unitOfWorkManager, StaffingResourceSummaryViewModel staffingResourceSummary, [ImportMany] IEnumerable <IStaffingResourceDetailSection> sections, IDialogManager dialogManager) { StaffingResourceSummary = staffingResourceSummary; _unitOfWorkManager = unitOfWorkManager; _sections = sections.ToList(); _dialogManager = dialogManager; Busy = new BusyWatcher(); PropertyChanged += OnPropertyChanged; }
public void ShouldNotifyOfPropertyChanged() { int propertyChangedCount = 0; var busyWatcher = new BusyWatcher(); busyWatcher.PropertyChanged += (sender, args) => propertyChangedCount++; using (busyWatcher.GetTicket()) { Assert.IsTrue(propertyChangedCount == 1); } Assert.IsTrue(propertyChangedCount == 2); }
public RegisterViewModel( [NotNull] IUserService userService, [NotNull] IEventAggregator eventAggregator, [NotNull] IMessageService messageService, [NotNull] IValidationAdapter validationAdapter) : base(validationAdapter) { _userService = userService ?? throw new ArgumentNullException(nameof(userService)); _eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator)); _messageService = messageService ?? throw new ArgumentNullException(nameof(messageService)); _cancellationToken = new CancellationTokenSource(); BusyWatcher = new BusyWatcher(); Validate(); }
public void Obtaining_Multiple_Tickets_Should_Not_Make_BusyWatcher_Busy_After_Disposal() { var busyWatcher = new BusyWatcher(); using (var dummy1 = busyWatcher.GetTicket()) { } using (var dummy2 = busyWatcher.GetTicket()) { } busyWatcher.IsBusy.ShouldBeFalse(); }
public UpdateViewModel(IEventAggregator events) { _events = events; CurrentVersion = Assembly.GetEntryAssembly().GetName().Version; if (!String.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["updatebaseurl"])) { _updateBaseUrl = ConfigurationManager.AppSettings["updatebaseurl"]; _updateXmlUrl = _updateBaseUrl + (!_updateBaseUrl.EndsWith("/", StringComparison.Ordinal) ? "/" : "") + "update.xml"; } _basePath = AppDomain.CurrentDomain.BaseDirectory; _tempPath = Path.GetTempPath(); Busy = new BusyWatcher(); }
public void ShoultThrowInvalidOperationException() { var expectedExceptionThrown = false; try { var busyWatcher = new BusyWatcher(); busyWatcher.RemoveWatch(); } catch (InvalidOperationException) { expectedExceptionThrown = true; } Assert.IsTrue(expectedExceptionThrown); }
public void ShouldNestBusyState() { var busyWatcher = new BusyWatcher(); busyWatcher.AddWatch(); Assert.IsTrue(busyWatcher.IsBusy); using (busyWatcher.GetTicket()) { Assert.IsTrue(busyWatcher.IsBusy); } Assert.IsTrue(busyWatcher.IsBusy); busyWatcher.RemoveWatch(); Assert.IsFalse(busyWatcher.IsBusy); }
public LoginViewModel(IAuthenticationService authenticationService, IDialogManager dialogManager, [Import(AllowDefault = true)] IGlobalCache globalCache) { Busy = new BusyWatcher(); _authenticationService = authenticationService; _dialogManager = dialogManager; _globalCache = globalCache; // ReSharper disable DoNotCallOverridableMethodsInConstructor DisplayName = ""; // ReSharper restore DoNotCallOverridableMethodsInConstructor #if DEBUG _username = "******"; _password = "******"; #endif }
public LatestGamesViewModel(IEventAggregator events, IRepository <GameResult> gameRepository, IDeckManager deckManager, Func <HearthStatsDbContext> dbContext, GameManager gameManager) { IsNotifying = false; this.events = events; this.gameRepository = gameRepository; this.deckManager = deckManager; this.dbContext = dbContext; this.gameManager = gameManager; this.Order = 1; this.DisplayName = "Games"; this.events.Subscribe(this); this.totals = new GameResultTotalsModel(); gameResultsCV = CollectionViewSource.GetDefaultView(this.gameResults); gameResultsCV.SortDescriptions.Add(new SortDescription("Started", ListSortDirection.Descending)); servers.Insert(0, new ServerItemModel("")); dateFilter.From = DateTime.Now.AddMonths(-1).SetToBeginOfDay(); Busy = new BusyWatcher(); dateFilter.DateChanged += DateFilterOnPropertyChanged; this.PropertyChanged += this.OnPropertyChanged; }
public StatisticsViewModel(Func <HearthStatsDbContext> dbContext, IRepository <GameResult> gameRepository, IRepository <ArenaSession> arenaRepository, [ImportMany] IEnumerable <IStatsViewModel> statsViewModels) { IsNotifying = false; this.dbContext = dbContext; this.gameRepository = gameRepository; this.arenaRepository = arenaRepository; DisplayName = Header = "Statistics"; Order = 3; dateFilter.From = DateTime.Now.AddMonths(-1); dateFilter.DateChanged += dateFilter_PropertyChanged; SelectedFilterType = FilterTypes.First(); foreach (var statsViewModel in statsViewModels) { Items.Add(statsViewModel); } servers.Insert(0, new ServerItemModel("")); Busy = new BusyWatcher(); PropertyChanged += OnPropertyChanged; }
public void BusyWatcher_RemoveWatch_Should_Throw_If_Not_Ticket_Present() { var busyWatcher = new BusyWatcher(); Should.Throw <InvalidOperationException>(() => busyWatcher.RemoveWatch()); }
public void BusyWatcher_Without_Tickets_Should_Be_Not_Busy() { var busyWatcher = new BusyWatcher(); busyWatcher.IsBusy.ShouldBeFalse(); }
public ConsumerWorker(QueueStrategy queueStrategy, BusyWatcher busyWatcher) { _queueStrategy = queueStrategy; _busyWatcher = busyWatcher; _queue = _queueStrategy.CreateQueueForWorker(this); }
// Inject Cocktail root navigation service public ListPageViewModel(INavigator navigator, ICustomerUnitOfWork unitOfWork, ErrorHandler errorHandler) : base(navigator, unitOfWork, errorHandler) { Busy = new BusyWatcher(); }
public ScenarioReportsViewModel(IDialogService dialogService, BusyWatcher busyWatcher) : base(4, dialogService) { this._busyWatcher = busyWatcher; DisplayName = ScreenName; }
public WorkerMonitor(BusyWatcher busyWatcher, Worker worker) { _worker = worker; _busyWatcher = busyWatcher; }
protected AbstractWorker(BusyWatcher busyWatcher) { _workerMonitor = new WorkerMonitor(busyWatcher, this); }