public KeyPressController( Func <bool> isWindowMinimized, Action <string> updateCurrentKey, Action <string> updateKeyPopularity, Action <double> updateProductiveRatio, Action <double> updateDestructiveRatio, Action <double> updateNaviationRatio, Action <double> updateMetaRatio, KeysCounter counter, GuiKeyboard keyboard) { this.isWindowMinimized = isWindowMinimized; this.updateCurrentKey = updateCurrentKey; this.updateKeyPopularity = updateKeyPopularity; this.updateProductiveRatio = updateProductiveRatio; this.updateDestructiveRatio = updateDestructiveRatio; this.updateNaviationRatio = updateNaviationRatio; this.updateMetaRatio = updateMetaRatio; this.counter = counter; this.keyboard = keyboard; }
public MainWindow() { InitializeComponent(); Title = $"Keyboord usage v{AppConstants.CurrentVersion} by Kasper B. Graversen"; var args = new CommandLineParser().ParseCommandLine(); var style = (Style)FindResource("InformButton"); configurationRepository = new ConfigurationRepository(new UserStateStandardConfiguraion(args)); keyboards = configurationRepository.GetKeyboards(style); state = configurationRepository.LoadUserState(); var userState = new DailySessionDecorator(state); var counter = new KeysCounter(userState); keyPressController = new KeyPressController( () => WindowState == WindowState.Minimized, x => CurrentKey.Content = x, x => KeyHistory.Text = x, x => ProductiveRatio.Content = x.ToString() + "%", x => DestructiveRatio.Content = x.ToString() + "%", x => NavigationRatio.Content = x.ToString() + "%", x => MetaRatio.Content = x.ToString() + "%", counter, null); listener = new KeyboardListener(counter, keyPressController); listener.Subscribe(); ResizeWindow(state); KeyboardChooser.ItemsSource = keyboards.Select(x => x.Name); KeyboardChooser.SelectedIndex = state.GetGuiConfiguration().SelectedKeyboardIndex; keyPressController.ForceRepaint(); }
public KeyboardListener(KeysCounter counter, KeyPressController keyPressController) { this.Counter = counter; this.keyPressController = keyPressController; }