/// <summary> /// 리스트뷰 클릭 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeviceLV_SelectedIndexChanged(object sender, EventArgs e) { if (this.DeviceLV.SelectedItems.Count != 0) { for (int i = 0; i < this.OaDeviceLV.Items.Count; i++) { this.OaDeviceLV.Items[i].Checked = false; } MapDevice mapDevice = this.deviceMng.GetDeviceOfDic(this.DeviceLV.SelectedItems[0].Name); if (mapDevice != null) { for (int i = 0; i < mapDevice.OaDeviceList.Count; i++) { if (this.OaDeviceLV.Items.ContainsKey(mapDevice.OaDeviceList[i].Key)) { this.OaDeviceLV.Items[mapDevice.OaDeviceList[i].Key].Checked = true; } } } } else { for (int i = 0; i < this.OaDeviceLV.Items.Count; i++) { this.OaDeviceLV.Items[i].Checked = false; } } }
/// <summary> /// 저장 버튼 클릭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddBtn_Click(object sender, EventArgs e) { if (this.DeviceLV.SelectedItems.Count == 1) { MapDevice mapDevice = this.deviceMng.GetDeviceOfDic(this.DeviceLV.SelectedItems[0].Name); if (mapDevice != null) { mapDevice.OaDeviceList.Clear(); for (int i = 0; i < this.OaDeviceLV.Items.Count; i++) { if (this.OaDeviceLV.Items[i].Checked) { DeviceBase tmpDeviceBase = this.deviceMng.GetDevice(this.OaDeviceLV.Items[i].Name); mapDevice.OaDeviceList.Add((OaDevice)tmpDeviceBase); } } this.deviceMng.SetOaDeviceOfMap(mapDevice); MessageBox.Show("성공적으로 저장되었습니다.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("저장을 실패했습니다.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("저장할 장비를 선택하세요.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } }