Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
I am using WCF services in my WPF project, which generates async methods. well before begins retrieve information, I set busyIndicator isBusy = "true". After async method in event, for example GetCustomersCompleted+=(s, e)=>{ set IsBusy = "false" }.
But after all of this madden, BusyIndicator dose not display. why? what is the problem?

here is code fragment of code:
C#
private void LoadData(){

    ServiceClient proxy = new ServiceClient();
    IsBusy = true;
    proxy.GetCustomersCompleted += (s, e)=>
    {
        ObservableCollection<CustomerModel> CustList = new ObservableCollection<CustomerModel>();
        
        foreach(var item in CustList)
        {
              CustList.Add(new CustomerModel()
                                  {
                                        FirstName = item.firstname,
                                        LastName = item.lastname,
                                       //and so on ...
                                  });
        }
     
        IsBusy = false;
    };
    proxy.GetCustomersAsync();
    proxy.Close();

}
Posted
Updated 20-Mar-13 9:43am
v2
Comments
Sider89 21-Mar-13 6:42am    
here is this simple project, where I suffer with this busy indicator

http://www.mediafire.com/?pdd99yyju2b4rjp

I suggest trying their forums:
http://www.telerik.com/community/forums.aspx[^]
They have great support people who specialize in their software.
 
Share this answer
 
Comments
Sider89 20-Mar-13 16:10pm    
I tried their forums.
But they said, that I must present them purchase license. My company have bought it and so I have not it.. and they avoid my questions
Sider89 21-Mar-13 5:49am    
???
wizardzz 21-Mar-13 10:31am    
That was my input. I'm not a servant. I'm not being paid to research an answer for you. Go ask your company for the license. If they bought it, they have it.
Keith Barrow 21-Mar-13 10:40am    
I don't see what the problem is. If you have Telerik-specific problems then the Telerik forums are more likely to help.
If they require the license and your company has it then you need to get in touch with the person in your company and get the key to get help. If your company doesn't have a license (even a trial one) and you are trying to use the controls then you are committing an act of software piracy. They aren't going to help you if you try and pirate their software.
jim lahey 21-Mar-13 11:21am    
This answer cannot be improved any further.
You are missing several bits here. Are you using MVVM here? If so, does your "IsBusy" property raise change notification? I also see big problems in your completed handler - you create an empty observable collection and then you iterate over it. You're never going to get any results in there. Also, as this is scoped locally, you aren't going to be able to bind to the observable collection. How do you dereference from your completed event handler.
 
Share this answer
 
Comments
Sider89 21-Mar-13 11:05am    
No, everything is well, beside the BusyIndicator, Bindings is correct and have result too. Problem is that BusyIndicator dose not display.
http://www.mediafire.com/?pdd99yyju2b4rjp here is link, there is simple project, if you check it you'll see that everything is fine, beside that BusyIndicator
Pete O'Hanlon 21-Mar-13 11:24am    
I'm not here to debug your project for you. I don't have Telerik installed on my machines, so it would not be ethical for me to install one of their controls just to look at this. And seriously, from the code you posted, it can't possibly work. Check the scope of your CustList and then ask yourself how it can contain any data when you've just created it.

What you need to do is add a breakpoint into this method and step into it. Actually inspect things - that's what you're expecting us to do for you after all.
Sider89 21-Mar-13 11:51am    
yes, this is in MVVM..
public ObservableCollection(customermodel) Customers
{ get { return _Customers; }
set {
if (_Customers != value){
_Customers = value;
}
}
}
private ObservableCollection(customermodel) _Customers;


private void LoadData()
{
App.Instance.SetBusy();


proxy.ServicesClient client = new proxy.ServicesClient();

client.GetCustomersCompleted += (s, e) =>
{
if (e.Error != null)
{
throw new Exception();
}
else
{
Customers = new ObservableCollection<customermodel>();
foreach (var item in e.Result)
{
Customers.Add(new CustomerModel()
{
CustomerId = item.CustomerId,
Title = item.Title,
FirstName = item.FirstName,
MiddleName = item.MiddleName,
LastName = item.LastName,
CompanyName = item.CompanyName,
SalesPerson = item.SalesPerson,
EmailAddress = item.EmailAddress,
Phone = item.Phone
});
}


OnPropertyChanged("Customers");


App.Instance.UnSetBusy();
};

client.GetCustomersAsync();
client.Close();

}

here is the fragment, it works. binding, evrithing ... not only busyindicator
Pete O'Hanlon 21-Mar-13 12:18pm    
Does your SetBusy and UnSetBusy method actually raise the property change notification though? I assume that you are binding to the IsBusy property and using the BooleanToVisibilityConverter to control whether or not the indicator is displaying.

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



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