-
August 20th, 2008, 05:30 PM
#6
Here is my latest code. I understand that you are not supporting .Net but still maybe you can give me a hint:
using System.Collections;
using System.Threading;
using System;
using System.Runtime.InteropServices;
using Lightstreamer.Interfaces.Data;
using System.Windows.Forms;
public class SocketToLightStreamer : IDataProvider
{
private IItemEventListener _listener;
public void Init(IDictionary parameters, string configFile)
{
}
public bool IsSnapshotAvailable(string itemName)
{
return false;
}
public void SetListener(IItemEventListener eventListener)
{
_listener = eventListener;
}
public void Subscribe(string itemName)
{
if (itemName.Equals("floorupdate"))
{
}
}
public void Unsubscribe(string itemName)
{
if (itemName.Equals("floorupdate"))
{
}
}
public void PushData(string data)
{
IDictionary eventData = new Hashtable();
eventData["scan"] = data;
_listener.Update("floorupdate", eventData, false);
}
public class GetMessage : Form
{
const int WM_COPYDATA = 0x004a;
public GetMessage()
{
Text = "my_unique_id";
}
protected override void WndProc(ref System.Windows.Forms.Message m)
{
switch (m.Msg)
{
case WM_COPYDATA:
COPYDATASTRUCT mystr = new COPYDATASTRUCT();
Type mytype = mystr.GetType();
mystr = (COPYDATASTRUCT)m.GetLParam(mytype);
IDictionary eventData = new Hashtable();
eventData["scan"] = mystr.Data;
SocketToLightStreamer a = new SocketToLightStreamer();
a._listener.Update("floorupdate", eventData, false);
break;
}
base.WndProc(ref m);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct COPYDATASTRUCT
{
public Int32 ID;
public int Length;
public string Data;
}
}
While this code is compiling fine when I run it I get:
"null reference" at a._listener.Update("floorupdate", eventData, false);
Wold you suggest to how to have a form inside of SocketToLightStreamer class in a way that I could access _listener object from it?
Thanks for the hep.
Similar Threads
-
By mode_vigilante in forum Adapter SDKs
Replies: 16
Last Post: January 27th, 2012, 03:58 PM
-
By icaiozzi in forum Adapter SDKs
Replies: 1
Last Post: November 19th, 2010, 11:52 AM
-
By AndyKelly in forum Client SDKs
Replies: 1
Last Post: July 7th, 2010, 10:50 AM
-
By devidasan in forum Adapter SDKs
Replies: 1
Last Post: March 17th, 2009, 11:00 AM
-
By markgoldin in forum General
Replies: 6
Last Post: September 28th, 2007, 01:15 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 04:22 PM.
Bookmarks