Example #1
0
        /// <summary>
        /// 파일열기
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            outOfFormUserAnalysis_Click(sender, e);
            if (this.panel1.Controls.Count > 0)
            {
                if (this.panel1.Controls[0] is Form)
                {
                    if ((this.panel1.Controls[0] as Form).Name == "FormAdmin")
                    {
                        (this.panel1.Controls[0] as FormAdmin).openFileDialog(sender, e);
                        return;
                    }
                }
            }
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "LGE File|*.lge|Excel File|*.xlsx|All File|*.*";
            openFileDialog1.Title = "Select a File";
            openFileDialog1.InitialDirectory = CommonUtil.dataDirectory;
            openFileDialog1.DefaultExt = "lge";
            openFileDialog1.AutoUpgradeEnabled = true;
            openFileDialog1.AddExtension = true;
            openFileDialog1.RestoreDirectory = true;

            // If the directory doesn't exist, create it.
            if (!Directory.Exists(openFileDialog1.InitialDirectory))
            {
                Directory.CreateDirectory(openFileDialog1.InitialDirectory);
            }

            // Show the Dialog.
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Read the files
                foreach (String file in openFileDialog1.FileNames)
                {
                    // Create a PictureBox.
                    try
                    {
                        if (file.EndsWith("lge"))
                        {
                            CommonUtil.readLGEFile(file, "|");
                        }
                        else if (file.EndsWith("xlsx"))
                        {
                            CommonUtil.ReadExcelFileToData(file);
                        }
                        else
                        {
                            throw new Exception("지원하지 않는 확장자");
                        }

                        // CDataControl의 파일정보변수(g_File*)에 담겨있는 데이터를 일반정보변수에 딥카피
                        // 엑셀내용중 시트 1의 내용만 옮겨짐
                        CommonUtil.deepCopyBasicInput(CDataControl.g_FileBasicInput, CDataControl.g_BasicInput);
                        CommonUtil.deepCopyBusinessData(CDataControl.g_FileDetailInput, CDataControl.g_DetailInput);

                        // 파일에서 읽음 체크
                        CommonUtil.isLoadedDataFromFile = true;
                        CommonUtil.isSelectExistData = true;
                        CommonUtil.isSimulatedOnce = false;

                        // 불러온 이름 등록
                        CommonUtil.saveAsName = file;

                        // 시뮬레이션 데이터 초기화
                        CDataControl.clearSimulData();
                    }
                    catch (Exception ex)
                    {
                        // Could not load the image - probably related to Windows file system permissions.
                        MessageBox.Show("파일을 열 수 없습니다.\n\nReported error: " + ex.Message);
                    }
                }
                FormUserInput frm = new FormUserInput();
                panelSet(frm);
            }
            setTitleBar();
        }
Example #2
0
 /// <summary>
 /// 입력
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripButton4_Click(object sender, EventArgs e)
 {
     outOfFormUserAnalysis_Click(sender, e);
     FormUserInput frm = new FormUserInput();
     panelSet(frm);
 }
Example #3
0
 public FormMaster()
 {
     InitializeComponent();
     FormUserInput frm = new FormUserInput();
     panelSet(frm);
 }