void rw_Closed(object sender, EventArgs e) { RecordsWindow rw = (RecordsWindow)sender; FCBList.Remove(rw.FCB); rw.FCB.Closefile(); }
private void OpenFile(FileUserControl fuc) { try { if ((from i in FCBList where i.GetFileDescription().FileName == fuc.DirEntry.FileName select i).AsParallel().FirstOrDefault() != null) { throw new Exception("Can't open file, already open.");// create only one FCB. } FCBList.Insert(0, Dsk.Openfile(fuc.DirEntry.FileName, MainWindow.User, "IO")); RecordsWindow rw = new RecordsWindow(FCBList[0]); rw.Closed += rw_Closed; subwindows.Insert(0, rw); rw.Show(); } catch (Exception exp) { ErrorHandling.ShowError(exp.Message); } }