public void SetUp() { List <Note> notes = new List <Note> { new Note { Name = "TestNote1", Description = "TestDescription1" }, new Note { Name = "TestNote2", Description = "TestDescription2" } }; var stubDataProvider = new Mock <IDataProvider>(); stubDataProvider.SetupAllProperties(); stubDataProvider.Setup(dp => dp.Notes).Returns(notes); stubDataProvider.Setup(dp => dp.GetCollection <Note>()).Returns(notes); mockNotificationCenter = new Mock <INotificationCenter>(); mockNotificationCenter.Setup(nc => nc.PostNotification(It.IsAny <NotificationName>(), It.IsAny <NotificationArgs>())) .Callback <NotificationName, NotificationArgs>((nName, nArgs) => notificationArgs = nArgs); notificationCenter = mockNotificationCenter.Object; notesVM = new NotesViewModel(stubDataProvider.Object, notificationCenter); }
public CommandManager(IEnumerable<ISecurityRole> availableRoles, IEnumerable<IInputCommand> commands, INotificationCenter notificationCenter) { this.serverRoles = availableRoles ?? Enumerable.Empty<ISecurityRole>(); this.commandCollection = commands; this.notificationCenter = notificationCenter; this.currentlyExecutingCommands = new Stack<IInputCommand>(); }
public FoilControl(INotificationCenter notificationCenter) { _notificationCenter = notificationCenter; ShowLabel = true; InitializeComponent(); rootGrid.DataContext = this; }
public void Init() { _notificationCenter = Substitute.For <INotificationCenter>(); _calc = Substitute.For <IPositionCalc>(); _display = Substitute.For <IDisplay>(); _displayFormatter = new DisplayFormatter(_display, _calc, _notificationCenter, _testWidth, _testHeight); }
public CollectionViewModel( INotificationCenter notification, IUserDatabase userDatabase, ICardDatabase cardDatabase, IApplicationSettings applicationSettings) { _notification = notification; _userDatabase = userDatabase; _cardDatabase = cardDatabase; _applicationSettings = applicationSettings; Collections = _userDatabase .GetAllCollections() .Select(c => new SingleCollectionViewModell(notification, _userDatabase, _cardDatabase, c)); ISingleCollectionViewModel loadedCollection = null; Task.Factory.StartNew(() => { var currentCollectionName = _applicationSettings.GetCurrentCollection(); var found = Collections.FirstOrDefault(c => c.CollectionName == currentCollectionName); loadedCollection = LoadCollection(found); }).ContinueWith((task) => { SelectedCollection = loadedCollection; }, TaskScheduler.FromCurrentSynchronizationContext()); }
public static void ClearImageData(INotificationCenter notificationCenter) { var watch = Stopwatch.StartNew(); notificationCenter.FireNotification(LogLevel.Debug, "Resetting image paths"); foreach (var item in PriceCache.Values.ToList()) { item.ImagePath = ""; } notificationCenter.FireNotification(LogLevel.Debug, "Flush image cache"); Write(); foreach (var file in Directory.EnumerateFiles(PathHelper.CardImageCacheFolder, "*.*", SearchOption.AllDirectories)) { try { notificationCenter.FireNotification(LogLevel.Debug, "Deleting file " + file); File.Delete(file); } catch (Exception error) { notificationCenter.FireNotification(LogLevel.Error, "Error deleting file '" + file + "':" + error.Message); } } watch.Stop(); notificationCenter.FireNotification(LogLevel.Debug, "Clear image data took " + watch.Elapsed); }
public CommandManager(IEnumerable <ISecurityRole> availableRoles, IEnumerable <IInputCommand> commands, INotificationCenter notificationCenter) { this.serverRoles = availableRoles ?? Enumerable.Empty <ISecurityRole>(); this.commandCollection = commands; this.notificationCenter = notificationCenter; this.currentlyExecutingCommands = new Stack <IInputCommand>(); }
public SignUpViewModel(IAccountStorage accountStorage, INotificationCenter notificationCenter, ICurrentUser currentUser) { _accountStorage = accountStorage; _notificationCenter = notificationCenter; _currentUser = currentUser; }
public void Init() { _display = Substitute.For <IDisplay>(); _formatter = Substitute.For <IDisplayFormatter>(); _notificationCenter = new NotificationCenter(_display); _notificationCenter.SetFormatter(_formatter); }
protected CollectionViewModel(IDataProvider dataProvider, INotificationCenter notificationCenter) { _dataProvider = dataProvider; _notificationCenter = notificationCenter; PopulateData(); InitCommands(); }
public BinderStatisticsViewModel( INotificationCenter notificationCenter, MagicBinderViewModel binderViewModel) { _notificationCenter = notificationCenter; _binderViewModel = binderViewModel; }
public SetImage(INotificationCenter notificationCenter) { _notificationCenter = notificationCenter; InitializeComponent(); rootGrid.DataContext = this; }
public static INotificationCenter GetInstance() { if (singleton == null) { singleton = new NotificationCenter(); } return(singleton); }
public ShellViewModel( INotificationCenter notificationCenter) { notificationCenter.NotificationFired += (sender, e) => { StatusBarMessage = e.Message; }; }
void DestroyNotificationCenter() { if (_notificationCenter != null) { _notificationCenter.Destroy(); _notificationCenter = null; } }
public PlayerLoginCommand(INotificationCenter notificationManager) { this.passwordProcessor = new CharacterPasswordProcessor(); this.nameProcessor = new CharacterNameProcessor(notificationManager, this.passwordProcessor); this.nameRequestor = new CharacterNameRequestor(notificationManager, this.nameProcessor); this.currentProcessor = this.nameRequestor; this.notificationManager = notificationManager; }
public PostsViewHolder(View itemView, INotificationCenter notification, IRepositoryPost repository, IRepositoryQc repositoryQc, PostOtherThemeStrings otherThemeStrings) : base(itemView) { _repository = repository; _repositoryQc = repositoryQc; _notification = notification; _otherThemeStrings = otherThemeStrings; _itemView = itemView; }
public DisplayFormatter(IDisplay display, IPositionCalc calc, INotificationCenter notificationCenter, int width = 150, int height = 50) { _calc = calc; _notificationCenter = notificationCenter; Width = width; Height = height; _display = display; _display.BuildFrame(width, height); }
public ReportsViewModel(IReportStorage reportStorage, INotificationCenter notificationCenter) { _reportStorage = reportStorage; Title = "Mina rapporter"; notificationCenter.Subscribe<User>(this, NotificationKeys.CurrentUserChanged, u => { Device.BeginInvokeOnMainThread(RefreshReports); }); }
public ServerService(ILogger <ServerService> logger, ApplicationDbContext context, IApplicationManager application, IConsoleService console, IDownloadService download, IFileWriterService fileWriter, INotificationCenter notificationCenter) { _logger = logger; _context = context; _application = application; _console = console; _download = download; _fileWriter = fileWriter; _notificationCenter = notificationCenter; }
public ReportsViewModel(IReportStorage reportStorage, INotificationCenter notificationCenter) { _reportStorage = reportStorage; Title = "Mina rapporter"; notificationCenter.Subscribe <User>(this, NotificationKeys.CurrentUserChanged, u => { Device.BeginInvokeOnMainThread(RefreshReports); }); }
public MagicBinderCardViewModel( IMagicCardDefinition definition, MagicBinderCard card) { _notificationCenter = NotificationCenter.Instance; _definition = definition; _card = card; _price = StaticPriceDatabase.FindPrice(_definition, false, false, "", false); _price.PriceChanged += OnPricePriceChanged; UpdatePrice(); }
public DataViewModel(ITasksViewModel tasksViewModel, INotesViewModel notesViewModel, IEventsViewModel eventsViewModel, INotificationCenter notificationCenter) { TasksViewModel = tasksViewModel; NotesViewModel = notesViewModel; EventsViewModel = eventsViewModel; SetControlVisibility = new RelayCommand(ControlVisibility); this.notificationCenter = notificationCenter; notificationCenter.AddMessageHandler(ShowModal, NotificationName.SHOW_ITEM_EDIT_MODAL); notificationCenter.AddMessageHandler(CloseModal, NotificationName.CLOSE_ITEM_EDIT_MODAL); }
public RulesViewModel(IRuleStorage ruleStorage, INotificationCenter notificationCenter) { _ruleStorage = ruleStorage; Title = "Regler"; Device.BeginInvokeOnMainThread(RefreshRules); notificationCenter.Subscribe<User>(this, NotificationKeys.CurrentUserChanged, u => { Device.BeginInvokeOnMainThread(RefreshRules); }); }
public SingleCollectionViewModell( INotificationCenter notification, IUserDatabase userDatabase, ICardDatabase cardDatabase, MagicCollection databaseCollection) { _userDatabase = userDatabase; _notification = notification; _cardDatabase = cardDatabase; _databaseCollection = databaseCollection; CollectionName = _databaseCollection != null ? _databaseCollection.Name : ""; }
public SightingsViewModel(ISightingStorage sightingStorage, INotificationCenter notificationCenter) { _sightingStorage = sightingStorage; Title = "Observationer"; DaysFilter = ""; notificationCenter.Subscribe <User>(this, NotificationKeys.CurrentUserChanged, u => { Device.BeginInvokeOnMainThread(RefreshSightings); }); }
public SightingsViewModel(ISightingStorage sightingStorage, INotificationCenter notificationCenter) { _sightingStorage = sightingStorage; Title = "Observationer"; DaysFilter = ""; notificationCenter.Subscribe<User>(this, NotificationKeys.CurrentUserChanged, u => { Device.BeginInvokeOnMainThread(RefreshSightings); }); }
public MagicBinderViewModel(string name, INotificationCenter notificationCenter) { _notificationCenter = notificationCenter; _cards = new ObservableCollection <MagicBinderCardViewModel>(); _sortedCards = new Dictionary <string, MagicBinderCardViewModel>(); if (!string.IsNullOrEmpty(name)) { _magicCollection = new MagicBinder { Name = name, }; } }
public RulesViewModel(IRuleStorage ruleStorage, INotificationCenter notificationCenter) { _ruleStorage = ruleStorage; Title = "Regler"; Device.BeginInvokeOnMainThread(RefreshRules); notificationCenter.Subscribe <User>(this, NotificationKeys.CurrentUserChanged, u => { Device.BeginInvokeOnMainThread(RefreshRules); }); }
public CardImage(INotificationCenter notificationCenter) { _notificationCenter = notificationCenter; InitializeComponent(); rootGrid.DataContext = this; _emptyImage = new BitmapImage(); _emptyImage.BeginInit(); _emptyImage.StreamSource = GetType().Assembly.GetEmbeddedResourceStream("Empty.png"); _emptyImage.EndInit(); _emptyImage.Freeze(); imageControl.Source = _emptyImage; }
/// <summary> /// Instances a new PlayerConnectionState. /// </summary> /// <param name="player">An instance of a Player type that will be performing network communication</param> /// <param name="currentSocket">The Socket used to communicate with the client.</param> /// <param name="bufferSize">The storage size of the data buffer</param> public PlayerConnectionState(IPlayer player, Socket currentSocket, int bufferSize) { this.Player = player; this.notificationManager = player.NotificationCenter; this.systemMessageSubscription = this.notificationManager.Subscribe <InformationMessage>( callback: (msg, sub) => this.SendMessage(msg.Content), condition: msg => !string.IsNullOrEmpty(msg.Content) && msg.Target == this.Player); this.Player.Deleted += this.PlayerDeleted; this.CurrentSocket = currentSocket; this.bufferSize = bufferSize; this.Buffer = new byte[bufferSize]; this.outgoingMessageQueue.CollectionChanged += MessageAddedToOutboundQueue; }
/// <summary> /// Instances a new PlayerConnectionState. /// </summary> /// <param name="player">An instance of a Player type that will be performing network communication</param> /// <param name="currentSocket">The Socket used to communicate with the client.</param> /// <param name="bufferSize">The storage size of the data buffer</param> public PlayerConnectionState(IPlayer player, Socket currentSocket, int bufferSize) { this.Player = player; this.notificationManager = player.NotificationCenter; this.systemMessageSubscription = this.notificationManager.Subscribe<InformationMessage>( callback: (msg, sub) => this.SendMessage(msg.Content), condition: msg => !string.IsNullOrEmpty(msg.Content) && msg.Target == this.Player); this.Player.Deleted += this.PlayerDeleted; this.CurrentSocket = currentSocket; this.bufferSize = bufferSize; this.Buffer = new byte[bufferSize]; this.outgoingMessageQueue.CollectionChanged += MessageAddedToOutboundQueue; }
public MainViewModel(INotificationCenter notificationCenter) { _logger.Log(LogLevel.Info, "============================= NEW APP START ============================= "); _notificationCenter = notificationCenter; CardLookup = new CardLookup(); CardLookup.SearchWanted += (sender, e) => { if (CardLookup.SearchAsYouType) { LookupCards(); } }; DatabaseSummary = string.Format( CultureInfo.CurrentUICulture, "{0} cards from {1} sets", StaticMagicData.CardDefinitions.Count(), StaticMagicData.SetDefinitions.Count()); notificationCenter.NotificationFired += (sender, e) => { _logger.Log(e.LogLevel, e.Message); if (e.LogLevel >= _maxLevel) { StatusBarText = e.Message; } }; // Load the settings var provider = new SettingsProvider(new LocalAppDataStorage("AppSettings")); _settings = provider.GetSettings <SettingsData>(); _maxLevel = LogLevel.FromString(_settings.LogLevel); _currentDataSource = new StaticMagicDataDataSource(); if (!string.IsNullOrEmpty(_settings.LoadedBinder)) { LoadBinder(new DirectoryInfo(PathHelper.UserDataFolder).MakeAbsolutePath(_settings.LoadedBinder)); } Task.Factory.StartNew(() => { LookupSource = LookupSource.ActiveBinder; // LookupCards(); }); }
public InteractorPost(string postId, IOnePostController onePostsController, INotificationCenter notificationCenter, IRepositoryPost repository, IRepositoryQc repositoryQc) { _postId = postId; _repository = repository; _onePostController = onePostsController; _onePostController.OnRecieveModel += ControllerOnMessage; InteractorPostBody = new InteractorPostBody(_postId, notificationCenter, repository); InteractorPostChart = new InteractorPostChart(notificationCenter, repository); InteractorPostHeader = new InteractorPostHeader(_postId, new PostHeaderController(ConnectionController.GetInstance(), WebMsgParser.ParseResponseDeletePost, notificationCenter, repositoryQc, repository.GetPostById(_postId).Quote), repository); InteractorPostSocial = new InteractorPostSocial(_postId, new PostSocialController(ConnectionController.GetInstance(), WebMsgParser.ParseResponsePostLike), notificationCenter, repository); //InteractorPostStatistics = new InteractorPostStatistics(notificationCenter, repository); InteractorTrade = new InteractorTrade(notificationCenter, repository); }
private static void WorkaroundTimeout(INotificationCenter notificationCenter, string additionalLogText) { ////lock (_timeoutSync) ////{ //// _timeoutHelper += 1; //// if (_timeoutHelper > 50) //// { //// _timeoutHelper = 0; //// notificationCenter.FireNotification( //// LogLevel.Debug, //// "Waiting to get around MKM timeout " + additionalLogText); //// // Warte kurz zwischen den Requests, damit wir nicht von //// // MKM einen Timeout bekommen //// Thread.Sleep(5 * 1000); //// } ////} }
public static INotificationCenter GetInstance() { if (singleton == null) singleton = new NotificationCenter(); return singleton; }
public CharacterNameProcessor(INotificationCenter notificationCenter, CommandProcess nextProcessor) : base(nextProcessor) { this.notificationManager = notificationCenter; }
public CharacterNameProcessor(INotificationCenter notificationCenter) { this.notificationManager = notificationCenter; }
void Awake() { handlers = new Dictionary<string, EventHandler>(); center = NotificationCenter.GenInstance(); }
/// <summary> /// Set our notification interface so we can post messages /// </summary> /// <param name="notificationInterface"></param> public void SetNotificationInterface(INotificationCenter notificationInterface) { this.notificationInterface = notificationInterface; }
public CharacterNameRequestor(INotificationCenter notificationManager) : base() { this.notificationCenter = notificationManager; }
public AccountStorage(INotificationCenter notificationCenter, ICurrentUser currentUser, IDeviceInfo deviceInfo) { _notificationCenter = notificationCenter; _currentUser = currentUser; _deviceInfo = deviceInfo; }