// Constructor public AppSystem(IForegroundWindowHook fgHook, IWindowUpdateHook winHook, IMouseHook msHook) { _state = new InitialState(); _stateContext = new AppStateContext { PathModeLocksToHandle = false, ForegroundHook = fgHook, WindowHook = winHook, MouseHook = msHook, SetCurrentState = (next) => SetCurrentState(next), SendLockStateChange = () => LockStateChanged.Invoke(this, new Events.LockStateChangedEventArgs { IsLocked = IsLocked }), SendPathChange = (path) => PathChanged.Invoke(this, new Events.PathChangedEventArgs { Path = path }), SendTitleChange = (title) => TitleChanged.Invoke(this, new Events.TitleChangedEventArgs { Title = title }), SendDimensionsChange = (dimensions) => DimensionsChanged.Invoke(this, new Events.DimensionsChangedEventArgs { Dimensions = dimensions }), SendForegroundChange = (inForeground) => ForegroundChanged.Invoke(this, new Events.ForegroundStateChangedEventArgs { InForeground = inForeground }) }; fgHook.ForegroundWindowChanged += ForegroundHook_ForegroundWindowChanged; winHook.WindowClosed += WindowHook_WindowClosed; winHook.DimensionsChanged += WindowHook_DimensionsChanged; winHook.TitleChanged += WindowHook_TitleChanged; }
private void StartSystem() { // Bind handlers Exit += App_Exit; DispatcherUnhandledException += App_DispatcherUnhandledException; // Create system objects foregroundWindowHook = new ForegroundWindowHook(); windowUpdateHook = new WindowUpdateHook(); mouseHook = new ClipMouseHook(); appSystem = new AppSystem(foregroundWindowHook, windowUpdateHook, mouseHook); windowEnumerator = new WindowEnumerator(); // Create components lockingComponent = new LockingComponent(appSystem); toolbarComponent = new ToolbarComponent(); windowListComponent = new WindowListComponent(windowEnumerator); findProgramComponent = new FindProgramComponent(); lockWindowComponent = new LockWindowComponent(appSystem); aboutComponent = new AboutComponent(); settingsComponent = new SettingsComponent(); mainWindowComponent = new MainWindowComponent(appSystem); // Create gui system guiSystem = new GuiSystem(lockingComponent, toolbarComponent, windowListComponent, findProgramComponent, lockWindowComponent, aboutComponent, settingsComponent, mainWindowComponent); guiSystem.Startup(); }