Relative Content

Tag Archive for c#.netwpf

How do I write a HTTPS Client request code properly in C#?

I have written this HTTPS Client code to get data from NSE Server.
On button click, the code is expected to send a request to the Server and get data in return.
Half the times when I click the button I don’t get data from the Server, and it returns me Status Code 401 – Unauthorized. But other half of the times when I click the button, the server returns me the required data and a Status Code 200.

How does the `CalculateButton_Click` method validate and update `HourlyEmployee` and `CommissionEmployee` properties, and handle input errors?

I need to understand how the CalculateButton_Click method in my WPF application handles input validation and updates for HourlyEmployee and CommissionEmployee objects. Specifically, how does it check and manage errors for user inputs related to hours worked, wage rates, gross sales, and commission rates? The method involves parsing user input, validating ranges, and throwing exceptions if the inputs are invalid. Could you explain how this process is implemented in the provided C# code? Any insights into how input errors are managed and the validation logic used would be very helpful

Wpf frame navigation automatically makes the path smaller

public void frameNavigation(string url) { string path = “”; if (url == “startup”) { path = “Pages/Optimizations/startupManagementPage.xaml”; } else if (url == “unusedM”) { path = “Pages/Optimizations/unusedMemoryPage.xaml”; } else { return; } try { framePage.Navigate(new Uri(path, UriKind.Relative)); } catch (Exception ex) { MessageBox.Show($”Navigation error: {ex.Message}”); } } This is a method added to my settings […]

WPF program sometimes has touch failure, but the mouse can click

WPF program uses a touch-screen all-in-one machine, so you can click on the screen or click with the mouse. When you start the program, everything is normal. After using it for a while, there is a small probability that you can’t touch the screen, but you can click with the mouse. I really don’t know why and how to solve it. I use the .netFramework framework。