Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When awaiting a method it is awaited until the cursor moves #306

Closed
timothyparez opened this issue Nov 19, 2019 · 30 comments
Closed

When awaiting a method it is awaited until the cursor moves #306

timothyparez opened this issue Nov 19, 2019 · 30 comments

Comments

@timothyparez
Copy link
Contributor

timothyparez commented Nov 19, 2019

I am probably just doing it the wrong way but the idea is
that I have one (or more) buttons which when pressed/clicked
load some data and display that data in a ListBox.

When I click the button the first time I can see the first WriteLine
and then the LoadItemsAsync method is awaited.

If I don't do anything it will just await forever.
When I click the button again or move focus to the next control
the awaited method completes and the next WriteLine is executed.

Update: If I move the mouse the awaited method also completes

I have tried without MainLoop.Invoke as well.
I'm guessing I am just handling this the wrong way.

Any suggestions?

button.Clicked += async () =>
{
    Application.MainLoop.Invoke (async () => {
            
        //When the button is 'clicked' the following is executed
        Debug.WriteLine($"Clicked the button");
        var items = await LoadItemsAsync();

        //However the following line is not executed
        //until the button is clicked again or
        //until the cursor is moved to the next view/control 
        Debug.WriteLine($"Got {items.Count} items)");                                                     
        itemsList.SetSource(items);

        //Without calling this the UI is not updated
        this.LayoutSubviews();                    
    });
};

System: Ubuntu 19.10

@BDisp
Copy link
Collaborator

BDisp commented Nov 19, 2019

@timothyparez Can you provide the code of what you want to do? I needed your code to look for more if I could make it available, of course. But in principle, the problem is that code is not executed because it is awaitable and will only execute after the execution of the asynchronous method. When the asynchronous method is fully executed it is in a different thread than the one in which it was called. Try the following code:

button.Clicked += async () => { 
				//When the button is 'clicked' the following is executed
				Debug.WriteLine ($"Clicked the button");
				using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource ()) {
					syncContextTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext ();
					await Task<List<string>>.Run (() => LoadItemsAsync (cancellationTokenSource.Token).Result).ContinueWith (task => {
						//However the following line is not executed
						//until the button is clicked again or
						//until the cursor is moved to the next view/control
						var items = task.Result;
						Debug.WriteLine ($"Got {items.Count} items)");
						itemsList.SetSource (items);

						//Without calling this the UI is not updated
						this.LayoutSubviews ();
					}, CancellationToken.None,
						TaskContinuationOptions.OnlyOnRanToCompletion,
						syncContextTaskScheduler);

				}
			};

@timothyparez
Copy link
Contributor Author

I'll take a look in the morning and I will try to provide a reproducing sample.
Will try your version as well, thnx!

@timothyparez
Copy link
Contributor Author

@BDisp I created a sample here:
https://github.com/timothyparez/gui.cs-issue-306

You can run it and hit the "Load Data" button once.
It will sit there forever until you do any of the following:

  • Hit the button again
  • Move the mouse
  • Move the focus to the ListView

@BDisp
Copy link
Collaborator

BDisp commented Nov 20, 2019

@timothyparez I'm working on it. ReadConsoleInput does not go well with Task.Delay (2000). However with Thread.Sleep (2000) it already works. Thanks.

@timothyparez
Copy link
Contributor Author

@BDisp The use of Task.Delay(2000) in this sample is just to simulate awaiting something.
In reality I am awaiting an async SQLite query: var people = await database.Table<Person>().ToListAsync();

@BDisp
Copy link
Collaborator

BDisp commented Nov 21, 2019

Yes I know. I'll try to solve that.

@BDisp
Copy link
Collaborator

BDisp commented Nov 22, 2019

timothyparez/gui.cs-issue-306#1
@timothyparez although it is working I noticed that it is not running asynchronously. I remain committed to trying to resolve this issue but if anyone else can contribute it would be great. In a windows forms or wpf project it works well, so I don't know if it's a gui limitation or if the asynchronous calling code isn't ideal for this gui.

