コード例 #1
0
ファイル: Form1.cs プロジェクト: bitembassy/bitcoin-ticker
        private void btnSendClock_Click(object sender, EventArgs e)
        {
            int ret = 0;

            m_nWidth  = Convert.ToInt32(m_edtWidth.Text);
            m_nHeight = Convert.ToInt32(m_edtHeight.Text);
            if (1 == InitComm())
            {
                if (0 == m_nCommType)
                {
                    ret = CP5200.CP5200_RS232_SendClock(m_nCardID, 0, 3, 0, 7, 7, 1, 255, 255, 255, Marshal.StringToHGlobalAnsi("Date"));
                }
                else
                {
                    ret = CP5200.CP5200_Net_SendClock(m_nCardID, 0, 3, 0, 7, 7, 1, 255, 255, 255, Marshal.StringToHGlobalAnsi("Date"));
                }

                if (0 <= ret)
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Fail");
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: bitembassy/bitcoin-ticker
        private void btnSendText_Click(object sender, EventArgs e)
        {
            int ret    = 0;
            int icolor = 3000;

            m_nWidth  = Convert.ToInt32(m_edtWidth.Text);
            m_nHeight = Convert.ToInt32(m_edtHeight.Text);
            IntPtr iPtr = Marshal.StringToHGlobalAnsi(m_edtText.Text);

            if (1 == InitComm())
            {
                if (0 == m_nCommType)
                {
                    ret = CP5200.CP5200_RS232_SendText(m_nCardID, 0, iPtr, icolor, 16, 3, 0, 3, 0);
                }
                else
                {
                    ret = CP5200.CP5200_Net_SendTagText(m_nCardID, 0, iPtr, icolor, 16, 3, 0, 3, 0);
                }

                if (0 <= ret)
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Fail");
                }
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
        private void btnSplitWnd_Click(object sender, System.EventArgs e)
        {
            int ret = 0;

            int[] nWndRect = new int[8];
            GetSplitWnd(nWndRect);
            InitComm();
            if (0 == m_nCommType)
            {
                ret = CP5200.CP5200_RS232_SplitScreen(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), Convert.ToInt32(m_txtWidth.Text), Convert.ToInt32(m_txtHeight.Text), 2, nWndRect);
            }
            else
            {
                ret = CP5200.CP5200_Net_SplitScreen(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), Convert.ToInt32(m_txtWidth.Text), Convert.ToInt32(m_txtHeight.Text), 2, nWndRect);
            }

            if (ret >= 0)
            {
                MessageBox.Show("Successful");
            }
            else
            {
                MessageBox.Show("Fail");
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: bitembassy/bitcoin-ticker
        private void btnPlayOneProgram_Click(object sender, EventArgs e)
        {
            int ret = 0;

            int[] strPrg = new int[256];
            strPrg[0] = Convert.ToInt32(m_edtSelProgram.Text);
            strPrg[1] = 0;

            if (1 == InitComm())
            {
                if (0 == m_nCommType)
                {
                    ret = CP5200.CP5200_RS232_PlaySelectedPrg(m_nCardID, strPrg, 1, 0);
                }
                else
                {
                    ret = CP5200.CP5200_Net_PlaySelectedPrg(m_nCardID, strPrg, 1, 0);
                }

                if (0 <= ret)
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Fail");
                }
            }
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
        private void btnSetTime_Click(object sender, System.EventArgs e)
        {
            InitComm();
            int nRet;

            byte[]   byTimeInfo = new byte[7];
            DateTime curTime;

            curTime       = DateTime.Now;
            byTimeInfo[0] = Convert.ToByte(curTime.Second);
            byTimeInfo[1] = Convert.ToByte(curTime.Minute);
            byTimeInfo[2] = Convert.ToByte(curTime.Hour);
            byTimeInfo[3] = Convert.ToByte(curTime.DayOfWeek);
            byTimeInfo[4] = Convert.ToByte(curTime.Day);
            byTimeInfo[5] = Convert.ToByte(curTime.Month);
            byTimeInfo[6] = Convert.ToByte(curTime.Year - 2000);

            if (m_nCommType == 1)              //網口
            {
                nRet = CP5200.CP5200_Net_SetTime(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), byTimeInfo);
            }
            else             //串口
            {
                nRet = CP5200.CP5200_RS232_SetTime(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), byTimeInfo);
            }

            if (nRet >= 0)
            {
                MessageBox.Show("Successful");
            }
            else
            {
                MessageBox.Show("Fail");
            }
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
        private void btnMakePlaybill_Click(object sender, System.EventArgs e)
        {
            Boolean bRet = false;
            IntPtr  hObj = CP5200.CP5200_Playbill_Create(Convert.ToInt32(m_txtWidth.Text), Convert.ToInt32(m_txtHeight.Text), 0x77);

            if (hObj != IntPtr.Zero)
            {
                if (CP5200.CP5200_Playbill_AddFile(hObj, GetProgramFileName()) >= 0)
                {
                    if (CP5200.CP5200_Playbill_SaveToFile(hObj, GetPlaybillFileName()) == 0)
                    {
                        bRet = true;
                    }
                }
                CP5200.CP5200_Playbill_Destroy(hObj);
            }

            if (bRet)
            {
                MessageBox.Show("Successful");
            }
            else
            {
                MessageBox.Show("Fail");
            }
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
        private void btnPlayProgram_Click(object sender, System.EventArgs e)
        {
            InitComm();
            int nRet = 0;

            int[] nProNo = new int[2];
            nProNo[0] = Convert.ToInt32(m_txtProNo.Text);
            nProNo[1] = 0;

            if (m_nCommType == 1)              //網口
            {
                nRet = CP5200.CP5200_Net_PlaySelectedPrg(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), nProNo, 1, 0);
            }
            else             //串口
            {
                nRet = CP5200.CP5200_RS232_PlaySelectedPrg(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), nProNo, 1, 0);
            }

            if (nRet >= 0)
            {
                MessageBox.Show("Successful");
            }
            else
            {
                MessageBox.Show("Fail");
            }
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: bitembassy/bitcoin-ticker
        private int InitComm()
        {
            int    nRet = 0;
            string strPort;

            if (0 == m_nCommType)
            {
                strPort = "COM" + m_nPort.ToString();
                nRet    = CP5200.CP5200_RS232_InitEx(Marshal.StringToHGlobalAnsi(strPort), m_nBaudrate, m_nTimeout);
            }
            else
            {
                m_dwIPAddr = GetIP(IPAddr.Text);
                if (0 != m_dwIPAddr)
                {
                    m_dwIDCode = GetIP(IDCode.Text);
                    if (0 != m_dwIDCode)
                    {
                        CP5200.CP5200_Net_Init(m_dwIPAddr, m_nIPPort, m_dwIDCode, m_nTimeout);
                        nRet = 1;
                    }
                }
            }

            return(nRet);
        }
コード例 #9
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
        private void btnSendStaticText_Click(object sender, System.EventArgs e)
        {
            int nRet;

            int[] nWndRect = new int[8];
            GetSplitWnd(nWndRect);
            InitComm();

            if (m_nCommType == 1)              //網口
            {
                nRet = CP5200.CP5200_Net_SendStatic(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, Marshal.StringToHGlobalAnsi(m_txtStaticText.Text), 0xFF, 16, 0,
                                                    0, 0, nWndRect[2 + m_cmbWndNo.SelectedIndex * 4] - nWndRect[0 + m_cmbWndNo.SelectedIndex * 4], nWndRect[3 + m_cmbWndNo.SelectedIndex * 4] - nWndRect[1 + m_cmbWndNo.SelectedIndex * 4]);
            }
            else             //串口
            {
                nRet = CP5200.CP5200_RS232_SendStatic(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, Marshal.StringToHGlobalAnsi(m_txtStaticText.Text), 0xFF, 16, 0,
                                                      0, 0, nWndRect[2 + m_cmbWndNo.SelectedIndex * 4] - nWndRect[0 + m_cmbWndNo.SelectedIndex * 4], nWndRect[3 + m_cmbWndNo.SelectedIndex * 4] - nWndRect[1 + m_cmbWndNo.SelectedIndex * 4]);
            }

            if (nRet >= 0)
            {
                MessageBox.Show("Successful");
            }
            else
            {
                MessageBox.Show("Fail");
            }
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
        private void btnSendText_Click(object sender, System.EventArgs e)
        {
            InitComm();
            int nRet;

            // Network
            if (m_nCommType == 1)
            {
                nRet = CP5200.CP5200_Net_SendText(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, Marshal.StringToHGlobalAnsi(m_txtText.Text), 0xFF, 16, 3, 0, 3, 5);
            }
            // RS232/485
            else
            {
                nRet = CP5200.CP5200_RS232_SendText(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, Marshal.StringToHGlobalAnsi(m_txtText.Text), 0xFF, 16, 3, 0, 3, 5);
            }

            if (nRet >= 0)
            {
                MessageBox.Show("Successful");
            }
            else
            {
                MessageBox.Show("Fail");
            }
        }
コード例 #11
0
ファイル: Form1.cs プロジェクト: bitembassy/bitcoin-ticker
        private void btnSendStaticText_Click(object sender, EventArgs e)
        {
            int ret = 0;

            m_nWidth  = Convert.ToInt32(m_edtWidth.Text);
            m_nHeight = Convert.ToInt32(m_edtHeight.Text);
            if (1 == InitComm())
            {
                if (0 == m_nCommType)
                {
                    ret = CP5200.CP5200_RS232_SendStatic(m_nCardID, 0, Marshal.StringToHGlobalAnsi(m_edtStaticText.Text), Color.FromArgb(255, 0, 0).ToArgb(), 16, 0, 0, 0, m_nWidth, m_nHeight);
                }
                else
                {
                    ret = CP5200.CP5200_Net_SendStatic(m_nCardID, 0, Marshal.StringToHGlobalAnsi(m_edtStaticText.Text), Color.FromArgb(255, 0, 0).ToArgb(), 16, 0, 0, 0, m_nWidth, m_nHeight);
                }

                if (0 <= ret)
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Fail");
                }
            }
        }
コード例 #12
0
ファイル: Form1.cs プロジェクト: bitembassy/bitcoin-ticker
        private void btnSplitWnd_Click(object sender, EventArgs e)
        {
            int ret = 0;

            int[] nWndRect = new int[4];
            m_nWidth    = Convert.ToInt32(m_edtWidth.Text);
            m_nHeight   = Convert.ToInt32(m_edtHeight.Text);
            nWndRect[0] = 0;
            nWndRect[1] = 0;
            nWndRect[2] = m_nWidth;
            nWndRect[3] = m_nHeight;

            if (1 == InitComm())
            {
                if (0 == m_nCommType)
                {
                    ret = CP5200.CP5200_RS232_SplitScreen(m_nCardID, m_nWidth, m_nHeight, 1, nWndRect);
                }
                else
                {
                    ret = CP5200.CP5200_Net_SplitScreen(m_nCardID, m_nWidth, m_nHeight, 1, nWndRect);
                }

                if (ret >= 0)
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Fail");
                }
            }
        }
コード例 #13
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
        private void btnMakProgram_Click(object sender, System.EventArgs e)
        {
            Boolean bRet = false;
            IntPtr  hObj = CP5200.CP5200_Program_Create(Convert.ToInt32(m_txtWidth.Text), Convert.ToInt32(m_txtHeight.Text), 0x77);

            if (hObj != IntPtr.Zero)
            {
                //分左右兩個窗口,
                int[] nWndRect = new int[8];
                GetSplitWnd(nWndRect);
                if (CP5200.CP5200_Program_SetProperty(hObj, 0xFFFF, 1) > 0)
                {
                    int nItemCnt = 0;
                    //0號窗口放文字,
                    int nWndNo = CP5200.CP5200_Program_AddPlayWindow(hObj, nWndRect[0], nWndRect[1], nWndRect[2] - nWndRect[0], nWndRect[3] - nWndRect[1]);
                    if (nWndNo >= 0)
                    {
                        CP5200.CP5200_Program_SetWindowProperty(hObj, nWndNo, 0x30, 1);                              //設置窗口邊框
                        //添加文本節目
                        if (CP5200.CP5200_Program_AddText(hObj, nWndNo, Marshal.StringToHGlobalAnsi(m_txtText.Text), 16, 0xFF, 0xFFFF, 100, 3) >= 0)
                        {
                            nItemCnt++;
                        }
                    }

                    //1號窗口放圖片
                    nWndNo = CP5200.CP5200_Program_AddPlayWindow(hObj, nWndRect[4], nWndRect[5], nWndRect[6] - nWndRect[4], nWndRect[7] - nWndRect[5]);
                    if (nWndNo >= 0)
                    {
                        //添加圖片節目
                        if (CP5200.CP5200_Program_AddPicture(hObj, nWndNo, Marshal.StringToHGlobalAnsi(m_txtPict.Text), 2, 0xFFFF, 100, 3, 0) >= 0)
                        {
                            nItemCnt++;
                        }
                    }

                    if (nItemCnt > 0 && CP5200.CP5200_Program_SaveToFile(hObj, GetProgramFileName()) >= 0)
                    {
                        bRet = true;
                    }
                }
                CP5200.CP5200_Program_Destroy(hObj);
            }

            if (bRet)
            {
                MessageBox.Show("Successful");
            }
            else
            {
                MessageBox.Show("Fail");
            }
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
        private void btnUpload_Click(object sender, System.EventArgs e)
        {
            InitComm();

            int nUploadCnt = 0;

            if (m_nCommType == 1)              //網口
            {
                if (0 == CP5200.CP5200_Net_UploadFile(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), GetProgramFileName(), GetProgramFileName()))
                {
                    nUploadCnt++;
                }

                if (0 == CP5200.CP5200_Net_UploadFile(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), GetPlaybillFileName(), GetPlaybillFileName()))
                {
                    nUploadCnt++;
                }

                if (nUploadCnt > 0)
                {
                    CP5200.CP5200_Net_RestartApp(Convert.ToByte(m_cmbCardID.SelectedIndex + 1));
                }
            }
            else             //串口
            {
                if (0 == CP5200.CP5200_RS232_UploadFile(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), GetProgramFileName(), GetProgramFileName()))
                {
                    nUploadCnt++;
                }

                if (0 == CP5200.CP5200_RS232_UploadFile(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), GetPlaybillFileName(), GetPlaybillFileName()))
                {
                    nUploadCnt++;
                }

                if (nUploadCnt > 0)
                {
                    CP5200.CP5200_RS232_RestartApp(Convert.ToByte(m_cmbCardID.SelectedIndex + 1));
                }
            }


            String strName = String.Format("Upload 2 files ,{0:D} successful ,{1:D}  failed!", nUploadCnt, 2 - nUploadCnt);

            MessageBox.Show(strName);
        }
