public static void Sluit_forms(base_form sluit_vanaf) { DE = Forms_OD.GetEnumerator(); int index = 0; bool gevonden = false; base_form herlaad_scherm = new base_form(); while (DE.MoveNext()) { if (DE.Key == sluit_vanaf && !gevonden) { herlaad_scherm = (base_form)Forms_OD[index]; KillStack.Push((base_form)DE.Key); gevonden = true; } else if (gevonden) { KillStack.Push((base_form)DE.Key); } ++index; } int KillCount = KillStack.Count; for (int j = 0; j < KillCount; j++) { base_form tmp = KillStack.Pop(); if (Sluitbaar(tmp)) { Forms_OD.Remove(tmp); tmp.program_closes = true; tmp.Close(); String log_line = "sluit venster @ " + DateTime.Now.ToString() + ": huidig: " + tmp.ToString() + ": close_naar: " + herlaad_scherm.ToString(); System.IO.StreamWriter file = new System.IO.StreamWriter(Global.log_file_path, true); file.WriteLine(log_line); file.Close(); } else { herlaad_scherm = tmp; break; } } if (gevonden) { herlaad_scherm.herlaad(); } KillStack.Clear(); }
public static void Sluit_form(base_form enkel_sluit) { base_form tmpfrm; if (Forms_OD.Contains(enkel_sluit)) { tmpfrm = (base_form)Forms_OD[enkel_sluit]; enkel_sluit.program_closes = true; enkel_sluit.Close(); Forms_OD.Remove(enkel_sluit); String log_line = "sluit venster @ " + DateTime.Now.ToString() + ": huidig: " + enkel_sluit.ToString() + ": close_naar: " + tmpfrm.ToString(); System.IO.StreamWriter file = new System.IO.StreamWriter(Global.log_file_path, true); file.WriteLine(log_line); file.Close(); } }