private void Bt\EditPLC\Click(object sender, RoutedEventArgs e) { if (SelectedSiemensPLC…
- User
private void Bt_EditPLC_Click(object sender, RoutedEventArgs e) { if (SelectedSiemensPLC != null) { SiemensEditor SiemensEditForm = new SiemensEditor(SelectedSiemensPLC.MySetUpInfo); SiemensEditForm.ShowDialog(); if (SiemensEditForm.DialogResult == true) { if(sQLite.UpdatePLCInDB(SiemensEditForm.MyInfo)) { SelectedSiemensPLC.MySetUpInfo = SiemensEditForm.MyInfo; ItemsConnection(SelectedSiemensPLC); } else { MessageBox.Show("PLC 수정이 실패하였습니다."); } } else { MessageBox.Show("PLC 수정을 취소하였습니다."); } SiemensEditForm.Close(); } else { MessageBox.Show("선택된 PLC 가 없습니다."); } }
- Assistant
This code is for a button click event in a Windows Forms application using C#. When the button is clicked, it checks if a variable "SelectedSiemensPLC" is not null. If it is not null, it opens a new window "SiemensEditor" and passes in the setup information of the selected PLC. The user can then edit the information in this new window. If the user clicks the "OK" button, the code will attempt to update the PLC information in the database using the method "UpdatePLCInDB" and passing in the new information. If the update is successful, the code updates the "SelectedSiemensPLC" variable with the new information and calls the method "ItemsConnection" passing in the updated "SelectedSiemensPLC" variable. If the update is not successful, a message box will display "PLC 수정이 실패하였습니다.". If the user clicks the "Cancel" button, a message box will display "PLC 수정을 취소하였습니다.". If the "SelectedSiemensPLC" variable is null, a message box will display "선택된 PLC 가 없습니다.".