コード例 #15
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
 private void InitComm()
 {
     if (0 == m_nCommType)
     {
         int    nPort     = Convert.ToByte(m_cmbPort.SelectedIndex + 1);
         String strPort   = "COM" + nPort.ToString();
         int    nBaudrate = Convert.ToInt32(m_lBaudtbl[m_cmbBaudrate.SelectedIndex]);
         CP5200.CP5200_RS232_InitEx(Marshal.StringToHGlobalAnsi(strPort), nBaudrate, m_nTimeout);
     }
     else
     {
         uint dwIPAddr = GetIP(m_txtIPAddr.Text);
         uint dwIDCode = GetIP(m_txtIDCode.Text);
         int  nIPPort  = Convert.ToInt32(m_txtIPPort.Text);
         if (dwIPAddr != 0 && dwIDCode != 0)
         {
             CP5200.CP5200_Net_Init(dwIPAddr, nIPPort, dwIDCode, m_nTimeout);
         }
     }
 }
コード例 #16
0
ファイル: Form1.cs プロジェクト: dspp779/MIRLE_LED
        private void btnSendClock_Click(object sender, System.EventArgs e)
        {
            InitComm();
            int nRet;

            if (m_nCommType == 1)              //網口
            {
                nRet = CP5200.CP5200_Net_SendClock(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, 3, 0, 7, 7, 1, 255, 255, 255, Marshal.StringToHGlobalAnsi("Date"));
            }
            else             //串口
            {
                nRet = CP5200.CP5200_RS232_SendClock(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, 3, 0, 7, 7, 1, 255, 255, 255, Marshal.StringToHGlobalAnsi("Date"));
            }

            if (nRet >= 0)
            {
                MessageBox.Show("Successful");
            }
            else
            {
                MessageBox.Show("Fail");
            }
        }
