Fix CanGenerate
This commit is contained in:
@@ -6,10 +6,13 @@ namespace LaDOSE.DesktopApp.Utils
|
|||||||
{
|
{
|
||||||
public static class WpfUtil
|
public static class WpfUtil
|
||||||
{
|
{
|
||||||
public static void AddUI<T>(this ICollection<T> collection, T item)
|
public static void AddUI<T>(this ICollection<T> collection, T item, Action action = null)
|
||||||
{
|
{
|
||||||
Action<T> addMethod = collection.Add;
|
Action<T> addMethod = collection.Add;
|
||||||
Application.Current.Dispatcher.BeginInvoke(addMethod, item);
|
Application.Current.Dispatcher.BeginInvoke(addMethod, item);
|
||||||
|
if(action!=null)
|
||||||
|
Application.Current.Dispatcher.BeginInvoke(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,13 +72,14 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
Players.Clear();
|
Players.Clear();
|
||||||
PlayersOptions.Clear();
|
PlayersOptions.Clear();
|
||||||
|
|
||||||
Task.Factory.StartNew(LoadPlayers, TaskCreationOptions.LongRunning).ContinueWith(t => { },
|
Task.Factory.StartNew(LoadPlayers, TaskCreationOptions.LongRunning).ContinueWith(
|
||||||
CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted,
|
t => { NotifyOfPropertyChange(() => this.CanGenerate); },
|
||||||
|
CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion,
|
||||||
TaskScheduler.FromCurrentSynchronizationContext());
|
TaskScheduler.FromCurrentSynchronizationContext());
|
||||||
NotifyOfPropertyChange(() => SelectedGame);
|
NotifyOfPropertyChange(() => SelectedGame);
|
||||||
NotifyOfPropertyChange(() => this.CanGenerate);
|
|
||||||
NotifyOfPropertyChange(() => Players);
|
NotifyOfPropertyChange(() => Players);
|
||||||
NotifyOfPropertyChange(() => PlayersOptions);
|
NotifyOfPropertyChange(() => PlayersOptions);
|
||||||
|
NotifyOfPropertyChange(() => this.CanGenerate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,13 +197,9 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
var findUser = FindUser(SelectedWpEvent.Id, SelectedGame);
|
var findUser = FindUser(SelectedWpEvent.Id, SelectedGame);
|
||||||
var findUser2 = FindUser(SelectedWpEvent.Id, SelectedGame,true);
|
var findUser2 = FindUser(SelectedWpEvent.Id, SelectedGame,true);
|
||||||
|
|
||||||
findUser.ForEach((e) => this.Players.AddUI(e));
|
findUser.ForEach((e) => this.Players.AddUI(e,()=>NotifyOfPropertyChange(() => this.CanGenerate)));
|
||||||
findUser2.ForEach((e) => this.PlayersOptions.AddUI(e));
|
findUser2.ForEach((e) => this.PlayersOptions.AddUI(e));
|
||||||
//this.RestService.GetUsers(SelectedWpEvent.Id, SelectedGame.Id)
|
|
||||||
// .ForEach((e) => this.Players.AddUI(e));
|
|
||||||
//this.RestService.GetUsersOptions(SelectedWpEvent.Id, SelectedGame.Id)
|
|
||||||
// .ForEach((e) => this.PlayersOptions.AddUI(e));
|
|
||||||
NotifyOfPropertyChange(() => this.CanGenerate);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user