private void UC_PlcDataState_Load(object sender, EventArgs e)
        {
            //다른 쓰레드에서 윈폼 컨트롤 사용가능 (비동기 작업에서 사용)
            //Control.CheckForIllegalCrossThreadCalls = false;

            if (!Directory.Exists(MyApp.RootRef))
            {
                Directory.CreateDirectory(MyApp.RootRef);
            }
            if (File.Exists(_PLCRefPath))
            {
                try
                {
                    int    iArrcnt = 0;
                    string Connstr = MyApp.RootMDB(_PLCRefPath);
                    using (OleDbConnection connDB = new OleDbConnection(Connstr))
                    {
                        connDB.Open();
                        foreach (string tbName in Share.GetMDBTable(connDB))
                        {
                            string sql = $"Select *from {tbName} " + "Order by PlcName ASC,BlockNum ASC,IndexNo ASC";

                            Array.Resize(ref tabPage, iArrcnt + 1);
                            Array.Resize(ref Uc_dgv, iArrcnt + 1);

                            tabPage[iArrcnt] = new TabPage();
                            AddTabpage(tbName, iArrcnt);

                            Uc_dgv[iArrcnt] = new UC_DGV();
                            AddDGV(iArrcnt);

                            using (DataSet dsData = new DataSet())
                            {
                                OleDbDataAdapter oledbAdapter = new OleDbDataAdapter(sql, connDB);
                                oledbAdapter.Fill(dsData);

                                //.DoubleBuffered(True)
                                Stopwatch Tchk = new Stopwatch();
                                Tchk.Start();

                                Uc_dgv[iArrcnt].DGVPlc.DataSource = dsData.Tables[0];
                                DataGridViewTextBoxColumn addrCol = new DataGridViewTextBoxColumn();

                                addrCol.Name       = "PLCVal";
                                addrCol.HeaderText = "PLCVal";

                                Uc_dgv[iArrcnt].DGVPlc.Columns.Add(addrCol);

                                Tchk.Stop();
                                Debug.Print(Tchk.Elapsed.ToString());

                                //DetailsView.Dispose();
                                oledbAdapter.Dispose();
                                oledbAdapter = null;

                                for (int i = 0; i < Uc_dgv[iArrcnt].DGVPlc.Columns.Count; i++)
                                {
                                    Uc_dgv[iArrcnt].DGVPlc.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
                                }
                            }
                            Uc_dgv[iArrcnt].DGVPlc.DoubleBuffered();
                            iArrcnt++;
                        }
                        connDB.Close();
                        connDB.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    StackTrace trace      = new StackTrace(ex, true);
                    StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1);
                    int        lineNumber = stackFrame.GetFileLineNumber();

                    I_Sub.ErrorLog(($"({lineNumber}) : {ex.ToString()}"));
                }
            }
        }
        private void InfoSetting()
        {
            try
            {
                string ID = DGVPart.SelectedRows[0].Cells[0].Value.ToString();
                using (GEN2_MEASUREDBEntities db = new GEN2_MEASUREDBEntities())
                {
                    TB_FrontSetting partcode = db.TB_FrontSetting.Find(ID);
                    if (partcode != null)
                    {
                        txtAlcCode.Text   = partcode.ALC_Code;
                        txtPartName.Text  = partcode.Part_Name;
                        numStandDis.Value = Convert.ToDecimal(partcode.StandardVal);

                        num_G4_Offset.Value = Convert.ToDecimal(partcode.Gain_G4);
                        num_G4_Min.Value    = Convert.ToDecimal(partcode.Shim_G4_Min);
                        num_G4_Max.Value    = Convert.ToDecimal(partcode.Shim_G4_Max);
                        num_G4_Range.Value  = Convert.ToDecimal(partcode.Shim_G4_Range);
                    }
                }
            }
            catch (Exception ex)
            {
                StackTrace trace      = new StackTrace(ex, true);
                StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1);
                int        lineNumber = stackFrame.GetFileLineNumber();

                I_Part.ErrorLog($"{Share.GetNow_ms()} ({lineNumber}) : {ex.ToString()}");
            }
        }
Exemplo n.º 3
0
        private void frmSetting_FormClosed(object sender, FormClosedEventArgs e)
        {
            try
            {
                int i = 0;
                dsData.AcceptChanges();
                foreach (OleDbDataAdapter item in oledbAdapter)
                {
                    item.Update(dsData.Tables[i]);
                    item.Dispose();
                    i++;
                }
                connDB.Close();

                frm.Exit_Main();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                StackTrace trace      = new StackTrace(ex, true);
                StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1);
                int        lineNumber = stackFrame.GetFileLineNumber();

                frm.ErrorLog(($"({lineNumber}) : {ex.ToString()}"));
            }
        }