コード例 #17
0
ファイル: Form1.cs プロジェクト: bitembassy/bitcoin-ticker
        private void btnSetTime_Click(object sender, EventArgs e)
        {
            int ret = 0;

            byte[]   byTime = new byte[7];
            DateTime curTime;

            curTime   = DateTime.Now;
            byTime[0] = Convert.ToByte(curTime.Second);
            byTime[1] = Convert.ToByte(curTime.Minute);
            byTime[2] = Convert.ToByte(curTime.Hour);
            byTime[3] = Convert.ToByte(curTime.DayOfWeek);
            byTime[4] = Convert.ToByte(curTime.Day);
            byTime[5] = Convert.ToByte(curTime.Month);
            byTime[6] = Convert.ToByte(curTime.Year - 2000);

            if (1 == InitComm())
            {
                if (0 == m_nCommType)
                {
                    ret = CP5200.CP5200_RS232_SetTime(Convert.ToByte(m_nCardID), byTime);
                }
                else
                {
                    ret = CP5200.CP5200_Net_SetTime(Convert.ToByte(m_nCardID), byTime);
                }

                if (0 <= ret)
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Fail");
                }
            }
        }
コード例 #18
0
 private void button1_Click(object sender, EventArgs e)
 {
     PRG = CP5200.CP5200_Program_Create(96, 16, 2);
 }
コード例 #19
0
        private void AddPRGText_Click(object sender, EventArgs e)
        {
            CP5200.CP5200_Add_Text(PRG, 0, "this is a string", 1, Color.FromArgb(255, 0, 0).ToArgb(), 1, 1, 5);

            CP5200.CP5200_Add_Text(PRG, 0, "this a string too ! ", 1, Color.FromArgb(255, 0, 0).ToArgb(), 1, 1, 5);
        }