Example #1
0
        private void InitBoardSettings()
        {
            cmbBoards.Items.Clear();
            BoardSetting.GetInstance().GetAllBoardMetaes().ForEach((meta) =>
            {
                cmbBoards.Items.Add(meta);
            }
                                                                   );
            Preference perfInst = Preference.GetInstace();

            if (cmbBoards.Items.Count > 0)
            {
                if (perfInst.HasPreference)
                {
                    BoardMeta findBoardMeta = BoardSetting.GetInstance().GetAllBoardMetaes().Find((meta) =>
                    {
                        return(meta.ID == perfInst.BoardID);
                    });
                    if (findBoardMeta != null)
                    {
                        cmbBoards.SelectedItem = findBoardMeta;
                    }
                }
                else
                {
                    cmbBoards.SelectedIndex = 0;
                }
            }
        }
        private BoardMeta GetTempBoardSetting()
        {
            BoardMeta temp = new BoardMeta();

            FormDatToMetaImpl(temp);

            return(temp);
        }
 private void tsmNew_Click(object sender, EventArgs e)
 {
     m_curMeta      = new BoardMeta();
     m_curMeta.ID   = BoardSetting.GetInstance().GetNextBoardNo();
     m_curMeta.Type = (int)BoardType.Site;
     FillData();
     m_mode = FORM_MODE.Add;
 }
        private void ResetData()
        {
            int preBoardType = m_curMeta.Type;

            m_curMeta      = new BoardMeta();
            m_curMeta.Type = preBoardType;
            m_mode         = FORM_MODE.Add;
            FillData();
        }
        private void btnChoose_Click(object sender, EventArgs e)
        {
            ItemListFrm frm = new ItemListFrm();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                m_curMeta = (BoardMeta)frm.SelectedObject;
                FillData();
                m_mode = FORM_MODE.Update;
            }
        }
        public void BuildGrid(BoardMeta board)
        {
            JObject opts = new JObject();

            opts.Add("type", board.Type);
            opts.Add("gridCount", board.GridCount);
            opts.Add("siteCount", board.SiteCount);
            opts.Add("rowCount", board.RowCount);
            opts.Add("columnCount", board.ColumnCount);

            CallJS("JsExecutor.buildGrid(" + opts.ToString() + ");");
        }
Example #7
0
        public bool SavePref()
        {
            bool       ret               = true;
            Preference perfInst          = Preference.GetInstace();
            BoardMeta  selectedBoardMeta = cmbBoards.SelectedItem as BoardMeta;

            if (selectedBoardMeta != null && selectedBoardMeta.ID != perfInst.BoardID)
            {
                perfInst.BoardID = selectedBoardMeta.ID;
                ret = perfInst.Save();
            }

            return(ret);
        }
