public void UpdateSessions() { this.menuTunnels.Enabled = false; if (!PuttyTunnelManagerSettings.Instance().HasPlink) { return; } this.menuTunnels.DropDownItems.Clear(); foreach (Session session in Core.Instance().Sessions) { List <Tunnel> tunnels = session.Tunnels; if (tunnels.Count > 0) { this.menuTunnels.Enabled = true; ToolStripMenuItem sessionItem = (ToolStripMenuItem)this.menuTunnels.DropDownItems.Add(session.Name); sessionItem.Tag = session; sessionItem.Click += new EventHandler(MenuSession_Click); if (session.IsOpen) { sessionItem.Checked = true; } } } }
public TrayIcon() { InitializeComponent(); // If plink.exe is not found, show the settings. this.settingsForm = new SettingsForm(); if (!PuttyTunnelManagerSettings.Instance().HasPlink) { this.notifyIcon.ShowBalloonTip(5, Application.ProductName, "Could not find plink.exe. Please locate it via the settings window.", ToolTipIcon.Info); settingsForm.ShowDialog(); } this.tipForm = new TipForm(); this.aboutForm = new AboutForm(); MessageForm messageForm = new MessageForm(); UserNotifications.init( messageForm ); UserNotifications.Notify( "PTM", "starting..." ); this.UpdateSessions(); // we need to enum sessions automaticaly for start some sessions }
public void UpdateSessions() { this.menuTunnels.Enabled = false; if (!PuttyTunnelManagerSettings.Instance().HasPlink) { return; } this.menuTunnels.DropDownItems.Clear(); foreach (Session session in Core.Instance().Sessions) { List <Tunnel> tunnels = session.Tunnels; if (tunnels.Count > 0) { this.menuTunnels.Enabled = true; var allTunnels = tunnels.Select(t => $" {t.Type} {t.SourcePort} > {t.DestinationPort}"); ToolStripMenuItem sessionItem = (ToolStripMenuItem) this.menuTunnels.DropDownItems.Add( session.Name + "\n" + String.Join("\n", allTunnels.ToArray()) ); sessionItem.Tag = session; sessionItem.Click += new EventHandler(MenuSession_Click); if (session.IsOpen) { sessionItem.Checked = true; } } } }
public TrayIcon() { InitializeComponent(); // If plink.exe is not found, show the settings. this.settingsForm = new SettingsForm(); if (!PuttyTunnelManagerSettings.Instance().HasPlink) { this.notifyIcon.ShowBalloonTip(5, Application.ProductName, "Could not find plink.exe. Please locate it via the settings window.", ToolTipIcon.Info); settingsForm.ShowDialog(); } this.tipForm = new TipForm(); this.aboutForm = new AboutForm(); this.UpdateSessions(); foreach (Session session in Core.Instance().Sessions) { if (!session.IsOpen && session.AutoStart) { session.Open(); } } }
private void buttonBrowseForPlink_Click(object sender, EventArgs e) { this.openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); if (DialogResult.OK == this.openFileDialog.ShowDialog(this)) { PuttyTunnelManagerSettings.Instance().PlinkLocation = this.openFileDialog.FileName; } this.UpdateSettings(); }
public TrayIcon() { InitializeComponent(); // If plink.exe is not found, show the settings. this.settingsForm = new SettingsForm(); if (!PuttyTunnelManagerSettings.Instance().HasPlink) { this.notifyIcon.ShowBalloonTip(5, Application.ProductName, "Could not find plink.exe. Please locate it via the settings window.", ToolTipIcon.Info); settingsForm.ShowDialog(); } this.tipForm = new TipForm(); this.aboutForm = new AboutForm(); }
private void PlinkLocation_TextChanged(object sender, EventArgs e) { if (File.Exists(this.plinkLocation.Text)) { PuttyTunnelManagerSettings.Instance().PlinkLocation = this.plinkLocation.Text; buttonDownloadPlink.Enabled = false; buttonBrowseForPlink.Enabled = false; plinkLocation.BackColor = SystemColors.Window; } else { buttonDownloadPlink.Enabled = true; buttonBrowseForPlink.Enabled = true; plinkLocation.BackColor = Color.LightCoral; } }
public void UpdateSettings() { this.plinkLocation.Text = PuttyTunnelManagerSettings.Instance().PlinkLocation; // This calls PlinkLocation_TextChanged }