コード例 #1
0
        private void InitializeReadOnlyModeBinding()
        {
            List <Control> controlList = GlobalStaticFunction.GetAllControls(this);

            foreach (Control control in controlList)
            {
                //if (control is TextBox) control.DataBindings.Add("Readonly", this, "ReadonlyMode");
                if (control is TextBox)
                {
                    control.DataBindings.Add("Enabled", this, "EditableMode");
                }
                else if (control is ComboBox || control is DateTimePicker)
                {
                    control.DataBindings.Add("Enabled", this, "EditableMode");
                }
                else if (control is DataGridView)
                {
                    control.DataBindings.Add("Readonly", this, "ReadonlyMode");
                    control.DataBindings.Add("AllowUserToAddRows", this, "EditableMode");
                    control.DataBindings.Add("AllowUserToDeleteRows", this, "EditableMode");
                }
            }

            this.dataListViewMaster.DataBindings.Add("Enabled", this, "ReadonlyMode");
        }
コード例 #2
0
ファイル: IOPortRS232.cs プロジェクト: Proerp/STS07JUL
        public void SendToSerial(string stringHex)
        {
            try
            {
                stringHex = stringHex.Replace(" ", "");
                stringHex = stringHex.Replace("/", "");
                stringHex = stringHex.Replace(",", "");
                stringHex = stringHex.Replace("-", "");

                byte[] buff = GlobalStaticFunction.HexStringToByteArray(stringHex);

                if (this.serialPort.IsOpen)
                {
                    this.serialPort.ReadExisting();      //Clear the port before send
                    this.readResultBuffer = new byte[0]; //Clear buffer before send
                    this.serialPort.Write(buff, 0, buff.Length);

                    this.MainStatus = stringHex;
                    this.MainStatus = "#";
                }
            }
            catch (Exception exception)
            {
                this.MainStatus = exception.Message;
            }
        }
コード例 #3
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.checkBoxSaveAgreement.Checked && this.privateFillingLineData.DataValidated())
         {
             if (!this.privateFillingLineData.Save())
             {
                 this.DialogResult = DialogResult.None;
             }
             else
             {
                 GlobalStaticFunction.CopyProperties(this.privateFillingLineData, this.globalFillingLineData);
                 GlobalVariables.noItemPerCartonSetByProductID = SQLDatabase.GetScalarValue("SELECT NoItemPerCarton FROM ListProductName WHERE ProductID = " + this.globalFillingLineData.ProductID);
             }
         }
         else
         {
             this.DialogResult = DialogResult.None;
         }
     }
     catch (Exception exception)
     {
         GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
         this.DialogResult = DialogResult.None;
     }
 }
コード例 #4
0
        private bool WaitForPrintingAcknowledge(ref string stringReadFrom)
        {
            try
            {
                bool returnValue = false;
                this.inkJetNetworkStream.ReadTimeout = 300; //Default = -1;


                stringReadFrom = GlobalNetSockets.ReadFromStream(inkJetTcpClient, inkJetNetworkStream);

                if (stringReadFrom == GlobalVariables.charPrintingACK.ToString()) //OK State
                {
                    returnValue = true;                                           // GlobalVariables.DominoProductCounter[(int)this.DominoPrinterNameID]++;
                }
                else//  !=  : Need to check some other condition
                {
                    int countPrintingACK = GlobalStaticFunction.CountStringOccurrences(stringReadFrom, GlobalVariables.charPrintingACK.ToString());

                    if (countPrintingACK == 1)      //OK: but in case of receive only one PrintingACK, following by something: Ignore. Later: Maybe ADD SOME CODE to SHOW on screen what stringReadFrom is
                    {
                        this.MainStatus = "NMVN: Some extra thing received: " + stringReadFrom;
                        returnValue     = true; // GlobalVariables.DominoProductCounter[(int)this.DominoPrinterNameID]++;
                    }
                    else if (countPrintingACK > 1)
                    {
                        this.MainStatus = "NMVN: Receive more than one printing acknowledge, a message may printed more than one times";
                        returnValue     = true; // GlobalVariables.DominoProductCounter[(int)this.DominoPrinterNameID] = GlobalVariables.DominoProductCounter[(int)this.DominoPrinterNameID] + countPrintingACK;
                    }
                    else // countPrintingACK < 1    :   Fail
                    {
                        this.MainStatus = "NMVN: Random received: " + stringReadFrom;
                        returnValue     = false;
                    }
                }

                this.inkJetNetworkStream.ReadTimeout = -1; //Default = -1
                return(returnValue);
            }

            catch (Exception exception)
            {
                //Ignore when timeout
                if (exception.Message != "Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.")
                {
                    this.MainStatus = exception.Message;
                }

                this.inkJetNetworkStream.ReadTimeout = -1; //Default = -1
                return(false);
            }
        }
