Click here to Skip to main content
15,074,942 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have silverlight project in which the busy indicator busy content has to be changed for 3 cases like before service call it should show "started" just before service call "Inprocess" and after the service is completed it should show "Completed".
I have implemented the following code in viewmodel but only "inprocess" is showing and "started" and "Completed" are not.The public property BusyIndicatorText is binded to
busy indicator busy content and also the all the three values are getted and setted.
So pls suggest some ans:

XAML
<toolkit:BusyIndicator BusyContent="{Binding BusyIndicatorText}" IsBusy="{Binding IsBusy, Mode=TwoWay}"><br />
<grid....../><br />
</toolkit:BusyIndicator>


ViewModel
private void GetdailyExpertData()
{
try
{


if (SelectedDate != null && SelectedSite != null && !string.IsNullOrWhiteSpace(NoofWeeksBack))
{
if (SelectedDate < DateTime.Now)
{
if (Convert.ToInt32(NoofWeeksBack) >= 0)
{
int selectedSiteId = SelectedSite.Id;
previousitem = null;


IsBusy = true;
BusyIndicatorText = Convert.ToString(DataRequestStatus.Started);

//calculates the date for monday of the N weeks back the date selccted
DateTime weeksBackDate = SelectedDate.AddDays(-7 * Convert.ToInt32(noofWeeksBack));
StartDate = GetDateForSelectedWeekMonday(weeksBackDate);

//gets the date for the sunday greater or equal to the date selected
EndDate = GetDateForSundayOfweek(SelectedDate);

EventHandler<webexpertsystem.getdailyviewdatacompletedeventargs> GetDailyViewdataCompletedObject = null;
GetDailyViewdataCompletedObject += (s, e) =>
{
BusyIndicatorText = Convert.ToString(DataRequestStatus.Completed);


IsBusy = false;
IsHourlyRevertButtonVisible = false;
IsHourlyApproveButtonVisible = false;
rrProxy.ExpertSystemProxy.GetDailyViewdataCompleted -= GetDailyViewdataCompletedObject;
};
BusyIndicatorText = Convert.ToString(DataRequestStatus.InProgress);
rrProxy.ExpertSystemProxy.GetDailyViewdataCompleted += GetDailyViewdataCompletedObject;
rrProxy.ExpertSystemProxy.GetDailyViewdataAsync(RrState.TnsName, selectedSiteId, StartDate, EndDate);
}
else
{
MessageBox.Show(Resource.ExpertSystemPositiveWeekConfirm, Resource.ExpertSystemTitle, MessageBoxButton.OK);
}
}
else
{
MessageBox.Show(Resource.ExpertSystemAdvanceDateConfirm, Resource.ExpertSystemTitle, MessageBoxButton.OK);
}
}
else
{
if (SelectedDate == null)
{
MessageBox.Show(Resource.ExpertSystemDateConfirm, Resource.ExpertSystemTitle, MessageBoxButton.OK);
}
else if (SelectedSite == null)
{
MessageBox.Show(Resource.ExpertSystemSiteConfirm, Resource.ExpertSystemTitle, MessageBoxButton.OK);
}
else if (string.IsNullOrWhiteSpace(NoofWeeksBack))
{
MessageBox.Show(Resource.ExpertSystemWeeksConfirm, Resource.ExpertSystemTitle, MessageBoxButton.OK);
}
}


}
catch (Exception ex)
{

}
}
Posted

Does your BusyIndicatorText property implement INotifyPropertyChanged?
   
Yes Here is the code:
XML
 /// <summary>
/// Holds the text to be shown on the busy indicator
/// </summary>
public string BusyIndicatorText
{
    get
    {
        return busyIndicatorText;
    }
    set
    {
        if (value != busyIndicatorText)
        {
            busyIndicatorText = value;
            OnPropertyChanged("BusyIndicatorText");
        }
    }
}
   
Actually the problem lies within the code it self.
Actually during async. call of one method completed method another method completed event is called so the busy indicator needs to be false there.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900