@BDisp
Copy link
Collaborator

BDisp commented Nov 23, 2019

@timothyparez. After some investigation it seems that there is an explanation for the freeze in await Task.Delay (2000). In the execution of this statement, it goes back to the calling code that is also awaiting for a returning task from the called task resulting in a deadlock. When a key is pressed or the mouse is moved is like the caller code is wakeup and request for the awaiting called task to return and ends execution. If you are getting data from a database this freeze doesn’t happen because you are going awaiting from another method, rather the caller. Can you confirm if the freeze also happens when getting data from a async database task? Thanks.

@timothyparez
Copy link
Contributor Author

Hi,
So the original code, how I found the issue, looks like this:

var people = await database.Table<Person>().ToListAsync();

https://github.com/praeclarum/sqlite-net/blob/master/src/SQLiteAsync.cs

@BDisp
Copy link
Collaborator

BDisp commented Nov 23, 2019

@timothyparez, please confirm that freezing data from sqlite only happens the first time it is run. Subsequently, pressing the button normally loads the data without freezing.

@timothyparez
Copy link
Contributor Author

@BDisp It does not. Every time I load data I have to press enter twice (or move the mouse)

@timothyparez
Copy link
Contributor Author

@BDisp please take a look at my "binding" branch.
Added SQLite there.
It really seems that as soon as anything is awaited this issue occurs.

@BDisp
Copy link
Collaborator

BDisp commented Nov 25, 2019

@ timothyparez I just sent a PR to resolve this symptom. Please check if it works well.

9dd806f

@timothyparez
Copy link
Contributor Author

Ok will have a look. Also is there a place to contact you I have some questions.

@BDisp
Copy link
Collaborator

BDisp commented Nov 25, 2019

@timothypare I think on my github the contact appears. Check out https://github.com/bdisp/

@timothyparez
Copy link
Contributor Author

No contact info there :D

@BDisp
Copy link
Collaborator

BDisp commented Nov 25, 2019

I didn't even know. Now it is :)

@migueldeicaza
Copy link
Collaborator

In your case, you are adding a idle handler in response to the click to run on the UI thread - but you are already on the main thread.

You do not need that level of indirection.

The patch shown before that does Send + MainLoop is likely wrong, as this would invoke a method that is expected to run on the UI from the background

@BDisp
Copy link
Collaborator

BDisp commented Nov 25, 2019

Thank you. I already noticed that. Even Send invokes a synchronous execution. Already managed to overcome the await delay but the problem is that does not return to the UI until you press a key or a mouse movement. I keep trying to solve this but dealing with threads is always very slippery.

@BDisp
Copy link
Collaborator

BDisp commented Nov 25, 2019

@timothypare please try again with the fix submitted and give feedback if it causes anothers weirds behaviours

@timothyparez
Copy link
Contributor Author

In your case, you are adding a idle handler in response to the click to run on the UI thread - but you are already on the main thread.

You do not need that level of indirection.

The patch shown before that does Send + MainLoop is likely wrong, as this would invoke a method that is expected to run on the UI from the background

