/// <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
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor for Display Form
        /// </summary>
        public DisplayForm()
        {
            InitializeComponent();

            viewModel = App.MainViewModel.SelectedItemDisplayViewModelInstance;
            if (!viewModel.IsInitialized)
            {
                viewModel.InitializationCompleted += new EventHandler <InitializationCompletedEventArgs>(OnViewModelInitialization);
                viewModel.Initialize();
            }
            else
            {
                this.DataContext = viewModel;
            }
        }
        /// <summary>
        /// Constructor for Display Form
        /// </summary>
        public DisplayForm()
        {
            InitializeComponent();

            viewModel = App.MainViewModel.SelectedItemDisplayViewModelInstance;
            if (!viewModel.IsInitialized)
            {
                viewModel.InitializationCompleted += new EventHandler<InitializationCompletedEventArgs>(OnViewModelInitialization);
                viewModel.Initialize();
            }
            else
            {
                this.DataContext = viewModel;
            }
        }
        /// <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 });
        }