Wait for preloading to finish during startup. Some of the following options may not work for Steam version.ĭisables the animated intro along with the sound.Multiple command lines should be separated by a space.Add options to the Target: ".\Path of Exile\Client.exe", after the quotes.Public void HandleEvent(object sender, object eventArgs, string eventName) => EventManagerService.HandleEvent(eventName, sender, eventArgs, _eventHandlers) Public void RemoveEventHandler(Delegate handler, string eventName = "")ĮventManagerService.RemoveEventHandler(eventName, handler.Target, handler.GetMethodInfo(), _eventHandlers) Throw new ArgumentNullException(nameof(handler)) ĮventManagerService.AddEventHandler(eventName, handler.Target, handler.GetMethodInfo(), _eventHandlers) Throw new ArgumentNullException(nameof(eventName)) Public void AddEventHandler(Delegate handler, string eventName = "") Readonly Dictionary> _eventHandlers = new Dictionary>() / Weak event manager that allows for garbage collection when the EventHandler is still subscribed #pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of voidĪwait task.ConfigureAwait(continueOnCapturedContext) Ĭatch (System.Exception ex) when (onException != null) Public static async void SafeFireAndForget(this task, bool continueOnCapturedContext = true, System.Action onException = null) #pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void ![]() Inspired by John Thiriet's blog post, "Removing Async Void". / Safely execute the Task without waiting for it to complete before moving to the next line of code commonly known as "Fire And Forget". Void ICommand.Execute(object parameter) => _execute().SafeFireAndForget(_continueOnCapturedContext, _onException) Public Task ExecuteAsync() => _execute() Public void RaiseCanExecuteChanged() => _weakEventManager.HandleEvent(this, EventArgs.Empty, nameof(CanExecuteChanged)) Public bool CanExecute(object parameter) => _canExecute(parameter) If the command does not require data to be passed, this object can be set to null. / true, if this command can be executed otherwise, false. / Determines whether the command can execute in its current state ![]() Remove => _weakEventManager.RemoveEventHandler(value) Public event EventHandler CanExecuteChangedĪdd => _weakEventManager.AddEventHandler(value) / Occurs when changes occur that affect whether or not the command should execute _continueOnCapturedContext = continueOnCapturedContext _execute = execute ? throw new ArgumentNullException(nameof(execute), $" cannot be null") If set to false continue on a different context this will allow the Synchronization Context to continue on a different thread / If set to true continue on captured context this will ensure that the Synchronization Context returns to the calling thread. If onException is null, the exception will be re-thrown / If an exception is thrown in the Task, onException will execute. / The Function that verifies whether or not AsyncCommand should execute. This does not check canExecute before executing and will execute even if canExecute is false / The Function executed when Execute or ExecuteAysnc is called. / Initializes a new instance of the class. ![]() Readonly WeakEventManager _weakEventManager = new WeakEventManager() Readonly bool _continueOnCapturedContext Public sealed class AsyncCommand : IAsyncCommand Allows Commands to safely be used asynchronously with Task. This implementation was inspired by Thiriet's blog post, "Going Async With AsyncCommand". Here is an implementation of AsyncCommand that I created for this NuGet Package: AsyncAwaitBestPractices.MVVM.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |