Skip to content

Commit 609bd19

Browse files
committed
add custom command example
1 parent 7b0a15b commit 609bd19

File tree

2 files changed

+77
-4
lines changed

2 files changed

+77
-4
lines changed

UnderAutomation.Fanuc.Showcase.Forms/Components/RemoteCommandsControl.Designer.cs

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnderAutomation.Fanuc.Showcase.Forms/Components/RemoteCommandsControl.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Linq;
3-
using System.Windows.Forms;
4-
using UnderAutomation.Fanuc;
1+
using UnderAutomation.Fanuc;
52
using UnderAutomation.Fanuc.Telnet;
63

74
public partial class TelnetControl : UserControl, IUserControl
@@ -169,4 +166,25 @@ private void btnGetTask_Click(object sender, EventArgs e)
169166
var result = _robot.Telnet.GetTaskInformation(cbPrograms.Text);
170167
LogCommand(nameof(_robot.Telnet.GetTaskInformation), result);
171168
}
169+
170+
private void btnSendCommand_Click(object sender, EventArgs e)
171+
{
172+
var result = _robot.Telnet.SendCustomCommand<TelnetControl.CustomCommandResult>(txtCommand.Text);
173+
LogCommand(nameof(_robot.Telnet.SendCustomCommand), result);
174+
}
175+
176+
public class CustomCommandResult : BaseResult
177+
{
178+
public string Data { get; private set; }
179+
protected override bool FromResult(string data)
180+
{
181+
Data = data;
182+
return true;
183+
}
184+
185+
public override string ToString()
186+
{
187+
return $"{KclCommand} :\r\n{Data}\r\n{ErrorText}";
188+
}
189+
}
172190
}

0 commit comments

Comments
 (0)