private CommandItemBase CreateCommand() { var createItems = _modelFunction.GetFunction <List <TreeItem> >(); if (createItems != null) { return(new AsyncCommandItem <TModel, List <TreeItem> >(BeginLoad, createItems, SyncItems) { Source = Model, Caption = "载入子级", Image = Application.Current.Resources["async_Executing"] as BitmapImage, }); } var loadChildren = _modelFunction.GetFunction <IList>(); if (loadChildren != null) { return(new AsyncCommandItem <TModel, IList>(BeginLoad, loadChildren, SyncItems) { Source = Model, Caption = "载入子级", Image = Application.Current.Resources["async_Executing"] as BitmapImage, }); } return(null); }
private ICommand CreateCommand() { var createItems = _modelFunction.GetFunction <List <TreeItem> >(); var haseAction = _modelFunction.GetFunction <bool>() ?? (p => false); if (createItems != null) { return(new AsyncCommand <TModel, List <TreeItem> >(BeginLoad, createItems, SyncItems, haseAction) { Parameter = Model }); } var loadChildren = _modelFunction.GetFunction <IList>(); if (loadChildren != null) { return(new AsyncCommand <TModel, IList>(BeginLoad, loadChildren, SyncItems, haseAction) { Parameter = Model }); } return(DelegateCommand.EmptyCommand); }