Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am using WPF Form Application in C # programming language. I have homework about MVP (Models-View-Presenter). I found a sample project in the Windows

I am using WPF Form Application in C # programming language. I have homework about MVP (Models-View-Presenter). I found a sample project in the Windows Form Application in C # language. I wrote the codes in the sample project to my own project. But I got a few errors. There is no change in the codes I share, I wrote the same.

In summary; Convert the same codes to WPF.

Windows Form Applicaton in C # >>>>>> WPF Form Application in C # It needs to be transformed.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

PLACES I HAVE FAILED;

*** There is an error in the "RectanglePresenter" code in "RectanglePresenter.cs".

ERROR: Inconsistent accessibility: The 'Rectangle' parameter type is less accessible than the 'Rectangle Presenter.Rectangle Presenter (Rectangle)' method.

*** "Return lblArea.Text;" in "MainWindows.cs" and "lblArea.Text = value;" There are two errors.

ERROR: The 'Label' does not contain a 'Text' definition and no accessible 'Text' extension method was found that accepts a first argument of type 'Label' (could your use-directive or compilation reference be missing?)

I want the screen output as in the picture below. BUT must be created by applying MVP(Model-View-Presenter).

image text in transcribed

I would be glad if you solve minor mistakes. Thank you from now.

IRectangle.cs Rectangle.cs + x FindingSourceElement.Models. Rectangle Length MainWindow.cs* MainWindow.xaml RectanglePresenter.cs C# FindingSourceElement using System; using System.Collections.Generic; using System.Text; Lusing System.Linq; namespace FindingSourceElement.Models 9 1 bavuru class Rectangle { 2 bavuru public double Length { get; set; } 2 bavuru public double Breadth { get; set; } 10 11 12 1 bavuru public double CalculateArea() 13 14 15 return Length * Breadth; 16 17 18 19 IRectangle.cs + x Rectangle.cs FindingSourceElement Views.Rectangle Length Text MainWindow.cs* MainWindow.xaml RectanglePresenter.cs C# FindingSourceElement Gusing System; using System.Collections.Generic; using System.Text; Lusing System.Linq; namespace FindingSourceElement. Views { 3 bavuru interface IRectangle 8 9 10 2 bavuru string LengthText { get; set; } 2 bavuru string BreadthText { get; set; } 2 bavuru string AreaText { get; set; } 11 12 13 14 15 - CalculateArea) MainWindow.cs* MainWindow.xaml RectanglePresenter.cs + X Rectangle.cs Rectangle.cs C# FindingSourceElement FindingSourceElement.Presenter.RectanglePresenter 2 using System.Collections.Generic; 3 using System.Text; 4 using System.Linq; 5 using FindingSourceElement.Views; 6 using FindingSourceElement.Models; 7 8 namespace FindingSourceElement Presenter 9 2 bavuru 10 public class RectanglePresenter 11 12 IRectangle rectangleView; 13 1 bavuru 14 public RectanglePresenter(IRectangle view) 15 16 rectangleView = view; 17 } 18 1 bavuru 19 public void CalculateArea() 20 21 Rectangle rectangle = new Rectangle(); 22 rectangle.Length = double.Parse(rectangleView.LengthText);|| 23 rectangle Breadth = double.Parse(rectangleview. BreadthText); 24 rectangleView.AreaText = rectangle.CalculateArea().ToString(); 26 27 29 30 MainWindow.cs* MainWindow.xaml + x RectanglePresenter.cs IRectangle.cs Rectangle.cs MainWindow Button 1 Button 2 Button 3 Length: TextBox Breadth: TextBox Calculate Area Output: DE 98,1% c fx !!! +9 Tasarm t XAMLE o Window - Window 9 10 16 17 19 20 21 22 23 24 25 IRectangle.cs Rectangle.cs FindingSourceElement.MainWindow - Area Text MainWindow.cs* + X MainWindow.xaml RectanglePresenter.cs C# FindingSourceElement 4 Gusing System.Windows; using System.Windows.Controls; using FindingSourceElement.Views; 7 using FindingSourceElement.Presenter; 8 5 6 9 10 11 12 13 14 Onamespace FindingSourceElement { /// Interaction logic for MainWindow.xaml /// 2 bavuru public partial class MainWindow : Window, IRectangle 15 16 O bavuru public MainWindow() 17 18 19 20 21 InitializeComponent(); } 2 bavuru public string LengthText get return txtLength.Text; 22 23 24 25 26 27 28 29 30 31 set txtLength.Text = value; 33 2 bavuru public string BreadthText { get { return txtBreadth. Text; 34 35 36 37 38 39 40 41 42 43 44 45 set txtBreadth.Text = value; 2 bavuru public string AreaText 46 108 % 2 2 bavuru public string AreaText { get { return lblArea.Text; } set { 1blArea.Text = value; } } 1 bavuru private void button1_Click(object sender, RoutedEventArgs e) { RectanglePresenter presenter = new RectanglePresenter(this); presenter.CalculateArea(); Formi 0 Length: 2 Breadth: Calculate Area 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions