private void Handler_VeicoloAggiunto(Veicolo v, Aggiungi a) { try { string pth = a.img.Split('\\')[a.img.Split('\\').Length - 1];//COPIO L'IMMAGINE DAL PATH ORIGINALE ALLA CARTELLA /WWW/IMAGES if (!File.Exists(Path.Combine(Properties.Resources.IMAGE_FOLDER_PATH, pth))) { File.Copy(a.img, Path.Combine(Properties.Resources.IMAGE_FOLDER_PATH, pth)); } v.ImagePath = Path.Combine(Properties.Resources.IMAGE_FOLDER_PATH, pth); } catch { v.ImagePath = ""; } a.img = ""; listaVeicoliAggiunti.Add(v); modifica = true; var c = new Card(v); this.pnlMain.Controls.Add(c); c.CardDeleted += Handler_CardDeleted; c.CardShowed += Handler_CardShowed; this.Tb.TabPages.Remove(tAggiungi); this.tAggiungi = null; }//EVENTO 'AGGIUNTA DI UN VEICOLO'
}//SHORTCUT #endregion #region toolStripButtons Click private void NuovoToolStripButton_Click(object sender, EventArgs e) { if (this.tAggiungi == null) //CONTROLLO SE NON HO GIA' APERTO LA TAB PER L'AGGIUNTA { this.tAggiungi = new TabPage(); //CREO UNA NUOVA PAGINA var a = new Aggiungi() { Dock = DockStyle.Fill }; a.VeicoloAggiunto += Handler_VeicoloAggiunto; this.tAggiungi.Controls.Add(a); this.tAggiungi.Text = "Aggiungi"; this.Tb.TabPages.Add(this.tAggiungi); this.Tb.SelectTab(this.tAggiungi); } else if (this.Tb.SelectedTab != this.tAggiungi) { this.Tb.SelectTab(this.tAggiungi); } }//AGGIUNTA VEICOLO