Exemplo n.º 4
0
        private void btn_HeaderMuClick(object sender, EventArgs e)
        {
            Button sendbtn = sender as Button;

            lblHdName.Text = sendbtn.Tag.ToString();
            try
            {
                foreach (KeyValuePair <string, Button> item in btnMenus)
                {
                    if (sendbtn.Tag != item.Value.Tag)
                    {
                        item.Value.BackColor = Color.FromArgb(28, 28, 28);
                        item.Value.ForeColor = Color.WhiteSmoke;
                        item.Value.Image     = null;
                    }
                    else
                    {
                        item.Value.BackColor = Color.LightGoldenrodYellow;
                        item.Value.ForeColor = Color.Black;
                        item.Value.Image     = Properties.Resources.check;
                        //idx = Array.FindIndex(Uc_Subitem, item => (string)item.Tag == (string)btnMenus[i].Tag);
                    }
                }

                foreach (KeyValuePair <WorkStep, DataGridView> item in DGVMenus)
                {
                    if (sendbtn.Tag == item.Value.Tag)
                    {
                        //item.Visible = true;
                        item.Value.BringToFront();
                        if (item.Value.Rows.Count > 0)
                        {
                            item.Value.FirstDisplayedScrollingRowIndex = item.Value.RowCount - 1;
                            item.Value.Rows[0].Selected     = false;
                            item.Value.CurrentCell.Selected = false;
                        }
                    }
                    else
                    {
                        //item.Visible = false;
                        item.Value.SendToBack();
                    }
                }
            }
            catch (Exception ex)
            {
                StackTrace trace      = new StackTrace(ex, true);
                StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1);
                int        lineNumber = stackFrame.GetFileLineNumber();

                I_Home.ErrorLog(($"btn_HeaderMuClick_Err({lineNumber}) : {ex.ToString()}"));
            }
        }
Exemplo n.º 5
0
        protected override void OnPaint(PaintEventArgs e)
        {
            try
            {
                base.OnPaint(e);
            }
            catch (Exception ex)
            {
                StackTrace trace      = new StackTrace(ex, true);
                StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1);
                int        lineNumber = stackFrame.GetFileLineNumber();

                I_Home.ErrorLog(($" ({lineNumber})[OnPaint] : {ex.ToString()}"));
                this.Invalidate();
            }
        }
Exemplo n.º 6
0
        private void UC_DataView_Load(object sender, EventArgs e)
        {
            try
            {
                //다른 쓰레드에서 윈폼 컨트롤 사용가능 (비동기 작업에서 사용)
                Control.CheckForIllegalCrossThreadCalls = false;
                DGVGrd.DoubleBuffered(true);
                CB_TableName.Items.Clear();
                CB_TableName.Items.Add("-Measure-");
                CB_TableName.Items.Add("-MasterData-");
                CB_TableName.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                StackTrace trace      = new StackTrace(ex, true);
                StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1);
                int        lineNumber = stackFrame.GetFileLineNumber();

                I_Sub.ErrorLog(($"({lineNumber}) : {ex.ToString()}"));
            }
        }
Exemplo n.º 7
0
        private void UC_Home_Load(object sender, EventArgs e)
        {
            try
            {
                rcvProcess = lvNotice;

                rcvProcess.Columns.Add("NOTICE", "");
                rcvProcess.GridLines     = true;
                rcvProcess.FullRowSelect = true;
                rcvProcess.Columns["NOTICE"].TextAlign = HorizontalAlignment.Center;
                rcvProcess.Columns["NOTICE"].Width     = -2;
                rcvProcess.HeaderStyle = ColumnHeaderStyle.None;

                DGVFGear.DoubleBuffered();
                DGVFCase.DoubleBuffered();
                DGVShim_Fc.DoubleBuffered();

                DGVFGear.Font   = new Font("현대하모니 M", 17f, FontStyle.Regular, GraphicsUnit.Point, Convert.ToByte(129));
                DGVFCase.Font   = new Font("현대하모니 M", 17f, FontStyle.Regular, GraphicsUnit.Point, Convert.ToByte(129));
                DGVShim_Fc.Font = new Font("현대하모니 M", 17f, FontStyle.Regular, GraphicsUnit.Point, Convert.ToByte(129));

                DGVShim_Fc.RowCount           = 1;
                DGVShim_Fc["NumG4", 0].Value  = "0001";
                DGVShim_Fc["ShimG4", 0].Value = "122.123";

                HomeInitial(20191205);
            }
            catch (Exception ex)
            {
                StackTrace trace      = new StackTrace(ex, true);
                StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1);
                int        lineNumber = stackFrame.GetFileLineNumber();

                I_Home.ErrorLog(($" ({lineNumber}) : {ex.ToString()}"));
            }
        }