/// <summary> /// Code to execute when a SharePoint View has been loaded completely. /// </summary> /// <param name="e" /> private void OnLoadViewDataCompleted(LoadViewCompletedEventArgs e) { IsBusy = false; if (e.Error != null) { OnViewDataLoaded(this, new ViewDataLoadedEventArgs { ViewName = e.ViewName, Error = e.Error }); return; } //Create a collection of DisplayItemViewModels ObservableCollection <DisplayItemViewModel> displayViewModelCollection = new ObservableCollection <DisplayItemViewModel>(); foreach (ListItem item in e.Items) { DisplayItemViewModel displayViewModel = new DisplayItemViewModel { ID = item.Id.ToString(), DataProvider = this.DataProvider }; displayViewModel.Initialize(); displayViewModelCollection.Add(displayViewModel); } OnViewDataLoaded(this, new ViewDataLoadedEventArgs { ViewName = e.ViewName, ViewData = displayViewModelCollection }); }
/// <summary> /// Constructor for Display Form /// </summary> public DisplayForm() { InitializeComponent(); viewModel = App.PrimaryViewModel.SelectedItemDisplayViewModelInstance; if (!viewModel.IsInitialized) { viewModel.InitializationCompleted += new EventHandler <InitializationCompletedEventArgs>(OnViewModelInitialization); viewModel.Initialize(); } else { this.DataContext = viewModel; } //this.txtID.Text = viewModel.ID; //TEST! }
/// <summary> /// Constructor for Display Form /// </summary> public DisplayForm() { InitializeComponent(); viewModel = App.PrimaryViewModel.SelectedItemDisplayViewModelInstance; if (!viewModel.IsInitialized) { viewModel.InitializationCompleted += new EventHandler<InitializationCompletedEventArgs>(OnViewModelInitialization); viewModel.Initialize(); } else { this.DataContext = viewModel; } //this.txtID.Text = viewModel.ID; //TEST! }
/// <summary> /// Code to execute when a SharePoint View has been loaded completely. /// </summary> /// <param name="e" /> private void OnLoadViewDataCompleted(LoadViewCompletedEventArgs e) { IsBusy = false; if (e.Error != null) { OnViewDataLoaded(this, new ViewDataLoadedEventArgs { ViewName = e.ViewName, Error = e.Error }); return; } //Create a collection of DisplayItemViewModels ObservableCollection<DisplayItemViewModel> displayViewModelCollection = new ObservableCollection<DisplayItemViewModel>(); foreach (ListItem item in e.Items) { DisplayItemViewModel displayViewModel = new DisplayItemViewModel { ID = item.Id.ToString(), DataProvider = this.DataProvider }; displayViewModel.Initialize(); displayViewModelCollection.Add(displayViewModel); } OnViewDataLoaded(this, new ViewDataLoadedEventArgs { ViewName = e.ViewName, ViewData = displayViewModelCollection }); }