Exemple #1
0
        public WindowHandler(ClientWindow cw)
        {
            InitializeComponent();
            List <string> items = config.readconfig();

            exeName       = items[0];
            dll           = items[1];
            drawingScreen = new DrawableScreen(cw, this);
            drawingPanel  = new DrawableScreen(cw, this);

            Load        += new EventHandler(Program_Load);
            FormClosing += new FormClosingEventHandler(Program_FormClosing);
            winDel       = new WinEventDelegate(HandleWindowChanges);
            MouseDown   += new MouseEventHandler(Form1_MouseDown);
            accManager   = new AccountManager();
            logViewer    = new LogViewer();
            logger       = new Logger(this, "a");


            Process p = null;

            p = System.Diagnostics.Process.Start(this.exeName);

            // Wait for process to be created and enter idle condition
            p.WaitForInputIdle();

            // Get the main handle
            appWin = p.MainWindowHandle;

            // Mark that control is created
            created = true;

            // Initialize handle value to invalid
            appWin = IntPtr.Zero;



            //this.Size = new Size(700, 600);
            this.cw = cw;



            //Move += new Form
            //this.AutoSize = true;

            //CheckForIllegalCrossThreadCalls = false;
        }
Exemple #2
0
 /// <summary>
 /// Internal use, the Bot will initialize the script with its input handlers once its loaded into memory
 /// </summary>
 /// <param name="bot">The reference to the bot's windowhandler</param>
 public void initializeInputs(WindowHandler bot)
 {
     this.EMouse             = bot.MOUSE;
     this.EPreciseMouse      = bot.PMOUSE;
     this.EMenuHandler       = bot.MENU;
     this.ECommunicator      = bot.COMMUNICATOR;
     this.EOverViewHandler   = bot.OVERVIEW;
     this.EStationHandler    = bot.STATION;
     this.MyShip             = bot.SHIP;
     this.ESession           = bot.SESSION;
     this.ECamera            = bot.CAMERA;
     this.EKeyboard          = bot.KEYBOARD;
     this.ELocalHandler      = bot.LOCAL;
     this.EDrawingArea       = bot.DrawingArea;
     this.ELogger            = bot.LOGGER;
     this.ELogger.ScriptName = name;
     this.EAgentHandler      = bot.AGENT;
     ERandom = new Random();
 }
Exemple #3
0
        /// <summary>
        /// Register a drawable area with the singleton
        /// </summary>
        /// <param name="screen">The drawable area to register</param>
        public static void addScreen(DrawableScreen screen)
        {
            int timeout = 300;

            rwlock.AcquireWriterLock(timeout);
            try
            {
                foreach (DrawableScreen s in screens)
                {
                    if (s.Equals(screen))
                    {
                        return;
                    }
                }
                screens.Add(screen);
            }
            finally
            {
                rwlock.ReleaseWriterLock();
            }
        }