private void Setting_OnClick(object sender, RoutedEventArgs e) { var phoneSetting = Setting ?? new PhoneSetting(); SettingWindow win = new SettingWindow(phoneSetting); var r = win.ShowDialog(); if (r.HasValue && r.Value) { Setting = phoneSetting; InitPhone(); } }
private void AddNew_OnClick(object sender, RoutedEventArgs e) { var setting = new PhoneSetting(); SettingWindow window = new SettingWindow(setting); var r = window.ShowDialog(); if (r.HasValue && r.Value) { var p = new Phone() { Setting = setting }; _appSetting.Phones.Add(setting); p.OnRemove += P_OnRemove; Phones.Children.Add(p); } ReSizeWindow(); }