Hi People
I have a strange problem while using a delegate to update a textbox. I am using an SDK from Swyx, which is a VOIP (telephone software) package.
The activeX triggers an onChnage event which has an event handler attached. I can change properties within my class using the delegate and even call functions, I cannot however change anything related to a UI component. It's very strange as only this SDK seems to have the probelm.
OnSwyxEvent is the method which is causing the problem.
Does anyone know of any reason why this would happen? Could the ActiveX I am using not have access to the front end for some reason?
I have included my code below:
namespace swyxApp
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
Swyx.swyxIt SwyxInstance = new Swyx.swyxIt();
//UltraSpace.UltraControl UltraInstance = new UltraSpace.UltraControl();
public ClientLineMgrClass clmgr;
public String myVar = "hello";
public Window1()
{
InitializeComponent();
clmgr = new ClientLineMgrClass();
myVar = "mat";
IClientLineMgrEventsPub_PubOnLineMgrNotificationEventHandler EvtHndlr = new IClientLineMgrEventsPub_PubOnLineMgrNotificationEventHandler(OnSwyxEvent);
clmgr.PubOnLineMgrNotification += EvtHndlr;
/* foreach (ListViewItem item in SwyxInstance.getUsers("matthew")){
listBox1.Items.Add(item);
}
foreach (ListViewItem item in SwyxInstance.getNumbers(90)){
listBox2.Items.Add(item);
}
foreach (ListViewItem item in SwyxInstance.getPublicNumbers(87)){
listBox3.Items.Add(item);
}*/
}
public void tryThis()
{
//MessageBox.Show("hello");
this.textBox1.Text = "hrhrh";
}
public void OnSwyxEvent(int msg, int param)
{
tryThis();
this.textBox1.Text = "don't care"; // does not work
myVar = "new val"; // works
}
private void button1_Click(object sender, RoutedEventArgs e)
{
//UltraInstance.disconnect();
textBox1.Text = myVar;
}
}
}
Thanks
Matthew