private void button_close_Click(object sender, RoutedEventArgs e) { try { Applets.Settings s = form as Applets.Settings; s.SaveSettings(); } catch { } Canvas parentForm = this.Parent as Canvas; Grid parentForm2 = parentForm.Parent as Grid; TabBar parentForm3 = parentForm2.Parent as TabBar; parentForm3.RemoveTab(this); }
private void button_close_Click(object sender, MouseButtonEventArgs e) { if (form.GetType() == typeof(Applets.Settings)) { try { Applets.Settings s = form as Applets.Settings; s.SaveSettings(); } catch (Exception ex) { Console.WriteLine("Save settings error: " + ex.Message + " " + ex.Data + " "); } } TabBar tb = this.FindParent <TabBar>(); tb.RemoveTab(this); }