Are you referring to Application.MainLoop.Invoke (() => { ... }
I can remove that but the issue remains.

@timothyparez
Copy link
Contributor Author

@timothypare please try again with the fix submitted and give feedback if it causes anothers weirds behaviours

Sorry, which one?

@BDisp
Copy link
Collaborator

BDisp commented Nov 26, 2019

a683345
@timothyparez is the last one. I think it must always be the last. Someone said that changes submitted to an already submitted PR can always be done on the same PR. However, I had a doubt that I would be grateful if someone with true knowledge of the subject please clarify me. Must the changes be submitted based on the last submission, as it really was, or will I have to make the changes again from a new upstream/master checkout? Thanks in advance.

@BDisp
Copy link
Collaborator

BDisp commented Nov 26, 2019

In your case, you are adding a idle handler in response to the click to run on the UI thread - but you are already on the main thread.
You do not need that level of indirection.
The patch shown before that does Send + MainLoop is likely wrong, as this would invoke a method that is expected to run on the UI from the background

Are you referring to Application.MainLoop.Invoke (() => { ... }
I can remove that but the issue remains.

@timothyparez that @migueldeicaza comment was for me :)

@BDisp
Copy link
Collaborator

BDisp commented Nov 26, 2019

@timothyparez as you don't have a fork of this repository in your github, of course you have to check it out in my fork of this repository at https://github.com/BDisp/gui.cs. But that you may already know, just to remember :)

jmurth1234 added a commit to jmurth1234/IrcClientCore that referenced this issue Jan 24, 2020
migueldeicaza pushed a commit that referenced this issue Feb 29, 2020
* Fixed async/await hang

* Fixed async/await hang with calling Wakeup

* Moved Wake Up into lock statement
migueldeicaza added a commit that referenced this issue Mar 31, 2020
* Fixed key events traversal for modal dialogs

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Fixes culture info of DataField from pr #250

* Fixes the rectangle drawing issue

* Fixes #290 issue "Redraw issue when setting coordinates of label"

* Added sub menus into menu bar with mouse and key navigation

* Needed to assume color for the Disable attribute

* Added Colors.Menu.Disabled to CursesDriver.cs

* Mouse text selection with cut, copy and paste on text fields

* Change sepChar from char to string in DateField

* Adding a disabled menu item in the demo file

* Adding a disabled menu item in the demo file

* Fixes Button repainting issue when changing the text length to one smaller

* Fixes #290 issue "Redraw issue when setting coordinates of label"

* Only demonstration of issue # 308 that even though the cursor is gray on a gray background can be viewed.

* Fixes issue #163 "ScrollView does not render some content"

* Fixed bug in Button that caused a loop redraw calling TerminalResized

* Fixes #282 "Repaint Issue"

* Removed white space

* Mouse features added to FileDialog including wheel support.

* Forget to delete this commented method.

* Changing back to MouseFlags.AllEvents in case some mouse event is not triggering.

* Add documentation on ISupportInitialize/ISupportInitializeNotification (#286)

* Switch netcoreapp target to netstandard2.0 (#284)

Fixes #283 

Instead of adding another target framework to the list, switch from netcoreapp2.0 to netstandard2.0, as ns2.0 is a subset of netcoreapp.

* Added TextView.TextChanged event (#264)

* Fixed key events traversal for modal dialogs (#288)

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Prepare for 0.25

* Remove travis link

* Revert Daniel's change 00c5997 as it prevents the solution from building on Mac

* Prepare for 0.26

* Restore some files that were deleted by Daniel's commit that I had not restored

* Fixed out of range exception and text redraw when navigate backward (#320)

* Typo fix (#321)

* Fixes issue #306 async/await hang (#312)

* Fixed async/await hang

* Fixed async/await hang with calling Wakeup

* Moved Wake Up into lock statement

* Support menu items that are null so they can be drawn as a menu separator (#304)

* Fixed and Enabled Library reinitialization (#291)

- Replaced static driver initialization with property getter for reference passing in Core.cs::View class, this allows the library to be reinitialized at any time.
- Made the Shutdown method on Core.cs::Application class public, since there is no reason to keep it private. Applications can shutdown the library and revert the console to the initial stage by calling it.
- Fixed a memory-leak on Drivers/WindowsDriver class by destroying the generated screen buffers at library shutdown by calling CloseHandle.
- Minor change to Core.cs::Application.Init(Func<Toplevel>) for better initialization status tracking, via backend property instead of relying on the Top field.

* Moved `ListView.ListWrapper` out of `ListView` #313` (#315)

* Resizing the MessageBox width to accommodate all message text (#299)

* Fixed key events traversal for modal dialogs

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Resizing the MessageBox width to accommodate all message text

Co-authored-by: Adrian Alonso <[email protected]>

* Timefield format with bounds values (#303)

* Implemented lower and upper bounds to TimeField

* Passing old text to the Changed event handler

* Change sepChar from char to string in TimeField

* Changing comparison from ':' to sepChar.ToCharArray () [0]

* extract methods on ListView to make it controlable from other controls (#310)

* moveup

* MoveDown

* MovePageDown

* MovePageUp

* MarkUnmarkRow

* Allowing list items selection (#302)

* Prepare for 0.26

* Restore some files that were deleted by Daniel's commit that I had not restored

* Fixed out of range exception and text redraw when navigate backward (#320)

* Typo fix (#321)

* Fixes issue #306 async/await hang (#312)

* Fixed async/await hang

* Fixed async/await hang with calling Wakeup

* Moved Wake Up into lock statement

* Support menu items that are null so they can be drawn as a menu separator (#304)

* Fixed and Enabled Library reinitialization (#291)

- Replaced static driver initialization with property getter for reference passing in Core.cs::View class, this allows the library to be reinitialized at any time.
- Made the Shutdown method on Core.cs::Application class public, since there is no reason to keep it private. Applications can shutdown the library and revert the console to the initial stage by calling it.
- Fixed a memory-leak on Drivers/WindowsDriver class by destroying the generated screen buffers at library shutdown by calling CloseHandle.
- Minor change to Core.cs::Application.Init(Func<Toplevel>) for better initialization status tracking, via backend property instead of relying on the Top field.

* Moved `ListView.ListWrapper` out of `ListView` #313` (#315)

* Resizing the MessageBox width to accommodate all message text (#299)

* Fixed key events traversal for modal dialogs

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Resizing the MessageBox width to accommodate all message text

Co-authored-by: Adrian Alonso <[email protected]>

* Timefield format with bounds values (#303)

* Implemented lower and upper bounds to TimeField

* Passing old text to the Changed event handler

* Change sepChar from char to string in TimeField

* Changing comparison from ':' to sepChar.ToCharArray () [0]

* extract methods on ListView to make it controlable from other controls (#310)

* moveup

* MoveDown

* MovePageDown

* MovePageUp

* MarkUnmarkRow

* Allowing list items selection (#302)

* Add documentation on ISupportInitialize/ISupportInitializeNotification (#286)

* Switch netcoreapp target to netstandard2.0 (#284)

Fixes #283 

Instead of adding another target framework to the list, switch from netcoreapp2.0 to netstandard2.0, as ns2.0 is a subset of netcoreapp.

* Added TextView.TextChanged event (#264)

* Fixed key events traversal for modal dialogs (#288)

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Prepare for 0.25

* Remove travis link

* Revert Daniel's change 00c5997 as it prevents the solution from building on Mac

* Prepare for 0.26

* Restore some files that were deleted by Daniel's commit that I had not restored

* Fixed out of range exception and text redraw when navigate backward (#320)

* Typo fix (#321)

* Fixes issue #306 async/await hang (#312)

* Fixed async/await hang

* Fixed async/await hang with calling Wakeup

* Moved Wake Up into lock statement

* Support menu items that are null so they can be drawn as a menu separator (#304)

* Fixed and Enabled Library reinitialization (#291)

- Replaced static driver initialization with property getter for reference passing in Core.cs::View class, this allows the library to be reinitialized at any time.
- Made the Shutdown method on Core.cs::Application class public, since there is no reason to keep it private. Applications can shutdown the library and revert the console to the initial stage by calling it.
- Fixed a memory-leak on Drivers/WindowsDriver class by destroying the generated screen buffers at library shutdown by calling CloseHandle.
- Minor change to Core.cs::Application.Init(Func<Toplevel>) for better initialization status tracking, via backend property instead of relying on the Top field.

* Moved `ListView.ListWrapper` out of `ListView` #313` (#315)

* Resizing the MessageBox width to accommodate all message text (#299)

* Fixed key events traversal for modal dialogs

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Resizing the MessageBox width to accommodate all message text

Co-authored-by: Adrian Alonso <[email protected]>

* Timefield format with bounds values (#303)

* Implemented lower and upper bounds to TimeField

* Passing old text to the Changed event handler

* Change sepChar from char to string in TimeField

* Changing comparison from ':' to sepChar.ToCharArray () [0]

* extract methods on ListView to make it controlable from other controls (#310)

* moveup

* MoveDown

* MovePageDown

* MovePageUp

* MarkUnmarkRow

* Allowing list items selection (#302)

* Switch netcoreapp target to netstandard2.0 (#284)

Fixes #283 

Instead of adding another target framework to the list, switch from netcoreapp2.0 to netstandard2.0, as ns2.0 is a subset of netcoreapp.

* Added TextView.TextChanged event (#264)

* Prepare for 0.25

* Remove travis link

* Revert Daniel's change 00c5997 as it prevents the solution from building on Mac

* Prepare for 0.26

* Restore some files that were deleted by Daniel's commit that I had not restored

* Fixed out of range exception and text redraw when navigate backward (#320)

* Typo fix (#321)

* Fixes issue #306 async/await hang (#312)

* Fixed async/await hang

* Fixed async/await hang with calling Wakeup

* Moved Wake Up into lock statement

* Fixed and Enabled Library reinitialization (#291)

- Replaced static driver initialization with property getter for reference passing in Core.cs::View class, this allows the library to be reinitialized at any time.
- Made the Shutdown method on Core.cs::Application class public, since there is no reason to keep it private. Applications can shutdown the library and revert the console to the initial stage by calling it.
- Fixed a memory-leak on Drivers/WindowsDriver class by destroying the generated screen buffers at library shutdown by calling CloseHandle.
- Minor change to Core.cs::Application.Init(Func<Toplevel>) for better initialization status tracking, via backend property instead of relying on the Top field.

* Moved `ListView.ListWrapper` out of `ListView` #313` (#315)

* Resizing the MessageBox width to accommodate all message text (#299)

* Fixed key events traversal for modal dialogs

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Resizing the MessageBox width to accommodate all message text

Co-authored-by: Adrian Alonso <[email protected]>

* Timefield format with bounds values (#303)

* Implemented lower and upper bounds to TimeField

* Passing old text to the Changed event handler

* Change sepChar from char to string in TimeField

* Changing comparison from ':' to sepChar.ToCharArray () [0]

* extract methods on ListView to make it controlable from other controls (#310)

* moveup

* MoveDown

* MovePageDown

* MovePageUp

* MarkUnmarkRow

* Allowing list items selection (#302)

* Added sub menus into menu bar with mouse and key navigation

* Fetch from upstream/master

* Fetch from upstream/master

* Fetch from upstream/master

* Fetch from upstream/master

* Fetch from upstream/master

* Add documentation on ISupportInitialize/ISupportInitializeNotification (#286)

* Switch netcoreapp target to netstandard2.0 (#284)

Fixes #283 

Instead of adding another target framework to the list, switch from netcoreapp2.0 to netstandard2.0, as ns2.0 is a subset of netcoreapp.

* Added TextView.TextChanged event (#264)

* Fixed key events traversal for modal dialogs (#288)

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Prepare for 0.25

* Remove travis link

* Revert Daniel's change 00c5997 as it prevents the solution from building on Mac

* Prepare for 0.26

* Restore some files that were deleted by Daniel's commit that I had not restored

* Fixed out of range exception and text redraw when navigate backward (#320)

* Typo fix (#321)

* Fixes issue #306 async/await hang (#312)

* Fixed async/await hang

* Fixed async/await hang with calling Wakeup

* Moved Wake Up into lock statement

* Support menu items that are null so they can be drawn as a menu separator (#304)

* Fixed and Enabled Library reinitialization (#291)

- Replaced static driver initialization with property getter for reference passing in Core.cs::View class, this allows the library to be reinitialized at any time.
- Made the Shutdown method on Core.cs::Application class public, since there is no reason to keep it private. Applications can shutdown the library and revert the console to the initial stage by calling it.
- Fixed a memory-leak on Drivers/WindowsDriver class by destroying the generated screen buffers at library shutdown by calling CloseHandle.
- Minor change to Core.cs::Application.Init(Func<Toplevel>) for better initialization status tracking, via backend property instead of relying on the Top field.

* Moved `ListView.ListWrapper` out of `ListView` #313` (#315)

* Resizing the MessageBox width to accommodate all message text (#299)

* Fixed key events traversal for modal dialogs

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Resizing the MessageBox width to accommodate all message text

Co-authored-by: Adrian Alonso <[email protected]>

* Timefield format with bounds values (#303)

* Implemented lower and upper bounds to TimeField

* Passing old text to the Changed event handler

* Change sepChar from char to string in TimeField

* Changing comparison from ':' to sepChar.ToCharArray () [0]

* extract methods on ListView to make it controlable from other controls (#310)

* moveup

* MoveDown

* MovePageDown

* MovePageUp

* MarkUnmarkRow

* Allowing list items selection (#302)

* Fetch from upstream/master

* Fetch from upstream/master

* Fetch from upstream/master

* Add documentation on ISupportInitialize/ISupportInitializeNotification (#286)

* Switch netcoreapp target to netstandard2.0 (#284)

Fixes #283 

Instead of adding another target framework to the list, switch from netcoreapp2.0 to netstandard2.0, as ns2.0 is a subset of netcoreapp.

* Added TextView.TextChanged event (#264)

* Fixed key events traversal for modal dialogs (#288)

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Prepare for 0.25

* Remove travis link

* Revert Daniel's change 00c5997 as it prevents the solution from building on Mac

* Prepare for 0.26

* Restore some files that were deleted by Daniel's commit that I had not restored

* Fixed out of range exception and text redraw when navigate backward (#320)

* Typo fix (#321)

* Fixes issue #306 async/await hang (#312)

* Fixed async/await hang

* Fixed async/await hang with calling Wakeup

* Moved Wake Up into lock statement

* Support menu items that are null so they can be drawn as a menu separator (#304)

* Fixed and Enabled Library reinitialization (#291)

- Replaced static driver initialization with property getter for reference passing in Core.cs::View class, this allows the library to be reinitialized at any time.
- Made the Shutdown method on Core.cs::Application class public, since there is no reason to keep it private. Applications can shutdown the library and revert the console to the initial stage by calling it.
- Fixed a memory-leak on Drivers/WindowsDriver class by destroying the generated screen buffers at library shutdown by calling CloseHandle.
- Minor change to Core.cs::Application.Init(Func<Toplevel>) for better initialization status tracking, via backend property instead of relying on the Top field.

* Moved `ListView.ListWrapper` out of `ListView` #313` (#315)

* Resizing the MessageBox width to accommodate all message text (#299)

* Fixed key events traversal for modal dialogs

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Resizing the MessageBox width to accommodate all message text

Co-authored-by: Adrian Alonso <[email protected]>

* Timefield format with bounds values (#303)

* Implemented lower and upper bounds to TimeField

* Passing old text to the Changed event handler

* Change sepChar from char to string in TimeField

* Changing comparison from ':' to sepChar.ToCharArray () [0]

* extract methods on ListView to make it controlable from other controls (#310)

* moveup

* MoveDown

* MovePageDown

* MovePageUp

* MarkUnmarkRow

* Allowing list items selection (#302)

* Fetch from upstream/master

* Switch netcoreapp target to netstandard2.0 (#284)

Fixes #283 

Instead of adding another target framework to the list, switch from netcoreapp2.0 to netstandard2.0, as ns2.0 is a subset of netcoreapp.

* Added TextView.TextChanged event (#264)

* Prepare for 0.25

* Remove travis link

* Revert Daniel's change 00c5997 as it prevents the solution from building on Mac

* Prepare for 0.26

* Restore some files that were deleted by Daniel's commit that I had not restored

* Fixed out of range exception and text redraw when navigate backward (#320)

* Typo fix (#321)

* Fixes issue #306 async/await hang (#312)

* Fixed async/await hang

* Fixed async/await hang with calling Wakeup

* Moved Wake Up into lock statement

* Support menu items that are null so they can be drawn as a menu separator (#304)

* Fixed and Enabled Library reinitialization (#291)

- Replaced static driver initialization with property getter for reference passing in Core.cs::View class, this allows the library to be reinitialized at any time.
- Made the Shutdown method on Core.cs::Application class public, since there is no reason to keep it private. Applications can shutdown the library and revert the console to the initial stage by calling it.
- Fixed a memory-leak on Drivers/WindowsDriver class by destroying the generated screen buffers at library shutdown by calling CloseHandle.
- Minor change to Core.cs::Application.Init(Func<Toplevel>) for better initialization status tracking, via backend property instead of relying on the Top field.

* Moved `ListView.ListWrapper` out of `ListView` #313` (#315)

* Resizing the MessageBox width to accommodate all message text (#299)

* Fixed key events traversal for modal dialogs

The key must be propagated initially to the first chain element
before evaluating if we should stop because of the handled or
the Modal condition. Otherwise the modal dialog
won't get any process key notification.

This fixes c072e29

* Resizing the MessageBox width to accommodate all message text

Co-authored-by: Adrian Alonso <[email protected]>

* Timefield format with bounds values (#303)

* Implemented lower and upper bounds to TimeField

* Passing old text to the Changed event handler

* Change sepChar from char to string in TimeField

* Changing comparison from ':' to sepChar.ToCharArray () [0]

* extract methods on ListView to make it controlable from other controls (#310)

* moveup

* MoveDown

* MovePageDown

* MovePageUp

* MarkUnmarkRow

* Allowing list items selection (#302)

* Fetch from upstream/master

* Fixes #342 and improves color change interaction.
Usage:
Colors.Base.Normal = new Terminal.Gui.Attribute (Color.Green, Color.Black);

* Inserted new line at the end  of file .
Changed method name to SetAttribute in the  ColorScheme class.

* Prepare for 0.70

* Prepare for 0.70

* Prepare for 0.70

* Prepare for 0.70

* Prepare for 0.70

* Prepare for 0.70

* Prepare for 0.70

* Prepare for 0.70

* Timefield format with bounds values (#303)

* Implemented lower and upper bounds to TimeField

* Passing old text to the Changed event handler

* Change sepChar from char to string in TimeField

* Changing comparison from ':' to sepChar.ToCharArray () [0]

* Prepare for 0.70

* Removed duplicated Attribute Disabled property

* Fixed some bugs with the mouse event and text selection, copy, cut and paste. There is still a random failure in the mouse events that lock on button released and only trigger button clicked after moving the mouse.

* Failure behavior solved. It was a threading safe issue. Driver.Wakeup () moved to the Post method on MainLoopSyncContext class solved it.

* Changed the default for RightmostButtonPressed to Button4 and enabled  clicked-drag

* Added support for Button Triple Clicked too.  FileDialog changed to deal with ButtonClicked.

* Fixed a bug with the timer when dragging.

* Fixes #343 - Added AllowsMultipleSelection to the ListView

* Fixes #346 issue with enhancers characters, but it only could be apply after the pull requests at NStack are merged because of the Rune.ColumnWidth error.

* Fixes code format.

* Enabled Button Pressed with ReportMousePosition simultaneously.

* Dragging is already working. TODO: optimize, only SetNeedsDisplay on the before/after regions.

* Fixes the extra characters that remains in case the new text length is smaller than the older.

* Fixes #349 TextField user typed input no longer fires Changed event.

* Includes ControlKeyState for all the buttons events.

* Added SetSourceAsync to ListView

* Menu enhancement that works well, even if the top level has no other views. Working in further feature that if clicked outside of the menu it will closed.

* Some more features in mouse and in core.

* Added more mouse events flags, drag features, toplevel color and more...

* Remove unnecessary SetNeedsDisplay.

* Fixes a bug in the label

* Added StatusBar from pr #201 with a  little change.

* Added features to TextField like mouse selection with copy, cut and paste shortcut keys. Now it's possible to use the combination of the Alt+Control+delta keys. It also be possible use special characters like €.

* Simplifying the menu with better performance.

* Private keyword dropped in all files and added some documentation.

* Changed demo to reflect the added and changes features.

* Added csproj and config files to verify if it won't trigger errors from Travis.

* Demo with the StatusBar.

* Patch for position of the StatusBar

* Removed unnecessary nugget packages.

* It looks like packages.config files are obsolete. Travis verification test.

* Update Designer.csproj

Use Stack 0.14

* Use NStack 0.14

* Use NStack 0.14

* Use NStack 0.14

* Use NStack 0.14

* Changed the NStack.Core and System.ValueTuple versions.

* Added System.ValueTuple to Example project.

* Remove System.ValueTuple and added NETStandard.Library to Example project.

* Try to restore the nuget packages.

* Revert "Try to restore the nuget packages."

This reverts commit 3957e02.

* Added NETStandard.Library ti the root packages.config

* Upgrade to "Microsoft.NETCore.Platforms" version="
2.0.1"

* Added <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

* Targeting framework 472.

* Removed "System.ValueTuple" Version="4.5.0" from Terminal.Gui project.

* More cleaning to the projects.

* I guess you don't need this.

Co-authored-by: Adrian Alonso <[email protected]>
Co-authored-by: Daniel Cazzulino <[email protected]>
Co-authored-by: Marius Ungureanu <[email protected]>
Co-authored-by: miguel <[email protected]>
Co-authored-by: Miguel de Icaza <[email protected]>
Co-authored-by: imaras <[email protected]>
Co-authored-by: Kasper B. Graversen <[email protected]>
Co-authored-by: Fabian R <[email protected]>
Co-authored-by: Timothy <[email protected]>
@BDisp
Copy link
Collaborator

BDisp commented Aug 3, 2020

This is already fixed and may be closed.

@TylerReid
Copy link

@BDisp I believe this is still an issue, or is maybe just me not understanding how it is supposed to work. I find that when I do an async task, it does not happen until I move the mouse or type.

Here is an example of in a constructor where I am trying to do an async load of data and here is an example where as a part of click and key event handlers I want to perform some async action

This also happens in the UI catalog threading example, with this label saying you need to type to get things to load So is this working as intended or is there some issue?

I have found that in general async and UI things don't play well together so its likely I am doing something dumb, but I don't see an alternative in the docs or in my application since I have to use async because that is what .net provides for http requests.

@BDisp
Copy link
Collaborator

BDisp commented Sep 21, 2023

@TylerReid I supposing you are using Linux or macOS and so running the CursesDriver. If it's the case I really broken the threading feature on this driver, when I fixed a unix console resize issue. I already submitted two PR to fix this, #2848 for the v1 and the #2849 for the v2. Checkout the desired PR and run against it instead of the nuget package. After testing please give some feedback. Thanks.

@TylerReid
Copy link

@BDisp amazingly quick response! and yes this is on a mac. Now that I think about it when I was testing on windows I don't remember this happening so I believe you are correct. I will try to check out the PR branch version. Thanks for help.

@BDisp
Copy link
Collaborator

BDisp commented Sep 21, 2023

You welcome. Do you are using a macOS Ventura? If affirmative, can you test and confirm this issue #2860, please? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants