8/25/2023 0 Comments Cursor pointer changer![]() ![]() Here's the main log, which shows things happening in the order we expect: 16:51:33.1064 Launching lengthy operation.ġ6:51:33.1215. I wasn't able to get the busy cursor show only when over a particular container on the form (but I didn't try very hard.) All controls have a UseWaitCursor property, but it doesn't seem have any effect on the controls I tried (maybe because they weren't on top?) I had to use a separate logger for the dummy action (I am using Nlog) and my main logger is writing to the UI (a rich text box). Log.Info(".Lengthy operation launched.") ![]() Log.Info("Launching lengthy operation.") ĬursorWait.LengthyOperation(control, () => DummyAction()) Here's the code form the main form private void btnSleep_Click(object sender, EventArgs e) Task doWork = new Task(() => action(), TaskCreationOptions.LongRunning) (You can press Windows+I to open the Settings application quickly. async public static void LengthyOperation(Control control, Action action) To find this option, head to Settings > Ease of Access > Cursor & Pointer. So the application remains responsive, even while the busy icon spins. Control returns to the caller while it waits. It runs the action as a task and waits for to finish. That disabled the control that launches the action and changes the application cursor.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |