private void button6_Click(object sender, System.EventArgs e)
        {
            this.Close();
            Form15 frm15 = new Form15();

            frm15.Show();
        }
        private void exit_b_Click(object sender, System.EventArgs e)
        {
            inputPanel1.Enabled = false;
            this.Close();
            Form15 fr15 = new Form15();

            fr15.Show();
        }
 private void ok_b_Click(object sender, System.EventArgs e)
 {
     if (nazwa_t.Text != "" && comboBox1.Text != "")
     {
         WriteLine();
         Form15 fr15 = new Form15();
         fr15.Show();
     }
     else if (nazwa_t.Text == "")
     {
         MessageBox.Show("WprowadŸ nazwê dokumentu");
     }
     else if (comboBox1.Text == "")
     {
         MessageBox.Show("WprowadŸ typ dokumentu");
     }
 }
        private void button3_Click(object sender, System.EventArgs e)
        {
            Form15 frm15 = new Form15();

            frm15.Show();
        }
Example #5
0
        private void recive()
        {
            if (bflag == true && bdll == "BTLibCs")
            {
                CalibCs.BTLibCs.BTLib_Initialize();
                this.label1.Text = "OTWIERAM PORT";
                label1.Refresh();
                IntPtr btest = CalibCs.SerialFuncCs.CreateFile(com + ":", CalibCs.SerialFuncCs.GENERIC_WRITE | CalibCs.SerialFuncCs.GENERIC_READ, 0, IntPtr.Zero, CalibCs.SerialFuncCs.OPEN_EXISTING, CalibCs.SerialFuncCs.FILE_ATTRIBUTE_NORMAL, IntPtr.Zero);
                if (btest != IntPtr.Zero)
                {
                    //	MessageBox.Show("Com ok");
                    CalibCs.SerialFuncCs.DCB portconfig = new CalibCs.SerialFuncCs.DCB();
                    bool test2 = CalibCs.SerialFuncCs.GetCommState(btest, ref portconfig);
                    if (test2 == true)
                    {
                        //		MessageBox.Show("Get com st ok");
                        portconfig.BaudRate = SerialFuncCs.CBR_115200;
                        portconfig.Flag32  |= SerialFuncCs.fBinary;
                        portconfig.Parity   = SerialFuncCs.NOPARITY;
                        portconfig.ByteSize = 8;
                        portconfig.StopBits = SerialFuncCs.ONESTOPBIT;
                        test2 = CalibCs.SerialFuncCs.SetCommState(btest, ref portconfig);
                        if (test2 == true)
                        {
                            byte[] bytecount = new byte[1024];
                            uint   bytestw   = new uint();
                            uint   byteswr   = new uint();
                            //uint pEvtMask = SerialFuncCs.EV_RXCHAR;
                            //uint pEvtMask2 = SerialFuncCs.EV_RXCHAR;
                            //uint CTS = SerialFuncCs.EV_CTS;
                            //SerialFuncCs.WaitCommEvent(btest, ref pEvtMask, IntPtr.Zero);

                            System.IO.FileStream file = new FileStream(dfile, FileMode.Create, FileAccess.Write);
                            byte[] flaga = new byte[1];
                            flaga[0] = 21;
                            int  licznik   = 0;
                            uint modemstat = 0;
                            while (modemstat != 176 && licznik != 30)
                            {
                                licznik += 1;

                                label1.Text = "CZEKAM NA PO£¥CZENIE 30 sekund: " + licznik.ToString();
                                label1.Focus();
                                System.Threading.Thread.Sleep(1000);
                                label1.Refresh();
                                SerialFuncCs.GetCommModemStatus(btest, ref modemstat);
                            }

                            if (licznik >= 30)
                            {
                                file.Close();
                                CalibCs.BTLibCs.BTLib_DeInitialize();
                                CalibCs.SerialFuncCs.CloseHandle(btest);
                                label1.Text = "KONIEC CZASU";
                                label1.Refresh();
                            }
                            else
                            {
                                this.label1.Text = "CZEKAM NA DANE";
                                label1.Refresh();
                                test2 = SerialFuncCs.WriteFile(btest, flaga, Convert.ToUInt32(flaga.Length), ref byteswr, IntPtr.Zero);
                                System.Threading.Thread.Sleep(2000);

                                test2 = SerialFuncCs.ReadFile(btest, bytecount, Convert.ToUInt32(bytecount.Length), ref byteswr, IntPtr.Zero);

                                uint lenght = BitConverter.ToUInt32(bytecount, 0);
                                this.label1.Text = "ODBIERAM DANE: " + (lenght / 1024).ToString() + " Kb";
                                label1.Refresh();
                                byte[] buffer = new byte[lenght];
                                //SerialFuncCs.WaitCommEvent(btest, ref pEvtMask2, IntPtr.Zero);
                                test2    = SerialFuncCs.ReadFile(btest, buffer, Convert.ToUInt32(buffer.Length), ref byteswr, IntPtr.Zero);
                                flaga[0] = 2;
                                test2    = SerialFuncCs.WriteFile(btest, flaga, Convert.ToUInt32(flaga.Length), ref byteswr, IntPtr.Zero);
                                SerialFuncCs.CloseHandle(btest);
                                CalibCs.BTLibCs.BTLib_DeInitialize();

                                this.label1.Text = "ZAPISUJE DANE: " + (lenght / 1024).ToString() + "Kb " + "PROSZÊ CZEKAÆ";
                                label1.Refresh();
                                file.Write(buffer, 0, Convert.ToInt32(lenght));

                                file.Close();
                                this.label1.Text = "DANE ZAPISANE";
                                label1.Refresh();
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Niepoprawny port com");
                    Form15 frm15 = new Form15();
                    frm15.Refresh();
                    this.Close();
                }
            }
            else if (bflag == true && bdll == "MSStack")
            {
                recivebtms();
            }
        }