Пример #1
0
        /// <summary>
        /// 폼 생성자
        /// </summary>
        public Form_Main()
        {
            InitializeComponent();

            newBD = new Brick_data();

            base.SetStyle(ControlStyles.DoubleBuffer, true);
            base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            base.SetStyle(ControlStyles.ResizeRedraw, true);

            this.make_ImgList();

            //base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            //this.pn_Brick.BackColor = Color.Transparent;

            bt_tooltip = new ToolTip();

            _pro = new Process();
            _pro.StartInfo.FileName = "makeSBOL.exe";
            _pro.EnableRaisingEvents = true;
            _pro.Exited += new EventHandler(_pro_Exited);
            _pro.StartInfo.CreateNoWindow = true;
            _pro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        }
Пример #2
0
        public void data_load()
        {
            StringBuilder sbLoad = new StringBuilder();
            Stream sr_Stream;

            connector = new DBconnector();

            OpenFileDialog openFD = new OpenFileDialog();
            openFD.Filter = "project files (*brp)|*.brp";

            if (openFD.ShowDialog() == DialogResult.OK)
            {
                if ((sr_Stream = openFD.OpenFile()) != null)
                {
                    this.newBD = new Brick_data();

                    TextReader tr = new StreamReader(sr_Stream);
                    string _str;

                    int i = 0;
                    int j = 0;
                    while ((_str = tr.ReadLine()) != null)
                    {

                        if (_str.Length == 0)
                        {
                            continue;
                        }

                        if (i == 0)
                        {
                            this.newBD.str_brick_name = _str;
                        }
                        else if (i == 1)
                        {
                            this.newBD.str_brick_type = _str;
                        }
                        else if (i == 2)
                        {
                            this.newBD.str_brick_desc = _str;
                        }
                        else
                        {
                            // 여기서 브릭 네임으로 가져와서 정보를 서브 데이터로 저장해야함

                            Brick_sub_data bsd = new Brick_sub_data();
                            string[] split_str = _str.Split(' ');

                            if (split_str[0] == "Scar" || split_str[0] == "Spe1+Xba1")
                            {
                                // 여긴 스칼임
                                bsd.part_name = "Scar";
                                bsd.part_type = "Scar";
                                bsd.part_seq = "";

                                this.newBD.sl_subpart_list.Add(j, bsd);

                            }
                            else if (split_str[1] == "-1")
                            {
                                // 유저브릭임.
                                string str_q = "select * from userbricks where part_name = '" + split_str[0] + "'";

                                OleDbDataReader oddr = connector.select_Data(str_q);

                                while (oddr.Read())
                                {
                                    bsd.part_name = oddr.GetString(0);
                                    bsd.part_type = oddr.GetString(1);
                                    bsd.part_desc = oddr.GetString(2);
                                    bsd.part_seq = oddr.GetString(3);

                                    if (split_str.Count() > 2)
                                    {
                                        bsd.part_icon = int.Parse(split_str[2]);
                                    }
                                }

                                this.newBD.sl_subpart_list.Add(j, bsd);
                            }
                            else
                            {
                                string str_q = "select * from part where part_name = '" + split_str[0] + "'";

                                OleDbDataReader oddr = connector.select_Data(str_q);

                                while (oddr.Read())
                                {
                                    bsd.part_id = oddr.GetInt32(0);
                                    bsd.part_name = oddr.GetString(1);
                                    bsd.part_desc = oddr.GetString(3);
                                    bsd.part_type = oddr.GetString(4);
                                    bsd.part_status = oddr.GetString(5);
                                    bsd.part_result = oddr.GetString(6);
                                    bsd.part_entered = oddr.GetString(10);
                                    bsd.part_author = oddr.GetString(11);
                                    bsd.best_qulity = oddr.GetString(12);
                                }

                                str_q = "select sequences.seq_data from sequences, part where part.part_name = '" + split_str[0] + "' and part.part_id = sequences.part_id";

                                oddr = connector.select_Data(str_q);

                                while (oddr.Read())
                                {
                                    bsd.part_seq = oddr.GetString(0);
                                }

                                str_q = "select p.part_name from part as p, specified_subparts as sp where sp.part_id = " + bsd.part_id + " and sp.subpart_id = p.part_id";

                                oddr = connector.select_Data(str_q);

                                while (oddr.Read())
                                {
                                    bsd.subparts.Add(oddr.GetString(0));
                                }

                                if (split_str.Count() > 2)
                                {
                                    bsd.part_icon = int.Parse(split_str[2]);
                                }

                                this.newBD.sl_subpart_list.Add(j, bsd);
                            }

                            j++;
                        }
                        i++;
                    }

                }
            }

            connector = null;
            this.change_FromName();
        }
Пример #3
0
        /************************************************************************/
        /*                                                                      */
        /************************************************************************/
        /// <summary>
        /// New 버튼 눌렀을 경우
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // 현재 데이터를 편집중이었다면 저장하시겠습니까?
            // 예스  - 저장
            // 노 - 데이터 리셋, 이름 저장

            if (this.newBD.sl_subpart_list.Count > 0)
            {
                // 정보를 저장하기 원하면
                if (MessageBox.Show("Do you want to save current data?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    // 데이터가 있으면
                    if (this.newBD.str_brick_name == null)
                    {
                        MessageBox.Show("Please enter information.");
                        Form_Save fs1 = new Form_Save(this, 2);
                        fs1.ShowDialog();
                    }
                    else
                    {
                        this.data_save();
                    }
                }
                else
                {
                    this.newBD = new Brick_data();
                    Form_Save fs1 = new Form_Save(this, 1);
                    fs1.ShowDialog();

                    paint_BrickData();
                    paint_Circle();
                    paint_linear_Seq();
                    listbox_from_BrickData();

                }
            }
            else // 정보가 없으면
            {
                this.newBD = new Brick_data();
                Form_Save fs1 = new Form_Save(this, 1);
                fs1.ShowDialog();

                paint_BrickData();
                paint_Circle();
                paint_linear_Seq();
                listbox_from_BrickData();
            }
        }
Пример #4
0
        /************************************************************************/
        /*                                                                      */
        /************************************************************************/
        /// <summary>
        /// New 버튼 눌렀을 경우
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // 현재 데이터를 편집중이었다면 저장하시겠습니까?
            // 예스  - 저장
            // 노 - 데이터 리셋, 이름 저장

            if (this.newBD.sl_subpart_list.Count > 0)
            {
                // 정보를 저장하기 원하면
                if (MessageBox.Show("현재 정보를 저장하시겠습니까?", "저장", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    // 데이터가 있으면
                    if (this.newBD.str_brick_name == null)
                    {
                        MessageBox.Show("정보를 입력하세요.");
                        Form_Save fs1 = new Form_Save(this, 2);
                        fs1.ShowDialog();
                    }
                    else
                    {
                        this.data_save();
                    }
                }
                else
                {
                    this.newBD = new Brick_data();
                    Form_Save fs1 = new Form_Save(this, 1);
                    fs1.ShowDialog();

                }
            }
            else // 정보가 없으면
            {
                this.newBD = new Brick_data();
                Form_Save fs1 = new Form_Save(this, 1);
                fs1.ShowDialog();
            }
        }