示例#1
0
        private void STOP_button_Click(object sender, EventArgs e)
        {
            MPIReset();
            FormConsole.Clear();

            long endFilePos;

            using (BinaryReader dataFile = new BinaryReader(File.OpenRead(BinPath)))
            {
                endFilePos = dataFile.BaseStream.Length;
            }

            if (endFilePos == 0)
            {
                File.Delete(BinPath);
                ConvertToCSV_Button.Enabled = false;
            }
            else
            {
                ConvertToCSV_Button.Enabled = true;
            }
        }
示例#2
0
        private void START_button_Click(object sender, EventArgs e)
        {
            DisplayClear();
            FormConsole.Clear();

            AllMPIbuttonsOFF();

            BrokenPackages = 0;

            string DirectoryPath = Application.StartupPath + "\\data\\";

            if (!Directory.Exists(DirectoryPath))
            {
                Directory.CreateDirectory(DirectoryPath);
            }

            BinPath = Path.Combine(DirectoryPath, "temporary.bin");
            using (new BinaryWriter(File.Create(BinPath))) { }

            ZeroSignalDisplayed = false;
            GIBgotov            = false;

            LastData_TempWords  = new int[SysInfo.TempWords * 2];
            LastData_OtherWords = new int[SysInfo.OtherWords];

            RS422_Port.DiscardInBuffer();
            RS422_Port.DiscardOutBuffer();

            byte[] Command = { 0x4D, 0x4B, (byte)SysInfo.OtherWords, (byte)SysInfo.TempWords, 0xFF };
            RS422_Port.Write(Command, 0, Command.Length);

            byte[] answer = new byte[2];
            RS422_Port.Read(answer, 0, 2);

            if ((answer[0] == 0x59) && (answer[1] == 0x00))
            {
                AllMPIbuttonsON();
                START_button.Enabled        = false;
                STOP_button.Enabled         = true;
                Back_button.Enabled         = false;
                ConvertToCSV_Button.Enabled = false;
                if (VKGroupIsEnable)
                {
                    VKGroup.Enabled = true;
                }

                if (SysInfo.RKVuse)
                {
                    if (SysInfo.YCXuse)
                    {
                        YCXtext.BackColor = Color.GreenYellow;                 //масштаб УСХ
                    }
                    if (SysInfo.YCYuse)
                    {
                        YCYtext.BackColor = Color.GreenYellow;                 //масштаб УСY
                    }
                    if (SysInfo.YCZuse)
                    {
                        YCZtext.BackColor = Color.GreenYellow;                 //масштаб УСZ
                    }
                }

                ConsoleWriter("Для прекращения работы нажмите \"СТОП\"");

                RS422_Port.Write(SysInfo.UsingAdressess, 0, SysInfo.UsingAdressess.Length);

                RS422_Port.DiscardInBuffer();
                RS422_Port.DataReceived += DataReceivedHandler;

                if (SysInfo.WordsInPack != 0)
                {
                    timer1.Start();
                }
            }
            else
            {
                MPIError(answer[0], answer[1]);
            }
        }