private void equipment_info_Click(object sender, RoutedEventArgs e) { ResourceItem equipment = (ResourceItem)(sender as Button).DataContext; StaffWindow window = (StaffWindow)Window.GetWindow(this); window.goToEquipmentPage(equipment.Resource); }
private void equipment_info_Click(object sender, RoutedEventArgs e) { // Go to selected equipment's page ElectronicResources equipment = (ElectronicResources)(sender as Button).DataContext; StaffWindow window = (StaffWindow)Window.GetWindow(this); window.goToEquipmentPage(equipment); }
private void create_equipment_button_Click(object sender, RoutedEventArgs e) { try { checkMandatoryFields(); // Change filename and produce it's new complete path String RunningPath = AppDomain.CurrentDomain.BaseDirectory; String name = equipment_name.Text + "_" + equipment_manufacturer.Text + "_" + equipment_model.Text; name.Replace(" ", ""); String imagePath = string.Format("{0}images\\", System.IO.Path.GetFullPath(System.IO.Path.Combine(RunningPath, @"..\..\"))) + name + System.IO.Path.GetExtension(fileName); MessageBoxResult confirm = MessageBox.Show( "Do you confirm the creation of the equipment?", "Equipment Creation Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question ); if (confirm == MessageBoxResult.Yes) { SubmitEquipment(imagePath); // Copy image file to project path System.IO.File.Copy(fileName, imagePath, true); MessageBox.Show("Equipment has been successfully added!"); // Go to created equipment's page StaffWindow window = (StaffWindow)Window.GetWindow(this); window.goToEquipmentPage(_equipment, true); } } catch (SqlException exc) { Helpers.ShowCustomDialogBox(exc); } catch (Exception exc) { MessageBox.Show(exc.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }