private void LoadAutoModeTypeIcon(AutoModeType type) { switch (type) { case AutoModeType.Disable: stopButton.Image = UIInfo.IsWhiteBackground ? IconResources.Pause_Black : IconResources.Pause_White; AllowlistButton.Image = BlockListButton.Image = foreButton.Image = apiButton.Image = IconResources.Empty; break; case AutoModeType.AutoHideApiMode: apiButton.Image = UIInfo.IsWhiteBackground ? IconResources.Run_Black : IconResources.Run_White; AllowlistButton.Image = BlockListButton.Image = foreButton.Image = stopButton.Image = IconResources.Empty; break; case AutoModeType.ForegroundMode: foreButton.Image = UIInfo.IsWhiteBackground ? IconResources.Run_Black : IconResources.Run_White; AllowlistButton.Image = BlockListButton.Image = apiButton.Image = stopButton.Image = IconResources.Empty; break; case AutoModeType.BlockListMode: BlockListButton.Image = UIInfo.IsWhiteBackground ? IconResources.Run_Black : IconResources.Run_White; AllowlistButton.Image = apiButton.Image = foreButton.Image = stopButton.Image = IconResources.Empty; break; case AutoModeType.AllowlistMode: AllowlistButton.Image = UIInfo.IsWhiteBackground ? IconResources.Run_Black : IconResources.Run_White; apiButton.Image = BlockListButton.Image = foreButton.Image = stopButton.Image = IconResources.Empty; break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
/// <summary> /// Shutdown process /// </summary> public void Stop() { if (isStop) { return; } isStop = true; process.Kill(); process.WaitForExit(); currentType = AutoModeType.none; Reset(); }
/// <summary> /// Change the display status of the Taskbar /// </summary> public void ChangeState() { Stop(); currentType = AutoModeType.none; if (IsHide()) { Show(); } else { Hide(); } }
public void SetAutoMode(AutoModeType modeType) { _timer.Stop(); _autoMode = modeType switch { AutoModeType.Disable => (IAutoMode)null, AutoModeType.ForegroundMode => new ForegroundMode(), AutoModeType.BlacklistMode => new AutoMode(_coreInvoker.UserSettings), AutoModeType.WhitelistMode => new AutoMode(_coreInvoker.UserSettings), _ => throw new ArgumentOutOfRangeException(nameof(modeType), modeType, null) }; _timer.Start(); }
private void SetAutoMode(AutoModeType modeType) { _autoModeTimer.Stop(); _autoMode = modeType switch { AutoModeType.Disable => new DisableMode(_coreInvoker.UserSettings), AutoModeType.AutoHideApiMode => new AutoHideApiMode(_coreInvoker.UserSettings), AutoModeType.ForegroundMode => new ForegroundMode(_coreInvoker.UserSettings), AutoModeType.BlockListMode => new BlockListMode(_coreInvoker.UserSettings), AutoModeType.AllowlistMode => new AllowlistMode(_coreInvoker.UserSettings), _ => throw new ArgumentOutOfRangeException(nameof(modeType), modeType, null) }; if (_autoMode != null) { _autoModeTimer.Start(); } else { ResetState(); } }
/// <summary> /// Start process /// </summary> /// <param name="type">AutoModeType</param> public void Start(AutoModeType type) { Stop(); currentType = type; switch (type) { case AutoModeType.display: process.StartInfo.FileName = auto_displayPath; break; case AutoModeType.size: process.StartInfo.FileName = auto_sizePath; Show(); break; default: return; } process.Start(); isStop = false; AddProcess(process.Handle); }
private void SetAutoModeType(AutoModeType type) { _userConfigEngine.Update(x => x.AutoModeType = type); LoadAutoModeTypeIcon(type); }
internal static extern bool EnumWindows(WndEnumProc lpEnumFunc, AutoModeType lParam);
private void SetAutoModeType(AutoModeType type) { _ = _userConfigEngine.Update(x => x with { AutoModeType = type } as MainViewModel