- Home
- Forum
- Xamarin.Forms
- For some reason the Circular progress bar isn't updating
For some reason the Circular progress bar isn't updating
I try and update the progress bar but it only updates on the 100%
The debug writeline shows the correct percentage but doesn't update the progress bar.
Please help
using System.Collections.Generic;
using System.Diagnostics;
using Syncfusion.SfBusyIndicator.XForms;
using Syncfusion.XForms.ProgressBar;
using Xamarin.Forms;
namespace LorikeetMApp
{
public partial class UpdatePage : ContentPage
{
public static Data.MemberManager memberManager { get; private set; }
private static Data.MemberDatabase database;
private static string databasePath = DependencyService.Get<Data.IFileHelper>().GetLocalFilePath("MemberSQLite.db");
public UpdatePage()
{
InitializeComponent();
memberManager = new Data.MemberManager(new Data.RestService());
database = Data.MemberDatabase.Create(databasePath);
}
async void UpdateButton_PressedAsync(object sender, EventArgs e)
{
try
{
/*
SfBusyIndicator busyIndicator = new SfBusyIndicator();
busyIndicator.AnimationType = AnimationTypes.Ball;
busyIndicator.ViewBoxWidth = 150;
busyIndicator.ViewBoxHeight = 150;
busyIndicator.TextColor = Color.Blue;
busyIndicator.Title = "Loading...";
busyIndicator.IsBusy = true;
this.Content = busyIndicator;
*/
var membersToDelete = await database.GetMemberItemsAsync();
database.DeleteMemberItems(membersToDelete);
var contactsToDelete = await database.GetContactItemsAsync();
database.DeleteContactItems(contactsToDelete);
List<Models.Member> Members = await memberManager.GetMembersAsync();
int totalPercent = Members.Count;
int count = 0;
SfCircularProgressBar circularProgressBar = new SfCircularProgressBar { Minimum = 0, Maximum = 100 };
this.Content = circularProgressBar;
circularProgressBar.Progress = 0;
foreach (var item in Members)
{
ModelsLinq.MemberSQLite modelToAdd = new ModelsLinq.MemberSQLite();
modelToAdd.MemberId = item.MemberId;
modelToAdd.Surname = item.Surname;
modelToAdd.FirstName = item.FirstName;
modelToAdd.DateOfBirth = item.DateOfBirth;
modelToAdd.Sex = item.Sex;
modelToAdd.Aboriginal = item.Aboriginal;
modelToAdd.StreetAddress = item.StreetAddress;
modelToAdd.PostCode = item.PostCode;
modelToAdd.Suburb = item.Suburb;
modelToAdd.State = item.State;
modelToAdd.Country = item.Country;
modelToAdd.TelephoneNumber = item.TelephoneNumber;
modelToAdd.MobileNumber = item.MobileNumber;
modelToAdd.EmailAddress = item.EmailAddress;
modelToAdd.DateAltered = item.DateAltered;
await database.SaveMemberItemAsync(modelToAdd);
count++;
var progress = 100 * (decimal.Divide(count, totalPercent));
circularProgressBar.Progress = (double)progress;
Debug.WriteLine("" + (double)progress);
}
List<Models.Contact> Contacts = await memberManager.GetContactsAsync();
foreach (var item in Contacts)
{
ModelsLinq.ContactSQLite contactToAdd = new ModelsLinq.ContactSQLite();
contactToAdd.ContactId = item.ContactId;
contactToAdd.MemberId = item.MemberId;
contactToAdd.ContactType = item.ContactType;
contactToAdd.ContactName = item.ContactName;
contactToAdd.ContactAddress = item.ContactAddress;
contactToAdd.ContactPhone = item.ContactPhone;
await database.SaveContactItemAsync(contactToAdd);
}
//busyIndicator.IsBusy = false;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
}
}
SIGN IN To post a reply.
1 Reply
SG
Sridharan Gajendran
Syncfusion Team
May 17, 2018 12:28 PM UTC
Hi Byron,
Thanks for contacting Syncfusion Support.
Circular progress bar’s progress value getting updated properly. We have prepared a demo sample based on the provided code example. Please find the demo sample from the following location.
Sample: ProgressDemo
If you still face the same problem. Please modify the sample and revert us, so that we can assist you with a better solution.
Thanks,
Sridharan
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
BH Byron Hobbs
- May 17, 2018 05:38 AM UTC
- May 17, 2018 12:28 PM UTC