From b1e7547aca2e2a7bbbbaaa8deefae4d41ff371df Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 21 Oct 2006 02:36:41 +0000 Subject: [PATCH] Adding groupmanager to svn git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@357 52acb1d6-8a22-11de-b505-999d5b087335 --- .../examples/groupmanager/App.ico | Bin 0 -> 1078 bytes .../groupmanager/frmGroupInfo.Designer.cs | 38 +++ .../examples/groupmanager/frmGroupInfo.cs | 22 ++ .../groupmanager/frmGroupManager.Designer.cs | 220 ++++++++++++++++++ .../examples/groupmanager/frmGroupManager.cs | 115 +++++++++ .../groupmanager/frmGroupManager.resx | 120 ++++++++++ .../examples/groupmanager/groupmanager.csproj | 128 ++++++++++ 7 files changed, 643 insertions(+) create mode 100644 libsecondlife-cs/examples/groupmanager/App.ico create mode 100644 libsecondlife-cs/examples/groupmanager/frmGroupInfo.Designer.cs create mode 100644 libsecondlife-cs/examples/groupmanager/frmGroupInfo.cs create mode 100644 libsecondlife-cs/examples/groupmanager/frmGroupManager.Designer.cs create mode 100644 libsecondlife-cs/examples/groupmanager/frmGroupManager.cs create mode 100644 libsecondlife-cs/examples/groupmanager/frmGroupManager.resx create mode 100644 libsecondlife-cs/examples/groupmanager/groupmanager.csproj diff --git a/libsecondlife-cs/examples/groupmanager/App.ico b/libsecondlife-cs/examples/groupmanager/App.ico new file mode 100644 index 0000000000000000000000000000000000000000..3a5525fd794f7a7c5c8e6187f470ea3af38cd2b6 GIT binary patch literal 1078 zcmeHHJr05}7=1t!Hp3A*8IHkVf+j?-!eHY14Gtcw1Eb*_9>Bq^zETJ@GKj{_2j4$w zo9}xCh!8{T3=X##Skq>ikMjsvB|y%crWBM2iW(4pI}c%z6%lW!=~4v77#3{z!dmB1 z__&l)-{KUYR+|8|;wB^R|9ET$J@(@=#rd^=)qs85?vAy(PSF5CyNkus435LVkZ$rj zNw|JG-P7^hF<(;#o*Vk}5R#e|^13tBbQkeF?djULtvqyxd3<{9 literal 0 HcmV?d00001 diff --git a/libsecondlife-cs/examples/groupmanager/frmGroupInfo.Designer.cs b/libsecondlife-cs/examples/groupmanager/frmGroupInfo.Designer.cs new file mode 100644 index 00000000..9adf6b79 --- /dev/null +++ b/libsecondlife-cs/examples/groupmanager/frmGroupInfo.Designer.cs @@ -0,0 +1,38 @@ +namespace groupmanager +{ + partial class frmGroupInfo + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Text = "frmGroupInfo"; + } + + #endregion + } +} \ No newline at end of file diff --git a/libsecondlife-cs/examples/groupmanager/frmGroupInfo.cs b/libsecondlife-cs/examples/groupmanager/frmGroupInfo.cs new file mode 100644 index 00000000..c302ecee --- /dev/null +++ b/libsecondlife-cs/examples/groupmanager/frmGroupInfo.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using libsecondlife; + +namespace groupmanager +{ + public partial class frmGroupInfo : Form + { + Group Group; + public frmGroupInfo(Group group) + { + Group = group; + + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/libsecondlife-cs/examples/groupmanager/frmGroupManager.Designer.cs b/libsecondlife-cs/examples/groupmanager/frmGroupManager.Designer.cs new file mode 100644 index 00000000..eb545253 --- /dev/null +++ b/libsecondlife-cs/examples/groupmanager/frmGroupManager.Designer.cs @@ -0,0 +1,220 @@ +namespace groupmanager +{ + partial class frmGroupManager + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox = new System.Windows.Forms.GroupBox(); + this.lstGroups = new System.Windows.Forms.ListBox(); + this.grpLogin = new System.Windows.Forms.GroupBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.txtLastName = new System.Windows.Forms.TextBox(); + this.cmdConnect = new System.Windows.Forms.Button(); + this.txtFirstName = new System.Windows.Forms.TextBox(); + this.cmdLeave = new System.Windows.Forms.Button(); + this.cmdCreate = new System.Windows.Forms.Button(); + this.cmdActivate = new System.Windows.Forms.Button(); + this.cmdInfo = new System.Windows.Forms.Button(); + this.groupBox.SuspendLayout(); + this.grpLogin.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox + // + this.groupBox.Controls.Add(this.cmdInfo); + this.groupBox.Controls.Add(this.cmdActivate); + this.groupBox.Controls.Add(this.cmdCreate); + this.groupBox.Controls.Add(this.cmdLeave); + this.groupBox.Controls.Add(this.lstGroups); + this.groupBox.Enabled = false; + this.groupBox.Location = new System.Drawing.Point(12, 12); + this.groupBox.Name = "groupBox"; + this.groupBox.Size = new System.Drawing.Size(419, 214); + this.groupBox.TabIndex = 0; + this.groupBox.TabStop = false; + this.groupBox.Text = "Groups"; + // + // lstGroups + // + this.lstGroups.FormattingEnabled = true; + this.lstGroups.Location = new System.Drawing.Point(19, 31); + this.lstGroups.Name = "lstGroups"; + this.lstGroups.Size = new System.Drawing.Size(384, 134); + this.lstGroups.TabIndex = 0; + this.lstGroups.SelectedIndexChanged += new System.EventHandler(this.lstGroups_SelectedIndexChanged); + // + // grpLogin + // + this.grpLogin.Controls.Add(this.label3); + this.grpLogin.Controls.Add(this.label2); + this.grpLogin.Controls.Add(this.label1); + this.grpLogin.Controls.Add(this.txtPassword); + this.grpLogin.Controls.Add(this.txtLastName); + this.grpLogin.Controls.Add(this.cmdConnect); + this.grpLogin.Controls.Add(this.txtFirstName); + this.grpLogin.Location = new System.Drawing.Point(12, 232); + this.grpLogin.Name = "grpLogin"; + this.grpLogin.Size = new System.Drawing.Size(419, 108); + this.grpLogin.TabIndex = 51; + this.grpLogin.TabStop = false; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(280, 24); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(120, 16); + this.label3.TabIndex = 50; + this.label3.Text = "Password"; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(152, 24); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(120, 16); + this.label2.TabIndex = 50; + this.label2.Text = "Last Name"; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(16, 24); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(120, 16); + this.label1.TabIndex = 50; + this.label1.Text = "First Name"; + // + // txtPassword + // + this.txtPassword.Location = new System.Drawing.Point(280, 40); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.PasswordChar = '*'; + this.txtPassword.Size = new System.Drawing.Size(120, 20); + this.txtPassword.TabIndex = 2; + // + // txtLastName + // + this.txtLastName.Location = new System.Drawing.Point(152, 40); + this.txtLastName.Name = "txtLastName"; + this.txtLastName.Size = new System.Drawing.Size(112, 20); + this.txtLastName.TabIndex = 1; + // + // cmdConnect + // + this.cmdConnect.Location = new System.Drawing.Point(280, 66); + this.cmdConnect.Name = "cmdConnect"; + this.cmdConnect.Size = new System.Drawing.Size(120, 24); + this.cmdConnect.TabIndex = 3; + this.cmdConnect.Text = "Connect"; + this.cmdConnect.Click += new System.EventHandler(this.cmdConnect_Click); + // + // txtFirstName + // + this.txtFirstName.Location = new System.Drawing.Point(16, 40); + this.txtFirstName.Name = "txtFirstName"; + this.txtFirstName.Size = new System.Drawing.Size(120, 20); + this.txtFirstName.TabIndex = 0; + // + // cmdLeave + // + this.cmdLeave.Enabled = false; + this.cmdLeave.Location = new System.Drawing.Point(313, 174); + this.cmdLeave.Name = "cmdLeave"; + this.cmdLeave.Size = new System.Drawing.Size(90, 23); + this.cmdLeave.TabIndex = 7; + this.cmdLeave.Text = "Leave"; + this.cmdLeave.UseVisualStyleBackColor = true; + // + // cmdCreate + // + this.cmdCreate.Location = new System.Drawing.Point(19, 174); + this.cmdCreate.Name = "cmdCreate"; + this.cmdCreate.Size = new System.Drawing.Size(90, 23); + this.cmdCreate.TabIndex = 8; + this.cmdCreate.Text = "Create"; + this.cmdCreate.UseVisualStyleBackColor = true; + // + // cmdActivate + // + this.cmdActivate.Enabled = false; + this.cmdActivate.Location = new System.Drawing.Point(116, 174); + this.cmdActivate.Name = "cmdActivate"; + this.cmdActivate.Size = new System.Drawing.Size(90, 23); + this.cmdActivate.TabIndex = 9; + this.cmdActivate.Text = "Activate"; + this.cmdActivate.UseVisualStyleBackColor = true; + // + // cmdInfo + // + this.cmdInfo.Enabled = false; + this.cmdInfo.Location = new System.Drawing.Point(216, 174); + this.cmdInfo.Name = "cmdInfo"; + this.cmdInfo.Size = new System.Drawing.Size(90, 23); + this.cmdInfo.TabIndex = 10; + this.cmdInfo.Text = "Info"; + this.cmdInfo.UseVisualStyleBackColor = true; + this.cmdInfo.Click += new System.EventHandler(this.cmdInfo_Click); + // + // frmGroupManager + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(445, 351); + this.Controls.Add(this.grpLogin); + this.Controls.Add(this.groupBox); + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(453, 378); + this.MinimumSize = new System.Drawing.Size(453, 378); + this.Name = "frmGroupManager"; + this.Text = "Group Manager"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmGroupManager_FormClosing); + this.groupBox.ResumeLayout(false); + this.grpLogin.ResumeLayout(false); + this.grpLogin.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox; + private System.Windows.Forms.ListBox lstGroups; + private System.Windows.Forms.GroupBox grpLogin; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtPassword; + private System.Windows.Forms.TextBox txtLastName; + private System.Windows.Forms.Button cmdConnect; + private System.Windows.Forms.TextBox txtFirstName; + private System.Windows.Forms.Button cmdInfo; + private System.Windows.Forms.Button cmdActivate; + private System.Windows.Forms.Button cmdCreate; + private System.Windows.Forms.Button cmdLeave; + } +} \ No newline at end of file diff --git a/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs b/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs new file mode 100644 index 00000000..709142d5 --- /dev/null +++ b/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using libsecondlife; +using libsecondlife.Packets; + +namespace groupmanager +{ + public partial class frmGroupManager : Form + { + SecondLife client; + + public frmGroupManager() + { + client = new SecondLife(); + client.Groups.OnGroupsUpdated += new GroupManager.GroupsUpdatedCallback(GroupsUpdatedHandler); + + InitializeComponent(); + } + + void GroupsUpdatedHandler() + { + Invoke(new MethodInvoker(UpdateGroups)); + } + + void UpdateGroups() + { + lstGroups.Items.Clear(); + + foreach (Group group in client.Groups.Groups) + { + lstGroups.Items.Add(group); + } + } + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + frmGroupManager frm = new frmGroupManager(); + frm.ShowDialog(); + } + + private void cmdConnect_Click(object sender, EventArgs e) + { + if (cmdConnect.Text == "Connect") + { + cmdConnect.Text = "Disconnect"; + txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = false; + + Hashtable loginParams = NetworkManager.DefaultLoginValues(txtFirstName.Text, + txtLastName.Text, txtPassword.Text, "00:00:00:00:00:00", "last", + "Win", "0", "groupmanager", "jhurliman@wsu.edu"); + + if (client.Network.Login(loginParams)) + { + groupBox.Enabled = true; + } + else + { + MessageBox.Show(this, "Error logging in: " + client.Network.LoginError); + cmdConnect.Text = "Connect"; + txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true; + groupBox.Enabled = false; + lstGroups.Items.Clear(); + } + } + else + { + client.Network.Logout(); + cmdConnect.Text = "Connect"; + txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true; + groupBox.Enabled = false; + lstGroups.Items.Clear(); + } + } + + private void lstGroups_SelectedIndexChanged(object sender, EventArgs e) + { + if (lstGroups.SelectedIndex >= 0) + { + cmdActivate.Enabled = cmdInfo.Enabled = cmdLeave.Enabled = true; + } + else + { + cmdActivate.Enabled = cmdInfo.Enabled = cmdLeave.Enabled = false; + } + } + + private void cmdInfo_Click(object sender, EventArgs e) + { + if (lstGroups.Items[lstGroups.SelectedIndex].ToString() != "none") + { + Group group = (Group)lstGroups.Items[lstGroups.SelectedIndex]; + + frmGroupInfo frm = new frmGroupInfo(group); + frm.ShowDialog(); + } + } + + private void frmGroupManager_FormClosing(object sender, FormClosingEventArgs e) + { + if (client.Network.Connected) + { + client.Network.Logout(); + } + } + } +} diff --git a/libsecondlife-cs/examples/groupmanager/frmGroupManager.resx b/libsecondlife-cs/examples/groupmanager/frmGroupManager.resx new file mode 100644 index 00000000..ff31a6db --- /dev/null +++ b/libsecondlife-cs/examples/groupmanager/frmGroupManager.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/libsecondlife-cs/examples/groupmanager/groupmanager.csproj b/libsecondlife-cs/examples/groupmanager/groupmanager.csproj new file mode 100644 index 00000000..ec77b773 --- /dev/null +++ b/libsecondlife-cs/examples/groupmanager/groupmanager.csproj @@ -0,0 +1,128 @@ + + + Local + 8.0.50727 + 2.0 + {F460FAB3-0D12-4873-89EB-2696818764B8} + Debug + AnyCPU + App.ico + + + groupmanager + + + JScript + Grid + IE50 + false + WinExe + groupmanager + OnBuildSuccess + + + + + + + + + ..\..\..\bin\ + false + 285212672 + false + + + DEBUG;TRACE + + + true + 4096 + false + + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + + TRACE + + + false + 4096 + false + + + true + false + false + false + 4 + none + prompt + + + + System + + + System.Data + + + System.Drawing + + + System.Windows.Forms + + + System.XML + + + libsecondlife + {D9CDEDFB-8169-4B03-B57F-0DF638F044EC} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Form + + + frmGroupInfo.cs + + + Form + + + frmGroupManager.cs + + + + + + + + Designer + frmGroupManager.cs + + + + + + + + + + \ No newline at end of file