예제 #1
0
        /// <summary>
        /// SetupItems creates all of the pages in the
        /// Wizard and hooks them to ViewModels.
        /// </summary>
        private void SetupItems()
        {
            //Create a List to hold the WizardPages
            ObservableCollection <WizardPage> list = new ObservableCollection <WizardPage>();

            //Add the Boundary Page
            PageBoundaryViewModel boundVM = this._unity.Resolve <PageBoundaryViewModel>();
            PageBoundaryView      pbv     = this._unity.Resolve <PageBoundaryView>();

            boundVM.NewSpectrumInfo = this.NewSpectrumInfo;
            boundVM.HookEvents(pbv);
            pbv.DataContext = boundVM;
            list.Add(pbv);

            //Add the Potstat / Laser properties Page
            PagePotstatLaserViewModel potstatVM = this._unity.Resolve <PagePotstatLaserViewModel>();
            PagePotstatLaserView      potstatV  = this._unity.Resolve <PagePotstatLaserView>();

            potstatVM.NewSpectrumInfo = this.NewSpectrumInfo;
            potstatVM.HookEvents(potstatV);
            potstatV.DataContext = potstatVM;
            list.Add(potstatV);

            //Add the File Open Page
            PageFileOpenViewModel fileVM = this._unity.Resolve <PageFileOpenViewModel>();
            PageFileOpenView      pfov   = this._unity.Resolve <PageFileOpenView>();

            fileVM.NewSpectrumInfo = this.NewSpectrumInfo;
            fileVM.HookEvents(pfov);
            pfov.DataContext = fileVM;
            list.Add(pfov);

            //Add the Finish Page
            PageFinishViewModel finishVM = this._unity.Resolve <PageFinishViewModel>();
            PageFinishView      pfv      = this._unity.Resolve <PageFinishView>();

            finishVM.NewSpectrumInfo = this.NewSpectrumInfo;
            finishVM.HookEvents(pfv);
            pfv.DataContext = finishVM;
            list.Add(pfv);

            //Assign the value
            this.ItemsSource = list;
        }
예제 #2
0
 /// <summary>
 /// HookEvents hooks the events of the WizardPage to
 /// methods on the ViewModel.
 /// </summary>
 /// <param name="view">The View on which to hook events</param>
 public void HookEvents(PageFileOpenView view)
 {
     //Hook the events
     view.Selected += new System.Windows.RoutedEventHandler(view_Selected);
 }