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

Add GlobalObject.EditAsync like the Dialog.ShowAsync #390

Open
KirillBorunov opened this issue Nov 25, 2021 · 2 comments
Open

Add GlobalObject.EditAsync like the Dialog.ShowAsync #390

KirillBorunov opened this issue Nov 25, 2021 · 2 comments
Labels
area-GM Issues related to SampSharp.GameMode feature
Milestone

Comments

@KirillBorunov
Copy link
Contributor

It would be great to work with the object edit awaiting it instead of using events. Just like in the dialogs.

Example:

await myObject.EditAsync();
Console.WriteLine("Finished editing");
@ikkentim
Copy link
Owner

Great idea, I'll look into it.

@ikkentim ikkentim added feature area-GM Issues related to SampSharp.GameMode labels Mar 25, 2022
@ikkentim ikkentim added this to the 0.11.0 milestone Mar 26, 2022
@nathan130200
Copy link

An temporary work around, you can use TaskCompletitionSource<TResult> in events to handle that.

var tcs = new TaskCompletitionSource();

SomeEventHandler handler = null;

handler = (sender, args) => 
{
 //do stuff
  obj.SomeEvent -= handler;
  tcs.TrySetResult(); // notify to complete task.
};

obj.SomeEvent += handler;

await tcs.Task;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-GM Issues related to SampSharp.GameMode feature
Projects
None yet
Development

No branches or pull requests

3 participants