Exemplo n.º 1
0
        public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
        {
            AppDomain.CurrentDomain.AssemblyResolve += AppDomain_AssemblyResolve;

            lblStatus = pluginStatusText;   // Hand the status label's reference to our local var
            pluginScreenSpace.Controls.Add(this);   // Add this UserControl to the tab ACT provides
            this.Dock = DockStyle.Fill; // Expand the UserControl to fill the tab's client space

            logWriter = new StreamWriter(logfile, true);

            LoadSettings();
            VM.InitializeWindowManager(new BuffetViewModelWindowManager());
            VM.PowerDisplay.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == nameof(PowerDisplayVM.EnableClickThrough))
                {
                    display.Close();
                    display = new PowerDisplay(VM.PowerDisplay);
                    display.Show();
                }
            };
            
            elementHost1.Child = new SettingsControl() { DataContext = VM };

            display = new PowerDisplay(VM.PowerDisplay);
            display.Show();

            // Create some sort of parsing event handler.  After the "+=" hit TAB twice and the code will be generated for you.
            //ActGlobals.oFormActMain.AfterCombatAction += new CombatActionDelegate(oFormActMain_AfterCombatAction);
            ActGlobals.oFormActMain.OnLogLineRead += oFormActMain_OnLogLineRead;

            lblStatus.Text = "Plugin Started";
        }
Exemplo n.º 2
0
        public void DeInitPlugin()
        {
            AppDomain.CurrentDomain.AssemblyResolve -= AppDomain_AssemblyResolve;
            // Unsubscribe from any events you listen to when exiting!
            //ActGlobals.oFormActMain.AfterCombatAction -= oFormActMain_AfterCombatAction;
            ActGlobals.oFormActMain.OnLogLineRead -= oFormActMain_OnLogLineRead;

            logWriter.Flush();
            logWriter.Close();

            Properties.Settings.Default.Save();
            SaveSettings();

            VM = null;

            display.Close();
            display = null;

            lblStatus.Text = "Plugin Exited";
        }