/// <summary> /// HookEvents hooks the events of the View to the /// logic of the ViewModel. /// </summary> /// <param name="view">The View to hook the events</param> public void HookEvents(PagePotstatLaserView view) { //Save the View in the member variable for //focusing on it later this._view = view; //Hook the events view.Selected += new RoutedEventHandler(view_Selected); }
/// <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; }