OSDN Git Service

RAD-308: Add Login option to File drop down
authorLatif Khalifa <latifer@streamgrid.net>
Thu, 19 Apr 2012 23:44:57 +0000 (23:44 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Thu, 19 Apr 2012 23:44:57 +0000 (23:44 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@1269 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/GUI/Consoles/MapConsole.cs
Radegast/GUI/Consoles/TabsConsole.cs
Radegast/GUI/Dialogs/MainForm.Designer.cs
Radegast/GUI/Dialogs/MainForm.cs

index e4e62af..ae99a22 100644 (file)
@@ -159,6 +159,7 @@ namespace Radegast
         {
             // Unregister callbacks
             UnregisterClientEvents(client);
+            instance.ClientChanged -= new EventHandler<ClientChangedEventArgs>(instance_ClientChanged);
 
             if (map != null)
             {
index f157049..34f8e9e 100644 (file)
@@ -674,8 +674,13 @@ namespace Radegast
             }
         }
 
-        private void InitializeMainTab()
+        public void InitializeMainTab()
         {
+            if (TabExists("login"))
+            {
+                ForceCloseTab("login");
+            }
+
             LoginConsole loginConsole = new LoginConsole(instance);
 
             RadegastTab tab = AddTab("login", "Login", loginConsole);
index fa8c458..6354833 100644 (file)
@@ -150,6 +150,7 @@ namespace Radegast
             this.ctxTreyRestore = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
             this.ctxTreyExit = new System.Windows.Forms.ToolStripMenuItem();
+            this.loginToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStrip1.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
@@ -196,6 +197,7 @@ namespace Radegast
             this.tmnuImport,
             this.scriptEditorToolStripMenuItem,
             this.toolStripMenuItem3,
+            this.loginToolStripMenuItem,
             this.disconnectToolStripMenuItem,
             this.reconnectToolStripMenuItem,
             this.tmnuPrefs,
@@ -572,7 +574,7 @@ namespace Radegast
             this.tbnObjects.Size = new System.Drawing.Size(51, 22);
             this.tbnObjects.Text = "Objects";
             this.tbnObjects.ToolTipText = "Displays a list of nearby objects that you can perform various operations on (Alt" +
-                "-7)";
+    "-7)";
             this.tbnObjects.Click += new System.EventHandler(this.tbnObjects_Click);
             // 
             // lblTime
@@ -885,6 +887,14 @@ namespace Radegast
             this.ctxTreyExit.ToolTipText = "Loggs of and closes application";
             this.ctxTreyExit.Click += new System.EventHandler(this.ctxTreyExit_Click);
             // 
+            // loginToolStripMenuItem
+            // 
+            this.loginToolStripMenuItem.Enabled = false;
+            this.loginToolStripMenuItem.Name = "loginToolStripMenuItem";
+            this.loginToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
+            this.loginToolStripMenuItem.Text = "Login";
+            this.loginToolStripMenuItem.Click += new System.EventHandler(this.loginToolStripMenuItem_Click);
+            // 
             // frmMain
             // 
             this.AutoSavePosition = true;
@@ -900,10 +910,10 @@ namespace Radegast
             this.MinimumSize = new System.Drawing.Size(754, 541);
             this.Name = "frmMain";
             this.Text = "Radegast";
-            this.Load += new System.EventHandler(this.frmMain_Load);
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing);
-            this.Resize += new System.EventHandler(this.frmMain_Resize);
+            this.Load += new System.EventHandler(this.frmMain_Load);
             this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.frmMain_KeyDown);
+            this.Resize += new System.EventHandler(this.frmMain_Resize);
             this.toolStrip1.ResumeLayout(false);
             this.toolStrip1.PerformLayout();
             this.statusStrip1.ResumeLayout(false);
@@ -998,6 +1008,7 @@ namespace Radegast
         public System.Windows.Forms.ToolStripMenuItem muteListToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem myAttachmentsToolStripMenuItem;
         public System.Windows.Forms.ToolStripButton tsb3D;
+        public System.Windows.Forms.ToolStripMenuItem loginToolStripMenuItem;
     }
 }
 
index 42bf5dd..d9b47f6 100644 (file)
@@ -339,6 +339,7 @@ namespace Radegast
             {
                 InAutoReconnect = false;
                 reconnectToolStripMenuItem.Enabled = false;
+                loginToolStripMenuItem.Enabled = false;
                 tsb3D.Enabled = tbtnVoice.Enabled = disconnectToolStripMenuItem.Enabled =
                 tbtnGroups.Enabled = tbnObjects.Enabled = tbtnWorld.Enabled = tbnTools.Enabled = tmnuImport.Enabled =
                     tbtnFriends.Enabled = tbtnInventory.Enabled = tbtnSearch.Enabled = tbtnMap.Enabled = true;
@@ -355,6 +356,7 @@ namespace Radegast
                 tbtnFriends.Enabled = tbtnInventory.Enabled = tbtnSearch.Enabled = tbtnMap.Enabled = false;
 
             reconnectToolStripMenuItem.Enabled = true;
+            loginToolStripMenuItem.Enabled = true;
             InAutoReconnect = false;
 
             if (statusTimer != null)
@@ -1538,5 +1540,11 @@ namespace Radegast
                 }
             }
         }
+
+        private void loginToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            TabConsole.InitializeMainTab();
+            TabConsole.Tabs["login"].Select();
+        }
     }
 }
\ No newline at end of file