Ejemplo n.º 1
0
        private void ShowBoardInfo(BoardsInfo boards)
        {
            panelListBoard.Controls.Clear();
            panelListBoard.SuspendLayout();
            for (int i = 0; i < boards.listBoardInfo.Count; i++)
            {
                Button btn = new Button();

                string name = boards.listBoardInfo[i].Name;
                //if (name == _frmMainWindow.selfDiagBoardName) continue;

                if (name.Length > 20)
                {
                    name = name.Substring(0, 20) + "..";
                }
                btn.Text = name;

                btn.Name        = "btn" + i.ToString();
                btn.Click      += btn_Click;
                btn.MouseEnter += btn_MouseEnter;
                btn.MouseLeave += btn_MouseLeave;
                btn.MouseHover += btn_MouseHover;
                btn.Font        = new Font("Verdana", 16);
                btn.Left        = 10;
                btn.Top         = i * 50 + 0;
                btn.Height      = 42;
                btn.Width       = 300;



                panelListBoard.Controls.Add(btn);
            }
            panelListBoard.ResumeLayout();
        }
Ejemplo n.º 2
0
        private void btnSelfDiagnostic_Click(object sender, EventArgs e)
        {
            if (Utils.isFileExist(_frmListBoard.ListBoardFileName))
            {
                bSelfDiag = true;
                BoardsInfo boards = _frmListBoard.OpenListBoards(_frmListBoard.ListBoardFileName);
                for (int i = 0; i < boards.listBoardInfo.Count; i++)
                {
                    if (boards.listBoardInfo[i].Name == selfDiagBoardName)
                    {
                        _frmListBoard.chooseBoard = boards.listBoardInfo[i];
                        break;
                    }
                }

                if (_frmListBoard.chooseBoard != null && _frmListBoard.chooseBoard.Name == selfDiagBoardName)
                {
                    //this.Hide();
                    //_frmBoardSignals.Show();
                    this.Hide();

                    _frmHelpBoard.Show();
                }
                else
                {
                    MessageBox.Show("В списке плат не найден файл самодиагностики", "Ошибка загрузки платы", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Файл списка плат не найден!", "Ошибка загрузки файла", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        private void Init()
        {
            bNeedReload = false;
            if (Utils.isFileExist(ListBoardFileName))
            {
                boardsInfo = OpenListBoards(ListBoardFileName);
                ShowBoardInfo(boardsInfo);

                pict.SizeMode = PictureBoxSizeMode.StretchImage;
                pict.Image    = (Image)Properties.Resources.listBoardInitmage;
                t             = new TypingText(Properties.Resources.comment_ListBoard_Initial, txtComment);
                t.StartTyping();
            }
            else
            {
                MessageBox.Show("Файл списка плат не найден!", "Ошибка загрузки файла", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        public BoardsInfo OpenListBoards(string filename)
        {
            BoardsInfo boards = _frmMainWindow.xml.OpenListBoards(Application.StartupPath + "//" + filename);

            return(boards);
        }
Ejemplo n.º 5
0
        public BoardsInfo OpenListBoards(string listBoardName)
        {
            BoardsInfo    boards    = new BoardsInfo();
            XmlTextReader reader    = new XmlTextReader(listBoardName);
            string        boardName = null;

            double dI27MAX = 999;
            double dI15MAX = 999;
            double dI12MAX = 999;
            double dI05MAX = 999;
            double dI03MAX = 999;


            string        commentString       = string.Empty;
            string        imageLinkString     = string.Empty;
            string        commentHelpString   = string.Empty;
            string        imageLinkHelpString = string.Empty;
            List <string> listImageLink_Help  = null;
            //            string str;

            string paramName = string.Empty;
            string fileName  = string.Empty;

            // UInt16 delay = 1000;


            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:     // Узел является элементом.
                    paramName = reader.Name;
                    if (reader.Name == "BOARD")
                    {
                        dI27MAX = 999;
                        dI15MAX = 999;
                        dI12MAX = 999;
                        dI05MAX = 999;
                        dI03MAX = 999;

                        reader.MoveToNextAttribute();
                        if (reader.Name == "NAME")
                        {
                            boardName          = reader.Value;
                            listImageLink_Help = new List <string>();
                        }
                    }

                    break;

                case XmlNodeType.Text:     // Вывести текст в каждом элементе.

                    if (paramName == "FILENAME")
                    {
                        fileName = reader.Value;
                    }


                    if (paramName == "COMMENT")
                    {
                        commentString = reader.Value;
                    }

                    if (paramName == "IMAGELINK")
                    {
                        imageLinkString = reader.Value;
                    }

                    if (paramName == "COMMENT_HELP")
                    {
                        commentHelpString = reader.Value;
                    }

                    if (paramName == "IMAGELINK_HELP")
                    {
                        imageLinkHelpString = reader.Value;
                        listImageLink_Help.Add(imageLinkHelpString);
                    }

                    if (paramName == "I27MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI27MAX = dValue;
                        }
                    }

                    if (paramName == "I15MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI15MAX = dValue;
                        }
                    }

                    if (paramName == "I12MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI12MAX = dValue;
                        }
                    }

                    if (paramName == "I5MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI05MAX = dValue;
                        }
                    }

                    if (paramName == "I3MAX")
                    {
                        double dValue = 0;
                        if (str2double(reader.Value, out dValue))
                        {
                            dI03MAX = dValue;
                        }
                    }

                    break;

                case XmlNodeType.EndElement:     // Вывести конец элемента.
                    if (reader.Name == "BOARD")
                    {
                        // BoardInfo boardInf = new BoardInfo(boardName, fileName, imageLinkString, commentString, imageLinkHelpString, commentHelpString);
                        //BoardInfo boardInf = new BoardInfo(boardName, fileName, imageLinkString, commentString, imageLinkHelpString, commentHelpString);
                        //BoardInfo boardInf = new BoardInfo(boardName, fileName, imageLinkString, commentString, listImageLink_Help, commentHelpString);
                        BoardInfo boardInf = new BoardInfo(boardName, fileName, imageLinkString, commentString, listImageLink_Help, commentHelpString,
                                                           dI27MAX, dI15MAX, dI12MAX, dI05MAX, dI03MAX);

                        commentString       = string.Empty;
                        imageLinkString     = string.Empty;
                        commentHelpString   = string.Empty;
                        imageLinkHelpString = string.Empty;
                        fileName            = string.Empty;
                        listImageLink_Help  = null;

                        boards.listBoardInfo.Add(boardInf);
                    }

                    break;
                }
            }


            return(boards);
        }