public ConsultasLogsController(ILogEntryService logEntryService, ILogLevelService logLevelService, ILogCategoryService logCategoryService) { //this.db = db; this.logEntryService = logEntryService; this.logLevelService = logLevelService; this.logCategoryService = logCategoryService; }
public LogEntryViewer(ILogEntryService logEntryService) { //build an observable filter var filter = this.WhenAnyValue(x => x.SearchText) .Throttle(TimeSpan.FromMilliseconds(250)) .Select(BuildFilter); //filter, sort and populate reactive list. var shared = logEntryService.Items.Connect() .Transform(le => new LogEntryProxy(le)) .DelayRemove(TimeSpan.FromSeconds(0.75), proxy => proxy.FlagForRemove()) .Publish(); var loader = shared.Filter(filter) .Sort(SortExpressionComparer <LogEntryProxy> .Descending(le => le.TimeStamp).ThenByDescending(l => l.Key), SortOptions.UseBinarySearch) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out var data) .DisposeMany() .Subscribe(); Data = data; //aggregate total items var summariser = shared.QueryWhenChanged(items => { var debug = items.Count(le => le.Level == LogLevel.Debug); var info = items.Count(le => le.Level == LogLevel.Info); var warn = items.Count(le => le.Level == LogLevel.Warning); var error = items.Count(le => le.Level == LogLevel.Error); return(new LogEntrySummary(debug, info, warn, error)); }) .Subscribe(s => Summary = s); //manage user selection, delete items command var selectedItems = _selectionController.SelectedItems.Connect().Publish(); //Build a message from selected items _deleteItemsText = selectedItems.QueryWhenChanged(query => { if (query.Count == 0) { return("Select log entries to delete"); } if (query.Count == 1) { return("Delete selected log entry?"); } return($"Delete {query.Count} log entries?"); }) .ToProperty(this, viewmodel => viewmodel.DeleteItemsText, "Select log entries to delete"); //make a command out of selected items - enabling the command when there is a selection DeleteCommand = ReactiveCommand.Create(() => { var toRemove = _selectionController.SelectedItems.Items.Select(proxy => proxy.Original).ToArray(); _selectionController.Clear(); logEntryService.Remove(toRemove); }, selectedItems.QueryWhenChanged(query => query.Count > 0)); var connected = selectedItems.Connect(); var connectedItems = shared.Connect(); _cleanUp = Disposable.Create(() => { loader.Dispose(); connected.Dispose(); _deleteItemsText.Dispose(); DeleteCommand.Dispose(); _selectionController.Dispose(); summariser.Dispose(); connectedItems.Dispose(); }); }
public LogEntryViewer(ILogEntryService logEntryService) { _logEntryService = logEntryService; //apply filter when search text has changed var filterApplier = this.WhenAnyValue(x => x.SearchText) .Throttle(TimeSpan.FromMilliseconds(250)) .Select(BuildFilter) .Subscribe(_filter.Change); //filter, sort and populate reactive list. var loader = logEntryService.Items.Connect() .Transform(le => new LogEntryProxy(le)) .DelayRemove(TimeSpan.FromSeconds(0.75), proxy => { proxy.FlagForRemove(); _selectionController.DeSelect(proxy); }) .Filter(_filter) .Sort(SortExpressionComparer <LogEntryProxy> .Descending(le => le.TimeStamp).ThenByDescending(l => l.Key), SortOptimisations.ComparesImmutableValuesOnly) .ObserveOn(RxApp.MainThreadScheduler) .Bind(_data) .DisposeMany() .Subscribe(); //aggregate total items var summariser = logEntryService.Items.Connect() .QueryWhenChanged(query => { var items = query.Items.ToList(); var debug = items.Count(le => le.Level == LogLevel.Debug); var info = items.Count(le => le.Level == LogLevel.Info); var warn = items.Count(le => le.Level == LogLevel.Warning); var error = items.Count(le => le.Level == LogLevel.Error); return(new LogEntrySummary(debug, info, warn, error)); }) .Subscribe(s => Summary = s); //manage user selection, delete items command var selectedItems = _selectionController.SelectedItems.Connect().Publish(); //Build a message from selected items _deleteItemsText = selectedItems.QueryWhenChanged(query => { if (query.Count == 0) { return("Select log entries to delete"); } if (query.Count == 1) { return("Delete selected log entry?"); } return(string.Format("Delete {0} log entries?", query.Count)); }) .ToProperty(this, viewmodel => viewmodel.DeleteItemsText, "Select log entries to delete"); //make a command out of selected items - enabling the command when there is a selection _deleteCommand = selectedItems .QueryWhenChanged(query => query.Count > 0) .ToCommand(); //Assign action when the command is invoked var commandInvoker = this.WhenAnyObservable(x => x.DeleteCommand) .Subscribe(_ => { var toRemove = _selectionController.SelectedItems.Items.Select(proxy => proxy.Key).ToArray(); _logEntryService.Remove(toRemove); }); var connected = selectedItems.Connect(); _cleanUp = Disposable.Create(() => { loader.Dispose(); filterApplier.Dispose(); _filter.Dispose(); connected.Dispose(); _deleteItemsText.Dispose(); _deleteCommand.Dispose(); commandInvoker.Dispose(); _selectionController.Dispose(); summariser.Dispose(); }); }
public LogEntryViewer(ILogEntryService logEntryService) { _logEntryService = logEntryService; //build an observable filter var filter = this.WhenAnyValue(x => x.SearchText) .Throttle(TimeSpan.FromMilliseconds(250)) .Select(BuildFilter); //filter, sort and populate reactive list. var loader = logEntryService.Items.Connect() .Transform(le => new LogEntryProxy(le)) .DelayRemove(TimeSpan.FromSeconds(0.75), proxy =>proxy.FlagForRemove()) .Filter(filter) .Sort(SortExpressionComparer<LogEntryProxy>.Descending(le=>le.TimeStamp).ThenByDescending(l => l.Key),SortOptions.UseBinarySearch) .ObserveOn(RxApp.MainThreadScheduler) .Bind(_data) .DisposeMany() .Subscribe(); //aggregate total items var summariser = logEntryService.Items.Connect() .QueryWhenChanged(items => { var debug = items.Count(le => le.Level == LogLevel.Debug); var info = items.Count(le => le.Level == LogLevel.Info); var warn = items.Count(le => le.Level == LogLevel.Warning); var error = items.Count(le => le.Level == LogLevel.Error); return new LogEntrySummary(debug, info, warn, error); }) .Subscribe(s => Summary = s); //manage user selection, delete items command var selectedItems = _selectionController.SelectedItems.Connect().Publish(); //Build a message from selected items _deleteItemsText = selectedItems.QueryWhenChanged(query => { if (query.Count == 0) return "Select log entries to delete"; if (query.Count == 1) return "Delete selected log entry?"; return string.Format("Delete {0} log entries?", query.Count); }) .ToProperty(this, viewmodel => viewmodel.DeleteItemsText, "Select log entries to delete"); //make a command out of selected items - enabling the command when there is a selection _deleteCommand = selectedItems .QueryWhenChanged(query => query.Count > 0) .ToCommand(); //Assign action when the command is invoked var commandInvoker = this.WhenAnyObservable(x => x.DeleteCommand) .ObserveOn(RxApp.TaskpoolScheduler) .Subscribe(_ => { var toRemove = _selectionController.SelectedItems.Items.Select(proxy => proxy.Original).ToArray(); _selectionController.Clear(); _logEntryService.Remove(toRemove); }); var connected = selectedItems.Connect(); _cleanUp= Disposable.Create(() => { loader.Dispose(); connected.Dispose(); _deleteItemsText.Dispose(); _deleteCommand.Dispose(); commandInvoker.Dispose(); _selectionController.Dispose(); summariser.Dispose(); }); }
public LogEntriesController(IUnitOfWorkAsync unitOfWorkAsync, ILogEntryService logEntryService) { _unitOfWorkAsync = unitOfWorkAsync; _logEntryService = logEntryService; }
public AdminController(ILogEntryService logEntryService) { _logEntryService = logEntryService; }
public LogWriter(ILogEntryService logEntryService) { _job = ReactiveLogAppender.LogEntryObservable .Subscribe(logEntryService.Add); }
public MeetingService(OrganizationContext context, ApplicationSettings applicationSettings, ILogEntryService logEntryService) { _context = context; _applicationSettings = applicationSettings; _logEntryService = logEntryService; }
public LogController(ILogEntryService logEntryService) { _logEntryService = logEntryService; }
public LogControllerTests() { _service = new LogEntryServiceFake(); _controller = new LogController(_service); }
/// <summary> /// Ctor. /// </summary> /// <param name="countryService"></param> /// <param name="areaService"></param> /// <param name="summitGroupService"></param> /// <param name="summitService"></param> /// <param name="routeService"></param> /// <param name="variationService"></param> /// <param name="logEntryService"></param> /// <param name="nameInputViewCommand"></param> /// <param name="difficultyManagementViewCommand"></param> /// <param name="nameAndLevelInputViewCommand"></param> /// <param name="logEntryInputViewCommand"></param> public MainViewModel(ICountryService countryService, IAreaService areaService, ISummitGroupService summitGroupService, ISummitService summitService, IRouteService routeService, IVariationService variationService, ILogEntryService logEntryService, IDifficultyLevelService difficultyLevelService, IDifficultyLevelScaleService difficultyLevelScaleService, NameInputViewCommand nameInputViewCommand, DifficultyManagementViewCommand difficultyManagementViewCommand, NameAndLevelInputViewCommand nameAndLevelInputViewCommand , LogEntryInputViewCommand logEntryInputViewCommand) { _countryService = countryService; _areaService = areaService; _summitGroupService = summitGroupService; _summitService = summitService; _routeService = routeService; _variationService = variationService; _logEntryService = logEntryService; _difficultyLevelService = difficultyLevelService; _difficultyLevelScaleService = difficultyLevelScaleService; _nameInputViewCommand = nameInputViewCommand; _difficultyManagementViewCommand = difficultyManagementViewCommand; _nameAndLevelInputViewCommand = nameAndLevelInputViewCommand; _logEntryInputViewCommand = logEntryInputViewCommand; }
public LogEntryViewer(ILogEntryService logEntryService) { _logEntryService = logEntryService; //apply filter when search text has changed var filterApplier = this.WhenAnyValue(x => x.SearchText) .Throttle(TimeSpan.FromMilliseconds(250)) .Select(BuildFilter) .Subscribe(_filter.Change); //filter, sort and populate reactive list. var loader = logEntryService.Items.Connect(_filter) .Transform(le => new LogEntryProxy(le)) .Sort(SortExpressionComparer <LogEntryProxy> .Descending(l => l.Key), SortOptimisations.ComparesImmutableValuesOnly) .ObserveOn(RxApp.MainThreadScheduler) .Bind(_data) .DisposeMany() .Subscribe(); //aggregate total items var summariser = logEntryService.Items.Connect() .QueryWhenChanged(query => { var items = query.Items.ToList(); var debug = items.Count(le => le.Level == LogLevel.Debug); var info = items.Count(le => le.Level == LogLevel.Info); var warn = items.Count(le => le.Level == LogLevel.Warning); var error = items.Count(le => le.Level == LogLevel.Error); return(new LogEntrySummary(debug, info, warn, error)); }) .Subscribe(s => Summary = s); //manage user selection, delete items command var selectedItems = _selection.Selected.ToObservableChangeSet().Transform(obj => (LogEntryProxy)obj).Publish(); //Build a message from selected items var selectedMessage = selectedItems .QueryWhenChanged(query => string.Format("{0} items selected.", query.Count)) .StartWith("0 items selected") .Subscribe(text => RemoveText = text); //covert stream into a cache so we can get a handle on items in thread safe manner. var selectedCache = selectedItems.AsObservableCache(); //make a command out of selected items - enabling command when there is a selection _deleteCommand = selectedItems .QueryWhenChanged(query => query.Count > 0) .ToCommand(); //Assign action when the command is invoked var commandInvoker = this.WhenAnyObservable(x => x.RemoveCommand) .Subscribe(x => _logEntryService.Remove(selectedCache.Items.Select(proxy => proxy.Key))); var connected = selectedItems.Connect(); _cleanUp = Disposable.Create(() => { loader.Dispose(); filterApplier.Dispose(); _filter.Dispose(); connected.Dispose(); selectedMessage.Dispose(); selectedCache.Dispose(); _selection.Dispose(); commandInvoker.Dispose(); summariser.Dispose(); }); }