public PageSummary(DataSummary summary) { InitializeComponent(); dataSummary = summary; HelpTextBlock.Text = dataSummary.SummaryForDisplay(); }
private void CalculateButton_OnClick(object sender, RoutedEventArgs e) { // -- Need Calculator object as non static var calculator = new Calculator(); try { var controlData = false; controlData = ControlHasValueCheck(); if (controlData) { // -- Get base data needed for room and tile tile = GetSelectedTile(); room = HarvestData(); // -- create a DataSummary object to hold calculation outcomes // -- This object will be passed to the PageSummary page // -- and then displayed in the TextBlock var dataForSummary = new DataSummary() { WholeRoomArea = RoomAreas.WholeRoomArea(room).ToString(), Cutout1Area = RoomAreas.AreaCutout1(room).ToString(), Cutout2Area = RoomAreas.AreaCutout2(room).ToString(), TileSizeUsed = selectedTileName, TilesNeededForRoom = calculator.NumberTilesForFloor(room, tile).ToString(), LeftoverTileArea = calculator.AreaLeftoverTile(room, tile).ToString(), PerimeterLength = RoomAreas.RoomPerimeter(room).ToString() }; dataSummary = dataForSummary; // -- DEBUG Test message MessageBox.Show(dataSummary.SummaryForDisplay()); // -- Navigate to PageSummary with the dataSummary object var pageSummary = new PageSummary(dataSummary); var navigationService = NavigationService; if (navigationService != null) { navigationService.Navigate(pageSummary); } } else { MessageBox.Show("Some data is missing. Please check"); } } catch (Exception exception) { Console.WriteLine(exception); throw; } }