G
Guest
Hi all,
as a newbie of C#, I am rather surprised when I saw that the method of
System.ServiceProcess.ServiceController - ExecuteCommand(int command) - has
only one parameter. What shall I do if I want to send other data contained in
a front-end GUI, say a windows form, to my windows service (could be on a
remote host)? Following is my code snipper,
-------------------------------------------------------------
In MyGui.cs:
private void buttonFind_Click(object sender, System.EventArgs e)
{
try
{
serviceController1.ExecuteCommand(129);
labelInfo.Text = "Execute command";
}
catch (System.InvalidOperationException exp)
{
MessageBox.Show(exp.ToString());
}
}
--------------------------------------------------------------
In MyService.cs:
protected override void OnCustomCommand(int command)
{
switch (command)
{
case 129:
cmd129Handler();
break;
....
The function cmd129Handler() cannot retrieve parameters from MyGui.
Any ideas or suggestions? Thanks in advance!
as a newbie of C#, I am rather surprised when I saw that the method of
System.ServiceProcess.ServiceController - ExecuteCommand(int command) - has
only one parameter. What shall I do if I want to send other data contained in
a front-end GUI, say a windows form, to my windows service (could be on a
remote host)? Following is my code snipper,
-------------------------------------------------------------
In MyGui.cs:
private void buttonFind_Click(object sender, System.EventArgs e)
{
try
{
serviceController1.ExecuteCommand(129);
labelInfo.Text = "Execute command";
}
catch (System.InvalidOperationException exp)
{
MessageBox.Show(exp.ToString());
}
}
--------------------------------------------------------------
In MyService.cs:
protected override void OnCustomCommand(int command)
{
switch (command)
{
case 129:
cmd129Handler();
break;
....
The function cmd129Handler() cannot retrieve parameters from MyGui.
Any ideas or suggestions? Thanks in advance!