Example #8
0
        private void InitBoardSettings()
        {
            cmbBoards.Items.Clear();
            txtDelaySeconds.Text = Preference.GetInstace().DelaySeconds.ToString();
            var allMetas = BoardSetting.GetInstance().GetAllBoardMetaes();
            List <BoardMeta> sortedMetas = new List <BoardMeta>();

            if (BoardSetting.GetInstance().NamesOrder.Count > 0)
            {
                foreach (var boardName in BoardSetting.GetInstance().NamesOrder)
                {
                    var validNameMetas = allMetas.Where(x => x.Name == boardName);
                    if (validNameMetas.Count() > 0)
                    {
                        sortedMetas.Add(validNameMetas.First());
                        //allMetas.Remove(validNameMetas.First());
                    }
                }
            }

            foreach (var meta in allMetas) //add remaining
            {
                if (!sortedMetas.Contains(meta))
                {
                    sortedMetas.Add(meta);
                }
            }
            sortedMetas.ForEach(x => cmbBoards.Items.Add(x));

            Preference perfInst = Preference.GetInstace();

            if (cmbBoards.Items.Count > 0)
            {
                if (perfInst.HasPreference)
                {
                    BoardMeta findBoardMeta = BoardSetting.GetInstance().GetAllBoardMetaes().Find((meta) =>
                    {
                        return(meta.ID == perfInst.BoardID);
                    });
                    if (findBoardMeta != null)
                    {
                        cmbBoards.SelectedItem = findBoardMeta;
                    }
                }
                else
                {
                    cmbBoards.SelectedIndex = 0;
                }
            }
        }
        private void BoardSettingFrm_Load(object sender, EventArgs e)
        {
            panelGrid.Top  = panelSite.Top;
            m_curMeta      = new BoardMeta();
            m_curMeta.Type = (int)BoardType.Site;
            FillData();
            m_mode = FORM_MODE.Add;

            if (!VsmdController.GetVsmdController().IsInitialized())
            {
                StatusBar.DisplayMessage(MessageType.Error, "设备未连接!");
                DisableControls();
                return;
            }
        }
        private void FormDatToMetaImpl(BoardMeta meta)
        {
            if (m_mode == FORM_MODE.Add)
            {
                meta.ID = BoardSetting.GetInstance().GetNextBoardNum();
            }
            meta.Name             = txtName.Text.Trim();
            meta.WashTimes        = int.Parse(txtWashTimes.Text);
            meta.WashDelaySeconds = int.Parse(txtWashDelaySeconds.Text);
            meta.WashX            = int.Parse(txtWashX.Text);
            meta.WashY            = int.Parse(txtWashY.Text);
            meta.WashZ            = int.Parse(txtWashZ.Text);
            meta.Type             = rbtSite.Checked ? 1 : 2;
            if (rbtSite.Checked)
            {
                meta.SiteCount   = int.Parse(txtSiteCnt.Text);
                meta.RowCount    = int.Parse(txtSiteRowCnt.Text);
                meta.ColumnCount = int.Parse(txtSiteColCnt.Text);

                meta.Site1FirstTubeX = int.Parse(txtSite1FTX.Text);
                meta.Site1FirstTubeY = int.Parse(txtSite1FTY.Text);
                meta.Site1LastTubeX  = int.Parse(txtSite1LTX.Text);
                meta.Site1LastTubeY  = int.Parse(txtSite1LTY.Text);
                meta.Site2FirstTubeX = int.Parse(txtSite2FTX.Text);
                meta.Site2FirstTubeY = int.Parse(txtSite2FTY.Text);

                meta.TouchEdgeOffset = int.Parse(txtTouchPosition.Text) - meta.Site1FirstTubeX;
            }
            else
            {
                meta.GridCount = int.Parse(txtGridCnt.Text);
                meta.RowCount  = int.Parse(txtGridRowCnt.Text);

                meta.GridFirstTubeX = int.Parse(txtGridFTX.Text);
                meta.GridFirstTubeY = int.Parse(txtGridFTY.Text);
                meta.GridLastTubeX  = int.Parse(txtGridLTX.Text);
                meta.GridLastTubeY  = int.Parse(txtGridLTY.Text);

                meta.TouchEdgeOffset = int.Parse(txtTouchPosition.Text) - meta.GridFirstTubeX;
            }

            meta.ZTravel      = int.Parse(txtZTravel.Text);
            meta.ZDispense    = int.Parse(txtZDispense.Text);
            meta.DelaySeconds = float.Parse(txtTouchDelaySeconds.Text);
        }
        private void FormDatToMetaImpl(BoardMeta meta)
        {
            if (m_mode == FORM_MODE.Add)
            {
                meta.ID = BoardSetting.GetInstance().GetNextBoardNum();
            }
            meta.Name = txtName.Text.Trim();
            meta.Type = rbtSite.Checked ? 1 : 2;
            if (rbtSite.Checked)
            {
                meta.SiteCount   = int.Parse(txtSiteCnt.Text);
                meta.RowCount    = int.Parse(txtSiteRowCnt.Text);
                meta.ColumnCount = int.Parse(txtSiteColCnt.Text);

                meta.Site1FirstTubeX = int.Parse(txtSite1FTX.Text);
                meta.Site1FirstTubeY = int.Parse(txtSite1FTY.Text);
                meta.Site1LastTubeX  = int.Parse(txtSite1LTX.Text);
                meta.Site1LastTubeY  = int.Parse(txtSite1LTY.Text);
                meta.Site2FirstTubeX = int.Parse(txtSite2FTX.Text);
                meta.Site2FirstTubeY = int.Parse(txtSite2FTY.Text);
                meta.ZTravel         = int.Parse(txtSiteZTravel.Text);
                meta.ZDispense       = int.Parse(txtSiteZDispense.Text);
            }
            else
            {
                meta.GridCount = int.Parse(txtGridCnt.Text);
                meta.RowCount  = int.Parse(txtGridRowCnt.Text);

                meta.GridFirstTubeX = int.Parse(txtGridFTX.Text);
                meta.GridFirstTubeY = int.Parse(txtGridFTY.Text);
                meta.GridLastTubeX  = int.Parse(txtGridLTX.Text);
                meta.GridLastTubeY  = int.Parse(txtGridLTY.Text);
                meta.ZTravel        = int.Parse(txtGridZTravel.Text);
                meta.ZDispense      = int.Parse(txtGridZDispense.Text);
            }
        }
Example #12
0
 public bool DeleteBoard(BoardMeta board)
 {
     m_boardSettings.Remove(board);
     return(Save());
 }
Example #13
0
 public bool AddNewBoard(BoardMeta board)
 {
     m_boardSettings.Add(board);
     return(Save());
 }