/// <summary> /// Edit the selected office /// </summary> /// <param name="item">user item</param> private void ExecuteEditCommand(Office office) { if (OfficeEditionRequested != null) { OfficeViewModel OfficeViewModel = new OfficeViewModel(); OfficeViewModel.OnSaveCompleted += Model_OnSaveCompleted; OfficeViewModel.Initialize(office,_context,true); OfficeEditionRequested(this, new ContextEditionEventArgs<OfficeViewModel>(OfficeViewModel)); } }
/// <summary> /// Execute the click event of the button new /// </summary> private void ExecuteNewCommand() { Office office = new Office(); OfficeViewModel officeViewModel = new OfficeViewModel(); if (OfficeEditionRequested != null) { officeViewModel.OnSaveCompleted += Model_OnSaveCompleted; officeViewModel.Initialize(office,_context); OfficeEditionRequested(this, new ContextEditionEventArgs<OfficeViewModel>(officeViewModel)); } }
void OnWindowsLoaded(object sender, RoutedEventArgs e) { _model = DataContext as OfficeViewModel; Loaded -= OnWindowsLoaded; }