示例#1
0
        public void StartPlugin0(RadegastInstance inst)
        {
            RadegastInstance = inst;
            Control.CheckForIllegalCrossThreadCalls = false;
            AddRadegastEvents();
            CogbotContextMenuListener = new CogbotContextMenuListener();
            CogbotNoticeuListener     = new CogbotNotificationListener();
            if (ClientManagerConfig.UsingRadegastFromCogbot)
            {
                // just unregister events for now
                inst.Netcom.Dispose();
                clientManager = ClientManager.SingleInstance ?? new ClientManager();
                // _theBot = clientManager.LastBotClient;
            }
            else
            {
                if (!plugInitCalledEver)
                {
                    CogbotGUI.GlobalRadegastInstance = inst;
                }
                ClientManagerConfig.UsingCogbotFromRadegast = true;
                clientManager = ClientManager.SingleInstance ?? new ClientManager();
            }
            BotClient bc = clientManager.EnsureBotByGridClient(inst.Client);

            bc.TheRadegastInstance = inst;
            _theBot = bc;
            cogbotRadegastInterpreter = new CogbotRadegastInterpreter(this);
            RadegastInstance.CommandsManager.LoadInterpreter(cogbotRadegastInterpreter);
            _commandContextAction = new CommandContextAction(inst, this);
            _commandContextAction.ScanCogbotMenu();
            inst.TabConsole.RegisterContextAction(_commandContextAction);
            _aspectContextAction = new AspectContextAction(inst, this);
            inst.TabConsole.RegisterContextAction(_aspectContextAction);
            _simUsageContextAction = new SimUsageContextAction(inst, this);
            inst.TabConsole.RegisterContextAction(_simUsageContextAction);

            //if (ClientManager.UsingRadgastFromCogbot) return;
            inst.Client.Settings.MULTIPLE_SIMS = true;
            clientManager.outputDelegate       = System.Console.Out.WriteLine;
            GUIInvoke(() => SetupRadegastGUI(inst));
            DLRConsole.SafelyRun(() => clientManager.ProcessCommandArgs());
            chatConsole.StartWriter();
            if (!bc.IsLoggedInAndReady)
            {
                TheBot.InvokeNext("Re-enable login button", () =>
                {
                    TheBot.DebugWriteLine("SetLoginButton = r-enabled");
                    SetLoginButton(OldLoginText, true);
                });
            }
            if (plugInitCalledEver)
            {
                return;
            }
            plugInitCalledEver = true;
            if (ClientManagerConfig.StartLispThreadAtPluginInit)
            {
                RunClientManagerStartupLisp();
            }
        }
 public CogbotNotificationListener()
 {
     _cogbotNotification = this;
     Notification.OnNotificationDisplayed += Test_OnNotificationOpened;
 }
 public CogbotNotificationListener()
 {
     _cogbotNotification = this;
     Notification.OnNotificationDisplayed += Test_OnNotificationOpened;
 }
        public void StartPlugin0(RadegastInstance inst)
        {
            RadegastInstance = inst;
            Control.CheckForIllegalCrossThreadCalls = false;
            AddRadegastEvents();
            CogbotContextMenuListener = new CogbotContextMenuListener();
            CogbotNoticeuListener = new CogbotNotificationListener();
            if (ClientManagerConfig.UsingRadegastFromCogbot)
            {
                // just unregister events for now
                inst.Netcom.Dispose();
                clientManager = ClientManager.SingleInstance ?? new ClientManager();
                // _theBot = clientManager.LastBotClient;
            }
            else
            {
                if (!plugInitCalledEver)
                {
                    CogbotGUI.GlobalRadegastInstance = inst;
                }
                ClientManagerConfig.UsingCogbotFromRadegast = true;
                clientManager = ClientManager.SingleInstance ?? new ClientManager();
            }
            BotClient bc = clientManager.EnsureBotByGridClient(inst.Client);
            bc.TheRadegastInstance = inst;
            _theBot = bc;
            cogbotRadegastInterpreter = new CogbotRadegastInterpreter(this);
            RadegastInstance.CommandsManager.LoadInterpreter(cogbotRadegastInterpreter);
            _commandContextAction = new CommandContextAction(inst, this);
            _commandContextAction.ScanCogbotMenu();
            inst.TabConsole.RegisterContextAction(_commandContextAction);
            _aspectContextAction = new AspectContextAction(inst, this);
            inst.TabConsole.RegisterContextAction(_aspectContextAction);
            _simUsageContextAction = new SimUsageContextAction(inst, this);
            inst.TabConsole.RegisterContextAction(_simUsageContextAction);

            //if (ClientManager.UsingRadgastFromCogbot) return;
            inst.Client.Settings.MULTIPLE_SIMS = true;
            clientManager.outputDelegate = System.Console.Out.WriteLine;
            GUIInvoke(() => SetupRadegastGUI(inst));
            DLRConsole.SafelyRun(() => clientManager.ProcessCommandArgs());
            chatConsole.StartWriter();
            if (!bc.IsLoggedInAndReady)
            {
                TheBot.InvokeNext("Re-enable login button", () =>
                                                                {
                                                                    TheBot.DebugWriteLine("SetLoginButton = r-enabled");
                                                                    SetLoginButton(OldLoginText, true);
                                                                });
            }
            if (plugInitCalledEver)
            {
                return;
            }
            plugInitCalledEver = true;
            if (ClientManagerConfig.StartLispThreadAtPluginInit)
            {
                RunClientManagerStartupLisp();
            }
        }