TreeNode AddSessionNode(TreeNode parentNode, SessionData session, bool isInitializing)
        {
            TreeNode addedNode = null;

            if (parentNode.Nodes.ContainsKey(session.SessionName))
            {
                SuperPuTTY.ReportStatus("Node with the same name exists.  New node ({0}) NOT added", session.SessionName);
            }
            else
            {
                addedNode     = parentNode.Nodes.Add(session.SessionName, session.SessionName, ImageKeySession, ImageKeySession);
                addedNode.Tag = session;
                addedNode.ContextMenuStrip = contextMenuStripAddTreeItem;
                addedNode.ToolTipText      = session.ToString();

                // Override with custom icon if valid
                if (IsValidImage(session.ImageKey))
                {
                    addedNode.ImageKey         = session.ImageKey;
                    addedNode.SelectedImageKey = session.ImageKey;
                }
            }

            session.OnPropertyChanged  += SessionPropertyChanged;
            session.OnPropertyChanging += SessionPropertyChanging;

            return(addedNode);
        }
        private void removeFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;

            if (node != null)
            {
                if (node.Nodes.Count > 0)
                {
                    List <SessionData> sessions = new List <SessionData>();
                    GetAllSessions(node, sessions);
                    if (DialogResult.Yes == MessageBox.Show(
                            "Remove Folder [" + node.Text + "] and [" + sessions.Count + "] sessions?",
                            "Remove Folder?",
                            MessageBoxButtons.YesNo))
                    {
                        foreach (SessionData session in sessions)
                        {
                            SuperPuTTY.RemoveSession(session.SessionId);
                        }
                        node.Remove();
                        SuperPuTTY.ReportStatus("Removed Folder, {0} and {1} sessions", node.Text, sessions.Count);
                        SuperPuTTY.SaveSessions();
                    }
                }
                else
                {
                    node.Remove();
                    SuperPuTTY.ReportStatus("Removed Folder, {0}", node.Text);
                }
            }
        }
 void Instance_FormClosed(object sender, FormClosedEventArgs e)
 {
     this.Instance = null;
     SuperPuTTY.ReportStatus("Closed {0}", this.Name);
     if (this.toolStrip != null && !SuperPuTTY.IsLayoutChanging && e.CloseReason == CloseReason.UserClosing)
     {
         this.toolStrip.Checked = false;
     }
 }
        private void timerDelayedSave_Tick(object sender, EventArgs e)
        {
            // stop timer
            timerDelayedSave.Stop();

            // do save
            SuperPuTTY.SaveSessions();
            SuperPuTTY.ReportStatus("Saved Sessions after Drag-Drop @ {0}", DateTime.Now);
        }
Exemple #5
0
        public void ShowWindow(DockPane pane, IDockContent PreviousContent)
        {
            if (this.Instance == null)
            {
                Initialize();
            }

            Instance.Show(pane, PreviousContent);
            SuperPuTTY.ReportStatus("Showing " + this.Name);
        }
 public void ShowWindow(DockPane pane, DockAlignment dockAlign, double proportion)
 {
     if (this.Instance == null)
     {
         Initialize();
         this.Instance.Show(pane, dockAlign, proportion);
         SuperPuTTY.ReportStatus("Showing " + this.Name);
     }
     else
     {
         this.Instance.Show(DockPanel);
         SuperPuTTY.ReportStatus("Bringing {0} to Front", this.Name);
     }
 }
 public void ShowWindow(DockState dockState)
 {
     if (this.Instance == null)
     {
         Initialize();
         this.Instance.Show(DockPanel, dockState);
         SuperPuTTY.ReportStatus("Showing " + this.Name);
     }
     else
     {
         this.Instance.Show(DockPanel);
         SuperPuTTY.ReportStatus("Bringing {0} to Front", this.Name);
     }
 }
        TreeNode AddFolderNode(TreeNode parentNode, String nodeName)
        {
            TreeNode nodeNew = null;

            if (parentNode.Nodes.ContainsKey(nodeName))
            {
                SuperPuTTY.ReportStatus("Node with the same name exists.  New node ({0}) NOT added", nodeName);
            }
            else
            {
                SuperPuTTY.ReportStatus("Adding new folder, {1}.  parent={0}", parentNode.Text, nodeName);
                nodeNew = parentNode.Nodes.Add(nodeName, nodeName, ImageKeyFolder, ImageKeyFolder);
                nodeNew.ContextMenuStrip = contextMenuStripFolder;
            }
            return(nodeNew);
        }
 public void ShowWindow(DockState dockState)
 {
     if (this.Instance == null)
     {
         Initialize();
         this.Instance.Show(DockPanel, dockState);
         SuperPuTTY.ReportStatus("Showing " + this.Name);
     }
     else if (this.Instance.DockState == DockState.DockLeftAutoHide || this.Instance.DockState == DockState.DockRightAutoHide || this.Instance.DockState == DockState.DockBottomAutoHide)
     {
         //fix for >v2.7.0
         //http://stackoverflow.com/questions/13843604/calling-up-dockpanel-suites-autohidden-dockcontent-programmatically
         this.DockPanel.ActiveAutoHideContent = this.Instance;
         this.Instance.Focus();
         SuperPuTTY.ReportStatus("Unhiding " + this.Name);
     }
     else
     {
         this.Instance.Show(DockPanel);
         SuperPuTTY.ReportStatus("Bringing {0} to Front", this.Name);
     }
 }
 void Instance_FormClosed(object sender, FormClosedEventArgs e)
 {
     this.Instance = null;
     SuperPuTTY.ReportStatus("Closed {0}", this.Name);
 }