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) async public static void LengthyOperation(Control control, Action action) ![]() I think that it is used to call members and functions (like the equivalent of the. I was reading the chapter on pointers and the -> (arrow) operator came up without explanation. So the application remains responsive, even while the busy icon spins. I am reading a book called 'Teach Yourself C in 21 Days' (I have already learned Java and C so I am moving at a much faster pace). 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. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |