Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Plugin Development Issue (C#)

hey there, I have an ACT c# plugin question. I made a simple plugin and can get ACT to load it, but for some reason none of the event handlers work. The init and de-init functions works fine though. Any ideas? :/

https://pastebin.com/LTznMVgm

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Advanced_Combat_Tracker;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Net;
using Newtonsoft.Json;

namespace Test_Plugin
{
public partial class TestPlugin: UserControl, IActPluginV1
{
private EncounterData ActiveEnconter;
private Label label1;
Label lblStatus;

public TestPlugin()
{
InitializeComponent();
}

public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
{
lblStatus = pluginStatusText;
pluginScreenSpace.Controls.Add(this);
this.Dock = DockStyle.Fill;
pluginScreenSpace.Text = "Test Plugin";

//Events
ActGlobals.oFormActMain.BeforeLogLineRead += new LogLineEventDelegate(OnBeforeLogLineRead);

lblStatus.Text = "Plugin Started";
label2.Text = "Started";

}

public void DeInitPlugin()
{
// Unsubscribe from any events you listen to when exiting!
ActGlobals.oFormActMain.BeforeLogLineRead -= OnBeforeLogLineRead;

lblStatus.Text = "Plugin Exited";
}

void OnBeforeLogLineRead(bool isImport, LogLineEventArgs logInfo)
{
MessageBox.Show(@"Show a box to prove this code executed.");

//Fetch Data
var log = logInfo.logLine;
var actData = ActiveEnconter.GetCombatant("YOU");


}
}
}




Tagged:

Comments

  • edited September 2018
    I can't really say.  It works fine for me...



    The only thing different for me is that I commented out your InitializeComponent method because you only gave half of your partial class.



Sign In or Register to comment.