//this routine should return -1 if xy and 0 if x==y. // for our sample we'll just use string comparison public int Compare(object x, object y) { ListViewItem item1 = (ListViewItem)x; ListViewItem item2 = (ListViewItem)y; if (sortByName) { return(string.Compare(item1.Text, item2.Text)); } double dist1 = Vector3d.Distance(me.GlobalPosition, SimObjectsConsole.WorldPosition(((SimObject)item1.Tag))); double dist2 = Vector3d.Distance(me.GlobalPosition, SimObjectsConsole.WorldPosition(((SimObject)item2.Tag))); if (dist1 == dist2) { return(String.Compare(item1.Text, item2.Text)); } else { if (dist1 < dist2) { return(-1); } return(1); } }
private void SetupRadegastGUI(RadegastInstance inst) { DLRConsole.AllocConsole(); SetLoginButton("SetupCogbotGUI", false); DLRConsole.SafelyRun(() => { chatConsole = new CogbotTabWindow(inst, this) { Dock = DockStyle.Fill, Visible = false }; tab = inst.TabConsole.AddTab("cogbot", "Cogbot", chatConsole); tab.AllowClose = false; tab.AllowDetach = true; }); DLRConsole.SafelyRun(() => { _simObjectsConsole = new SimObjectsConsole(inst, this) { Dock = DockStyle.Fill, // Visible = false }; tab = inst.TabConsole.AddTab("simobjects", "SimObjects", _simObjectsConsole); tab.AllowClose = false; tab.AllowDetach = true; }); DLRConsole.SafelyRun(() => { RadegastTab tab1 = RadegastInstance.TabConsole.GetTab("chat"); tab1.AllowDetach = true; ChatConsole rchatConsole = (ChatConsole)tab1.Control; rchatConsole.cbxInput.Enabled = true; rchatConsole.btnSay.Enabled = true; // rchatConsole.btnShout.Enabled = true; //RadegastTab tab3 = RadegastInstance.TabConsole.GetTab("search"); //tab3.Control = new METAbolt.SearchConsole(inst); DLRConsole.SafelyRun(() => { var sc = new METAbolt.SearchConsole(inst) { Dock = DockStyle.Fill, // Visible = false }; tab = inst.TabConsole.AddTab("cogbotsearch", "CogbotSearch", sc); tab.AllowClose = false; tab.AllowDetach = true; }); }); if (TheBot.IsLoggedInAndReady) { RadegastInstance.Netcom.GetType().GetMethod("Network_LoginProgress", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) .Invoke(RadegastInstance.Netcom, new object[] { this, new LoginProgressEventArgs(LoginStatus.Success, "Cogbot already logged in", "") }); } }
private void SetupRadegastGUI(RadegastInstance inst) { DLRConsole.AllocConsole(); SetLoginButton("SetupCogbotGUI", false); DLRConsole.SafelyRun(() => { chatConsole = new CogbotTabWindow(inst, this) { Dock = DockStyle.Fill, Visible = false }; tab = inst.TabConsole.AddTab("cogbot", "Cogbot", chatConsole); tab.AllowClose = false; tab.AllowDetach = true; }); DLRConsole.SafelyRun(() => { _simObjectsConsole = new SimObjectsConsole(inst, this) { Dock = DockStyle.Fill, // Visible = false }; tab = inst.TabConsole.AddTab("simobjects", "SimObjects", _simObjectsConsole); tab.AllowClose = false; tab.AllowDetach = true; }); DLRConsole.SafelyRun(() => { RadegastTab tab1 = RadegastInstance.TabConsole.GetTab("chat"); tab1.AllowDetach = true; ChatConsole rchatConsole = (ChatConsole)tab1.Control; rchatConsole.cbxInput.Enabled = true; rchatConsole.btnSay.Enabled = true; // rchatConsole.btnShout.Enabled = true; //RadegastTab tab3 = RadegastInstance.TabConsole.GetTab("search"); //tab3.Control = new METAbolt.SearchConsole(inst); DLRConsole.SafelyRun(() => { var sc = new METAbolt.SearchConsole(inst) { Dock = DockStyle.Fill, // Visible = false }; tab = inst.TabConsole.AddTab("cogbotsearch", "CogbotSearch", sc); tab.AllowClose = false; tab.AllowDetach = true; }); }); if (TheBot.IsLoggedInAndReady) { RadegastInstance.Netcom.GetType().GetMethod("Network_LoginProgress", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) .Invoke(RadegastInstance.Netcom, new object[] {this, new LoginProgressEventArgs(LoginStatus.Success, "Cogbot already logged in", "")}); } }