Example #1
0
 /// <summary>
 /// HookEvents hooks the events of the View to the
 /// Methods of the ViewModel.
 /// </summary>
 /// <param name="view">The View to hook events</param>
 public void HookEvents(PageBoundaryView view)
 {
     //Hook the events
     view.Selected   += new RoutedEventHandler(view_Selected);
     view.Unselected += new RoutedEventHandler(view_Unselected);
     view.initialPosUD.ButtonClicked += new UpDown2DButtonClickEventHandler(initialPosUD_ButtonClicked);
     view.finalPosUD.ButtonClicked   += new UpDown2DButtonClickEventHandler(finalPosUD_ButtonClicked);
 }
Example #2
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;
        }