private void saveLampBtn_Click(object sender, RoutedEventArgs e) { AddLampWindow dialog; if (CurrentLamp != null) { if (Controller.MainController.GetInstance().SavedLamps.Find(l => l.IP == CurrentLamp.IP) != null) { return; } dialog = new AddLampWindow(CurrentLamp.IP, CurrentLamp.Port, (CurrentLamp.GetType().FullName == "AlexGyver_s_Lamp_Control_Panel.Models.KDnLamp"), CurrentLamp.Name); } else { dialog = new AddLampWindow(); } dialog.ShowDialog(); Controller.MainController.GetInstance().SaveLamp(dialog.ReturnValue); refreshData(); }