[OpenMetaverse.GUI]

* Implemented LoginPanel component in Dashboard example
* Fixed and added more sanity checking on window handles
* Fixed gender detection showing some women as men

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2569 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
2009-03-31 21:28:51 +00:00
parent db5be9692b
commit 0bd903312c
8 changed files with 70 additions and 50 deletions

View File

@@ -36,6 +36,7 @@ namespace Dashboard
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.loginPanel1 = new OpenMetaverse.GUI.LoginPanel();
this.localChat1 = new OpenMetaverse.GUI.LocalChat();
this.statusOutput1 = new OpenMetaverse.GUI.StatusOutput();
this.avatarList1 = new OpenMetaverse.GUI.AvatarList();
@@ -62,8 +63,10 @@ namespace Dashboard
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point(0, 40);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
@@ -73,8 +76,8 @@ namespace Dashboard
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(632, 443);
this.splitContainer1.SplitterDistance = 418;
this.splitContainer1.Size = new System.Drawing.Size(772, 514);
this.splitContainer1.SplitterDistance = 540;
this.splitContainer1.TabIndex = 4;
//
// splitContainer3
@@ -91,8 +94,8 @@ namespace Dashboard
// splitContainer3.Panel2
//
this.splitContainer3.Panel2.Controls.Add(this.statusOutput1);
this.splitContainer3.Size = new System.Drawing.Size(418, 443);
this.splitContainer3.SplitterDistance = 335;
this.splitContainer3.Size = new System.Drawing.Size(540, 514);
this.splitContainer3.SplitterDistance = 388;
this.splitContainer3.TabIndex = 0;
//
// splitContainer2
@@ -109,8 +112,8 @@ namespace Dashboard
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.miniMap1);
this.splitContainer2.Size = new System.Drawing.Size(210, 443);
this.splitContainer2.SplitterDistance = 225;
this.splitContainer2.Size = new System.Drawing.Size(228, 514);
this.splitContainer2.SplitterDistance = 271;
this.splitContainer2.TabIndex = 9;
//
// tabControl1
@@ -123,7 +126,7 @@ namespace Dashboard
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(210, 225);
this.tabControl1.Size = new System.Drawing.Size(228, 271);
this.tabControl1.TabIndex = 1;
//
// tabPage1
@@ -132,7 +135,7 @@ namespace Dashboard
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(202, 199);
this.tabPage1.Size = new System.Drawing.Size(220, 245);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Nearby";
this.tabPage1.UseVisualStyleBackColor = true;
@@ -143,7 +146,7 @@ namespace Dashboard
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(202, 199);
this.tabPage2.Size = new System.Drawing.Size(202, 178);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Friends";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -153,7 +156,7 @@ namespace Dashboard
this.tabPage3.Controls.Add(this.groupList1);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(202, 199);
this.tabPage3.Size = new System.Drawing.Size(202, 178);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Groups";
this.tabPage3.UseVisualStyleBackColor = true;
@@ -163,18 +166,26 @@ namespace Dashboard
this.tabPage4.Controls.Add(this.inventoryTree1);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(202, 199);
this.tabPage4.Size = new System.Drawing.Size(202, 178);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Inventory";
this.tabPage4.UseVisualStyleBackColor = true;
//
// loginPanel1
//
this.loginPanel1.Dock = System.Windows.Forms.DockStyle.Top;
this.loginPanel1.Location = new System.Drawing.Point(0, 0);
this.loginPanel1.Name = "loginPanel1";
this.loginPanel1.Size = new System.Drawing.Size(772, 37);
this.loginPanel1.TabIndex = 5;
//
// localChat1
//
this.localChat1.Client = null;
this.localChat1.Dock = System.Windows.Forms.DockStyle.Fill;
this.localChat1.Location = new System.Drawing.Point(0, 0);
this.localChat1.Name = "localChat1";
this.localChat1.Size = new System.Drawing.Size(418, 335);
this.localChat1.Size = new System.Drawing.Size(540, 388);
this.localChat1.TabIndex = 4;
//
// statusOutput1
@@ -185,7 +196,7 @@ namespace Dashboard
this.statusOutput1.Location = new System.Drawing.Point(0, 0);
this.statusOutput1.Name = "statusOutput1";
this.statusOutput1.ReadOnly = true;
this.statusOutput1.Size = new System.Drawing.Size(418, 104);
this.statusOutput1.Size = new System.Drawing.Size(540, 122);
this.statusOutput1.TabIndex = 0;
this.statusOutput1.Text = "";
//
@@ -195,7 +206,8 @@ namespace Dashboard
this.avatarList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.avatarList1.Location = new System.Drawing.Point(3, 3);
this.avatarList1.Name = "avatarList1";
this.avatarList1.Size = new System.Drawing.Size(196, 193);
this.avatarList1.Size = new System.Drawing.Size(214, 239);
this.avatarList1.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.avatarList1.TabIndex = 2;
this.avatarList1.UseCompatibleStateImageBehavior = false;
this.avatarList1.View = System.Windows.Forms.View.Details;
@@ -206,7 +218,7 @@ namespace Dashboard
this.friendsList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.friendsList1.Location = new System.Drawing.Point(3, 3);
this.friendsList1.Name = "friendsList1";
this.friendsList1.Size = new System.Drawing.Size(196, 193);
this.friendsList1.Size = new System.Drawing.Size(196, 172);
this.friendsList1.TabIndex = 5;
this.friendsList1.UseCompatibleStateImageBehavior = false;
this.friendsList1.View = System.Windows.Forms.View.Details;
@@ -217,7 +229,7 @@ namespace Dashboard
this.groupList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupList1.Location = new System.Drawing.Point(0, 0);
this.groupList1.Name = "groupList1";
this.groupList1.Size = new System.Drawing.Size(202, 199);
this.groupList1.Size = new System.Drawing.Size(202, 178);
this.groupList1.TabIndex = 7;
this.groupList1.UseCompatibleStateImageBehavior = false;
this.groupList1.View = System.Windows.Forms.View.Details;
@@ -228,7 +240,7 @@ namespace Dashboard
this.inventoryTree1.Dock = System.Windows.Forms.DockStyle.Fill;
this.inventoryTree1.Location = new System.Drawing.Point(0, 0);
this.inventoryTree1.Name = "inventoryTree1";
this.inventoryTree1.Size = new System.Drawing.Size(202, 199);
this.inventoryTree1.Size = new System.Drawing.Size(202, 178);
this.inventoryTree1.TabIndex = 1;
//
// miniMap1
@@ -239,7 +251,7 @@ namespace Dashboard
this.miniMap1.Dock = System.Windows.Forms.DockStyle.Fill;
this.miniMap1.Location = new System.Drawing.Point(0, 0);
this.miniMap1.Name = "miniMap1";
this.miniMap1.Size = new System.Drawing.Size(210, 214);
this.miniMap1.Size = new System.Drawing.Size(228, 239);
this.miniMap1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.miniMap1.TabIndex = 11;
this.miniMap1.TabStop = false;
@@ -248,7 +260,8 @@ namespace Dashboard
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(632, 443);
this.ClientSize = new System.Drawing.Size(772, 548);
this.Controls.Add(this.loginPanel1);
this.Controls.Add(this.splitContainer1);
this.Name = "Dashboard";
this.Text = "Dashboard";
@@ -288,6 +301,7 @@ namespace Dashboard
private System.Windows.Forms.SplitContainer splitContainer3;
private OpenMetaverse.GUI.LocalChat localChat1;
private OpenMetaverse.GUI.StatusOutput statusOutput1;
private OpenMetaverse.GUI.LoginPanel loginPanel1;
}
}

