public TimeInfoViewModel( [NotNull] ILog logger, [NotNull] IActivityProcessor activityProcessor, [NotNull] IReportSerializer reportSerializer, [NotNull] IStatusChangeEventRepository statusChangeEventRepository) { _statusChangeEventRepository = statusChangeEventRepository ?? throw new ArgumentNullException(nameof(statusChangeEventRepository)); activityProcessor = activityProcessor ?? throw new ArgumentNullException(nameof(activityProcessor)); ToggleCommand = new CorrelationCommand <ActivityReportItemViewModel>(Toggle); _report = activityProcessor.GenerateReport(DateTime.Now); _timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; _timer.Start(); _report = activityProcessor.GenerateReport(DateTime.Now); ActivityReportItems.Clear(); foreach (var viewModelItem in _report.Items.Select(item => new ActivityReportItemViewModel(item))) { ActivityReportItems.Add(viewModelItem); } SetCurrentTimeInfo(); _timer.Tick += Timer_Tick; }
private void SignalsGenerated(object sender, EventArgs args) { AddCommand.RaiseCanExecuteChanged(); DivideCommand.RaiseCanExecuteChanged(); MultiplyCommand.RaiseCanExecuteChanged(); SubtractCommand.RaiseCanExecuteChanged(); SwapCommand.RaiseCanExecuteChanged(); CorrelationCommand.RaiseCanExecuteChanged(); ConvolutionCommand.RaiseCanExecuteChanged(); }
public TrayViewModel( [NotNull] ILog logger, [NotNull] IActivityProcessor activityProcessor, [NotNull] IReportSerializer reportSerializer, Func <TimeInfoViewModel> timeInfoViewModelFactory, [NotNull] IWindowFactory <ITimeInfoWindow> timeInfoWindowFactory) { _activityProcessor = activityProcessor ?? throw new ArgumentNullException(nameof(activityProcessor)); _reportSerializer = reportSerializer ?? throw new ArgumentNullException(nameof(reportSerializer)); _timeInfoViewModelFactory = timeInfoViewModelFactory; _timeInfoWindowFactory = timeInfoWindowFactory; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); SaveReportCommand = new CorrelationCommand(SaveReport); ToolTipOpenCommand = new CorrelationCommand(ToolTipOpen); ToolTipCloseCommand = new CorrelationCommand(ToolTipClose); ExitCommand = new CorrelationCommand(Exit); OpenSettingsFolderCommand = new CorrelationCommand(OpenSettingsFolder); ViewLogsCommand = new CorrelationCommand(ViewLogs); EditPeriodsCommand = new AsyncCorrelationCommand(EditPeriodsAsync); }
protected IRefreshableCommand AddCommand <T>(Action <T> executeFunc, Predicate <T>?canExecuteFunc = null) { var tempCmd = new CorrelationCommand <T>(_commandManager, executeFunc, canExecuteFunc); return(AddCommandToList(tempCmd)); }
protected IRefreshableCommand AddCommand(Action executeFunc, Func <bool>?canExecuteFunc = null) { var tempCmd = new CorrelationCommand(_commandManager, executeFunc, canExecuteFunc); return(AddCommandToList(tempCmd)); }