.net

How do I detect if a Windows device is touch-enabled

元气小坏坏 提交于 2021-02-18 12:13:44
问题 How do I detect if a device is touch-enabled in c# for a WinForms app (Not WPF). I found information on GetSystemMetrics...can't find how to use this in c#. I Tried using System.Windows.Input.Tablet class..not coming up in c#, even though I am using .Net Framework 4.5. I Tried using System.Windows.Devices...not coming up in c#, even though I am using .Net Framework 4.5. I have also checked This and This, which would seem to make this question a duplicate. However, neither of these answers my

How do I detect if a Windows device is touch-enabled

这一生的挚爱 提交于 2021-02-18 12:13:07
问题 How do I detect if a device is touch-enabled in c# for a WinForms app (Not WPF). I found information on GetSystemMetrics...can't find how to use this in c#. I Tried using System.Windows.Input.Tablet class..not coming up in c#, even though I am using .Net Framework 4.5. I Tried using System.Windows.Devices...not coming up in c#, even though I am using .Net Framework 4.5. I have also checked This and This, which would seem to make this question a duplicate. However, neither of these answers my

“Did you mean to run dotnet SDK commands? Please install dotnetsdk” in windows command prompt

笑着哭i 提交于 2021-02-18 11:59:23
问题 I have just installed dot net core sdk and runtime (2.2.1) on my system viz. a Windows Server 2012R2. I am trying to create a console app using the command prompt using dotnet new console but it says Did you mean to run dotnet SDK commands? Please install dotnetsdk Is there any other configurations needed. The Environment path variable also contains the following folder C:\Program Files\dotnet. I have not installed VS2017. Was trying to use VS Code 回答1: Please, make sure you've installed SDK

How to get hash value in user.config path?

情到浓时终转凉″ 提交于 2021-02-18 11:12:07
问题 I have installed .NET application. Its config location is %AppData%\[CompanyName]\[ExeName]_Url_[hash]\[version]\user.config. I need to get [hash] value from another application. According with MSDN, user.config path template is [c:\Documents and Settings]\[username]\[Local Settings]\Application Data\[companyname]\[appdomainname]_[eid]_[hash]\[version] where [hash] is SHA1 hash of evidence (in my case eid=Url). I noticed the following things: [hash] changes with application installation path

Understanding async/await vs Wait in C# with “ContinueWith” behavior

泄露秘密 提交于 2021-02-18 10:46:06
问题 One method is a standard async method, like this one : private static async Task AutoRetryHandlerAsync_Worker(Func<Task<bool>> taskToRun,...) I have tested two implementations, one that use await and the other uses .Wait() The two implementations are not equal at all because the same tests are failing with the await version but not the Wait() one. The goal of this method is to "execute a Task returned by the input function, and retry by executing the same function until it works" (with

Understanding async/await vs Wait in C# with “ContinueWith” behavior

匆匆过客 提交于 2021-02-18 10:46:02
问题 One method is a standard async method, like this one : private static async Task AutoRetryHandlerAsync_Worker(Func<Task<bool>> taskToRun,...) I have tested two implementations, one that use await and the other uses .Wait() The two implementations are not equal at all because the same tests are failing with the await version but not the Wait() one. The goal of this method is to "execute a Task returned by the input function, and retry by executing the same function until it works" (with

Get/Set First Visible Line of RichTextBox

微笑、不失礼 提交于 2021-02-18 10:45:31
问题 I have a RichTextBox with thousands of lines of text in it. I can easily SET the first visible line by using ScrollToCaret() by doing... this.SelectionStart = this.Find(this.Lines[lineIndex], RichTextBoxFinds.NoHighlight); this.ScrollToCaret(); But I would like to be able to GET the first visible line too. Any suggestions? 回答1: Here may be what you need: //get the first visible char index int firstVisibleChar = richTextBox1.GetCharIndexFromPosition(new Point(0,0)); //get the line index from

Is it possible to reassign a ref local?

冷暖自知 提交于 2021-02-18 10:29:18
问题 C#'s ref locals are implemented using a CLR feature called managed pointers, that come with their own set of restrictions, but luckily being immutable is not one of them. I.e. in ILAsm if you have a local variable of managed pointer type, it's entirely possible to change this pointer, making it "reference" another location. (C++/CLI also exposes this feature as interior pointers.) Reading the C# documentation on ref locals it appears to me that C#'s ref locals are, even though based on the

Windows UI Automation doesn't recognize button controls

▼魔方 西西 提交于 2021-02-18 10:23:08
问题 I'm having problems trying to identify via Windows UI Automation the button controls that are inside the Notification Area window (classname: ToolbarWindow32 ): I verified via the Windows UI Automation tools deployed in the Windows SDK that those "icons" are controls of type ControlType.Button , however when I try to run the code below I get a null-reference exception because the search condition I use doesn't get any control. I'm doing something wrong, or maybe I found some kind of

Hyperlinks without underline in RichTextBox on Windows 10 1803

倖福魔咒の 提交于 2021-02-18 10:21:08
问题 I'm displaying RTF document in RichTextBox ("upgraded" to RichEdit50W ). Keywords in the document are linked to a webpage using a syntax: {\field{\*\fldinst{HYPERLINK ""https://www.example.com/"" }}{\fldrslt{\cf1 keyword\cf0 }}} I do not want to underline the keywords. Until Windows 10 version 1803 (and in all previous versions of Windows, including XP, Vista, 8), whenever a color was set on the anchor (note the \cf1 ), the anchor was not underlined. But this no longer works in Windows 10