コード例 #5
0
 private void timerEverySecond_Tick(object sender, EventArgs e)
 {
     if (this.privateFillingLineData != null)
     {
         if (this.privateFillingLineData.SettingMonthID != GlobalStaticFunction.DateToContinuosMonth())
         {
             this.pictureBoxWarningNewMonth.Visible = !this.pictureBoxWarningNewMonth.Visible; this.labelWarningNewMonth.Visible = !this.labelWarningNewMonth.Visible;
         }
         else
         {
             this.pictureBoxWarningNewMonth.Visible = false; this.labelWarningNewMonth.Visible = false;
         }
     }
 }
コード例 #6
0
ファイル: DataMessageMaster.cs プロジェクト: Proerp/STS07JUL
        //Mr THẢO: LOGO: FF; THÉP: FE; SÓNG THẦN: FD; TÔN: FC; MẠ KẼM: FB; MẠ MÀU: FA; LẠNH: F9
        //BLOCK TEXT/COUNTER/LOGO: [BOLD/SYMBOL/CONTENT]
        //BOLD: 01|02
        //SYMBOL: TEXT | COUNTER: 38: (LARGE - LINE 1); 34 (SMALL LINE 1); 35 (SMALL LINE 2)
        //SYMBOL: LOGO: FF, FE, FD, FC, ..
        //CONTENT: TEXT: ASCCI TEXT, COUNTER: 1C, LOGO: 21


        private string ImageS8BlockTextCounterLogo(string hexBold, string hexSymbol, string textDescription, string listLogoGenerator)
        {
            if (listLogoGenerator != "")
            {
                string[] arrayLogoGenerator = listLogoGenerator.Split(";".ToCharArray());
                string   returnHexString = ""; int logoGeneratorNumber = 0; string logoHexContent = "21";

                string symbolGenerator = ""; string symbolNumber = "";

                foreach (string logoGenerator in arrayLogoGenerator)
                {
                    // LEMINHHIEP04NOV2017: IMAJES8: CLASSIC PRINTER. symbolNumber IS ALWAY 21H
                    // IMAJE 9040: MASTER, IP65 PRINTER => symbolNumber: WILL BE: SYMBOL 1: 21H, SYMBOL 2: 22H, ... ETC
                    // HERE: WE SET LOGO FOR IMAGE 9040 LIKE THIS: 250-1, 250-2, 250-3 ===> THE SYMBOL IS 1, 2, 3 => WE NEED TO MAKE LIKE THIS: '2' + SYMBOL => '21', '22', '23' (HEX)
                    if (logoGenerator.IndexOf("-") > 0)
                    {
                        symbolGenerator = logoGenerator.Substring(0, logoGenerator.IndexOf("-"));
                        symbolNumber    = "2" + logoGenerator.Substring(logoGenerator.IndexOf("-") + 1); //'2' + SYMBOL => '21', '22', '23' (HEX)
                    }
                    else
                    {
                        symbolGenerator = logoGenerator;
                        symbolNumber    = logoHexContent;
                    }


                    if (int.TryParse(symbolGenerator, out logoGeneratorNumber))
                    {
                        returnHexString = returnHexString + hexBold + "," + logoGeneratorNumber.ToString("X2") + "," + symbolNumber + "," + this.ImageS8BlockTextCounterLogo(hexBold, hexSymbol, " ", ""); //Add BLANK after logo
                    }
                }
                return(returnHexString);
            }
            else
            if (textDescription != "")
            {
                return(hexBold + "," + hexSymbol + "," + GlobalStaticFunction.TextToHEX(textDescription + (textDescription.Substring(textDescription.Length - 1, 1) == " " ? "" : " ")));
            }
            else
            {
                return("");
            }
        }
コード例 #7
0
 private void timerEverySecond_Tick(object sender, EventArgs e)
 {
     try
     {
         this.toolStripTextBoxCurrentDate.TextBox.Text = DateTime.Now.ToString("dd/MM/yy");
         if (this.fillingLineData != null)
         {
             if (this.fillingLineData.SettingMonthID != GlobalStaticFunction.DateToContinuosMonth())
             {
                 this.toolStripButtonWarningNewMonth.Visible = !this.toolStripButtonWarningNewMonth.Visible; this.toolStripLabelWarningNewMonth.Visible = !this.toolStripLabelWarningNewMonth.Visible;
             }
             else
             {
                 this.toolStripButtonWarningNewMonth.Visible = false; this.toolStripLabelWarningNewMonth.Visible = false;
             }
         }
     }
     catch (Exception exception)
     {
         GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
     }
 }