/// <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["BdcIdentity"].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.MainViewModel.SelectedItemDisplayViewModelInstance;
            if (!viewModel.IsInitialized)
            {
                viewModel.InitializationCompleted += new EventHandler<InitializationCompletedEventArgs>(OnViewModelInitialization);
                viewModel.Initialize();
            }

            this.DataContext = viewModel;
        }
Ejemplo n.º 3
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();
            }

            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["BdcIdentity"].ToString(), DataProvider = this.DataProvider };
                displayViewModel.Initialize();

                displayViewModelCollection.Add(displayViewModel);
            }

            OnViewDataLoaded(this, new ViewDataLoadedEventArgs { ViewName = e.ViewName, ViewData = displayViewModelCollection });
        }