public Toolbar(ProxyBot pProxyBot, StarCraftAgent pAgent) { InitializeComponent(); proxyBot = pProxyBot; agent = pAgent; //Subscribe to events proxyBot.OnStarcraftConnected += new ProxyBot.ProxyBotDelegate(proxyBot_OnStarcraftConnected); //Set up status bar proxyStatus = new ToolStripStatusLabel("Proxy Bot: Waiting for Starcraft..."); ssMainStatus.Items.Add(proxyStatus); }
public static void Main(System.String[] args) { StarCraftAgent agent = new StarCraftAgent(); ProxyBot proxyBot = new ProxyBot(agent); proxyBot.showGUI = false; try { proxyBot.start(); } catch (SocketException e) { e.WriteStackTrace(Console.Error); System.Environment.Exit(0); } catch (System.Exception e) { e.WriteStackTrace(Console.Error); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); StarCraftAgent agent = new StarCraftAgent(); ProxyBot proxyBot = new ProxyBot(agent); proxyBot.showGUI = true; //Start the agent in it's own thread BackgroundWorker proxyBotBg = new BackgroundWorker(); proxyBotBg.DoWork += new DoWorkEventHandler((object sender, DoWorkEventArgs e) => { proxyBot.start(); }); proxyBotBg.RunWorkerAsync(); //Sign up for the proxy bot connected event Toolbar toolbar = new Toolbar(proxyBot, agent); Application.Run(toolbar); }