Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Silverlight
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}">
<grid....../>
</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 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 7-Jan-13 21:09pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Does your BusyIndicatorText property implement INotifyPropertyChanged?
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Yes Here is the code:
         /// <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");
                }
            }
        }
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 341
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 220
3 Praneet Nadkar 197
4 Shweta N Mishra 161
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100