private void btn_newSync_Click(object sender, EventArgs e) { SyncSettings ss = new SyncSettings(); tc_syncs.TabPages.Add("<New Sync>"); tc_syncs.TabPages[tc_syncs.TabPages.Count-1].Controls.Add(ss); linkSyncSettings(ss); ss.Dock = DockStyle.Top; }
private void linkSyncSettings(SyncSettings ss) { ss.Dock = DockStyle.Fill; ss.BringToFront(); ss.SrcChanged += new EventHandler<EventArgs>(ss_SrcChanged); ss.CloseClicked += new EventHandler<EventArgs>(ss_CloseClicked); ss.Status += new EventHandler<SyncSettings.StatusEventArgs>(ss_Status); ss.NeedScpPath += new EventHandler<SyncSettings.GetPathEventArgs>(ss_NeedScpPath); }
void ss_Status(object sender, SyncSettings.StatusEventArgs e) { StatusOut(((SyncSettings)sender).src, e.status); }
void ss_NeedScpPath(object sender, SyncSettings.GetPathEventArgs e) { if (File.Exists(_scpPath)) { e.path = _scpPath; } else { e.path = Environment.ExpandEnvironmentVariables("%programfiles(x86)%\\putty\\pscp.exe"); if (!File.Exists(e.path)) { e.path=Environment.ExpandEnvironmentVariables("%programfiles%\\putty\\pscp.exe"); if (!File.Exists(e.path)) { e.path = null; } } } }