View File

@@ -13,6 +13,7 @@ namespace Dashboard
GridClient Client;
LoginParams ClientLogin;
bool ShuttingDown = false;
/// <summary>
/// Provides a full representation of OpenMetaverse.GUI
@@ -37,8 +38,12 @@ namespace Dashboard
//login
ClientLogin = Client.Network.DefaultLoginParams(firstName, lastName, password, "OpenMetaverse Dashboard", Assembly.GetExecutingAssembly().GetName().Version.ToString());
loginPanel1.LoginParams = ClientLogin;
ClientLogin.Start = "last";
Client.Network.BeginLogin(ClientLogin);
if (firstName != String.Empty && lastName != String.Empty && password != String.Empty)
Client.Network.BeginLogin(ClientLogin);
}
private void InitializeClient(bool initialize)
@@ -55,21 +60,24 @@ namespace Dashboard
//initialize client object
Client = new GridClient();
Client.Network.OnLogin += new NetworkManager.LoginCallback(Network_OnLogin);
Client.Settings.USE_TEXTURE_CACHE = true;
Client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected);
//define the client object for each GUI element
avatarList1.Client = Client;
friendsList1.Client = Client;
groupList1.Client = Client;
inventoryTree1.Client = Client;
localChat1.Client = Client;
loginPanel1.Client = Client;
miniMap1.Client = Client;
statusOutput1.Client = Client;
}
private void Dashboard_FormClosing(object sender, FormClosingEventArgs e)
{
ShuttingDown = true;
InitializeClient(false);
Environment.Exit(0);
}
@@ -89,19 +97,9 @@ namespace Dashboard
MessageBox.Show(group.Name + " = " + group.ID);
}
private void Network_OnLogin(LoginStatus login, string message)
private void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message)
{
if (login == LoginStatus.Failed)
{
this.BeginInvoke((MethodInvoker)delegate
{
if (MessageBox.Show(this, "Login failed. Try again?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
{
InitializeClient(true);
Client.Network.BeginLogin(ClientLogin);
}
});
}
InitializeClient(!ShuttingDown);
}
}

View File

@@ -11,8 +11,12 @@ namespace Dashboard
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length > 2) Application.Run(new Dashboard(args[0], args[1], args[2]));
else MessageBox.Show("Usage: dashboard.exe <firstName> <lastName> <password>", "Dashboard", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
string firstName = args.Length > 0 ? args[0] : String.Empty;
string lastName = args.Length > 2 ? args[1] : String.Empty;
string password = args.Length > 2 ? args[2] : String.Empty;
Application.Run(new Dashboard(firstName, lastName, password));
}
}
}