[DXLog.net - Support] My First C# script
Oliver Grossmann
olli at bretzi.de
Wed Mar 18 16:52:55 CET 2015
As I forgot attachments will be filtered the script within the email:
//INCLUDE_ASSEMBLY System.dll
//INCLUDE_ASSEMBLY System.Windows.Forms.dll
using System;
using System.Windows.Forms;
//using IOComm;
using CWKeyer;
namespace DXLog.net
{
public class Script : ScriptClass
{
FrmMain m_main;
public void Initialize(FrmMain main)
{
m_main = main;
}
public void Deinitialize()
{
}
public void Main(FrmMain main, ContestData cdata, COMMain comMain)
{
CATCommon radioOject =
m_main.COMMainProvider.RadioObject(cdata.FocusedRadio);
if (radioOject == null)
{
main.SetMainStatusText(String.Format("CAT object for radio {0}
isn't available!", cdata.FocusedRadio));
return;
}
radioOject.SendCustomCommand("ks" +
main._cwKeyer.CWSpeed(cdata.FocusedRadio).ToString("000") + ";");
main._cwKeyer.CWSpeedChange += new
CWKey.CWSpeedChangeDelegate(_cwKeyer_CWSpeedChange);
}
void _cwKeyer_CWSpeedChange(int radioNumber, int newSpeed)
{
CATCommon radioOject =
m_main.COMMainProvider.RadioObject(radioNumber);
if (radioOject == null)
{
m_main.SetMainStatusText(String.Format("CAT object for radio
{0} isn't available!", radioNumber));
return;
}
radioOject.SendCustomCommand("ks" + newSpeed.ToString("000") + ";");
}
}
}
------------------------------------------------------------------------
Oliver Grossmann | DH2WQ | oliver.grossmann at bretzi.de
Am 18.03.2015 um 15:32 schrieb Oliver Grossmann:
> Hello Chris,
>
> thanks for the information.
>
> I started with the MS Visual Studio 2010 Express C# to write my first
> script.
>
> I do like the possibility to sync speed of PC Keyer and internal radio
> keyer. In my case I want to sync internal K3 Keyer with DXLog.net. The
> script is using the event main._cwKeyer.CWSpeedChange. To activate the
> script I do need to call it on a message or by pressing a assigned key.
> For my script a start at startup would be a great feature, for other
> scripts a start at loading a certain contest could also be a nice.
>
> My Programming skill are limited to C and C++, so the strictly world of
> object oriented programming is quite new to me.
>
> In my script I wasn't able to get access to a CATCommon object from the
> main instance. I resolved this by using a module global variable of type
> FrmMain and used it in my callback for the CWSpeedChange. Is this a
> suitable solution or is there a better way to handle it without an
> direct reference to the FrmMain instance?
>
> As reference I attached my Script.
>
> Thanks a lot for the support and the fantastic script interface,
>
> Olli, DH2WQ
>
> ------------------------------------------------------------------------
> Oliver Grossmann | DH2WQ | oliver.grossmann at bretzi.de
>
> Am 17.03.2015 um 19:11 schrieb 9A5K:
>> Hi Oliver...
>>
>> Yep, there are couple of samples available at
>> http://dxlog.net/sw/download/script_examples/
>>
>> You can easily check what objects, properties, events and methods are
>> available with Xamarin Studio (or MS Visual Studio),
>> if you add reference to DXLog.net.exe and dll's.
>>
>>
>>
>> On Tue, Mar 17, 2015 at 7:04 PM, Oliver Grossmann <olli at bretzi.de
>> <mailto:olli at bretzi.de>> wrote:
>>
>> Hi Chris,
>> is the API for the C# scripts available?
>>
>> Thanks,
>> Olli, DH2WQ
>>
>> ------------------------------__------------------------------__------------
>> Oliver Grossmann | DH2WQ | oliver.grossmann at bretzi.de
>> <mailto:oliver.grossmann at bretzi.de>
>>
>> Am 06.02.2015 um 18:29 schrieb 9A5K:
>>
>> Hi everyone.
>>
>> Version 2.2.9 is now available in public download folder.
>>
>> New contest is supported for this weekend, it's XE RTTY contest.
>>
>> Also, there is a big new feature available: custom C# scripts.
>> C# scripts are compiled during runtime and can be executed in
>> couple of
>> different ways:
>> 1. By assigning a shortcut - when pressed, main method in the
>> script will
>> be executed
>> 2. By assigning some name - when found as macro in message, main
>> method
>> will be executed
>> 3. By attaching to some event - when event is raised from
>> DXLog.net, method
>> defined will be executed
>>
>> Scripting will need a lot of documentation as this part of the
>> code has
>> full access to all objects/classes available in DXLog.
>> There are couple of samples uploaded in public download
>> directory, I will
>> try to expand it during the time with more examples
>> and finished scripts.
>> In case you need some help with script, let me now and I'll be
>> glad to
>> assist with it.
>>
>> Enjoy.
>>
>> 73,
>> Chris - 9A5K
>>
>> Release notes:
>> Ver 2.2.9
>> ------------------------
>> - Mouse middle button click in digi mode decoder now also adds
>> call to
>> partner stack. (TNX N6TV)
>> - New option added: Tools->Scripts manager.
>> DXLog.net now supports custom made C# scripts, to enable
>> additional
>> functionalities.
>> Custom scripts are written in C# language and they are
>> compiled during
>> runtime.
>> Script can be assigned to some shortcut and will be executed
>> when
>> shortcut key is pressed.
>> Also, script can be called by name from CW/Digi message as
>> macro command
>> prefixed with "$!".
>> For example, if CW/Digi message contains $!SCRIPT1, it will
>> execute
>> script with name SCRIPT1.
>> - New contest supported: XE RTTY International Contest.
>> - Added band changes count for Multi/Single category in CQ WPX
>> RTTY Contest.
>> - CTRL+SHIFT+F4 on the fly scenario/message editor wasn't
>> working properly.
>> Fixed. (TNX IK2NCJ)
>> _________________________________________________
>> Support mailing list
>> Support at dxlog.net <mailto:Support at dxlog.net>
>> http://www.dxlog.net/mailman/__listinfo/support
>> <http://www.dxlog.net/mailman/listinfo/support>
>>
>>
>>
>>
>> _______________________________________________
>> Support mailing list
>> Support at dxlog.net
>> http://www.dxlog.net/mailman/listinfo/support
More information about the Support
mailing list