======================================== LiveView .NET Client API Sample ======================================== This is a Visual Studio 2010 project that is intended to be run as a demonstration of the StreamBase LiveView .NET Client API. This sample does not run or build in StreamBase Studio. The purpose of loading this sample into Studio is to make a copy of the sample's files in your Studio workspace, which is always a writable location. Open the lv-sample-dotnet.sln solution file in Visual Studio, using a path like the following to locate the resulting directory: C:\Users\sbuser\Documents\StreamBase Studio n.m Workspace\sample_lv-dotnet To build this sample, you need references to the LiveView client API assembly, and you need the StreamBase client API assembly itself. -- The LiveView assembly, StreamBase.LiveView.API.dll, is supplied for you in this sample's project folder. If you have an automated build or deployment process, the official reference copy of this assembly is %STREAMBASE_HOME%\sdk\bin\StreamBase.LiveView.API.dll. -- The StreamBase client API assembly, StreamBase.SB.Client.dll might need to be located, although normally it is picked up as installed by your StreamBase release in the usual place. If not automatically found, add a reference to the StreamBase.SB.Client.dll located in the StreamBase installation directory that this version LiveView requires. This sample's Visual Studio project file has a suggested path to the 64-bit version of the Client DLL. You may need to adjust this path, especially if you are running from the 32-bit version of StreamBase Studio. Like all projects that use StreamBase .NET APIs, this project targets .NET 4.0. Notice that both assembly references set the "Copy Local" property to "True," so that the DLLs are copied to same output directory as your program. This helps when redistributing a program that uses StreamBase .NET APIs. For more on redistribution, see below. The sample is a simple WPF application that connects to the lv-sample-helloliveview application that is also included in your StreamBase LiveView installation and executes several LiveView queries to obtain various result sets from its Items table. The results are displayed in real-time in the sample's main window. The .NET LiveView API offers two ways to present the results of executing a query: -- An ObservableQueryResult exposes the result set by providing a collection of tuples suitable for data binding. (This class derives from ObservableCollection()). This collection has full support for the CollectionChanged and PropertyChanged events. -- An EventBasedQueryResult exposes the raw events received from the LiveView server, such as when a new tuple is added to the results set or when one is removed or changed. Your application can consume these events and maintain its own result set. This may offer better performance in very high volume situations, at the expense of convenience. To illustrate how to use both ways of obtaining results from a query, the sample executes three queries, two with an ObservableQueryResult and one with an EventBaseQueryResult. In the top half of the window is a WPF DataGrid control to which an ObservableQueryResult is bound, where you can see the whole Items table displayed and updating in real time. Next to it is a pie chart (also driven by an ObservableQueryResult) which displays the relative number of items in each category. In the bottom half is a line chart that uses an EventBasedQueryResult to display the average price of all items on the Items table over time. All of the interesting code to accomplish these tasks is contained in the MainWindow.xaml.cs code-behind file and its associated helper file LVConnection.cs. To run this sample: - Make sure the lv-sample-helloliveview application is already running by following the steps outlined in its README.txt file, which is opened when you load the sample into StreamBase Studio. - Open the lv-sample-dotnet.sln solution file in Visual Studio 2010 and select "Build | Build Solution" from the menu to build the sample. - Select either "Debug | Start Debugging" or "Debug | Start Without Debugging" from the menu to launch the application. - The sample's main window comes up and the DataGrid and charts shortly fill with the contents of the LiveView application's Items table. Also look for various values in the grid and charts to update in real time as new data is received from the LiveView Server. * Redistribution Of Programs That Use the LiveView Client API For LiveView 1.3 and later, your program needs the following files in the same directory with it: -- The LiveView client API assembly, StreamBase.LiveView.API.dll. -- The StreamBase client API assembly, StreamBase.SB.Client.API.dll; either the 32-bit or 64-bit version will do. -- The Microsoft Visual Studio Runtime DLLs, either 32-bit or 64-bit depending on the target architecture of the StreamBase client API assembly that you are using. For further details, refer to the Redistributing the .NET Client Library topic in the API Guide of the StreamBase CEP documentation.