Exemple #1
0
        // initial log
        public void InitLog()
        {
            // load configures
            using (DB_Manager.ConfigManagement cm = new DB_Manager.ConfigManagement())
            {
                /* ----------------------------------------------
                 * Log file.
                 * ----------------------------------------------*/
                string logPath;
                try
                {
                    logPath = cm.GetCharValue("VIS_LogPath");
                    if (logPath.Equals(""))
                    {
                        logPath = @"C:\BHM\Log\VISION";
                    }
                }
                catch { logPath = @"C:\BHM\Log\VISION"; }

                /* ----------------------------------------------
                 * Create log file
                 * ----------------------------------------------*/
                log = new LogFile.Log(logPath, "vision");

                // สร้าง timer

                // บันทึก
                log.AppendText("AUTO RUN CREATED.");
            }
        }
Exemple #2
0
        public MainWindow()
        {
            InitializeComponent();

            this.Title = "BO23 KIOSK (version " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + ")";

            /* -------------------------------------------------
             * เรียกค่าตั้งเริ่มต้นจากฐานข้อมูล
             * -------------------------------------------------*/
            string LogPath    = string.Empty;
            ushort dioCardNbr = 0;

            using (DB_Manager.ConfigManagement cm = new DB_Manager.ConfigManagement())
            {
                try { Testing = cm.GetIntValue("TESTING") == 1 ? true : false; }
                catch { Testing = false; }
                try { LogPath = cm.GetCharValue("KIOSK_LogPath"); }
                catch { LogPath = @"C:\BHM\Log\kiosk_gui"; }
                try { OrgCode = cm.GetCharValue("OrgCode"); }
                catch { OrgCode = "0689"; /* ซีพี-หนองจอก */ }
                try { dioCardNbr = (ushort)cm.GetIntValue("DIO_Card_Nbr"); }
                catch { dioCardNbr = 0 /*เข้าเป็นตัวแรก*/; }
            }
            log = new LogFile.Log(LogPath, "Main log");

            /* -------------------------------------------------
             * เขียนข้อความเริ่มต้น
             * -------------------------------------------------*/
            log.AppendText("-------------------------------------------------");
            log.AppendText("START NEW RUNNING.");
            log.AppendText("-------------------------------------------------");
            System.Diagnostics.Debug.WriteLine("-------------------------------------------------");
            System.Diagnostics.Debug.WriteLine("START NEW RUNNING.");
            System.Diagnostics.Debug.WriteLine("-------------------------------------------------");

            /* -------------------------------------------------
             * ติดตั้ง DIO กับระบบ
             * -------------------------------------------------*/
            DIO_Library.D7432.SetupLog();
            short  dioCode;
            string dioMessage;

            DIO_Library.D7432.Initial(dioCardNbr, out dioCode, out dioMessage);
            DIO_Library.D7432.Testing = false; //<-------------------------------------------------------------<-TESTING

            /* -------------------------------------------------
             * ติดตั้ง ระบบส่งหน้า ของ WPF
             * -------------------------------------------------*/
            pageTransControl.TransitionType = WpfPageTransitions.PageTransitionType.Appear;
            Helper.NewPage(this, PageName.SplashScreen);

            /* -------------------------------------------------
             * ติดตั้ง Events
             * -------------------------------------------------*/
            this.Loaded   += new RoutedEventHandler(MainWindow_Loaded);
            this.Unloaded += new RoutedEventHandler(MainWindow_Unloaded);
        }
Exemple #3
0
        public static void SetupLog()
        {
            string logPath = string.Empty;

            using (DB_Manager.ConfigManagement cm = new DB_Manager.ConfigManagement())
            {
                try { logPath = cm.GetCharValue("DIO_LogPath"); }
                catch { logPath = @"C:\BHM\BHMLog\DIO"; }
            }
            log = new LogFile.Log(logPath, "DIO");
        }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string LogPath = string.Empty;

            using (DB_Manager.ConfigManagement cm = new DB_Manager.ConfigManagement())
            {
                try { LogPath = cm.GetCharValue("Motion_Card_Log_Path"); }
                catch { LogPath = @"C:\TestLog\Test"; }
            }
            log = new LogFile.Log(LogPath, "Test log");
        }
        public RC522MegawinReader(int readTimeout, string portName)
        {
            string logPath = string.Empty;

            using (DB_Manager.ConfigManagement cm = new DB_Manager.ConfigManagement())
            {
                try { logPath = cm.GetCharValue("RFID_Reader_LogPath"); }
                catch { logPath = @"C:\BHM\BHMlog\RFID_Reader"; }
            }
            log = new LogFile.Log(logPath, "RFID_Reader");

            _readTimeout = readTimeout;
            _portName    = portName;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="portName"></param>
        /// <param name="baudRate"></param>
        /// <param name="dataBits"></param>
        /// <param name="parity"></param>
        /// <param name="stopBits"></param>
        public SimpleSerialText(string portName, int baudRate, int dataBits, Parity parity, StopBits stopBits, Handshake handshake)
        {
            this.PortName  = portName;
            this.BaudRate  = baudRate;
            this.DataBits  = dataBits;
            this.Parity    = parity;
            this.StopBits  = stopBits;
            this.Handshake = handshake;

            if (_Log == null)
            {
                _Log = new LogFile.Log(@"C:\Log\Serial", @"Serial Text");
            }
            if (sp == null)
            {
                this.sp = new SerialPort();
            }
        }
Exemple #7
0
        public TMT82_Printer(string printer_name)
        {
            /* -----------------------------------------
             * LOG PATH
             * -----------------------------------------*/
            string logPath = string.Empty;

            using (DB_Manager.ConfigManagement cm = new DB_Manager.ConfigManagement())
            {
                try { logPath = cm.GetCharValue("Printer_LogPath"); }
                catch { logPath = @"C:\BHM\BHMlog\TMT82_Printer"; }
            }
            log = new LogFile.Log(logPath, "TMT82_Printer");

            /* -----------------------------------------
             * Create  status API
             * -----------------------------------------*/
            this.PRINTER_NAME = printer_name;
            _objAPI           = new StatusAPI();
        }
Exemple #8
0
        /// <summary>
        /// Constructor
        /// </summary>
        public VISCOM()
        {
            /* -----------------------------------------
             * LOG PATH
             * -----------------------------------------*/
            string logPath = string.Empty;

            using (DB_Manager.ConfigManagement cm = new DB_Manager.ConfigManagement())
            {
                try { logPath = cm.GetCharValue("VISCOM_LogPath"); }
                catch { logPath = @"C:\BHM\BHMLog\VISCOM"; }
            }
            log = new LogFile.Log(logPath, "VISCOM");

            /* ล้างค่า */
            _lastResult.IncomeMessage = "";
            _lastResult.Result        = VisionResult.NG;
            _lastResult.Count         = 0;
            _lastResult.RespondedCode = 0;
            _lastResult.Message       = "";
        }