Cinthia
Cinthia
CC#
Created by Cinthia on 5/8/2023 in #help
❔ Best loading progress WPF
Hello guys, I need to implement a progress bar using IProgress interface, The problem is that I did something like this: private async task LoadData(IProgress<int> progress) {
var connection = await networkService.CheckConnectionAsync(); if(!connection.IsSuccess) { wait LoadDataBaseCountries(); progress.Report(100); } other { wait dataService.DeleteData(); progress.Report(33); wait LoadApiCountries(); progress.Report(66); wait dataService.SaveData(Country); progress.Report(100); } LoadComboBoxData(); } and the bar loads very quickly, but what takes longer to complete is the API, and I don't know how to implement slower loading on the bar
17 replies
CC#
Created by Cinthia on 5/4/2023 in #help
❔ Binding WPF Combobox
Hello, I'm having trouble doing the Binding in WPF, I have a combobox and I want to show the image that I have saved in the images folder, and the name of the country. I created a separate class just for ImagePath and Text, and I tried to do the Binding, but it doesn't work, does anyone have any tips on how to solve this? And I am not using MVC. public class Item { public string Name { get; set; } public string ImagePath { get; set; } } <syncfusion:ComboBoxAdv x:Name="ComboBoxCountries" AllowMultiSelect="False" DefaultText="Countries List" Foreground="#333333" Height="35" Width="350" Margin="30,60,740,516" ItemsSource="{Binding Template}" SelectionChanged="ComboBoxCountries_SelectionChanged"> <syncfusion:ComboBoxItemAdv>
<StackPanel Orientation="Horizontal"> <Image Source="{Binding ImagePath}" Width="20" Height="20" Margin="0,0,5,0"/> <TextBlock Text="{Binding Text}"/> </StackPanel>
</syncfusion:ComboBoxItemAdv> </syncfusion:ComboBoxAdv>
3 replies
CC#
Created by Cinthia on 5/2/2023 in #help
❔ Change Null Values
I'm working on a project in my course, where I need to change all values ​​that come from the API to my list that are NULL to "N/A". I made a default value but my professor didn't accept it, he said it's not the most professional way, the code below is close to what he asked, but I still couldn't get to the point. And everything I think about is going to turn into a very big or complicated code, which they already said it's not, I need help! public class Root { public Name name { get; set; } public string cca3 { get; set; } public Currencies currencies { get; set; } public List<string> capital { get; set; } public string region { get; set; } public string subregion { get; set; } public Languages languages { get; set; } public List<double> latlng { get; set; } public double area { get; set; } public string flag { get; set; } public Maps maps { get; set; } public int population { get; set; } public List<string> timezones { get; set; } public List<string> continents { get; set; } public Flags flags { get; set; } public Gini gini { get; set; } public string giniYear { get; set; } public double giniValue { get; set; } public static string ReturnNull(string Value) { return Value != null ? Value : "n/d"; } }
38 replies