private void timerForImport_Tick(object sender, EventArgs e) { timerForImport.Enabled = false; string ext = System.IO.Path.GetExtension(ImportFile).ToLower(); if (ext == ".specchr" && SaveQuestion()) { if (!CurrentProject.Open(ImportFile)) return; Project.EditName = ImportFile; CurrentSymbol = CurrentProject.ADD; InitBitmaps(); DrawDocument(); ResetHistory(); Change(true); return; } if (ext == ".tap") { FormLoadTAP form = new FormLoadTAP(FormLoadTAP.ImportTypes.Tap, ImportFile); if (form.ShowDialog() == DialogResult.OK) { InitBitmaps(); DrawDocument(); Change(false); } return; } if (ext == ".bmp" | ext == ".png" | ext == ".jpg" | ext == ".jpeg" | ext == ".gif") { FormLoadBMP form = new FormLoadBMP(ImportFile); if (form.ShowDialog() == DialogResult.OK) { Change(false); InitBitmaps(); DrawDocument(); } return; } //Если ничего не подошло, импортируем как бинарник using (FormLoadTAP form = new FormLoadTAP(FormLoadTAP.ImportTypes.Bin, ImportFile)) if (form.ShowDialog() == DialogResult.OK) { InitBitmaps(); DrawDocument(); Change(false); } }
//Импорт из файла void ImportFromFile(FormLoadTAP.ImportTypes type) { FormLoadTAP form = new FormLoadTAP(type); if (form.ShowDialog() == DialogResult.OK) { Change(false); InitBitmaps(); DrawDocument(); } }