using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Janus.Windows.GridEX; using System.IO; using System.Drawing.Imaging; using Microsoft.VisualBasic.PowerPacks; using System.Drawing.Drawing2D; using System.Collections; using Janus.Windows.GridEX.EditControls; namespace IControls_FireManager { public partial class Form_MapDesigner : Form { // CheckedComboBox_DeviceType콤보박스에 체크되어 있는 것만 알기 위해서 사용되는 ArrayList ArrayList DeviceType = new ArrayList(); // 접근 파일 및 경로 string Default_Field_PageName = null; string Default_Field_FileName = null; string Default_Field_FullPath = null; string Default_Field_FullPath_FileName = null; string Default_Symbol_FullPath = null; string Default_Xml_FullPath = null; // 아이디 순번 (리스트뷰에 속한 디바이스 아이콘 혹은 배경에서 오른쪽 마우스 클릭해서 추가하는 버튼 아이콘) int ICON_ID_Order = 0; // 현재 선택된 픽쳐박스 _PictureBoxItem Selected_PictureBoxItem = new _PictureBoxItem(); // 배경화면에서 드래그 혹은 아이템(디바이스 아이콘, 버튼 아이콘) 을 선택하는 경우 생성되는 네모박스 스타일 DashStyle Selected_DashStyle_First = DashStyle.Dash; DashStyle Selected_DashStyle_Second = DashStyle.DashDot; Color Selected_Color = Color.Red; int Selected_BorderWidth_BakcGround = 1; // 배경에서 드래그할때 생기는 네모박스 굵기 int Selected_BorderWidth_Item = 3; // 별도로 아이템 (디바이스 아이콘, 버튼 아이콘) 선택되었을때 생기는 네모박스 굵기는 조금 더 굵게 표시한다 // 배경에서 마우스 드래그시 좌표값 bool BackGround_MouseDrag = false; int BackGround_MouseDrag_Before_X = 0; int BackGround_MouseDrag_Before_Y = 0; int BackGround_MouseDrag_After_X = 0; int BackGround_MouseDrag_After_Y = 0; // 배경에서 마우스 드래그하면 사각형이 생성 public ShapeContainer ShapeContainer_MouseDragBackGround = new ShapeContainer(); public LineShape LineShape_MouseDragBackGround_TOP = new LineShape(); public LineShape LineShape_MouseDragBackGround_BOTTOM = new LineShape(); public LineShape LineShape_MouseDragBackGround_LEFT = new LineShape(); public LineShape LineShape_MouseDragBackGround_RIGHT = new LineShape(); // 키이벤트 bool KeyDown_ALTKEY = false; // 현재 ALTKEY 키를 눌렀는지 확인 bool KeyDown_SHIFTKEY = false; // 현재 SHIFTKEY 키를 눌렀는지 확인 // 복사용 : 아이콘 (디바이스 아이콘 혹은 버튼 아이콘)을 복사하기 위해서 사용되는 해쉬테이블 public Hashtable COPY_HASH_ICON = new Hashtable(); public ArrayList COPY_LIST_ICON_ID = new ArrayList(); // 임시용 : 저장직전 맵디자이너중 추가된 아이콘 (디바이스 아이콘 혹은 버튼 아이콘)을 관리하기 위해서 사용되는 해쉬테이블 public Hashtable TEMP_HASH_ICON = new Hashtable(); public ArrayList TEMP_LIST_ICON_ID = new ArrayList(); // 타이머 동작 int MapDesigner_Count = 0; // 팝업용 Form DialogPopup = new Form(); // 관할수신기 아이디 정보 public string Seleted_RECEIVER_ID = null; // 페이지 정보 public string Seleted_PageNodeKey = null; public string Seleted_PageNodeText = null; // 픽쳐박스 좌표 (수직으로 드래그 할지 수평으로 드래그 할지 이전 좌표값 비교용) public int PictureBox_Old_MousePoint_X = 0; public int PictureBox_New_MousePoint_X = 0; // 픽쳐박스 드래그하는 경우 Shift 키를 누른상태가 유지 (true : Down , false : Up) public bool PictureBox_Drag_Shift = false; // 픽쳐박스 드래그하는 경우 모드 (true : 수직으로 , false : 수평으로) public bool PictureBox_Drag_Vertical = false; // 디바이스 조회창 색상 (연동되면 파랑) Color Apply_Color_HASH = Color.SteelBlue; Color Apply_Color_TEMP = Color.YellowGreen; Color Apply_Color_NOT = Color.White; // 연동 여부 대화 팝업창 public Form Popup_DeviceOper = new Form(); // // 맵디자이너 초기화 // // 신규 이미지를 추가하는 경우와 맵디자이너가 켜져 있지 않는 상태에서 그림 수정을 선택하는 경우 public Form_MapDesigner(string RECEIVER_ID, string PageNodeKey, string PageNodeText) { InitializeComponent(); /// /// 이벤트 /// // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용) this.FormClosing += new FormClosingEventHandler(CreateForm_FormClosing); // 윈도우 스타일 변경 이벤트 핸들러 등록 _Event.WindowStyleSet_SendMessage_Event += new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event); // 메인 메뉴에서 그림 수정 이벤트 핸들러 등록 _Event.PictrueEdit_NodeSeleted_SendMessage_Event += new _Event.PictrueEdit_NodeSeleted_SendMessage_Handler(_Event_PictrueEdit_NodeSeleted_SendMessage_Event); // 맵디자이너 창을 닫는 이벤트 핸들러 등록 _Event.MapDesigner_Close_SendMessage_Event += new _Event.MapDesigner_Close_SendMessage_Handler(_Event_MapDesigner_Close_SendMessage_Event); /// /// 스타일 변경 /// UI_Style_Initialize(); /// /// 수신기 정보 /// // 단, 수신기 정보없다면 이는 단순히 클래스 내부의 함수에 접근하기 위한 용도이니 필요없다 if (RECEIVER_ID == null) return; else Seleted_RECEIVER_ID = RECEIVER_ID; /// /// 페이지 이름, 파일명, 파일경로 /// Seleted_PageNodeKey = PageNodeKey; Seleted_PageNodeText = PageNodeText; if (PageNodeKey == null) { Default_Field_PageName = _Text.DEFAULT_FIELD_PAGENAME; Default_Field_FileName = _Text.DEFAULT_FIELD_FILENAME; } else { Default_Field_PageName = PageNodeText; Default_Field_FileName = ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[RECEIVER_ID]).HASH_PAGE[PageNodeKey]).PictureBoxItem_BackGround.FileName; // 페이지명이 null 값이 아니라면 트리노드에 설정되어있는 그래픽노드중 1개를 선택했다는 뜻이다 // 즉, 페이지명은 수정이 불가하다 this.editBox_Base_PageName.ReadOnly = true; this.editBox_Base_PageName.BackColor = System.Drawing.SystemColors.MenuBar; this.editBox_Base_PageName.Text = PageNodeText; } // 수신기 폴더명 string ReiceiverFolderName = _Text.DEFAULT_FOLDER_RECEIVER_PREFIX + Seleted_RECEIVER_ID; Default_Field_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_FIELD; Default_Field_FullPath_FileName = Default_Field_FullPath + "\\" + Default_Field_FileName; Default_Symbol_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_SYMBOL; Default_Xml_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_XML; /// /// XML /// ITEM_XML_Initialize(); /// /// 타이머 /// _Timer_WindowBase.Delete("Form_MapDesigner"); _Timer_WindowBase.Create("Form_MapDesigner", 1000, timer_MapDesignerConfig_Tick, true); /// /// UI 초기화 /// UI_Base_Initialize(Default_Field_PageName, Default_Field_FileName, Default_Field_FullPath_FileName); UI_Item_Initialize(Default_Symbol_FullPath); UI_Device_Initialize(); UI_Tree_Initialize(); UI_Status_Initialize(Item_Type.BackGround, Default_Field_FullPath_FileName); UI_Work_Initialize(Default_Field_FullPath_FileName); /// /// 해쉬 및 리스트 초기화 /// TEMP_HASH_LIST_Initialize(); COPY_HASH_LIST_Initialize(); /// /// 페이지 클래스에 저장된 정보를 토대로 화면에 표시 /// if (PageNodeKey != null) { UI_DATA_Initialize(PageNodeKey); /// /// 아이템 아이디 셋팅 /// /// 페이지에 있는 최대의 아이콘 int MaxValue = 0; foreach (string ICON_ID in ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[RECEIVER_ID]).HASH_PAGE[PageNodeKey]).LIST_ICON_ID) { if (MaxValue <= Int32.Parse(ICON_ID)) MaxValue = Int32.Parse(ICON_ID); } ICON_ID_Order = MaxValue + 1; } // 화면 위치는 항상 모니터 최상단 (Left , Up) this.Location = new System.Drawing.Point(0, 0); this.StartPosition = FormStartPosition.Manual; } /// /// 기기타입 XML 파일 접근 /// // XML 파일에 파일이 속해있는지 검사 private bool Check_DevTypeXml_FileName(string filename) { foreach (string DevTypeID in _Data.LIST_XMLDEVTYPE_ID) { if (((_DevTypeXML)_Data.HASH_XMLDEVTYPE[DevTypeID]).FILENAME == filename) return true; } return false; } /// /// 파일정보 추출 /// // XML 데이터 읽어오기 private void ITEM_XML_Initialize() { // 초기화 _Data.HASH_XMLDEVTYPE.Clear(); _Data.LIST_XMLDEVTYPE_ID.Clear(); // 현재 설정된 프로젝트명에 의해 폴더를 접근하여 DevType.xml 파일을 로드한다 _File.Read_DevType_XML(Default_Xml_FullPath); } // 파일 포맷 가져오기 private string Get_Image_Format(string FIleName) { try { string[] Temps = FIleName.Split('.'); //예시 : test.txt => txt return Temps[1]; } catch { return _Text.Null; } } // 파일 이름 가져오기 private string Get_Image_RemoveFormat(string FIleName) { try { string[] Temps = FIleName.Split('.'); //예시 : test.txt => test return Temps[0]; } catch { return _Text.Null; } } // 파일 사이즈 가져오기 private string Get_Image_Size(string FilePath) { try { string result = null; Image Info = Image.FromFile(FilePath); //예시 : Size : 1080 * 720" result = Info.Width + " * " + Info.Height; return result; } catch { return "0 * 0"; } } // 파일 정보를 지정된 형식대로 가져오기 private string Get_Image_Info(string FilePath) { try { // 파일정보 string result = null; long FileLength_Kilobyte = 0; string FileName = null; if (_File.Read_FileInfo(FilePath) != null) { FileLength_Kilobyte = _File.Read_FileInfo(FilePath).Length; FileName = _File.Read_FileInfo(FilePath).Name; } // 3자리수 이상이라면 if (FileLength_Kilobyte - 1000 >= 0) { string FileKilobyte = FileLength_Kilobyte.ToString(); FileKilobyte = FileKilobyte.Remove(FileKilobyte.Length - 3); result = FileName + " / " + FileKilobyte + "K byte"; } else { string Filebyte = FileLength_Kilobyte.ToString(); result = FileName + " / " + Filebyte + " byte"; } if (FileLength_Kilobyte == 0 || FileName == null) result = _Text.Null; return result; } catch { return _Text.Null; } } /// /// 초기화 /// // 스타일 초기화 함수 private void UI_Style_Initialize() { } // 기본 패널 초기화 private void UI_Base_Initialize(string PageName, string Field_FileName, string Field_FullPath_FileName) { // 페이지명 this.editBox_Base_PageName.Text = PageName; // 배경그림 this.editBox_Base_BackgrondFileName.Text = Field_FileName; // 파일경로 this.editBox_Base_BackgrondFilePath.Text = Field_FullPath_FileName; // 파일정보 //this.label_Base_BackgrondFileInfo.Text = // "Format : " + Get_Image_Format(Field_FullPath_FileName) + " File / " + // "Size : " + Get_Image_Size(Field_FullPath_FileName); // 아이콘 잠금 UI_Base_IconLock(false); } // 아이템 패널 초기화 private void UI_Item_Initialize(string Symbol_FullPath) { // 이미지 경로 string temp_path = Symbol_FullPath; // 파일명 리스트 가져오기 string GetImageFileNameList = _File.Get_FileNameList(temp_path); // 파일명을 저장 string[] FileNames = _Convert.String_to_ArrayString(GetImageFileNameList); // Construct the ImageList. ImageList ImageList_GetImages = new ImageList(); // Set the ImageSize property to a larger size // (the default is 16 x 16). ImageList_GetImages.ImageSize = new Size(24, 24); if (FileNames != null) { // 리스트에 추가 for (int i = 0; i < FileNames.Length; i++) { // 필요없는 파일은 올릴 필요가 없다 if (Check_DevTypeXml_FileName(FileNames[i]) == true) { ImageList_GetImages.Images.Add(FileNames[i], this.Get_Image_From_File(temp_path + "\\" + FileNames[i])); } } } // 리스트뷰 초기화 this.listView_Item.Clear(); // 리스트뷰 이미지리스트 치환 this.listView_Item.LargeImageList = ImageList_GetImages; // 이미지리스트가 존재하는 경우에만 리스트뷰에 추가 if (ImageList_GetImages != null) { // 리스트에 추가 for (int i = 0; i < ImageList_GetImages.Images.Count; i++) { ListViewItem a = new ListViewItem(ImageList_GetImages.Images.Keys[i], i); this.listView_Item.Items.Add(a); } } // 리스트뷰 정렬 this.listView_Item.Sort(); } // 디바이스 정보창 초기화 private void UI_Device_Initialize() { //** UiComboBox_Board 콤보박스 셋팅 // 먼저 UiComboBox_Board 콤보박스를 클리어시킴 UiComboBox_Board.Items.Clear(); DataRowCollection DB_TABLE_TB_BOARD = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_BoardTable("1", "", "Y", Seleted_RECEIVER_ID)); if (DB_TABLE_TB_BOARD != null) { // 공백도 하나 넣어둠 UiComboBox_Board.Items.Add(""); foreach (DataRow dr in DB_TABLE_TB_BOARD) { // UiComboBox_Board 콤보박스에 아이템 ADD UiComboBox_Board.Items.Add(dr[2]); } } UiComboBox_Board.Items.Sort(); // 정렬 //** CheckedComboBox_DeviceType 콤보박스 셋팅 // 먼저 CheckedComboBox_DeviceType 콤보박스를 클리어시킴 CheckedComboBox_DeviceType.Clear(); // TB_DEVICE_TYPE 테이블에 접근 DataRowCollection DB_TABLE_TB_DEVICE_TYPE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value("TB_DEVICE_TYPE", null)); if (DB_TABLE_TB_DEVICE_TYPE != null && CheckedComboBox_DeviceType.DropDownList != null) { foreach (DataRow dr in DB_TABLE_TB_DEVICE_TYPE) { // GridEx에 내용 채우기 GridEXRow row; row = CheckedComboBox_DeviceType.DropDownList.AddItem(); row.BeginEdit(); row.Cells["Device_Type"].Value = dr[1].ToString(); row.EndEdit(); } } //** UiComboBox_Device_InOut 콤보박스 셋팅 UiComboBox_Device_InOut.Items.Clear(); UiComboBox_Device_InOut.Items.Add(""); UiComboBox_Device_InOut.Items.Add("IN"); UiComboBox_Device_InOut.Items.Add("OUT"); UiComboBox_Device_InOut.Items.Sort();// 정렬 // 기본값 지정 UiComboBox_Device_InOut.Text = "IN"; UiComboBox_Board.Text = "1"; UiComboBox_Channel.Text = ""; // 배경색 지정 string[] gridex_device_columnheader = _Gridex.Get_ColumnHeadersName(this.GridEX_Device); // 연동 적용된 아이템은 배경 색상이 변경된다 (HASH 혹은 TEMP 혹은 NOT) _Gridex.BackColorFormatCondition_Create(this.GridEX_Device, Apply_Color_HASH, gridex_device_columnheader, "Apply", "HASH"); _Gridex.BackColorFormatCondition_Create(this.GridEX_Device, Apply_Color_TEMP, gridex_device_columnheader, "Apply", "TEMP"); _Gridex.BackColorFormatCondition_Create(this.GridEX_Device, Apply_Color_NOT, gridex_device_columnheader, "Apply", "NOT"); } // 오브젝트 트리 초기화 private void UI_Tree_Initialize() { // 초기화 this.treeView_ObjectTree.Nodes.Clear(); // 버튼 아이콘 노드와 디바이스 아이콘 노드를 추가하고 // 버튼이 삽입되면 트리에 표시하고, 디바이스가 삽입되면 트리에 표시된다 // 버튼이 삭제되면 트리에서 삭제하고, 디바이스가 삭제되면 트리에서 삭제된다 // 버튼의 경우 점프 페이지가 설정되면 트리에 표시된다 // 디바이스의 경우 연동이 설정되면 트리에 표시된다 // 루트 노드 추가 : 페이지 이름 _Tree.NodeAdd_Root(this.treeView_ObjectTree, _Text.UI_TREE_ROOT_KEY, this.editBox_Base_PageName.Text, Object_Type.PAGE); // 버튼 아이콘 노드 추가 : 버튼 아이콘 메인 _Tree.NodeAdd_Root_Node(this.treeView_ObjectTree, 0, _Text.UI_TREE_BUTTON_ICON, _Text.UI_TREE_BUTTON_ICON, Object_Type.BUTTON_ICON); // 디바이스 아이콘 노드 추가 : 디바이스 아이콘 메인 _Tree.NodeAdd_Root_Node(this.treeView_ObjectTree, 0, _Text.UI_TREE_DEVICE_ICON, _Text.UI_TREE_DEVICE_ICON, Object_Type.DEVICE_ICON); // 트리 노드 확장 this.treeView_ObjectTree.ExpandAll(); // 트리 노드 정렬 this.treeView_ObjectTree.Sort(); } // 작업화면 초기화 (배경화면) private void UI_Work_Initialize(string FullPath_PlusFileName) { // 그림을 전체 모드로 교체 (픽쳐박스의 크기에 따라 이미지 사이즈가 자동조절) pictureBox_Background.SizeMode = PictureBoxSizeMode.StretchImage; // 파일경로 + 파일명 pictureBox_Background.BackgroundImage = Get_Image_From_File(FullPath_PlusFileName); // 갱신 pictureBox_Background.ResumeLayout(); // 선택취소 Selected_PictureBoxItem = null; } // 상태창 초기화 private void UI_Status_Initialize(Item_Type itemType, string Item_Full_Path) { // 파일정보 this.label_Status_Info.Text = Get_Image_Info(Item_Full_Path); // 타입 this.label_Status_IconType.Text = itemType.ToString(); // 디바이스 this.label_Status_Device.Text = _Text.None; // X this.editBox_Status_Location_X.Text = pictureBox_Background.Location.X.ToString(); // Y this.editBox_Status_Location_Y.Text = pictureBox_Background.Location.Y.ToString(); // W this.editBox_Status_Size_W.Text = pictureBox_Background.Width.ToString(); // H this.editBox_Status_Size_H.Text = pictureBox_Background.Height.ToString(); // JUMP this.uiComboBox_Status_Jump.Text = _Text.None; } /// /// 리스트 초기화 /// // 저장직전 해쉬 및 리스트 private void TEMP_HASH_LIST_Initialize() { // 디바이스 아이콘 및 버튼 아이콘 전체 삭제 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Dispose(); } TEMP_LIST_ICON_ID.Clear(); TEMP_HASH_ICON.Clear(); } // 복사용 해쉬 및 리스트 private void COPY_HASH_LIST_Initialize() { // 디바이스 아이콘 및 버튼 아이콘 전체 삭제 foreach (string ICON_ID in COPY_LIST_ICON_ID) { ((_PictureBoxItem)COPY_HASH_ICON[ICON_ID]).Dispose(); } COPY_LIST_ICON_ID.Clear(); COPY_HASH_ICON.Clear(); } /// /// 데이터를 토대로 화면에 표시 /// public void UI_DATA_Initialize(string PageName) { // 임시 리스트 및 해쉬 테이블을 만듬 -> 차후 TEMP_LIST_ICON_ID,TEMP_HASH_ICON 생성에서 사용함 ArrayList temp_list_icon_id = new ArrayList(); Hashtable temp_hash_icon = new Hashtable(); // 저장 정보를 토대로 리스트 및 해쉬 생성 - 불러오기 Copy_HASH_LIST( ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[PageName]).LIST_ICON_ID, ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[PageName]).HASH_ICON, temp_list_icon_id, temp_hash_icon); // 해쉬테이블에서 매칭한다 foreach (string ICON_ID in temp_list_icon_id) { // 아이템 화면 배치 _PictureBoxItem PictureBoxItem = UI_Create_PictureBoxItem( this.pictureBox_Background, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).ItemType, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).FullPath_FileName, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).FileName, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Location.X, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Location.Y); if (PictureBoxItem != null) { /// /// 동적 할당 변수 처리 /// // 디바이스 연동 회로 번호 if (PictureBoxItem.ItemType == Item_Type.Device) { PictureBoxItem.Device_Oper_ID = ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_Oper_ID; PictureBoxItem.Device_DB_Name = ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_DB_Name; } // 점프 페이지 if (PictureBoxItem.ItemType == Item_Type.Button) PictureBoxItem.Button_JumpPageName = ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Button_JumpPageName; /// /// 오브젝트 트리에 추가 /// // 버튼 아이콘의 경우 if (((_PictureBoxItem)temp_hash_icon[ICON_ID]).ItemType == Item_Type.Button) { // 트리 추가 _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 0, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).NodeText(), Object_Type.BUTTON_DETAIL); // 오브젝트 트리 색상 반영 (버튼) _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Button_JumpPageName); } // 디바이스 아이콘의 경우 else if (((_PictureBoxItem)temp_hash_icon[ICON_ID]).ItemType == Item_Type.Device) { // 트리 추가 _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 1, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).NodeText(), Object_Type.DEVICE_DETAIL); // 오브젝트 트리 색상 반영 (디바이스) _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_Oper_ID); } // 해쉬 추가 if (_Hash.Add(TEMP_HASH_ICON, PictureBoxItem.Name, PictureBoxItem) == true) { TEMP_LIST_ICON_ID.Add(PictureBoxItem.Name); } } } // 디바이스 조회창 색상 반영 GridexDevice_ChangeColor_By_HASH(); // 트리는 초기화 작업시 무조건 확장 this.treeView_ObjectTree.ExpandAll(); // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); } public Image Get_Image_From_File(string FilePath) { try { return Image.FromFile(FilePath); } catch { return null; } } /// /// 픽쳐박스 생성부 /// public _PictureBoxItem UI_Create_PictureBoxItem( PictureBox PictureBox_BackGround, Item_Type type, // 아이콘 타입 string FullPath_FileName, // 파일경로+파일명 string FileName, // 파일명 string UI_Create_PictureBoxItem_ID, // 픽쳐박스 순번 (숫자로 저장되는 고유 아이디이다. 단, xml 저장시에는 버튼은 B 접두사를 붙임) int Location_X, // 위치 X 좌표 int Location_Y) // 위치 Y 좌표 { // PictureBox 기본 정보 설정 _PictureBoxItem PictureBoxItem = new _PictureBoxItem(); // 이미지 PictureBoxItem.Image = Get_Image_From_File(FullPath_FileName); // 이미지가 널값이라면 무시하자 if (PictureBoxItem.Image == null) return null; // ID // 픽쳐박스 순번 (숫자로 저장되는 고유 아이디) PictureBoxItem.Name = UI_Create_PictureBoxItem_ID; // 타입 PictureBoxItem.ItemType = type; // 파일정보 PictureBoxItem.Info = Get_Image_Info(FullPath_FileName); // 아이콘 아이디 if (type == Item_Type.Device) { PictureBoxItem.Device_Icon_ID = ((_DevTypeXML)_File.Read_DevType_By_FileName(FileName)).ID; PictureBoxItem.Device_Icon_NAME = ((_DevTypeXML)_File.Read_DevType_By_FileName(FileName)).NAME; } // 드래그 상태 PictureBoxItem.MouseDrag_Status = false; // 드래그 X 좌표 PictureBoxItem.MouseDown_X = 0; // 드래그 Y 좌표 PictureBoxItem.MouseDown_Y = 0; // 파일 이름 PictureBoxItem.FileName = FileName; // 파일 경로 PictureBoxItem.FullPath_FileName = FullPath_FileName; // 이미지를 크기에 맞게 셋팅 PictureBoxItem.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; // 위치 PictureBoxItem.Location = new System.Drawing.Point(Location_X, Location_Y); // 사이즈 PictureBoxItem.Size = new System.Drawing.Size(PictureBoxItem.Image.Width, PictureBoxItem.Image.Height); // 배경을 제외한 나머지는 아래의 속성을 받는다 if (type != Item_Type.BackGround) { // 배경보다 작아야 한다 if (PictureBoxItem.Image.Width >= PictureBox_BackGround.Size.Width || PictureBoxItem.Image.Height >= PictureBox_BackGround.Size.Height) return null; // 일반 픽쳐박스 속성 지정 PictureBoxItem.BackColor = Color.Transparent; PictureBoxItem.Parent = PictureBox_BackGround;// 부모는 항상 백그라운드 PictureBoxItem.MouseDown += new MouseEventHandler(pictureBox_Create_MouseDown); PictureBoxItem.MouseUp += new MouseEventHandler(pictureBox_Create_MouseUp); PictureBoxItem.MouseMove += new MouseEventHandler(pictureBox_Create_MouseMove); PictureBoxItem.MouseClick += new MouseEventHandler(pictureBox_Create_MouseClick); // 외부 선 PictureBoxItem.Selected = false; // 생성당시에는 선택된 상태가 아님 PictureBoxItem.ShapeContainer_Seleted = new ShapeContainer(); PictureBoxItem.LineShape_TOP = new LineShape(); PictureBoxItem.LineShape_LEFT = new LineShape(); PictureBoxItem.LineShape_RIGHT = new LineShape(); PictureBoxItem.LineShape_BOTTOM = new LineShape(); // 선 스타일 지정 LineShape_Item_BorderStyle(PictureBoxItem, Selected_DashStyle_First, Selected_Color, Selected_BorderWidth_Item); // TOP LineShape_Start(PictureBoxItem.LineShape_TOP, 0, 0); LineShape_End(PictureBoxItem.LineShape_TOP, PictureBoxItem.Size.Width, 0); // LEFT LineShape_Start(PictureBoxItem.LineShape_LEFT, 0, 0); LineShape_End(PictureBoxItem.LineShape_LEFT, 0, PictureBoxItem.Size.Height); // RIGHT LineShape_Start(PictureBoxItem.LineShape_RIGHT, PictureBoxItem.Size.Width - 1, 0); LineShape_End(PictureBoxItem.LineShape_RIGHT, PictureBoxItem.Size.Width - 1, PictureBoxItem.Size.Height); // BOTTM LineShape_Start(PictureBoxItem.LineShape_BOTTOM, 0, PictureBoxItem.Size.Height - 1); LineShape_End(PictureBoxItem.LineShape_BOTTOM, PictureBoxItem.Size.Width, PictureBoxItem.Size.Height - 1); // 컨테이너에 상위 4개 선 포함 PictureBoxItem.ShapeContainer_Seleted.Shapes.AddRange(new Microsoft.VisualBasic.PowerPacks.Shape[] { PictureBoxItem.LineShape_TOP,PictureBoxItem.LineShape_LEFT,PictureBoxItem.LineShape_RIGHT,PictureBoxItem.LineShape_BOTTOM, }); // 배경그림에 컨테이너 포함 PictureBoxItem.Controls.Add(PictureBoxItem.ShapeContainer_Seleted); // 선택하면 표시하도록 한다 PictureBoxItem.ShapeContainer_Seleted.Visible = false; } PictureBoxItem.ResumeLayout(); return PictureBoxItem; } /// /// 이벤트 /// // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용) public void CreateForm_FormClosing(object sender, FormClosingEventArgs e) { // 윈도우 스타일 변경 이벤트 핸들러 해제 _Event.WindowStyleSet_SendMessage_Event -= new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event); // 메인 메뉴에서 그림 수정 이벤트 핸들러 해제 _Event.PictrueEdit_NodeSeleted_SendMessage_Event -= new _Event.PictrueEdit_NodeSeleted_SendMessage_Handler(_Event_PictrueEdit_NodeSeleted_SendMessage_Event); // 맵디자이너 창을 닫는 이벤트 핸들러 해제 _Event.MapDesigner_Close_SendMessage_Event -= new _Event.MapDesigner_Close_SendMessage_Handler(_Event_MapDesigner_Close_SendMessage_Event); // 워크뷰 그래픽 개요 페이지로 전환 _Event.WorkViewPageName_SendMessage_Write(Seleted_RECEIVER_ID, Object_Type.IMAGE, null, null); } // 윈도우 스타일 변경 이벤트 public void _Event_WindowStyleSet_SendMessage_Event() { UI_Style_Initialize(); } // 메인에서 맵디자이너가 켜져 있는 상태에서 그래픽 노드의 페이지 노드를 선택하여 오른쪽 마우스 버튼 메뉴중 그림 수정 버튼을 누르는 경우 public void _Event_PictrueEdit_NodeSeleted_SendMessage_Event(_RECEIVER RECEIVER, string PageName) { /// /// 페이지 이름, 파일명, 파일경로 /// // 수신기 Seleted_RECEIVER_ID = RECEIVER.ID; if (PageName == null) { Default_Field_PageName = _Text.DEFAULT_FIELD_PAGENAME; Default_Field_FileName = _Text.DEFAULT_FIELD_FILENAME; } else { Default_Field_PageName = PageName; Default_Field_FileName = ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[RECEIVER.ID]).HASH_PAGE[PageName]).PictureBoxItem_BackGround.FileName; // 페이지명이 null 값이 아니라면 트리노드에 설정되어있는 그래픽노드중 1개를 선택했다는 뜻이다 // 즉, 페이지명은 수정이 불가하다 this.editBox_Base_PageName.ReadOnly = true; this.editBox_Base_PageName.BackColor = System.Drawing.SystemColors.MenuBar; this.editBox_Base_PageName.Text = PageName; } // 수신기 폴더명 string ReiceiverFolderName = _Text.DEFAULT_FOLDER_RECEIVER_PREFIX + RECEIVER.ID; Default_Field_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_FIELD; Default_Field_FullPath_FileName = Default_Field_FullPath + "\\" + Default_Field_FileName; Default_Symbol_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_SYMBOL; Default_Xml_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_XML; /// /// UI 초기화 /// UI_Base_Initialize(Default_Field_PageName, Default_Field_FileName, Default_Field_FullPath_FileName); UI_Item_Initialize(Default_Symbol_FullPath); UI_Device_Initialize(); UI_Tree_Initialize(); UI_Status_Initialize(Item_Type.BackGround, Default_Field_FullPath_FileName); UI_Work_Initialize(Default_Field_FullPath_FileName); /// /// 해쉬 및 리스트 초기화 /// TEMP_HASH_LIST_Initialize(); COPY_HASH_LIST_Initialize(); /// /// 페이지 클래스에 저장된 정보를 토대로 화면에 표시 /// if (PageName != null) { UI_DATA_Initialize(PageName); /// /// 아이템 아이디 셋팅 /// /// 페이지에 있는 최대의 아이콘 int MaxValue = 0; foreach (string ICON_ID in ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[RECEIVER.ID]).HASH_PAGE[PageName]).LIST_ICON_ID) { if (MaxValue <= Int32.Parse(ICON_ID)) MaxValue = Int32.Parse(ICON_ID); } ICON_ID_Order = MaxValue + 1; } // 최대화 혹은 최소화 된 창을 일반으로 돌리고 포커스를 줌 this.WindowState = FormWindowState.Normal; this.Focus(); } // 맵디자이너 창을 닫는 이벤트 전용 델리게이트 delegate void Close_SetCallback(); // 맵디자이너 창을 닫는 이벤트 public void _Event_MapDesigner_Close_SendMessage_Event() { if (this.InvokeRequired) { Close_SetCallback d = new Close_SetCallback(_Event_MapDesigner_Close_SendMessage_Event); this.Invoke(d, new object[] { }); } else { this.Close(); } } /// /// 기본 /// // 기본 - 배경화면 열기 버튼 private void uiButton_Base_BackgrondFileName_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); // 배경 삽입시에 다이얼로그창은 프로젝트 경로에 따라서 Field 폴더에 곧바로 접근할 수있도록 함 openFileDialog.InitialDirectory = Default_Field_FullPath; if (openFileDialog.ShowDialog() == DialogResult.OK) { // 기본 패널 초기화 UI_Base_Initialize(this.editBox_Base_PageName.Text, openFileDialog.SafeFileName, openFileDialog.FileName); // 작업화면 초기화 UI_Work_Initialize(openFileDialog.FileName); // 상태창 초기화 UI_Status_Initialize(Item_Type.BackGround, openFileDialog.FileName); } } // 기본 - 페이지명 체크 private bool Check_PageName(string PageNameText) { // 페이지이름 string PageName = PageNameText.Trim(); // 널값 허용안함 if (PageName.Length == 0 || PageName == null) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.NullPageNameInform, 0); return false; } // 동일한 페이지 이름은 허용안함 if (((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE.Contains(PageName) == true) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.ContainPageNameInform, 0); return false; } return true; } // 페이지명 트리에 반영 private void uiButton_PageName_Edit_Click(object sender, EventArgs e) { // 페이지명 체크 if (Check_PageName(this.editBox_Base_PageName.Text) == false) return; // 트리에 반영 TreeNode PageName = _Tree.GetNode_By_Name(this.treeView_ObjectTree, _Text.UI_TREE_ROOT_KEY); PageName.Text = this.editBox_Base_PageName.Text; } // 기본 - 저장 버튼 private void uiButton_Base_Save_Click(object sender, EventArgs e) { // 그래픽 노드를 선택해서 맵디자이너를 여는 경우 if (this.editBox_Base_PageName.ReadOnly == true) { // 대화 팝업 DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 350, 150, _Text.LeftBracket + this.editBox_Base_PageName.Text + _Text.RightBracket + _Text.Blank + _Text.PageEditDataInform, 0); // 대화 팝업은 특별처리 _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_Edit); } // 새로운 페이지를 저장하는 경우 else { // 오브젝트 트리의 페이지명과 저장시에 페이지 명이 틀린 경우 if (this.editBox_Base_PageName.Text != this.treeView_ObjectTree.Nodes[0].Text) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.PageNameNotSameObjectTree, 0); return; } // 신규로 저장하는 경우 페이지명이 기존에 있는 페이지와 일치하면 수정이다 // 덮어쓰기 if (_Data.Check_Receiver_In_PageName(Seleted_RECEIVER_ID, this.editBox_Base_PageName.Text) == true) { // 대화 팝업 DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 350, 150, _Text.LeftBracket + this.editBox_Base_PageName.Text + _Text.RightBracket + _Text.Blank + _Text.PageEditDataInform, 0); // 대화 팝업은 특별처리 _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_Edit); } // 신규 else { // 대화 팝업 DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 350, 150, _Text.LeftBracket + this.editBox_Base_PageName.Text + _Text.RightBracket + _Text.Blank + _Text.PageSaveDataInform, 0); // 대화 팝업은 특별처리 _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_New); } } } // 기본 - 저장 버튼 -> 신규 private void _Event_PopupClose_SendMessage_Event_New(object sender, object etc) { // 대화 팝업 주체 Form DialogPopup = (Form)sender; // 팝업창에서 확인 버튼을 누르면 if (DialogPopup.Name == DialogPopup.Name && etc.ToString() == _Text.OK) { // 무조건 편집 혹은 새로만들기의 경우 차후 저장을 위해 셋팅 if (_Data.LIST_XmlDBNotSave_Receiver.Contains(Seleted_RECEIVER_ID) == false) _Data.LIST_XmlDBNotSave_Receiver.Add(Seleted_RECEIVER_ID); // 페이지명 및 배경그림 안에 있는 픽쳐박스를 전부 해쉬에 저장 해야한다 // 차후 프로젝트 저장시에 XML 파일이 생성될 수 있도록 한다 _Page Page = new _Page(); // 페이지명 (중복되지 않는 고유의 아이디로 사용함) string Item_ID = Page.NodeKey = _Data.CREATE_PAGE_ID(Seleted_RECEIVER_ID, this.editBox_Base_PageName.Text); //Seleted_RECEIVER_ID + _Text.Minus + this.editBox_Base_PageName.Text; Page.NodeText = this.editBox_Base_PageName.Text; // 관할 수신기 아이디 Page.Receiver_ID = Seleted_RECEIVER_ID; // 배경그림 Page.PictureBoxItem_BackGround = UI_Create_PictureBoxItem( this.pictureBox_Background, Item_Type.BackGround, this.editBox_Base_BackgrondFilePath.Text, this.editBox_Base_BackgrondFileName.Text, Item_ID, 0, 0); if (Page.PictureBoxItem_BackGround != null) { // 해쉬 추가 if (_Hash.Add(((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE, Item_ID, Page) == true) { ((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).LIST_PAGE_ID.Add(Item_ID); } // 추가된 아이콘 (디바이스 아이콘 혹은 버튼 아이콘) 모두 저장 - 신규저장 Copy_HASH_LIST( TEMP_LIST_ICON_ID, TEMP_HASH_ICON, Page.LIST_ICON_ID, Page.HASH_ICON); // 확인 메세지 _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.PageSaveData_TreeNodeInform, 0); // 메인 창의 페이지 노드를 트리에 추가한다 _Event.TreeView_PageNodeSet_SendMessage_Write(Seleted_RECEIVER_ID, Page); // UI 정리 uiButton_Device_Clear_Click(null, null); } } // 대화 팝업은 특별처리 _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_New); } // 저장용도로 사용되는 리스트와 해쉬테이블에 작업완료한 리스트와 해쉬테이블을 복사한다 public void Copy_HASH_LIST(ArrayList Temp_List, Hashtable Temp_Hash, ArrayList Save_List, Hashtable Save_Hash) { foreach (string ICON_ID in Temp_List) { // 리스트 추가 Save_List.Add(ICON_ID); // 아이템 정보 읽기 _PictureBoxItem PictureBoxItem = new _PictureBoxItem(); // 타입 PictureBoxItem.ItemType = ((_PictureBoxItem)Temp_Hash[ICON_ID]).ItemType; // 파일정보 PictureBoxItem.Info = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Info; // 디바이스 아이콘 아이디 (DevType.XML) PictureBoxItem.Device_Icon_ID = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Device_Icon_ID; // 디바이스 아이콘 이름 (DevType.XML) PictureBoxItem.Device_Icon_NAME = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Device_Icon_NAME; // 드래그 상태 PictureBoxItem.MouseDrag_Status = ((_PictureBoxItem)Temp_Hash[ICON_ID]).MouseDrag_Status; // 드래그 X 좌표 PictureBoxItem.MouseDown_X = ((_PictureBoxItem)Temp_Hash[ICON_ID]).MouseDown_X; // 드래그 Y 좌료 PictureBoxItem.MouseDown_Y = ((_PictureBoxItem)Temp_Hash[ICON_ID]).MouseDown_Y; // 파일 이름 PictureBoxItem.FileName = ((_PictureBoxItem)Temp_Hash[ICON_ID]).FileName; // 파일 경로 PictureBoxItem.FullPath_FileName = ((_PictureBoxItem)Temp_Hash[ICON_ID]).FullPath_FileName; // 현재 선택여부 PictureBoxItem.Selected = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Selected; // 선택하는 경우 외부 테두리 PictureBoxItem.ShapeContainer_Seleted = ((_PictureBoxItem)Temp_Hash[ICON_ID]).ShapeContainer_Seleted; PictureBoxItem.LineShape_TOP = ((_PictureBoxItem)Temp_Hash[ICON_ID]).LineShape_TOP; PictureBoxItem.LineShape_BOTTOM = ((_PictureBoxItem)Temp_Hash[ICON_ID]).LineShape_BOTTOM; PictureBoxItem.LineShape_LEFT = ((_PictureBoxItem)Temp_Hash[ICON_ID]).LineShape_LEFT; PictureBoxItem.LineShape_RIGHT = ((_PictureBoxItem)Temp_Hash[ICON_ID]).LineShape_RIGHT; // 이미지 PictureBoxItem.Image = Image.FromFile(PictureBoxItem.FullPath_FileName); // 이미지를 크기에 맞게 셋팅 PictureBoxItem.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; // 위치 PictureBoxItem.Location = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Location; // 사이즈 if (PictureBoxItem.Image == null) PictureBoxItem.Size = new System.Drawing.Size(0, 0); else PictureBoxItem.Size = new System.Drawing.Size(PictureBoxItem.Image.Width, PictureBoxItem.Image.Height); // 이름 PictureBoxItem.Name = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Name; // 디바이스 아이콘 if (PictureBoxItem.ItemType == Item_Type.Device) { // 데이타베이스 디바이스 명칭 PictureBoxItem.Device_DB_Name = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Device_DB_Name; // 연동 회로 번호 PictureBoxItem.Device_Oper_ID = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Device_Oper_ID; } // 버튼 아이콘 else if (PictureBoxItem.ItemType == Item_Type.Button) { // 점프 페이지 (문자열로 저장되는 페이지 이름이다. 단, xml 저장시에는 페이지 아이디로 저장됨) PictureBoxItem.Button_JumpPageName = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Button_JumpPageName; } // 해쉬테이블 추가 Save_Hash.Add(ICON_ID, PictureBoxItem); } } // 기존의 내용을 편집해서 저장하는 경우 private void _Event_PopupClose_SendMessage_Event_Edit(object sender, object etc) { // 대화 팝업 주체 Form DialogPopup = (Form)sender; // 팝업창에서 확인 버튼을 누르면 if (DialogPopup.Name == DialogPopup.Name && etc.ToString() == _Text.OK) { // 무조건 편집 혹은 새로만들기의 경우 차후 저장을 위해 셋팅 if (_Data.LIST_XmlDBNotSave_Receiver.Contains(Seleted_RECEIVER_ID) == false) _Data.LIST_XmlDBNotSave_Receiver.Add(Seleted_RECEIVER_ID); // 페이지명 및 배경그림 안에 있는 픽쳐박스를 전부 해쉬에 저장 해야한다 // 차후 프로젝트 저장시에 XML 파일이 생성될 수 있도록 한다 //_Page Page = new _Page(); // 페이지명 (중복되지 않는 고유의 아이디로 사용함) Seleted_PageNodeKey = _Data.CREATE_PAGE_ID(Seleted_RECEIVER_ID, this.editBox_Base_PageName.Text); // 페이지를 새로 생성한후에 페이키값이 없다 Seleted_PageNodeText = this.editBox_Base_PageName.Text; string Item_ID = Seleted_PageNodeKey; // 배경그림을 다시 저장 ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).PictureBoxItem_BackGround = UI_Create_PictureBoxItem( this.pictureBox_Background, Item_Type.BackGround, this.editBox_Base_BackgrondFilePath.Text, this.editBox_Base_BackgrondFileName.Text, Item_ID, 0, 0); if (((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).PictureBoxItem_BackGround != null) { // 해쉬 추가 //if (_Hash.Add(_Data.HASH_PAGE, Item_ID, Page) == true) //{ // _Data.LIST_PAGE_ID.Add(Item_ID); //} // 특별히 수정하려는 페이지에서 저장하는 경우에는 기존의 리스트 및 해쉬를 초기화하고 복사를 진행하자 ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).LIST_ICON_ID.Clear(); ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).HASH_ICON.Clear(); // 추가된 아이콘 (디바이스 아이콘 혹은 버튼 아이콘) 모두 저장 - 기존 내용 편집 Copy_HASH_LIST( TEMP_LIST_ICON_ID, TEMP_HASH_ICON, ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).LIST_ICON_ID, ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).HASH_ICON); // 확인 메세지 _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.PageEditData_TreeNodeInform, 0); // 메인 창의 페이지 노드를 트리에 추가한다 //_Event.TreeView_PageNodeSet_SendMessage_Write(Seleted_RECEIVER, Page); // UI 정리 uiButton_Device_Clear_Click(null, null); } } // 대화 팝업은 특별처리 _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_Edit); } /// /// 리스트뷰 /// // 리스트뷰의 아이템(디바이스 아이콘) 더블클릭하면 아이템이 작업화면에 보여진다 private void listView_Item_MouseDoubleClick(object sender, MouseEventArgs e) { // Work 패널 포커스 이동 this.uiPanel_Work.Focus(); // 아이템이 새롭게 추가되면 선택되엇던 아이템이 모두 선택 해제된다 pictureBox_SeletedStatusInitialize(); // 선택 Selected_PictureBoxItem = null; ListView ListViewItem = (ListView)sender; // 아이템 아이디 string Item_ID = ICON_ID_Order++.ToString(); // 파일경로, 아이디, 위치, 사이즈 지정 _PictureBoxItem PictureBoxItem = UI_Create_PictureBoxItem( this.pictureBox_Background, Item_Type.Device, Default_Symbol_FullPath + "\\" + ListViewItem.FocusedItem.Text, ListViewItem.FocusedItem.Text, Item_ID, 0, 0); // 사이즈 제한 if (PictureBoxItem == null) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 450, 150, _Text.SizeLimitOrEtcError, 0); return; } // 해쉬 추가 if (_Hash.Add(TEMP_HASH_ICON, Item_ID, PictureBoxItem) == true) { TEMP_LIST_ICON_ID.Add(Item_ID); } // 상태바 갱신 UI_Status_Write(PictureBoxItem); // 오브젝트 트리에 추가 - 디바이스 _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 1, Item_ID, PictureBoxItem.NodeText(), Object_Type.DEVICE_DETAIL); this.treeView_ObjectTree.ExpandAll(); // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); } // 리스트뷰의 아이템 클릭하면 상태바가 갱신된다 private void listView_Item_MouseClick(object sender, MouseEventArgs e) { // 아이템이 새롭게 추가되면 선택되엇던 아이템이 모두 선택 해제된다 pictureBox_SeletedStatusInitialize(); // 선택 Selected_PictureBoxItem = null; ListView item = (ListView)sender; _PictureBoxItem PictureBoxItem = new _PictureBoxItem(); // 타입 PictureBoxItem.ItemType = Item_Type.Device; // 파일정보 PictureBoxItem.Info = Get_Image_Info(Default_Symbol_FullPath + "\\" + item.FocusedItem.Text); // 드래그 상태 PictureBoxItem.MouseDrag_Status = false; // 드래그 X 좌표 PictureBoxItem.MouseDown_X = 0; // 드래그 Y 좌표 PictureBoxItem.MouseDown_Y = 0; // 점프페이지 PictureBoxItem.Button_JumpPageName = null; // 픽쳐박스에서 상속 PictureBoxItem.Location = new System.Drawing.Point(0, 0); PictureBoxItem.Size = new System.Drawing.Size(24, 24); // 상태바 갱신 UI_Status_Write(PictureBoxItem); } /// /// 상태창 변경 /// // 파일정보를 표시하는 경우 private void UI_Status_Write(_PictureBoxItem PictureBoxItem) { // 파일정보 this.label_Status_Info.Text = PictureBoxItem.Info; // 아이콘 타입 this.label_Status_IconType.Text = Convert.ToString(PictureBoxItem.ItemType); // 디바이스 연동 회로 아이디 this.label_Status_Device.Text = PictureBoxItem.Device_Oper_ID; // X this.editBox_Status_Location_X.Text = PictureBoxItem.Location.X.ToString(); // Y this.editBox_Status_Location_Y.Text = PictureBoxItem.Location.Y.ToString(); // W this.editBox_Status_Size_W.Text = PictureBoxItem.Width.ToString(); // H this.editBox_Status_Size_H.Text = PictureBoxItem.Height.ToString(); // JUMP this.uiComboBox_Status_Jump.Text = PictureBoxItem.Button_JumpPageName; } // 파일정보를 표시하는 경우 (좌표만 갱신하는 경우, 부하를 막기 위해 마우스 move 이벤트에서만 동작하도록 한다) private void UI_Status_Write(int x, int y) { // X this.editBox_Status_Location_X.Text = x.ToString(); // Y this.editBox_Status_Location_Y.Text = y.ToString(); } // 파일정보를 표시하지 않아도 되는 경우 private void UI_Status_Clear() { // 파일정보 this.label_Status_Info.Text = _Text.None; // 타입 this.label_Status_IconType.Text = _Text.None; // 디바이스 this.label_Status_Device.Text = _Text.None; // X this.editBox_Status_Location_X.Text = _Text.Zero; // Y this.editBox_Status_Location_Y.Text = _Text.Zero; // W this.editBox_Status_Size_W.Text = _Text.Zero; // H this.editBox_Status_Size_H.Text = _Text.Zero; // JUMP this.uiComboBox_Status_Jump.Text = _Text.None; } /// /// 아이템 (디바이스 아이콘 혹은 버튼 아이콘 ) 마우스 이벤트 처리부 /// // 모든 픽쳐박스 선택 해제 private void pictureBox_SeletedStatusInitialize() { // 버튼 선택 해제 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected = false; ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ShapeContainer_Seleted.Visible = false; } this.pictureBox_Background.ResumeLayout(); } // 픽쳐박스 마우스 다운 private void pictureBox_Create_MouseDown(object sender, MouseEventArgs e) { // Work 패널 포커스 이동 this.uiPanel_Work.Focus(); // 선택한 픽쳐박스 _PictureBoxItem PictureBoxItem = (_PictureBoxItem)sender; // 범위를 벗어나면 안됨 Check_Icon_Location(PictureBoxItem); // 선택 Selected_PictureBoxItem = null; // 상태갱신 UI_Status_Write(PictureBoxItem); // 오브젝트 트리에 현재 선택된 아이콘 정보를 입력 treeView_ObjectTree.SelectedNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, PictureBoxItem.Name); // 오브젝트 트리에 포커스 입력 treeView_ObjectTree.Focus(); // 선택 Selected_PictureBoxItem = PictureBoxItem; // 오른쪽 마우스 버튼 if (e.Button == System.Windows.Forms.MouseButtons.Right) { int Selected_Icon_Count = 0; foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) Selected_Icon_Count++; } if (Selected_Icon_Count > 1) // 1개이상 선택하는 경우 { // 팝업 메세지 출력 _Contextmenustrip.Create(PictureBoxItem, e.Location, _Text.IconLeftSort + ";" + _Text.IconRightSort + ";" + _Text.IconTopSort + ";" + _Text.IconBottomSort + ";" + _Text.ContextStripSeparator + ";" + _Text.IconSelDel, PictureBoxItem_Menustrip_ItemClicked); } else if (Selected_Icon_Count == 1) { // 팝업 메세지 출력 _Contextmenustrip.Create(PictureBoxItem, e.Location, _Text.IconSelDel, PictureBoxItem_Menustrip_ItemClicked); } } // 왼쪽 마우스 버튼 else { // 쉬프트키를 누르지 않았다면 if (KeyDown_SHIFTKEY == false) { // 디바이스 아이콘 혹은 버튼 아이콘 선택 초기화 pictureBox_SeletedStatusInitialize(); } // 드래그 시작하면 PictureBox_Drag_Shift = false; // 선택시 스타일 변경 (주변에 네모박스 보이도록 출력) Selected_PictureBoxItem.Selected = true; Selected_PictureBoxItem.ShapeContainer_Seleted.Visible = true; // 버튼이라면 점프페이지 선택가능함 if (Selected_PictureBoxItem.ItemType == Item_Type.Button) { this.uiComboBox_Status_Jump.ReadOnly = false; this.uiComboBox_Status_Jump.BackColor = System.Drawing.Color.White; if (Selected_PictureBoxItem.Button_JumpPageName != null && Selected_PictureBoxItem.Button_JumpPageName.Length != 0) this.uiComboBox_Status_Jump.Text = Selected_PictureBoxItem.Button_JumpPageName; else this.uiComboBox_Status_Jump.Text = _Text.None; } else { this.uiComboBox_Status_Jump.ReadOnly = true; this.uiComboBox_Status_Jump.BackColor = System.Drawing.SystemColors.MenuBar; this.uiComboBox_Status_Jump.Text = _Text.None; } // 단 멀티선택의 경우 동시에 옮겨야 한다 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status = true; ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDown_X = e.X; ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDown_Y = e.Y; } } // 키보드를 누른상태에서 마우스를 누르면 잔상이 남고 그건 나중에 원본이랑 대체가 된다 if (KeyDown_ALTKEY == true) { // 아이콘 잠금 기능 활성화 체크 if (this.uiCheckBox_IconLock.Checked == true) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0); return; } // 복사 해쉬 및 리스트 초기화 COPY_HASH_ICON.Clear(); COPY_LIST_ICON_ID.Clear(); foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { // 아이템 아이디 string Item_ID = ICON_ID_Order++.ToString(); // 파일경로, 아이디, 위치, 사이즈 지정 _PictureBoxItem Copy_PictureBoxItem = UI_Create_PictureBoxItem( this.pictureBox_Background, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).FullPath_FileName, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).FileName, Item_ID, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y); /// /// 동적 할당 변수 처리 /// // 디바이스 연동 회로 번호 Copy_PictureBoxItem.Device_Oper_ID = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID; // 점프 페이지 PictureBoxItem.Button_JumpPageName = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName; if (Copy_PictureBoxItem != null) { // 복사 리스트에 일단 넣고 if (_Hash.Add(COPY_HASH_ICON, Item_ID, Copy_PictureBoxItem) == true) { COPY_LIST_ICON_ID.Add(Item_ID); } } } } } } } // 픽쳐박스 마우스 업 private void pictureBox_Create_MouseUp(object sender, MouseEventArgs e) { // 선택한 픽쳐박스 _PictureBoxItem PictureBoxItem = (_PictureBoxItem)sender; // 범위를 벗어나면 안됨 Check_Icon_Location(PictureBoxItem); // 마우스 드래그 상태 해제 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status = false; } } // 드래그 종료하면 PictureBox_Drag_Shift = false; // Alt 키를 누르는 경우 복사를 완료한다 if (KeyDown_ALTKEY == true) { // 복사한 리스트를 토대로 해쉬테이블에 추가 foreach (string COPY_ICON_ID in COPY_LIST_ICON_ID) { TEMP_LIST_ICON_ID.Add(COPY_ICON_ID); TEMP_HASH_ICON.Add(COPY_ICON_ID, COPY_HASH_ICON[COPY_ICON_ID]); // 오브젝트 트리에 추가 if (((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).ItemType == Item_Type.Button) { // 버튼 타입 _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 1, ((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).Name, ((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).NodeText(), Object_Type.BUTTON_DETAIL); } else { // 디바이스 타입 _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 1, ((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).Name, ((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).NodeText(), Object_Type.DEVICE_DETAIL); } } // 완료한후 해쉬 및 리스트 초기화 COPY_LIST_ICON_ID.Clear(); COPY_HASH_ICON.Clear(); // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); } // 이동 else { // 복사하려는 아이템이 있을경우에만 (즉 복사시도를 했을경우에만) if (COPY_LIST_ICON_ID.Count != 0) { // 원본위치에서 복사했던 리스트 삭제 COPY_HASH_LIST_Initialize(); } } } // 픽쳐박스 마우스 이동 private void pictureBox_Create_MouseMove(object sender, MouseEventArgs e) { // 아이콘 잠금 기능 활성화 체크 (팝업창은 날리지 않는다) if (this.uiCheckBox_IconLock.Checked == true) return; // 선택한 픽쳐박스 _PictureBoxItem PictureBoxItem = (_PictureBoxItem)sender; // 범위를 벗어나면 안됨 Check_Icon_Location(PictureBoxItem); // 마우스 포인트 (픽쳐박스 내부 마우스 포인트) int PictureBox_MousePoint_X = e.X; int PictureBox_MousePoint_Y = e.Y; // 새로운 좌표 PictureBox_New_MousePoint_X = PictureBox_MousePoint_X; // 쉬프트키를 누르면 수직 혹은 수평으로 이동할수 있다 if (KeyDown_SHIFTKEY == true) { // 마우스를 떼기 전까지는 단한번의 결정으로 모드가 결정된다 if (PictureBox_Drag_Shift == false) { // 드래그 중이다 PictureBox_Drag_Shift = true; // 수평이동만 하는 경우에는 가장 최근의 좌표와 비교해서 X 좌표가 변경되었다면 if (PictureBox_New_MousePoint_X != PictureBox_Old_MousePoint_X) { PictureBox_Drag_Vertical = false; } // 수직이동만 하는 경우에는 가장 최근의 좌표와 비교해서 Y 좌표가 변경되었다면 else //if (New_PictureBoxItem_Y != Old_PictureBoxItem_Y) { PictureBox_Drag_Vertical = true; } } if (PictureBox_Drag_Vertical == false) { // 좌표 갱신 (1개만) if (PictureBoxItem.MouseDrag_Status == true) { // X 좌표만 갱신한다 UI_Status_Write( PictureBoxItem.Location.X + PictureBox_MousePoint_X - PictureBoxItem.MouseDown_X, PictureBoxItem.Location.Y); } // 실제 위치 변경 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status == true) { _PictureBoxItem PictureBoxItem_Selected = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]); ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point( PictureBoxItem_Selected.Location.X + PictureBox_MousePoint_X - PictureBoxItem_Selected.MouseDown_X, PictureBoxItem_Selected.Location.Y); } } } } else { // 좌표 갱신 (1개만) if (PictureBoxItem.MouseDrag_Status == true) { // Y좌표만 갱신한다 UI_Status_Write( PictureBoxItem.Location.X, PictureBoxItem.Location.Y + PictureBox_MousePoint_Y - PictureBoxItem.MouseDown_Y); } // 실제 위치 변경 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status == true) { _PictureBoxItem PictureBoxItem_Selected = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]); ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point( PictureBoxItem_Selected.Location.X, PictureBoxItem_Selected.Location.Y + PictureBox_MousePoint_Y - PictureBoxItem_Selected.MouseDown_Y); } } } } } else { // 좌표 갱신 (1개만) if (PictureBoxItem.MouseDrag_Status == true) { // 좌표만 갱신한다 UI_Status_Write( PictureBoxItem.Location.X + PictureBox_MousePoint_X - PictureBoxItem.MouseDown_X, PictureBoxItem.Location.Y + PictureBox_MousePoint_Y - PictureBoxItem.MouseDown_Y); } // 실제 위치 변경 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status == true) { _PictureBoxItem PictureBoxItem_Selected = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]); ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point( PictureBoxItem_Selected.Location.X + PictureBox_MousePoint_X - PictureBoxItem_Selected.MouseDown_X, PictureBoxItem_Selected.Location.Y + PictureBox_MousePoint_Y - PictureBoxItem_Selected.MouseDown_Y); } } } } // 마지막 좌표 PictureBox_Old_MousePoint_X = PictureBox_MousePoint_X; } // 아이템클릭 private void pictureBox_Create_MouseClick(object sender, MouseEventArgs e) { //// Work 패널 포커스 이동 //this.uiPanel_Work.Focus(); //// 선택한 픽쳐박스 //_PictureBoxItem PictureBoxItem = (_PictureBoxItem)sender; //// 선택 //Selected_PictureBoxItem = PictureBoxItem; //// 오른쪽 마우스 버튼 //if (e.Button == System.Windows.Forms.MouseButtons.Right) //{ // ; // Down 이벤트에서 처리 //} //// 왼쪽 마우스 버튼 //else //{ // // 아이템 (디바이스 아이콘 혹은 버튼 아이콘 선택 초기화) // pictureBox_SeletedStatusInitialize(); // // 선택시 스타일 변경 (주변에 네모박스 보이도록 출력) // Selected_PictureBoxItem.Selected = true; // Selected_PictureBoxItem.ShapeContainer_Seleted.Visible = true; // // 버튼이라면 점프페이지 선택가능함 // if (Selected_PictureBoxItem.ItemType == Item_Type.Button) // { // this.uiComboBox_Status_Jump.ReadOnly = false; // this.uiComboBox_Status_Jump.BackColor = System.Drawing.Color.White; // if (Selected_PictureBoxItem.Button_JumpPageName != null && Selected_PictureBoxItem.Button_JumpPageName.Length != 0) // this.uiComboBox_Status_Jump.Text = Selected_PictureBoxItem.Button_JumpPageName; // else // this.uiComboBox_Status_Jump.Text = _Text.None; // } // else // { // this.uiComboBox_Status_Jump.ReadOnly = true; // this.uiComboBox_Status_Jump.BackColor = System.Drawing.SystemColors.MenuBar; // this.uiComboBox_Status_Jump.Text = _Text.None; // } //} } // 아이템 클릭후 오른쪽 마우스 팝업 public void PictureBoxItem_Menustrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { // 호출한 것은 감추기 ContextMenuStrip menustrip = (ContextMenuStrip)sender; // 잔상 삭제 menustrip.Hide(); // 위 정렬 if (e.ClickedItem.Text == _Text.IconTopSort) { PictureBoxItem_TopSort(); } // 아래 정렬 else if (e.ClickedItem.Text == _Text.IconBottomSort) { PictureBoxItem_BottomSort(); } // 아래 정렬 else if (e.ClickedItem.Text == _Text.IconLeftSort) { PictureBoxItem_LeftSort(); } // 아래 정렬 else if (e.ClickedItem.Text == _Text.IconRightSort) { PictureBoxItem_RightSort(); } // 선택된 아이콘 삭제 else if (e.ClickedItem.Text == _Text.IconSelDel) { // 선택된 아이콘 삭제 Common_IconSelDel(); } } /// /// 상태창에서 사이즈 및 위치를 편집할수있다 (단, 입력후 반드시 엔터키를 눌러야 된다) /// private void editBox_Status_Location_X_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar.ToString() == _Text.Return) { if (Selected_PictureBoxItem != null && editBox_Status_Location_X.Text.Length != 0 && editBox_Status_Location_Y.Text.Length != 0) { int x = Int32.Parse(editBox_Status_Location_X.Text); int y = Int32.Parse(editBox_Status_Location_Y.Text); if (x >= 0 && x <= 1080 && y >= 0 && y <= 720) Selected_PictureBoxItem.Location = new Point(x, y); } } } catch { ; // 잘못된 입력입니다 } } private void editBox_Status_Location_Y_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar.ToString() == _Text.Return) { if (Selected_PictureBoxItem != null && editBox_Status_Location_X.Text.Length != 0 && editBox_Status_Location_Y.Text.Length != 0) { int x = Int32.Parse(editBox_Status_Location_X.Text); int y = Int32.Parse(editBox_Status_Location_Y.Text); if (x >= 0 && x <= 1080 && y >= 0 && y <= 720) Selected_PictureBoxItem.Location = new Point(x, y); } } } catch { ; // 잘못된 입력입니다 } } private void editBox_Status_Size_W_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar.ToString() == _Text.Return) { if (Selected_PictureBoxItem != null && editBox_Status_Size_W.Text.Length != 0 && editBox_Status_Size_H.Text.Length != 0) { int w = Int32.Parse(editBox_Status_Size_W.Text); int h = Int32.Parse(editBox_Status_Size_H.Text); if (w > 0 && w <= 1080 && h > 0 && h <= 720) Selected_PictureBoxItem.Size = new Size(w, h); } } } catch { ; // 잘못된 입력입니다 } } private void editBox_Status_Size_H_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar.ToString() == _Text.Return) { if (Selected_PictureBoxItem != null && editBox_Status_Size_W.Text.Length != 0 && editBox_Status_Size_H.Text.Length != 0) { int w = Int32.Parse(editBox_Status_Size_W.Text); int h = Int32.Parse(editBox_Status_Size_H.Text); if (w > 0 && w <= 1080 && h > 0 && h <= 720) Selected_PictureBoxItem.Size = new Size(w, h); } } } catch { ; // 잘못된 입력입니다 } } /// /// 상태창 추가 이벤트 /// // 점프페이지 콤보박스 아이템 추가 private void uiComboBox_Status_Jump_DroppingDown(object sender, CancelEventArgs e) { // 콤보박스에 추가할 리스트 ArrayList TempComboBoxPageName = new ArrayList(); foreach (string PAGE_ID in ((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).LIST_PAGE_ID) { _RECEIVER RECEIVER = ((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]); // 페이지 명을 추가한다 TempComboBoxPageName.Add(((_Page)RECEIVER.HASH_PAGE[PAGE_ID]).NodeText); } // 선택한 점프페이지 if (Selected_PictureBoxItem != null && this.uiComboBox_Status_Jump.Text.Length != 0 && this.uiComboBox_Status_Jump.Text != null) { // 콤보박스 셋팅 _Combobox.Initialize(this.uiComboBox_Status_Jump, TempComboBoxPageName, Selected_PictureBoxItem.Button_JumpPageName); // None 값도 추가 if (this.uiComboBox_Status_Jump.Items.Contains(_Text.None) == false) this.uiComboBox_Status_Jump.Items.Add(_Text.None); } } // 점프페이지 설정 private void uiComboBox_Status_Jump_SelectedItemChanged(object sender, EventArgs e) { if (Selected_PictureBoxItem != null && this.uiComboBox_Status_Jump.Text.Length != 0 && this.uiComboBox_Status_Jump.Text != null) { if (Selected_PictureBoxItem.ItemType == Item_Type.Button) { // // 아이템에 점프 페이지 적용 // ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).Button_JumpPageName = this.uiComboBox_Status_Jump.Text; // 편집할 노드 검색 TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).Name); // 트리에 반영 EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).NodeText(); // 오브젝트 트리 색상 반영 (버튼) _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).Button_JumpPageName); // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); } } } /// /// 공통으로 사용되는 선 (배경에서 드래그를 하여 생성되는 네모 혹은 아이템(디바이스 아이콘 혹은 버튼 아이콘을 선택하여 생성되는 네모) /// // 선 스타일 private void LineShape_BorderStyle(LineShape lineshape, DashStyle dashstyle, Color color, int borderwidth) { try { lineshape.BorderStyle = dashstyle; lineshape.BorderColor = color; lineshape.BorderWidth = borderwidth; } catch { } } // 선 시작점 private void LineShape_Start(LineShape lineshape, int x, int y) { try { lineshape.X1 = x; lineshape.Y1 = y; } catch { } } // 선 끝점 private void LineShape_End(LineShape lineshape, int x, int y) { try { lineshape.X2 = x; lineshape.Y2 = y; } catch { } } // 배경에 올라온 이미지의 선 스타일 일괄 변경 private void LineShape_Item_BorderStyle(_PictureBoxItem PictureBoxItem, DashStyle dashstyle, Color color, int borderwidth) { LineShape_BorderStyle(PictureBoxItem.LineShape_TOP, dashstyle, color, borderwidth); LineShape_BorderStyle(PictureBoxItem.LineShape_BOTTOM, dashstyle, color, borderwidth); LineShape_BorderStyle(PictureBoxItem.LineShape_LEFT, dashstyle, color, borderwidth); LineShape_BorderStyle(PictureBoxItem.LineShape_RIGHT, dashstyle, color, borderwidth); } // 배경에서 마우스로 드래그하는 경우 생성되는 선 스타일 일괄변경 private void LineShape_MouseDragBackGrond_BorderStyle(DashStyle dashstyle, Color color, int borderwidth) { LineShape_BorderStyle(LineShape_MouseDragBackGround_TOP, dashstyle, color, borderwidth); LineShape_BorderStyle(LineShape_MouseDragBackGround_BOTTOM, dashstyle, color, borderwidth); LineShape_BorderStyle(LineShape_MouseDragBackGround_LEFT, dashstyle, color, borderwidth); LineShape_BorderStyle(LineShape_MouseDragBackGround_RIGHT, dashstyle, color, borderwidth); } // 배경에서 마우스로 드래그하는 경우 생성되는 선 모두 삭제 private void LineShape_MouseDragBackGrond_Clear() { if (ShapeContainer_MouseDragBackGround != null) ShapeContainer_MouseDragBackGround.Dispose(); if (LineShape_MouseDragBackGround_TOP != null) LineShape_MouseDragBackGround_TOP.Dispose(); if (LineShape_MouseDragBackGround_BOTTOM != null) LineShape_MouseDragBackGround_BOTTOM.Dispose(); if (LineShape_MouseDragBackGround_LEFT != null) LineShape_MouseDragBackGround_LEFT.Dispose(); if (LineShape_MouseDragBackGround_RIGHT != null) LineShape_MouseDragBackGround_RIGHT.Dispose(); } /// /// 배경 /// // 배경 클릭 (마우스 클릭) private void pictureBox_Background_MouseClick(object sender, MouseEventArgs e) { //// 선택 //Selected_PictureBoxItem = null; //// 상태갱신 //UI_Status_Initialize(Item_Type.BackGround, this.editBox_Base_BackgrondFilePath.Text); //// 나머지 선택 스타일 초기화 //pictureBox_SeletedStatusInitialize(); //// 오른쪽 마우스 //if (e.Button == System.Windows.Forms.MouseButtons.Right) //{ // _Contextmenustrip.Create(this.pictureBox_Background, e.Location, // _Text.ButtonAdd + ";" + // _Text.ItemAllDel, // pictureBox_Background_Menustrip_ItemClicked); //} //// 왼쪽 마우스 //else //{ // // 배경 선을 모두 클리어 // LineShape_MouseDragBackGrond_Clear(); // MouseDrag = false; //} } // 배경클릭후 팝업창에서 선택 public void pictureBox_Background_Menustrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { // 호출한 것은 감추기 ContextMenuStrip menustrip = (ContextMenuStrip)sender; // 잔상 삭제 menustrip.Hide(); // 버튼 추가 if (e.ClickedItem.Text == _Text.ButtonAdd) { OpenFileDialog openFileDialog = new OpenFileDialog(); // 배경 삽입시에 다이얼로그창은 프로젝트 경로에 따라서 Field 폴더에 곧바로 접근할 수있도록 함 openFileDialog.InitialDirectory = Default_Field_FullPath; if (openFileDialog.ShowDialog() == DialogResult.OK) { // 아이템 아이디 string Item_ID = ICON_ID_Order++.ToString(); // 파일경로, 아이디, 위치, 사이즈 지정 _PictureBoxItem PictureBoxItem = UI_Create_PictureBoxItem( this.pictureBox_Background, Item_Type.Button, openFileDialog.FileName, //Default_Field_FullPath + "\\" + openFileDialog.SafeFileName, openFileDialog.SafeFileName,//ListViewItem.FocusedItem.Text, Item_ID, 0, 0); // 사이즈 제한 if (PictureBoxItem == null) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 450, 150, _Text.SizeLimitOrEtcError, 0); return; } // 아이콘 리스트 와 해쉬에 추가 if (_Hash.Add(TEMP_HASH_ICON, Item_ID, PictureBoxItem) == true) { TEMP_LIST_ICON_ID.Add(Item_ID); } // 상태창 초기화 UI_Status_Initialize(Item_Type.Button, openFileDialog.FileName); // 오브젝트 트리에 추가 - 버튼 _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 0, Item_ID, PictureBoxItem.NodeText(), Object_Type.BUTTON_DETAIL); this.treeView_ObjectTree.ExpandAll(); // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); } } // 전체 삭제 else if (e.ClickedItem.Text == _Text.IconAllDel) { // 버튼 및 디바이스 아이콘 전체 삭제 Common_IconAllDel(); } } // 배경에서 마우스 버튼 누르는 동시에 드래그 시작 private void pictureBox_Background_MouseDown(object sender, MouseEventArgs e) { // Work 패널 포커스 이동 this.uiPanel_Work.Focus(); // 선택 Selected_PictureBoxItem = null; // 상태갱신 UI_Status_Initialize(Item_Type.BackGround, this.editBox_Base_BackgrondFilePath.Text); // 나머지 선택 스타일 초기화 pictureBox_SeletedStatusInitialize(); // 오른쪽 마우스 if (e.Button == System.Windows.Forms.MouseButtons.Right) { _Contextmenustrip.Create(this.pictureBox_Background, e.Location, _Text.ButtonAdd + ";" + _Text.ContextStripSeparator + ";" + _Text.IconAllDel, pictureBox_Background_Menustrip_ItemClicked); } // 왼쪽 마우스 else { // 배경 선을 모두 클리어 LineShape_MouseDragBackGrond_Clear(); //MouseDrag = false; // 드래그 시작 BackGround_MouseDrag = true; // 클릭좌표 BackGround_MouseDrag_Before_X = e.X; BackGround_MouseDrag_Before_Y = e.Y; // 메모리 해제 LineShape_MouseDragBackGrond_Clear(); // 메모리 할당 ShapeContainer_MouseDragBackGround = new ShapeContainer(); LineShape_MouseDragBackGround_TOP = new LineShape(); LineShape_MouseDragBackGround_BOTTOM = new LineShape(); LineShape_MouseDragBackGround_LEFT = new LineShape(); LineShape_MouseDragBackGround_RIGHT = new LineShape(); // 선 스타일 지정 LineShape_MouseDragBackGrond_BorderStyle(Selected_DashStyle_First, Selected_Color, Selected_BorderWidth_BakcGround); } } // 범위안에 아이콘이 포함되는지 체크함 (선으로 구성한 덕분에 계산이 복잡해졌음).. private bool pictureBox_Background_MouseUp_InCheck(string ICON_ID) { // 왼쪽 상단 -> 오른쪽 하단 드래그시 if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= BackGround_MouseDrag_Before_X && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= BackGround_MouseDrag_Before_Y && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Width <= BackGround_MouseDrag_After_X && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Height <= BackGround_MouseDrag_After_Y) { return true; } // 왼쪽 하단 -> 오른쪽 상단 드래그시 else if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= BackGround_MouseDrag_Before_X && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= BackGround_MouseDrag_After_Y && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Width <= BackGround_MouseDrag_After_X && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Height <= BackGround_MouseDrag_Before_Y) { return true; } // 오른쪽 상단 -> 왼쪽 하단 드래그시 else if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= BackGround_MouseDrag_After_X && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= BackGround_MouseDrag_Before_Y && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Width <= BackGround_MouseDrag_Before_X && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Height <= BackGround_MouseDrag_After_Y) { return true; } // 오른쪽 하단 -> 왼쪽 상단 드래그시 else if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= BackGround_MouseDrag_After_X && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= BackGround_MouseDrag_After_Y && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Width <= BackGround_MouseDrag_Before_X && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Height <= BackGround_MouseDrag_Before_Y) { return true; } return false; } // 배경에서 마우스 버튼 누르는 동시에 드래그 종료 private void pictureBox_Background_MouseUp(object sender, MouseEventArgs e) { // Work 패널 포커스 이동 this.uiPanel_Work.Focus(); // 드래그 해제 BackGround_MouseDrag = false; // 드래그 영역안에 아이템이 포함되면 선택한 아이템 모두 선택 표시 // 범위안의 디바이스 아이콘 및 버튼 아이콘 검색 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (pictureBox_Background_MouseUp_InCheck(ICON_ID) == true) { ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected = true; ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ShapeContainer_Seleted.Visible = true; } } // 배경 선을 모두 클리어 LineShape_MouseDragBackGrond_Clear(); } // 배경에서 마우스로 드래그하는 동안 선이 생성 private void pictureBox_Background_MouseMove(object sender, MouseEventArgs e) { // 배경 드래그 상태 if (BackGround_MouseDrag == true) { // 클릭좌표 BackGround_MouseDrag_After_X = e.X; BackGround_MouseDrag_After_Y = e.Y; // TOP LineShape_Start(LineShape_MouseDragBackGround_TOP, BackGround_MouseDrag_Before_X, BackGround_MouseDrag_Before_Y); LineShape_End(LineShape_MouseDragBackGround_TOP, BackGround_MouseDrag_After_X, BackGround_MouseDrag_Before_Y); // LEFT LineShape_Start(LineShape_MouseDragBackGround_LEFT, BackGround_MouseDrag_Before_X, BackGround_MouseDrag_Before_Y); LineShape_End(LineShape_MouseDragBackGround_LEFT, BackGround_MouseDrag_Before_X, BackGround_MouseDrag_After_Y); // RIGHT LineShape_Start(LineShape_MouseDragBackGround_RIGHT, BackGround_MouseDrag_After_X, BackGround_MouseDrag_Before_Y); LineShape_End(LineShape_MouseDragBackGround_RIGHT, BackGround_MouseDrag_After_X, BackGround_MouseDrag_After_Y); // BOTTM LineShape_Start(LineShape_MouseDragBackGround_BOTTOM, BackGround_MouseDrag_Before_X, BackGround_MouseDrag_After_Y); LineShape_End(LineShape_MouseDragBackGround_BOTTOM, BackGround_MouseDrag_After_X, BackGround_MouseDrag_After_Y); // 컨테이너에 상위 4개 선 포함 ShapeContainer_MouseDragBackGround.Shapes.AddRange(new Microsoft.VisualBasic.PowerPacks.Shape[] { LineShape_MouseDragBackGround_TOP,LineShape_MouseDragBackGround_BOTTOM,LineShape_MouseDragBackGround_LEFT,LineShape_MouseDragBackGround_RIGHT, }); // 배경그림에 컨테이너 포함 this.pictureBox_Background.Controls.Add(ShapeContainer_MouseDragBackGround); } } /// /// 아이콘 관련 공통 루틴 /// // 아이콘 전체 삭제 private void Common_IconAllDel() { // 해쉬 및 리스트 전체 삭제 TEMP_HASH_LIST_Initialize(); // 상태바 초기화 UI_Status_Clear(); // 오브젝트 트리 초기화 UI_Tree_Initialize(); // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); // 디바이스 조회창 초기화 UI_Device_Initialize(); } // 선택된 아이콘 삭제 private void Common_IconSelDel() { // 삭제하려는 키리스트 임시로 만듬 ArrayList RemoveKeyLIst = new ArrayList(); // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { // 선택한 아이콘은 삭제 ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Dispose(); // 트리에 반영 _Tree.DelNodeName_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name); // 삭제할 키리스트에 할당 , 중복은 배제하도록 함 if (RemoveKeyLIst.Contains(ICON_ID) == false) RemoveKeyLIst.Add(ICON_ID); } } // 삭제할 키리스트에 의해 해쉬와 리스트를 삭제 _Hash.DelData_ByKey(TEMP_HASH_ICON, RemoveKeyLIst); _LIst.Del_ByKeyList(TEMP_LIST_ICON_ID, RemoveKeyLIst); // 상태바 초기화 UI_Status_Clear(); // 선택된 픽쳐박스 초기화 Selected_PictureBoxItem = null; // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오) GridexDevice_ChangeColor_By_TEMP(); GridexDevice_ChangeColor_By_HASH(); } // 선택된 버튼 아이콘 연동 초기화 private void Common_ButtonJumpClear() { // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button) { // // 점프 페이지 초기화 // ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName = null; // 트리 검색 TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name); // 트리에 반영 EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText(); // 오브젝트 트리 색상 반영 (버튼) _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName); } } } // 상태바 초기화 UI_Status_Clear(); // 선택된 픽쳐박스 초기화 Selected_PictureBoxItem = null; // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); } // 선택된 디바이스 아이콘 연동 초기화 private void Common_DeviceLinkClear() { // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device) { // 초기화 ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID = null; // 트리 검색 TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name); // 트리에 반영 EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText(); // 오브젝트 트리 색상 반영 (디바이스) _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID); } } } // 상태바 초기화 UI_Status_Clear(); // 선택된 픽쳐박스 초기화 Selected_PictureBoxItem = null; // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오) GridexDevice_ChangeColor_By_TEMP(); GridexDevice_ChangeColor_By_HASH(); } // 버튼 아이콘 전체 삭제 private void Common_ButtonAllDel() { // 삭제하려는 키리스트 임시로 만듬 ArrayList RemoveKeyLIst = new ArrayList(); // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button) { // 선택한 아이콘은 삭제 ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Dispose(); // 트리에 반영 _Tree.DelNodeName_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name); // 삭제할 키리스트에 할당 , 중복은 배제하도록 함 if (RemoveKeyLIst.Contains(ICON_ID) == false) RemoveKeyLIst.Add(ICON_ID); } } // 삭제할 키리스트에 의해 해쉬와 리스트를 삭제 _Hash.DelData_ByKey(TEMP_HASH_ICON, RemoveKeyLIst); _LIst.Del_ByKeyList(TEMP_LIST_ICON_ID, RemoveKeyLIst); // 상태바 초기화 UI_Status_Clear(); // 선택된 픽쳐박스 초기화 Selected_PictureBoxItem = null; // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); } // 버튼 아이콘 점프페이지 전체초기화 private void Common_ButtonJumpAllClear() { // 버튼 아이콘 전부 검색 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button) { // 점프 페이지 초기화 ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName = null; // 트리 검색 TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name); // 트리에 반영 EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText(); // 오브젝트 트리 색상 반영 (버튼) _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName); } } // 상태바 초기화 UI_Status_Clear(); // 선택된 픽쳐박스 초기화 Selected_PictureBoxItem = null; // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); } // 디바이스 아이콘 전체 삭제 private void Common_DeviceAllDel() { // 삭제하려는 키리스트 임시로 만듬 ArrayList RemoveKeyLIst = new ArrayList(); // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device) { // 선택한 아이콘은 삭제 ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Dispose(); // 트리에 반영 _Tree.DelNodeName_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name); // 삭제할 키리스트에 할당 , 중복은 배제하도록 함 if (RemoveKeyLIst.Contains(ICON_ID) == false) RemoveKeyLIst.Add(ICON_ID); } } // 삭제할 키리스트에 의해 해쉬와 리스트를 삭제 _Hash.DelData_ByKey(TEMP_HASH_ICON, RemoveKeyLIst); _LIst.Del_ByKeyList(TEMP_LIST_ICON_ID, RemoveKeyLIst); // 상태바 초기화 UI_Status_Clear(); // 선택된 픽쳐박스 초기화 Selected_PictureBoxItem = null; // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오) GridexDevice_ChangeColor_By_TEMP(); GridexDevice_ChangeColor_By_HASH(); } // 디바이스 아이콘 연동 전체초기화 private void Common_DeviceLinkAllClear() { // 디바이스 아이콘 전부 검색 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device) { // 점프 페이지 초기화 ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID = null; // 트리 검색 TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name); // 트리에 반영 EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText(); // 오브젝트 트리 색상 반영 (디바이스) _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID); } } // 상태바 초기화 UI_Status_Clear(); // 선택된 픽쳐박스 초기화 Selected_PictureBoxItem = null; // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오) GridexDevice_ChangeColor_By_TEMP(); GridexDevice_ChangeColor_By_HASH(); } /// /// 맵디자이너 공통 타이머 /// // 사용용도는 크게 2가지이다. // 1. 배경에서 드래그하는 경우 스타일이 토글되면서 변경 // 2. 아이템 (디바이스 아이콘, 버튼 아이콘) 을 선택하는 경우 스타일이 초단위로 토글되면서 변경 private void timer_MapDesignerConfig_Tick(object sender, EventArgs e) { MapDesigner_Count++; // 스타일 지정 (초단위로) if (MapDesigner_Count % 2 == 0) { // 배경에서 드래그한 네모 스타일 변경 옵션 1 LineShape_MouseDragBackGrond_BorderStyle(Selected_DashStyle_First, Selected_Color, Selected_BorderWidth_BakcGround); // 선택한 아이콘 스타일 변경 옵션 1 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { LineShape_Item_BorderStyle(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]), Selected_DashStyle_First, Selected_Color, Selected_BorderWidth_Item); } } // 홀짝 순으로 토글하기 위한 초기화 MapDesigner_Count = 0; } else { // 배경에서 드래그한 네모 스타일 변경 옵션 2 LineShape_MouseDragBackGrond_BorderStyle(Selected_DashStyle_Second, Selected_Color, Selected_BorderWidth_BakcGround); // 선택한 아이콘 스타일 변경 옵션 2 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ShapeContainer_Seleted.Visible = true; LineShape_Item_BorderStyle(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]), Selected_DashStyle_Second, Selected_Color, Selected_BorderWidth_Item); } } } } /// /// 키보드 이벤트 /// private void Form_MapDesigner_KeyUp(object sender, KeyEventArgs e) { KeyDown_ALTKEY = e.Alt; KeyDown_SHIFTKEY = e.Shift; } private void Form_MapDesigner_KeyDown(object sender, KeyEventArgs e) { // 복사 : Alt 키를 누르면 마우스 드래그하면서 아이템을 복사 할수 있다 KeyDown_ALTKEY = e.Alt; // 반드시 워크 작업 뷰에 포커스가 있을 경우에만 if (this.uiPanel_Work.Focused == true || this.uiPanel_WorkContainer.Focused == true) { switch (e.KeyCode) { // 삭제 : 현재 1개만 삭제 가능하다 (선택되어 있는 아이템 전부 삭제 루틴은 차후 개발 -> 현재 배경에서 오른쪽 마우스 버튼으로 전체 삭제로 일단 대체함) case Keys.Delete: { // 선택된 아이콘 삭제 Common_IconSelDel(); } break; case Keys.W: case Keys.NumPad8: case Keys.S: case Keys.NumPad2: case Keys.A: case Keys.NumPad4: case Keys.D: case Keys.NumPad6: { uiPanel_WorkContainer_KeyDown_UpDownLeftRight(e.KeyCode); } break; default: break; } } // 일반적인 상황에서 핫키가 필요한 경우 switch (e.KeyCode) { // Operation : 디바이스 연동 루틴이 너무 많아서 단축키가 필요하다 O 를 2번 누르도록 유도하자 case Keys.O: // 디바이스창에서 선택한 아이템이 1개이며, 워크뷰에서도 선택한 아이템이 1개인지 if (uiButton_Device_Apply_Verify() != null) { uiButton_Device_Apply_Click(this.uiButton_Device_Apply, EventArgs.Empty); } break; } } private void uiPanel_WorkContainer_KeyDown_UpDownLeftRight(Keys KeyCode) { // 아이콘 잠금 기능 활성화 체크 if (this.uiCheckBox_IconLock.Checked == true) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0); return; } _PictureBoxItem PictureBoxItem = null; int Selected_Icon_Count = 0; foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { // 선택된 아이콘이라면 카운트 Selected_Icon_Count++; // 선택된 아이콘 위치 조절 PictureBoxItem = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]); switch (KeyCode) { case Keys.W: case Keys.NumPad8: ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(PictureBoxItem.Location.X, PictureBoxItem.Location.Y - 1); break; case Keys.S: case Keys.NumPad2: ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(PictureBoxItem.Location.X, PictureBoxItem.Location.Y + 1); break; case Keys.A: case Keys.NumPad4: ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(PictureBoxItem.Location.X - 1, PictureBoxItem.Location.Y); break; case Keys.D: case Keys.NumPad6: ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(PictureBoxItem.Location.X + 1, PictureBoxItem.Location.Y); break; } } } // 단순히 1개만 선택했을 경우에만 바로 상태바에 표시된다 if (Selected_Icon_Count == 1) { // 좌표만 갱신한다 switch (KeyCode) { case Keys.W: case Keys.NumPad8: UI_Status_Write(PictureBoxItem.Location.X, PictureBoxItem.Location.Y - 1); break; case Keys.S: case Keys.NumPad2: UI_Status_Write(PictureBoxItem.Location.X, PictureBoxItem.Location.Y + 1); break; case Keys.A: case Keys.NumPad4: UI_Status_Write(PictureBoxItem.Location.X - 1, PictureBoxItem.Location.Y); break; case Keys.D: case Keys.NumPad6: UI_Status_Write(PictureBoxItem.Location.X + 1, PictureBoxItem.Location.Y); break; } } this.pictureBox_Background.ResumeLayout(); } /// /// 정렬 /// // 왼쪽 정렬 private void PictureBoxItem_LeftSort() { // 아이콘 잠금 기능 활성화 체크 if (this.uiCheckBox_IconLock.Checked == true) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0); return; } // 1. 제일 왼쪽에 있는 아이콘이 기준 // 2. 나머지 아이콘은 X 좌표만 정렬 , Y 좌표 고정됨 // 기준 X 좌표 int Criteria_X = this.pictureBox_Background.Width; // 제일 왼쪽에 있는 아이콘 foreach (string ICON_ID in TEMP_LIST_ICON_ID) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X <= Criteria_X) Criteria_X = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X; // 선택된 아이콘 위치 변경 foreach (string ICON_ID in TEMP_LIST_ICON_ID) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(Criteria_X, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y); } // 오른쪽 정렬 private void PictureBoxItem_RightSort() { // 아이콘 잠금 기능 활성화 체크 if (this.uiCheckBox_IconLock.Checked == true) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0); return; } // 1. 제일 오른쪽에 있는 아이콘이 기준 // 2. 나머지 아이콘은 X 좌표만 정렬 , Y 좌표 고정됨 // 기준 X 좌표 int Criteria_X = 0; // 제일 오른쪽에 있는 아이콘 foreach (string ICON_ID in TEMP_LIST_ICON_ID) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= Criteria_X) Criteria_X = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X; // 선택된 아이콘 위치 변경 foreach (string ICON_ID in TEMP_LIST_ICON_ID) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(Criteria_X, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y); } // 위 정렬 private void PictureBoxItem_TopSort() { // 아이콘 잠금 기능 활성화 체크 if (this.uiCheckBox_IconLock.Checked == true) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0); return; } // 1. 제일 위쪽에 있는 아이콘이 기준 // 2. 나머지 아이콘은 Y 좌표만 정렬 , X 좌표 고정됨 // 기준 Y 좌표 int Criteria_Y = this.pictureBox_Background.Height; // 제일 위쪽에 있는 아이콘 foreach (string ICON_ID in TEMP_LIST_ICON_ID) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y <= Criteria_Y) Criteria_Y = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y; // 선택된 아이콘 위치 변경 foreach (string ICON_ID in TEMP_LIST_ICON_ID) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X, Criteria_Y); } // 아래 정렬 private void PictureBoxItem_BottomSort() { // 아이콘 잠금 기능 활성화 체크 if (this.uiCheckBox_IconLock.Checked == true) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0); return; } // 1. 제일 아래쪽에 있는 아이콘이 기준 // 2. 나머지 아이콘은 Y 좌표만 정렬 , X 좌표 고정됨 // 기준 Y 좌표 int Criteria_Y = 0; // 제일 위쪽에 있는 아이콘 foreach (string ICON_ID in TEMP_LIST_ICON_ID) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= Criteria_Y) Criteria_Y = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y; // 선택된 아이콘 위치 변경 foreach (string ICON_ID in TEMP_LIST_ICON_ID) if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X, Criteria_Y); } //private void PictureBoxItem_HorizontalSort() //{ // /// // /// 왼쪽 정렬 // /// 1. 제일 왼쪽에 있는 아이콘이 기준 // /// 2. 나머지 아이콘은 X 좌표만 정렬 , Y 좌표 고정됨 // /// // // 최소값 // int Min_Value = 0; // // 최대값 // int Max_Value = 0; // // 간격 // int Margin = 0; // // 기준 Y 좌표 // int Criteria_Y = 0; // // 선택된 아이콘 리스트 // ArrayList Order = new ArrayList(); // // 선택된 아이콘이 1개 이상인 경우에 적용됨 // if (TEMP_LIST_ICON_ID.Count > 1) // { // // 제일 오른쪽에 있는 아이콘 // foreach (string ICON_ID in TEMP_LIST_ICON_ID) // { // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) // { // // 최대값 구하기 // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= Max_Value) // { // Max_Value = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X; // } // // 선택 되어있는 리스트 // Order.Add(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X); // } // } // // 아이콘 위치에 의해 정렬 (오름차순) // Order.Sort(); // // 최소값을 최대값으로 치환 // Min_Value = Max_Value; // // 제일 왼쪽에 있는 아이콘 // foreach (string ICON_ID in TEMP_LIST_ICON_ID) // { // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) // { // // 최소값 구하기 // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X <= Min_Value) // { // // X 기준 좌표 // Min_Value = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X; // // Y 기준 좌표 // Criteria_Y = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y; // } // } // } // // 제일 왼쪽에 있는 아이콘을 기준으로 정렬하되 아래와 같이 간격을 지정한다 // // 간격 = (최대값 - 최소값 사이즈) / (총개수 - 1) // Margin = (Max_Value - Min_Value) / (TEMP_LIST_ICON_ID.Count-1); // // 단, 디바이스 아이콘의 사이즈는 초과하도록 한다 (마진값이 1이상 나지 않다면 의미가 없다) // if (Margin < 24) Margin = 25; // // 오름차순으로 정렬된 리스트를 기준으로 차례대로 간격을 계산해서 정렬한다 // for (int j = 0; j 1) // { // // 제일 위쪽에 있는 아이콘 // foreach (string ICON_ID in TEMP_LIST_ICON_ID) // { // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) // { // // 최대값 구하기 // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= Max_Value) // { // Max_Value = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y; // } // // 선택 되어있는 리스트 // Order.Add(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y); // } // } // // 아이콘 위치에 의해 정렬 (오름차순) // Order.Sort(); // // 최소값을 최대값으로 치환 // Min_Value = Max_Value; // // 제일 아래쪽에 있는 아이콘 // foreach (string ICON_ID in TEMP_LIST_ICON_ID) // { // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) // { // // 최소값 구하기 // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y <= Min_Value) // { // // Y 기준 좌표 // Min_Value = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y; // // X 기준 좌표 // Criteria_X = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X; // } // } // } // // 제일 왼쪽에 있는 아이콘을 기준으로 정렬하되 아래와 같이 간격을 지정한다 // // 간격 = (최대값 - 최소값 사이즈) / (총개수 - 1) // Margin = (Max_Value - Min_Value) / (TEMP_LIST_ICON_ID.Count - 1); // // 단, 디바이스 아이콘의 사이즈는 초과하도록 한다 (마진값이 1이상 나지 않다면 의미가 없다) // if (Margin < 24) Margin = 25; // // 오름차순으로 정렬된 리스트를 기준으로 차례대로 간격을 계산해서 정렬한다 // for (int j = 0; j < Order.Count; j++) // { // foreach (string ICON_ID in TEMP_LIST_ICON_ID) // { // // Order 의 Y 값과 일치하는 것만 찾아서 // if (Int32.Parse(Order[j].ToString()) == ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y) // { // // X 좌표 : 기준점(최소값) + 마진 // // Y 좌표 : 기준점(최소값) // ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(Criteria_X, Min_Value + (j * Margin)); // break; // } // } // } // } //} /// /// 마우스 범위 벗어남 /// private void Check_Icon_Location(_PictureBoxItem PictureBoxItem) { if (PictureBoxItem.Location.X < 0) PictureBoxItem.Location = new Point(0, PictureBoxItem.Location.Y); if (PictureBoxItem.Location.Y < 0) PictureBoxItem.Location = new Point(PictureBoxItem.Location.X, 0); if (PictureBoxItem.Location.X + PictureBoxItem.Size.Width > this.pictureBox_Background.Width) PictureBoxItem.Location = new Point(this.pictureBox_Background.Width - PictureBoxItem.Size.Width, PictureBoxItem.Location.Y); if (PictureBoxItem.Location.Y + PictureBoxItem.Size.Height > this.pictureBox_Background.Height) PictureBoxItem.Location = new Point(PictureBoxItem.Location.X, this.pictureBox_Background.Height - PictureBoxItem.Size.Height); } // // 디바이스 // // 조회버튼 private void uiButton_Device_Inq_Click(object sender, EventArgs e) { //** 디바이스가 IN인지 OUT인지 설정 string Device_InOut = null; if (UiComboBox_Device_InOut.Text == "IN") Device_InOut = "I"; else if (UiComboBox_Device_InOut.Text == "OUT") Device_InOut = "O"; else Device_InOut = ""; // 그리드이엑스 클리어 시키고 다시 조회 GridEX_Device.ClearItems(); // No.를 출력하기 위해서 int i = 1; // CheckedComboBox_DeviceType콤보박스에서 선택한 항목들은 OR조건으로 검색, 나머지는 AND조건 검색 int number = DeviceType.Count; // CheckedComboBox_DeviceType콤보박스에서 선택한 항목이 없을 경우 if (number == 0) { // 아래와 같이 하는 이유는 통신보드를 1~14까지만 조회하기 위해서다 // 조회하려는 통신보드에 값이 없으면 if문을 타고 값이 있으면 else 문을 탄다. SQL문이 달라지는 것이다 DataRowCollection DB_TABLE_TB_DEVICE = null; if (UiComboBox_Board.Text.Length == 0) { // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경 if (((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).MODEL == "IFC3300") { DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable_NoneBoardID_BigReceiver("1", Device_InOut, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, "", EditBox_DeviceName.Text, Seleted_RECEIVER_ID)); } else { DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable("1", Device_InOut, "15", _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, "", EditBox_DeviceName.Text, Seleted_RECEIVER_ID)); } } else { DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DeviceTable("1", Device_InOut, UiComboBox_Board.Text, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, "", EditBox_DeviceName.Text, Seleted_RECEIVER_ID)); } if (DB_TABLE_TB_DEVICE != null) { foreach (DataRow dr in DB_TABLE_TB_DEVICE) { if (_Convert.Exception_Into_object(dr[3], dr[4], dr[5], dr[6], dr[7]) == true) { // 매개변수 순서 => COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE MskDeviceIDString dev_s = new MskDeviceIDString( _Convert.Null_to_IntZero(dr[3].ToString()), _Convert.Null_to_IntZero(dr[4].ToString()), _Convert.Null_to_IntZero(dr[5].ToString()), _Convert.Null_to_IntZero(dr[6].ToString()), _Convert.Null_to_IntZero(dr[7].ToString()), dr[8].ToString(), Seleted_RECEIVER_ID); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경 GridEXRow row; row = GridEX_Device.AddItem(); row.BeginEdit(); row.Cells["Number"].Value = i++; row.Cells["ID"].Value = dev_s.MskId; row.Cells["DeviceType"].Value = dr[0].ToString(); row.Cells["Position"].Value = dr[1].ToString(); row.Cells["DeviceName"].Value = dr[2].ToString(); row.EndEdit(); } } } } // CheckedComboBox_DeviceType콤보박스에서 선택한 항목이 있을 경우 선택한 항목만큼 For문을 돌려 검색해서 출력 else { for (int search = 0; search < number; search++) { // 아래와 같이 하는 이유는 통신보드를 1~14까지만 조회하기 위해서다 // 조회하려는 통신보드에 값이 없으면 if문을 타고 값이 있으면 else 문을 탄다. SQL문이 달라지는 것이다 DataRowCollection DB_TABLE_TB_DEVICE = null; if (UiComboBox_Board.Text.Length == 0) { // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경 if (((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).MODEL == "IFC3300") { DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable_NoneBoardID_BigReceiver("1", Device_InOut, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, DeviceType[search].ToString(), EditBox_DeviceName.Text, Seleted_RECEIVER_ID)); } else { DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable("1", Device_InOut, "15", _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, DeviceType[search].ToString(), EditBox_DeviceName.Text, Seleted_RECEIVER_ID)); } } else { DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DeviceTable("1", Device_InOut, UiComboBox_Board.Text, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, DeviceType[search].ToString(), EditBox_DeviceName.Text, Seleted_RECEIVER_ID)); } if (DB_TABLE_TB_DEVICE != null) { foreach (DataRow dr in DB_TABLE_TB_DEVICE) { if (_Convert.Exception_Into_object(dr[3], dr[4], dr[5], dr[6], dr[7]) == true) { // 매개변수 순서 => COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE MskDeviceIDString dev_s = new MskDeviceIDString( _Convert.Null_to_IntZero(dr[3].ToString()), _Convert.Null_to_IntZero(dr[4].ToString()), _Convert.Null_to_IntZero(dr[5].ToString()), _Convert.Null_to_IntZero(dr[6].ToString()), _Convert.Null_to_IntZero(dr[7].ToString()), dr[8].ToString(), Seleted_RECEIVER_ID); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경 GridEXRow row; row = GridEX_Device.AddItem(); row.BeginEdit(); row.Cells["Number"].Value = i++; row.Cells["ID"].Value = dev_s.MskId; row.Cells["DeviceType"].Value = dr[0].ToString(); row.Cells["Position"].Value = dr[1].ToString(); row.Cells["DeviceName"].Value = dr[2].ToString(); row.EndEdit(); } } } } } // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오) GridexDevice_ChangeColor_By_TEMP(); GridexDevice_ChangeColor_By_HASH(); } // 디바이스창에서 회로번호를 토대로 색상 반영 // 단, 이렇게 사용하면 느려질수 있다. 하지만 현재 색상을 적용하려면 이 방법외에 데이타베이스에 직접 필드를 추가하여 현재 적용된것인지 아닌지를 판단해야하는데 // 현재 데이타베이스를 직접 수정하는 것은 지양하므로 퍼포먼스에 영향이 있을지 모르나 일단 이렇게 구현한다 // 향후 이 루틴에서 속도가 현저하게 떨어지는 상황이 발생한다면 데이타베이스에서 처리하도록 해야한다 // 디바이스 조회창 색상 반영 (임시 저장소 정보를 토대로 보여준다) public void GridexDevice_ChangeColor_By_TEMP() { // // 부하가 걸린다..구조상 어쩔수없다.. 삭제하려면 Device_Oper_ID 가 널인 조건인데 이미 돌리고 있는 디바이스 아이콘 리스트에는 그 정보가 없다. (상위 설명과 동일함) // GridEXRow[] GridEx_Rows = this.GridEX_Device.GetRows(); foreach (GridEXRow row in GridEx_Rows) { row.BeginEdit(); row.Cells["Apply"].Value = "NOT"; row.EndEdit(); } // // 현재 임시 리스트를 모두 뒤져보자 // foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID != null) _Gridex.Column_Data_Edit(this.GridEX_Device, "ID=" + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID, "Apply=" + "TEMP"); } } this.GridEX_Device.ResumeLayout(); } // 디바이스 조회창 색상 반영 (임시 저장소가 아닌 진짜 해쉬테이블 정보를 토대로 보여준다) public void GridexDevice_ChangeColor_By_HASH() { // // 전 페이지를 모두 뒤져보자. // foreach (string PAGE_ID in ((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).LIST_PAGE_ID) { ArrayList temp_list_icon_id = ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[PAGE_ID]).LIST_ICON_ID; Hashtable temp_hash_icon = ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[PAGE_ID]).HASH_ICON; foreach (string ICON_ID in temp_list_icon_id) { if (((_PictureBoxItem)temp_hash_icon[ICON_ID]).ItemType == Item_Type.Device) { if (((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_Oper_ID != null) _Gridex.Column_Data_Edit(this.GridEX_Device, "ID=" + ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_Oper_ID, "Apply=" + "HASH"); } } } this.GridEX_Device.ResumeLayout(); } //** 디바이스 클리어버튼 private void uiButton_Device_Clear_Click(object sender, EventArgs e) { UiComboBox_Device_InOut.Text = null; UiComboBox_Board.Text = null; UiComboBox_Channel.Text = null; UiComboBox_Repeater.Text = null; EditBox_Position.Text = null; CheckedComboBox_DeviceType.Text = null; EditBox_DeviceName.Text = null; GridEX_Device.ClearItems(); } //** 통신보드 콤보박스 Changing private void UiComboBox_Board_SelectedValueChanged(object sender, EventArgs e) { // 먼저 UiComboBox_Channel 콤보박스를 클리어시킴 UiComboBox_Channel.Items.Clear(); UiComboBox_Channel.Text = null; // UiComboBox_Board.Text가 공백이면 리턴 if (UiComboBox_Board.Text.Length == 0) return; DataRowCollection DB_TABLE_TB_BOARD = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_BoardTable("1", UiComboBox_Board.Text, "Y", Seleted_RECEIVER_ID)); if (DB_TABLE_TB_BOARD != null) { // 공백도 하나 넣어둠 if (UiComboBox_Channel.Items.Contains("") == false) UiComboBox_Channel.Items.Add(""); foreach (DataRow dr in DB_TABLE_TB_BOARD) { if (dr[4].ToString() == "Y") { if (UiComboBox_Channel.Items.Contains("0") == false) UiComboBox_Channel.Items.Add("CH1"); } if (dr[5].ToString() == "Y") { if (UiComboBox_Channel.Items.Contains("1") == false) UiComboBox_Channel.Items.Add("CH2"); } if (dr[16].ToString() == "Y") { if (UiComboBox_Channel.Items.Contains("1") == false) UiComboBox_Channel.Items.Add("CH3"); } if (dr[17].ToString() == "Y") { if (UiComboBox_Channel.Items.Contains("1") == false) UiComboBox_Channel.Items.Add("CH4"); } } // 정렬 UiComboBox_Channel.Items.Sort(); } } //** 채널 콤보박스 Changing private void UiComboBox_Channel_SelectedValueChanged(object sender, EventArgs e) { // 먼저 UiComboBox_Repeater 콤보박스를 클리어시킴 UiComboBox_Repeater.Items.Clear(); UiComboBox_Repeater.Text = null; // UiComboBox_Board.Text 및 UiComboBox_Channel.Text가 공백이면 리턴 if (UiComboBox_Board.Text.Length == 0) return; if (UiComboBox_Channel.Text.Length == 0) return; DataRowCollection DB_TABLE_TB_REPEATER = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_RepeaterTable("1", UiComboBox_Board.Text, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), Seleted_RECEIVER_ID)); if (DB_TABLE_TB_REPEATER != null) { // 공백도 하나 넣어둠 if (UiComboBox_Repeater.Items.Contains("") == false) UiComboBox_Repeater.Items.Add(""); foreach (DataRow dr in DB_TABLE_TB_REPEATER) { if (UiComboBox_Repeater.Items.Contains(dr[4].ToString()) == false) UiComboBox_Repeater.Items.Add(dr[4].ToString()); } // 정렬 UiComboBox_Repeater.Items.Sort(); } } //** CheckedComboBox_DeviceType콤보박스에 체크가 변경될때마다 발생하는 이벤트 private void CheckedComboBox_DeviceType_CheckedValuesChanged(object sender, EventArgs e) { //** DeviceType을 ArrayList에 저장하기 위해서 DeviceType.Clear(); //** sender을 이용하는 이유는 clear를 했을때를 알기 위해서 CheckedComboBox checkedcombobox = (CheckedComboBox)sender; //** 이렇게 하는 이유는 clear버튼을 사용해 텍스트를 클리어 했을 때에, 콤보박스는 이전에 선택했을 값을 가지고 있다고 여김 // 그래서 아래의 속성으로 clear버튼을 클릭했을 때에는 해당 루틴을 타지 못하게 함 if (checkedcombobox.Text.Length != 0) { // 아래와 같이 포커스를 주는 이유는 야누스 콤포넌트의 에러 때문이다 uiButton_Device_Inq.Focus(); // 콤보박스에 체크되어 있는 것만 알기 위해서 GridEXRow[] GridEx_Rows = this.CheckedComboBox_DeviceType.DropDownList.GetRows(); foreach (GridEXRow row in GridEx_Rows) { if (row.Cells["Check"].Value.ToString() == "True") DeviceType.Add(row.Cells["Device_Type"].Value.ToString()); } } } // 연동버튼 클릭 전에 사전 검사 (정상인 경우에만 디바이스명이 리턴됨, 아니라면 null) private string uiButton_Device_Apply_Verify() { // 디바이스 연동알림 팝업창이 켜져있는 경우에는 실행 못함 if (Popup_DeviceOper == null || Popup_DeviceOper.Visible == true) return null; // 리스트에 포커스는 반드시 1개 if (GridEX_Device.SelectedItems.Count != 1) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.OnlyOneSelectedGridEx, 0); return null; } // 워크뷰에서 선택한 아이템이 없다면 클릭해도 소용없다, 단 1개만 선택되어야 한다 또한 반드시 디바이스 아이콘이어야 한다 int Selected_ICON_Count = 0; string Selected_ICON_Name = null; foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device) { Selected_ICON_Count++; Selected_ICON_Name = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Icon_NAME; } } // 반드시 아이콘은 1개만 사용, 또한 선택 if (Selected_ICON_Count != 1 || Selected_ICON_Name == null) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.OnlyOneSelectedICON, 0); return null; } return Selected_ICON_Name; } // 연동버튼 클릭 private void uiButton_Device_Apply_Click(object sender, EventArgs e) { string result = uiButton_Device_Apply_Verify(); if (result != null) { // 회로번호 string Temp_Selected_DeviceInfo = this.GridEX_Device.CurrentRow.Cells["ID"].Value.ToString(); // 아이템명 string Temp_Selected_PictureBoxItem = result; // 팝업창 준비 if (Popup_DeviceOper != null) Popup_DeviceOper.Close(); Popup_DeviceOper = new Form(); // 선택한 아이템과 디바이스를 연동하시겠습니까 Popup_DeviceOper = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 600, 150, _Text.DeviceOperSave + " [" + _Text.DeviceOperSave_OperID + Temp_Selected_DeviceInfo + "] = [" + _Text.DeviceOperSave_Item + Temp_Selected_PictureBoxItem + " ]", 0); // 대화 팝업은 특별처리 _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_DeviceOperSave_PopupClose_SendMessage_Event); } } // 디바이스 연동 적용 이벤트 public void _Event_DeviceOperSave_PopupClose_SendMessage_Event(object sender, object etc) { // 대화 팝업 주체 Form popup = (Form)sender; if (Popup_DeviceOper.Name == popup.Name && etc.ToString() == _Text.OK) { foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true) { // 상태창 반영 UI_Status_Write(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID])); // 트리에 반영 if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.OnlyButtonSelectedICON, 0); return; } else { // 디바이스 아이디가 회로번호이므로 반영 // 트리 검색 TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name); /// /// 동적 할당 변수 처리 /// // 디바이스 연동 회로 아이디 ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID = this.GridEX_Device.CurrentRow.Cells["ID"].Value.ToString(); // 디바이스 연동 명칭 ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_DB_Name = this.GridEX_Device.CurrentRow.Cells["DeviceName"].Value.ToString(); // 트리에 반영 EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText(); // 오브젝트 트리 색상 반영 (디바이스) _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID); // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 ObjectTree_RootNodeUpdate(); // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오) GridexDevice_ChangeColor_By_TEMP(); GridexDevice_ChangeColor_By_HASH(); } break; } } } // 대화 팝업은 특별처리 _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_DeviceOperSave_PopupClose_SendMessage_Event); } /// /// 오브젝트 트리 노드 /// // 노드를 선택하면 해당 아이콘이 점멸된다 private void treeView_ObjetTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { // 선택한 노드 정보와 일치하는 픽쳐박스 _PictureBoxItem PictureBoxItem = null; // 오른쪽마우스를 누르면 왼쪽마우스 버튼을 누른것처럼 포커스를 이동한다 treeView_ObjectTree.SelectedNode = treeView_ObjectTree.GetNodeAt(e.X, e.Y); // 아이템 (디바이스 아이콘 혹은 버튼 아이콘 선택 초기화) pictureBox_SeletedStatusInitialize(); // 선택한 노드의 아이디를 토대로 아이템을 찾는다 foreach (string ICON_ID in TEMP_LIST_ICON_ID) { if (e.Node.Name == ICON_ID) { PictureBoxItem = (_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]; break; } } // 노드를 찾지 못하면 실행 안함 if (PictureBoxItem != null) { // 선택 Selected_PictureBoxItem = null; // 상태갱신 UI_Status_Write(PictureBoxItem); // 선택 Selected_PictureBoxItem = PictureBoxItem; // 선택시 스타일 변경 (주변에 네모박스 보이도록 출력) Selected_PictureBoxItem.Selected = true; Selected_PictureBoxItem.ShapeContainer_Seleted.Visible = true; } // 오른쪽 마우스 버튼 if (e.Button == System.Windows.Forms.MouseButtons.Right) { // 페이지 노드 if (e.Node.Level == 0) { // 아이콘 전체삭제 _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location, _Text.IconAllDel, treeView_ObjectTree_Menustrip_ItemClicked); } else if (e.Node.Level == 1) { if (e.Node.Name == "DEVICE") { // 디바이스 전체삭제 // 디바이스연동 전체초기화 _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location, _Text.DeviceLinkAllClear + ";" + _Text.ContextStripSeparator + ";" + _Text.DeviceAllDel, treeView_ObjectTree_Menustrip_ItemClicked); } else if (e.Node.Name == "BUTTON") { // 버튼 전체삭제 // 점프페이지 전체초기화 _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location, _Text.ButtonJumpAllClear + ";" + _Text.ContextStripSeparator + ";" + _Text.ButtonAllDel, treeView_ObjectTree_Menustrip_ItemClicked); } } else if (e.Node.Level == 2) { if (e.Node.ImageIndex == (int)Object_Type.DEVICE_DETAIL) { // 디바이스 삭제 // 디바이스연동 초기화 _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location, _Text.DeviceLinkClear + ";" + _Text.ContextStripSeparator + ";" + _Text.DeviceDel, treeView_ObjectTree_Menustrip_ItemClicked); } else if (e.Node.ImageIndex == (int)Object_Type.BUTTON_DETAIL) { // 버튼 삭제 // 점프페이지 초기화 _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location, _Text.ButtonJumpClear + ";" + _Text.ContextStripSeparator + ";" + _Text.ButtonDel, treeView_ObjectTree_Menustrip_ItemClicked); } } } // 왼쪽 마우스 버튼 else { if (Selected_PictureBoxItem != null) { // 버튼 아이콘이라면 상태바에서 점프페이지 선택가능함 if (Selected_PictureBoxItem.ItemType == Item_Type.Button) { this.uiComboBox_Status_Jump.ReadOnly = false; this.uiComboBox_Status_Jump.BackColor = System.Drawing.Color.White; if (Selected_PictureBoxItem.Button_JumpPageName != null && Selected_PictureBoxItem.Button_JumpPageName.Length != 0 && Selected_PictureBoxItem.Button_JumpPageName != _Text.None) this.uiComboBox_Status_Jump.Text = Selected_PictureBoxItem.Button_JumpPageName; else this.uiComboBox_Status_Jump.Text = _Text.None; } // 디바이스 아이콘이라면 상태바에서 점프페이지 선택불가 else { this.uiComboBox_Status_Jump.ReadOnly = true; this.uiComboBox_Status_Jump.BackColor = System.Drawing.SystemColors.MenuBar; this.uiComboBox_Status_Jump.Text = _Text.None; } } } } public void treeView_ObjectTree_Menustrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { // 호출한 것은 감추기 ContextMenuStrip menustrip = (ContextMenuStrip)sender; // 잔상 삭제 menustrip.Hide(); // 아이콘 전체삭제 if (e.ClickedItem.Text == _Text.IconAllDel) { Common_IconAllDel(); } // 디바이스 전체삭제 else if (e.ClickedItem.Text == _Text.DeviceAllDel) { Common_DeviceAllDel(); } // 디바이스연동 전체초기화 else if (e.ClickedItem.Text == _Text.DeviceLinkAllClear) { Common_DeviceLinkAllClear(); } // 버튼 전체삭제 else if (e.ClickedItem.Text == _Text.ButtonAllDel) { Common_ButtonAllDel(); } // 점프페이지 전체초기화 else if (e.ClickedItem.Text == _Text.ButtonJumpAllClear) { Common_ButtonJumpAllClear(); } // 디바이스 삭제 else if (e.ClickedItem.Text == _Text.DeviceDel) { Common_IconSelDel(); } // 디바이스연동 초기화 else if (e.ClickedItem.Text == _Text.DeviceLinkClear) { Common_DeviceLinkClear(); } // 버튼 삭제 else if (e.ClickedItem.Text == _Text.ButtonDel) { Common_IconSelDel(); } // 점프페이지 초기화 else if (e.ClickedItem.Text == _Text.ButtonJumpClear) { Common_ButtonJumpClear(); } } // // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다 // public void ObjectTree_RootNodeUpdate() { // 아이콘의 총 개수 및 적용 개수를 파악하기 위한 변수 int ButtonIcon_AllCnt = 0; int ButtonIcon_ApplyCnt = 0; int DeviceIcon_AllCnt = 0; int DeviceIcon_ApplyCnt = 0; foreach (string ICON_ID in TEMP_LIST_ICON_ID) { // 버튼 아이콘의 경우 처리 if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button) { // 개수 파악 ButtonIcon_AllCnt++; if (_Data.Get_Verify_ID(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName) != "0") ButtonIcon_ApplyCnt++; } // 디바이스 아이콘의 경우 처리 else if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device) { // 개수 파악 DeviceIcon_AllCnt++; if (_Data.Get_Verify_ID(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID) != "0") DeviceIcon_ApplyCnt++; } } // 트리에 표시 _Tree.SetNodeText_By_Name(this.treeView_ObjectTree, _Text.UI_TREE_BUTTON_ICON, string.Format("{0} [총합:{1} 적용:{2}]", _Text.UI_TREE_BUTTON_ICON, ButtonIcon_AllCnt, ButtonIcon_ApplyCnt)); _Tree.SetNodeText_By_Name(this.treeView_ObjectTree, _Text.UI_TREE_DEVICE_ICON, string.Format("{0} [총합:{1} 적용:{2}]", _Text.UI_TREE_DEVICE_ICON, DeviceIcon_AllCnt, DeviceIcon_ApplyCnt)); } // 아이콘 잠금 기능 private void UI_Base_IconLock(bool Enable) { if (Enable == true) { this.uiCheckBox_IconLock.Checked = true; this.uiCheckBox_IconLock.Text = "LOCK"; this.uiCheckBox_IconLock.BackColor = Color.Red; } else { this.uiCheckBox_IconLock.Checked = false; this.uiCheckBox_IconLock.Text = "UNLOCK"; this.uiCheckBox_IconLock.BackColor = Color.Transparent; } } // 아이콘 잠금 private void uiCheckBox_IconLock_CheckedChanged(object sender, EventArgs e) { UI_Base_IconLock(this.uiCheckBox_IconLock.Checked); } // 디바이스 조회창에서 카운트 결과 표시 private void uiButton_Device_Result_Click(object sender, EventArgs e) { // 현재 조회창 GridEXRow[] GridEx_Rows = this.GridEX_Device.GetRows(); // 조회창의 총개수 int Cnt_All = 0; // 조회창의 연동미적용수 int Cnt_OperNot = 0; // 조회창의 연동미적용 중의 마지막 순번 string Last_Number = null; foreach (GridEXRow row in GridEx_Rows) { Cnt_All++; if (row.Cells["Apply"].Value == null || row.Cells["Apply"].Value.ToString().Trim().Length == 0 || row.Cells["Apply"].Value.ToString() == "NOT" || row.Cells["Apply"].Value.ToString() == _Text.Blank) { Cnt_OperNot++; Last_Number = row.Cells["Number"].Value.ToString(); } } _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 500, 150, string.Format(_Text.DeviceOperResult, Cnt_All, Cnt_OperNot, Last_Number), 0); } } }