Comments (3)
More info about detecting tablet mode: http://stackoverflow.com/questions/33041370/know-when-windows-10-are-tablet-mode-windows-10-windows-10-mobile
This info was for UWP apps
This doesn't seem so easy to detect in a WPF project. Moved back to v1.3.
from dopamine-windows.
using System;
using System.Management;
using System.Security.Principal;
using System.Windows.Forms;
using Microsoft.Win32;
public partial class MainForm : Form
{
public MainForm()
{
this.InitializeComponent();
this.UpdateModeFromRegistry();
var currentUser = WindowsIdentity.GetCurrent();
if (currentUser != null && currentUser.User != null)
{
var wqlEventQuery = new EventQuery(string.Format(@"SELECT * FROM RegistryValueChangeEvent WHERE Hive='HKEY_USERS' AND KeyPath='{0}\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ImmersiveShell' AND ValueName='TabletMode'", currentUser.User.Value));
var managementEventWatcher = new ManagementEventWatcher(wqlEventQuery);
managementEventWatcher.EventArrived += this.ManagementEventWatcher_EventArrived;
managementEventWatcher.Start();
}
}
private void ManagementEventWatcher_EventArrived(object sender, EventArrivedEventArgs e)
{
this.UpdateModeFromRegistry();
}
private void UpdateModeFromRegistry()
{
var tabletMode = (int)Registry.GetValue("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ImmersiveShell", "TabletMode", 0);
if (tabletMode == 1)
{
Console.Write(@"Tablet mode is enabled");
}
else
{
Console.Write(@"Tablet mode is disabled");
}
}
}
Oops, still for UWPs........
from dopamine-windows.
The value HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ImmersiveShell\TabletMode does change between 0 and 1 whether or not Tablet mode is enabled. So even from a WPF application I should be able o check it.
from dopamine-windows.
Related Issues (20)
- Unable to load UTF-8 Chinese stored from the lyrics file
- Covers won't save for real (in files)
- After clicking into a song, then getting back, I'm landing on top of the albums list (and not on actual album) HOT 2
- CUE files senseless? Can't click single tracks!
- Cannot compile, getting a bunch of "tag does not exist in XML namespace" errors HOT 3
- Playlist errors HOT 3
- Windows 11 does not remember Dopamine's size & position HOT 1
- Modifying devices in WASAPI results in a queue reset
- Unable to create playlist with rule 'plays(play times)' in 'Smart Playlist'.
- [Feature request] Open Dopamine with a double click on the taskbar icon
- [Feature Request] Open player on double click on taskbar icon HOT 1
- CoverArt folder takes too much space
- Support for multiple artists
- 800 x 600 Resolution and Touch Support
- Cannot drag and drop files. What am I doing wrong?
- Unable to Drag & Drop Files into Dopamine
- Cannot fetch original lyrics
- Wastes significant CPU power when idle
- Dopamine Crash Windows 11 22H2 22621.2715
- customizable shortcuts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dopamine-windows.