-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hotkey to cycle to the next power schema #32
Hotkey to cycle to the next power schema #32
Conversation
objecttothis
commented
May 29, 2021
- Refactored variables to fix typos
- Added function to PowerManager to cycle to the next power schema
- Added Configuration variables for the Cycle to the next schema hotkey toggle and status
- Added app string to explain the setting
- Added business logic to register and unregister the hotkey when enabled or disabled
- Added business logic to register and unregister the hotkey from the xml config file
- Added business logic to fire cycling to the next power schema on hotkey press
- Removed unneeded whitespace in the code
- Removed unused "using" statements
- Refactored variables to fix typos - Added function to PowerManager to cycle to the next power schema - Added Configuration variables for the Cycle to the next schema hotkey toggle and status - Added app string to explain the setting - Added business logic to register and unregister the hotkey when enabled or disabled - Added business logic to register and unregister the hotkey from the xml config file - Added business logic to fire cycling to the next power schema on hotkey press - Removed unneeded whitespace in the code - Removed unused "using" statements
newHotKey.HotKeyFired += (this.MainWindow as MainWindow).ToggleWindowVisibility; | ||
|
||
if (isCycleNextSchemaSwitch) | ||
newHotKey.HotKeyFired += CycleNextPowerSchema; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petrroll The hotkey press is correctly switching the schema to the next power schema. The problem is that it doesn't show you what schema it switched you to. What I would like to do is modify MainWindow.ToggleWindowVisibility()
to sort of act as a toast notification and disappear on its own after, say, 5 seconds. I can call `newHotKey.HotKeyFired += (this.MainWindow as MainWindow).ToggleWindowVisibility; as it currently is, and it shows the new schema, but it doesn't hide the window unless the user manually clicks somewhere on the screen. I played around with adding an optional timeout parameter but Visual Studio complained about that. I also couldn't figure out how to trigger the HideWithAnimation() function after the timeout period. I'm open to ideas about the best way to implement some sort of indicator notification of what power schema it just got changed to and then letting it disappear... if there is somewhere in the code where you are already doing this, please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I vaguely remember the fly-out logic was somehow buggy w.r.t. to timeout parameters. The best way to approach it might be to use winrt API for proper notifications. I.e. instead of creating your own toast-like notification just use native Windows Notification API.
Not sure how much identity the current packaging schema provides and what's the state of invoking notifications without it, but remember that https://github.com/File-New-Project/EarTrumpet was doing something with winRT APIs so it might be a good place to start. Or you might wait until project reunion comes with notifications API (won't need app identity at all): https://github.com/microsoft/ProjectReunion
Hi!
Given I won't be merging this change (despite it being super cool and good quality) into master. If someone wants to build their own version with your update they can just just clone your fork and build it locally. Alternatively, I'd be happy to create a separate branch for this feature on this repo and you can merge into that one. I'll remember to keep it in sync with master if I ever come back to developing this. Or, I'm also perfectly fine with you creating proper fork and even releasing it to Windows store. I hope you understand. :) |
I completely understand. With my own work, I'm always finding things that I wish I could figure out how to clone myself over and work on.
I understand. I saw that it had not been in development for some time, so I knew there was a chance that it would be an exercise in learning. I was feeling inspired to code on a non-work project at the time.
I think at this point, I'd recommend creating a branch on this repo and merging this into that branch. That way, if you or someone else ever picks the project back up, they can use the functionality if they want...
Thanks for taking the time to look at the PR. |
9acf931
into
petrroll:contribPRAfterActiveDev/cycleNextSchemaHotkey
Did just that :) |