123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- 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 System.Threading;
- using System.Collections;
- namespace IControls_FireManager
- {
- public partial class Form_OperSetMapProcessFile : Form
- {
-
- Form DialogPopup = new Form();
-
- delegate void Cross_Thread();
-
- string Receiver_ID = null;
-
- DataRowCollection DB_TABLE_MAPPROCESS = null;
-
- public delegate void ProgressBarWorking_SendMessage_Handler();
- public event ProgressBarWorking_SendMessage_Handler ProgressBarWorking_SendMessage_Event;
-
- public Form_OperSetMapProcessFile(_RECEIVER RECEIVER)
- {
- InitializeComponent();
-
-
-
- this.StartPosition = FormStartPosition.Manual;
- this.Location = new System.Drawing.Point(MousePosition.X, MousePosition.Y);
-
-
-
-
- Receiver_ID = RECEIVER.ID;
-
- string ReiceiverFolderName = _Text.DEFAULT_FOLDER_RECEIVER_PREFIX + Receiver_ID;
-
-
-
-
- this.editBox_ProjectPath.Text = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName;
-
-
-
-
- this.FormClosing += new FormClosingEventHandler(CreateForm_FormClosing);
- ProgressBarWorking_SendMessage_Event += new ProgressBarWorking_SendMessage_Handler(Form_OperSetMapProcessFile_ProgressBarWorking_SendMessage_Event);
- }
-
- public void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
- {
-
- ProgressBarWorking_SendMessage_Event -= new ProgressBarWorking_SendMessage_Handler(Form_OperSetMapProcessFile_ProgressBarWorking_SendMessage_Event);
- }
- public void Form_OperSetMapProcessFile_ProgressBarWorking_SendMessage_Event()
- {
- if (UiProgressBar_MapProcess.Value <= UiProgressBar_MapProcess.Maximum)
- Delegate_UiProgressBar();
- }
-
- private void uiButton_ProjectPath_Click(object sender, EventArgs e)
- {
-
- FolderBrowserDialog pFolderBrowserDialog = new FolderBrowserDialog();
-
- string ReiceiverFolderName = _Text.DEFAULT_FOLDER_RECEIVER_PREFIX + Receiver_ID;
-
- pFolderBrowserDialog.SelectedPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName;
-
-
-
- if (pFolderBrowserDialog.ShowDialog() == DialogResult.OK)
- {
- this.editBox_ProjectPath.Text = pFolderBrowserDialog.SelectedPath;
- }
- }
-
- private void Delegate_UiProgressBar()
- {
- if (UiProgressBar_MapProcess.InvokeRequired)
- {
- Cross_Thread d = new Cross_Thread(Delegate_UiProgressBar);
- UiProgressBar_MapProcess.Invoke(d, new object[] { });
- }
- else
- {
- UiProgressBar_MapProcess.Value++;
- }
- }
-
- private void Delegate_UiButton()
- {
- if (this.InvokeRequired)
- {
- Cross_Thread d = new Cross_Thread(Delegate_UiButton);
- this.Invoke(d, new object[] { });
- }
- else
- {
- label1.Text = "※ 완료되었습니다.";
- UiButton_Apply.Enabled = true;
- UiButton_Close.Enabled = true;
- }
- }
-
- private void UiButton_Close_Click(object sender, EventArgs e)
- {
-
- this.Close();
- }
-
- private void UiButton_Apply_Click(object sender, EventArgs e)
- {
-
- if (editBox_ProjectPath.Text.Length == 0)
- {
-
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, _Text.NotFolderChoice, 0);
- return;
- }
-
-
-
- _Data.DataBaseFilePath_Set(null);
-
- DB_TABLE_MAPPROCESS = _Db.ExecuteRead_SqlDataAdapter(_Sql.MapProcessFile_Create(Receiver_ID));
- if (DB_TABLE_MAPPROCESS == null || DB_TABLE_MAPPROCESS.Count == 0)
- {
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, _Text.FailDataInform, 0);
- return;
- }
- else
- {
-
- DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 500, 150, _Text.MapProcessFileCreate_Continue, 0);
-
- _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event);
- }
- }
-
- public void MapProcess_DataCreate()
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- StringBuilder Contents = new StringBuilder();
-
- ProgressBarWorking_SendMessage_Event();
- foreach (DataRow dr in DB_TABLE_MAPPROCESS)
- {
- if (dr[0].ToString().Length != 0 && dr[1].ToString().Length != 0 && dr[2].ToString().Length != 0 && dr[3].ToString().Length != 0
- && dr[4].ToString().Length != 0 && dr[5].ToString().Length != 0 && dr[6].ToString().Length != 0 && dr[7].ToString().Length != 0
- && dr[8].ToString().Length != 0 && dr[9].ToString().Length != 0 && dr[10].ToString().Length != 0)
- {
-
- string RECEIVER_ID = Int32.Parse(dr["RECEIVER_ID"].ToString()).ToString("D3");
-
- string MAP_NO = "";
- if (_Data.Project_MapGroupIDTypeNumber == "6")
- MAP_NO = Int32.Parse(dr["MAP_NO"].ToString()).ToString("D7");
- else
- MAP_NO = Int32.Parse(dr["MAP_NO"].ToString()).ToString("D5");
- string MAP_TYPE = dr["MAP_TYPE"].ToString();
- string PROCESS_TYPE = dr["PROCESS_TYPE"].ToString();
- string COMM_ID = Int32.Parse(dr["COMM_ID"].ToString()).ToString("D3");
- string BOARD_ID = Int32.Parse(dr["BOARD_ID"].ToString()).ToString("D3");
- string LOOP_NO = Int32.Parse(dr["LOOP_NO"].ToString()).ToString("D3");
- string REPEATER_ID = Int32.Parse(dr["REPEATER_ID"].ToString()).ToString("D3");
- string DEVICE_ID = Int32.Parse(dr["DEVICE_ID"].ToString()).ToString("D3");
- string INOUT_TYPE = dr["INOUT_TYPE"].ToString();
- string USE_FLAG = dr["USE_FLAG"].ToString();
-
- Contents.Append(
- RECEIVER_ID + "|" +
- MAP_NO + "|" +
- MAP_TYPE + "|" +
- PROCESS_TYPE + "|" +
- COMM_ID + "|" +
- BOARD_ID + "|" +
- LOOP_NO + "|" +
- REPEATER_ID + "|" +
- DEVICE_ID + "|" +
- INOUT_TYPE + "|" +
- USE_FLAG + "|"
-
- );
- }
- }
-
- ProgressBarWorking_SendMessage_Event();
-
-
-
- _Cfg.Create_Cfg(Contents.ToString(), this.editBox_ProjectPath.Text + "\\" + _Text.DEFALUT_MAPPROCESS_FILENAME);
-
- ProgressBarWorking_SendMessage_Event();
-
- Delegate_UiButton();
- }
-
- public void _Event_PopupClose_SendMessage_Event(object sender, object etc)
- {
-
- Form popup = (Form)sender;
- if (DialogPopup.Name == popup.Name && etc.ToString() == _Text.OK)
- {
-
- UiButton_Apply.Enabled = false;
- UiButton_Close.Enabled = false;
-
- int ProgressBar_TotalCount = 3;
-
-
-
- UiProgressBar_MapProcess.Maximum = ProgressBar_TotalCount;
-
- UiProgressBar_MapProcess.Value = 0;
-
- Thread WorkingThread = new Thread(new ThreadStart(MapProcess_DataCreate));
-
- WorkingThread.Start();
- }
-
- _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event);
- }
- }
- }
|