Rank: Administration
Groups: Registered, Administrators Joined: 8/17/2010(UTC) Posts: 6 Location: Denver
|
This example shows how to use asynchronous calls to ESWeb so that your UI can continue operating while the view/subset/process is working. This example uses a service reference rather than a web reference to ESWeb. Code:
public partial class MainPage : UserControl
{
private ESWeb.ESWebSoapClient _es;
public MainPage()
{
_es = new ESWeb.ESWebSoapClient();
// Required to initialize variables
InitializeComponent();
DisplayView("Employees", "Big Query");
}
// This function starts the process of getting the
// view "Big Query" from the "Employees" cube
public void DisplayView( string cubeName, string viewName )
{
// Set up the handler for notifying when the view is complete and ready to display
_es.TM1ViewCompleted += new EventHandler<ESWeb.TM1ViewCompletedEventArgs>(DisplayViewCompleted);
// Make the call to the web service
_es.TM1ViewAsync(cubeName, viewName, true);
}
// This function gets called when the view has
// completed and is ready to be processed
public void DisplayViewCompleted(object sender, ESWeb.TM1ViewCompletedEventArgs e)
{
// Do the required work with the results, in this case we convert the results
// to a class that is bindable by a Silverlight grid control.
CubeView cubeView = new CubeView( e.Result.Results );
viewPane.Items.Add(cubeView);
}
}
|