public static async void AddOnUi(this MapleDictionary collection, Title item) { var action = new Action(() => collection.Add(item)); if (Application.Current == null) { action.DynamicInvoke(); } else { await Application.Current.Dispatcher.BeginInvoke(action); } }
public static void AddOnUI(this MapleDictionary collection, Title item) { var add = new Action(() => collection.Add(item)); Application.Current.Dispatcher.BeginInvoke(add); }
public static object AddOnUI(this MapleDictionary collection, Title item) { var add = new Action(() => collection.Add(item)); return(Application.Current?.Dispatcher.BeginInvoke(add) ?? add.DynamicInvoke()); }