我想在我的 C# WPF 项目中实现一个功能,其中用户可以在应用程序中使用复选框打开/关闭焦点辅助(Windows 10 中的设置),该复选框将自动将焦点辅助设置切换为“打开”或未选中'离开'。
如果可能,我不想打开焦点辅助窗口让用户手动单击开/关。
我试图寻找如何有能力控制这些设置的能力,以及所有我能找到的是实现类Windows.System,不过,唯一的控制似乎是Windows.System.RemoteDesktop,Windows.System.Power,Windows.System.Display和缺乏FocusAssist。
有人能指出我正确的方向吗?
我正在构建C#WPF应用程序,并希望能够以编程方式启用和禁用Windows系统功能Focus Assist。
我尝试研究如何以编程方式控制此功能,但看不到它的任何内容(可能是因为它是一项新的系统功能)。我看过有关使用该Windows.System库的说明,但是对焦辅助似乎并没有分开
谁能指出我正确的方向?
在我调用的类中的一个方法中Login.Show(),它是一个Login Window. 我希望窗口在单击“登录”按钮时将电子邮件传递回类,而不创建类的新实例。
有没有办法做到这一点?
目前我有
Login loginWindow;
public void AppStartup {
loginWindow = new Login();
loginWindow.Show();
//in this instance I'd like the email to be returned here
Run Code Online (Sandbox Code Playgroud)
内 Login.xaml.cs
public void Login_Click(object sender, RoutedEventArgs e)
{
string email;
try {
email = InputEmail.Text;
//ideally I would like to return email to AppStartup without
//using new AppStartup(); , rather back in the same instance
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Run Code Online (Sandbox Code Playgroud)