For more information about the RANET. uilibrary. OLAP project, see my other article here.
For whatever reason, sometimes we want to debug on the Silverlight client to view the request parameters sent to the server, so as to better locate the problem. The following method is based on RANET. uilibrary. OLAP project, add a debugging window to its client:
Add silverliclient client DEBUG feature in RANET. uilibrary. OLAP:
1. Change file \ RANET-uilibrary-OLAP \ uilibrary. OLAP \ uilibrary. OLAP. mergemodule. samples. SRC \ installdir \ samples \ uitest. web \ silverliteapplication.htm:
ADD? DEBUG = true in line 68 (<Param name = "Source" value = "clientbin/uitest. xap? DEBUG = true ")
2. Change file \ RANET-uilibrary-OLAP \ uilibrary. OLAP \ uilibrary. OLAP. mergemodule. samples. SRC \ installdir \ samples \ uitest. Silverlight \ evmdxdesigner. CS:
Add initdebug (); Method
Code
Void initdebug ()
{
String src = app. Current. Host. Source. tostring ();
Int idx = SRC. indexof ("? ");
If (idx>-1)
{
String [] paramlst = SRC. substring (idx + 1). Split ("&". tochararray ());
For (INT I = 0; I <paramlst. length; I ++)
{
String [] P = paramlst [I]. Split ("=". tochararray ());
Switch (P [0])
{
Case "debug ":
If (P [1] = "true ")
{
Isdebug = true;
// Txtlogger. Visibility = visibility. visible;
Debugrow. Height = new gridlength (100 );
This. effectmdxdesignercontrol. begindataload + = new eventhandler <RANET. agolap. Controls. General. dataloadereventargs> (effectmdxdesignercontrol_begindataload );
}
Break;
Default:
Break;
}
}
}
}
Add initdebug (); Method invoke in init method;
Add method into tmdxdesignercontrol_begindataload ();
Code
Void uplotmdxdesignercontrol_begindataload (Object sender, RANET. agolap. Controls. General. dataloadereventargs E)
{
If (isdebug)
{
Txtlogger. Text + = E. userstate;
}
}
Add private variable bool isdebug = false;
3. Change file RANET-uilibrary-OLAP \ uilibrary. OLAP \ RANET. agolap \ controls \ pivotmdxdesignercontrol. CS
Add private variable public event eventhandler <dataloadereventargs> begindataload;
Add event register in method initialize (): m_serverexplorer.olapdataloader.begindataload + = This. begindataload;
4. Change file uitest. Silverlight \ page. XAML
Add new Textbox Control txtlogger at proper place
Code
<Grid X: Name = "layoutroot" loaded = "init">
<Grid. columndefinitions>
<Columndefinition/>
</Grid. columndefinitions>
<Grid. rowdefinitions>
<Rowdefinition/>
<Rowdefinition X: Name = "debugrow" Height = "0"/> <! -- Here -->
</Grid. rowdefinitions>
<Samples: mydesigner grid. Row = "0" grid. Column = "0" X: Name = "effectmdxdesignercontrol"/>
<Textbox X: Name = "txtlogger" grid. Row = "1" grid. Column = "0"/> <! -- Here -->
</GRID>
5. Change file RANET-uilibrary-OLAP \ uilibrary. OLAP \ RANET. agolap \ controls \ General \ olapdataloader. CS
Add method invoke in loaddata (olapactionbase schema, object state): raise_begindataload (New dataloadereventargs (null, null, Service. endpoint. Address. Uri. tostring ()));
Add method raise_begindataload (dataloadereventargs ARGs)
Code
Void raise_begindataload (dataloadereventargs ARGs)
{
Eventhandler <dataloadereventargs> handler = This. begindataload;
If (handler! = NULL)
{
Handler (this, argS );
}
}
Add public variable: public event eventhandler <dataloadereventargs> begindataload;
6. Change file RANET-uilibrary-OLAP \ uilibrary. OLAP \ RANET. agolap \ controls \ General \ idataloader. CS
Add variable in interface idataloader: Event eventhandler <dataloadereventargs> begindataload;