protected override IPromise<object, Exception> LoadChildrenAsync() { var promise = Utility.ExecuteAsync(_site.IncludeRootWeb().LoadAsync()); promise.Done(() => { var rootWeb = _site.GetRootWeb(); var viewModel = new SPWebViewModel(rootWeb, this) {IsExpanded = true}; Children.Add(viewModel); }); promise.Fail(OnFail); return promise; }
protected override IPromise<object, Exception> LoadChildrenAsync() { var promise = Utility.ExecuteAsync(_web.IncludeWebs().LoadAsync()); promise.Done(() => { var webs = _web.GetWebs(); Name = $"Webs ({webs.Length})"; foreach (var web in webs.OrderBy(w => w.Web.Title)) { var w = web; Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Background, new Action(() => { var viewModel = new SPWebViewModel(w, this); Children.Add(viewModel); })); } }); return promise; }
/// <summary> /// Initializes a new instance of the SiteItemViewModel class. /// </summary> protected SPSiteFieldCollectionViewModel(SPWebViewModel parent, bool lazyLoadChildren) : base(parent, lazyLoadChildren) { }
public SPSiteFieldCollectionViewModel(SPClientWeb web, SPWebViewModel parent) : this(parent, true) { if (web == null) throw new ArgumentNullException(nameof(web)); _web = web; }
/// <summary> /// Initializes a new instance of the SiteItemViewModel class. /// </summary> protected SPWebContentTypeCollectionViewModel(SPWebViewModel parent, bool lazyLoadChildren) : base(parent, lazyLoadChildren) { }