private void AddBotVisual(SBot bot) { lock (this) { //Program.BM.Bots stc_Cord found = new stc_Cord(); if (OnlineList.TryGetValue(bot.CharName, out found)) return; this.Invoke(new MethodInvoker(() => { DevExpress.XtraMap.MapPushpin mp = new MapPushpin() { //Image = global::SbotControl.Properties.Resources.Info, Location = ConvertToGeoPoint(Convert.ToInt32(bot.PosX), Convert.ToInt32(bot.PosY)), Text = bot.CharName, TextColor = System.Drawing.Color.Lime, TextGlowColor = System.Drawing.Color.Gray, ToolTipPattern = string.Format("Lv. {0}\n\r{1}\n\r{2}\n\rKills: {3}\n\rXP Gained: {4}\n\rSP Gained: {5}\n\rGold: {6}\n\rDied: {7}\n\rDrops: {8}", bot.Level, bot.SilkroadServerStatus, bot.BotStatus, bot.Kills, bot.XPGained, bot.SPGained, bot.Gold, bot.Died, bot.ItemDrops), UseAnimation = true, }; ((DevExpress.XtraMap.InformationLayer)MCMain.Layers[0]).Data.Items.Add(mp); stc_Cord stc = new stc_Cord() { bot = bot, mp = mp }; //Create Context menu item DevExpress.XtraBars.BarButtonItem bbiNew = new DevExpress.XtraBars.BarButtonItem(); barManagerMain.Items.Add(bbiNew); bsiSetFocus.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {new DevExpress.XtraBars.LinkPersistInfo(bbiNew)}); bbiNew.Caption = bot.CharName; bbiNew.Glyph = global::SbotControl.Properties.Resources.geopoint_16x16; //bbiNew.Id = 1; bbiNew.Tag = stc; bbiNew.ItemClick += BbiSetFocus_ItemClick; bbiNew.Name = "bbiNew" + bot.CharName; stc.menu = bbiNew; OnlineList.Add(bot.CharName, stc); })); } }
private void RemoveBotVisual(SBot bot) { stc_Cord item = new stc_Cord(); if (!OnlineList.TryGetValue(bot.CharName, out item)) return; ((DevExpress.XtraMap.InformationLayer)MCMain.Layers[0]).Data.Items.Remove(item.mp); item.mp = null; item.menu.ItemClick -= BbiSetFocus_ItemClick; barManagerMain.Items.Remove(item.menu); item.menu.Dispose(); OnlineList.Remove(bot.CharName); }
public BotInfoUC(SBot sbot) { InitializeComponent(); _sbot = sbot; }
private void Bot_StateChanged(SBot sender, SBot.StatusType e) { switch (e) { case SBot.StatusType.Nothing: break; case SBot.StatusType.Unknown: break; case SBot.StatusType.Disconnected: break; case SBot.StatusType.Try_to_login: break; case SBot.StatusType.Online: break; case SBot.StatusType.bot_Process_Terminated: break; case SBot.StatusType.BotStuck_NPC: break; default: break; } }
private void _sbot_LogAdded(SBot sender, string Log) { rec.Invoke(new MethodInvoker(() => { AddLog(DateTime.Now.ToShortDateString(), Log); rec.Document.CaretPosition = rec.Document.Range.End; rec.ScrollToCaret(); })); }