Exemplo n.º 1
0
        //
        public MainWindow()
        {
            InitializeComponent();

            testLedCom = new LEDDrive();

            LEDUI.DataContext = ledData;

            ledData.content = "欢迎公司领导检查指导!";
            ledData.Color   = "黄";
            //ledData.ChineseFont = "中文字体";
            textBox11.IsEnabled = false;
            //ledData.EnglishFont = "英文字体";
            textBox12.IsEnabled = false;

            ledData.IP = "192.168.1.100";//10.136.165.212
            //ledData.Left = "10";
            textBox9.IsEnabled = false;

            //ledData.Top = "20";
            textBox10.IsEnabled = false;

            //ledData.W_Width = "100";
            textBox6.IsEnabled = false;

            //ledData.W_Height = "200";
            textBox5.IsEnabled = false;

            //ledData.X = "5";
            textBox3.IsEnabled = false;

            //ledData.Y = "5";
            textBox4.IsEnabled = false;

            ledData.FontSize = "32*32";

            //textBox13
            ledData.LEDPort = "1023";

            try
            {
                bInitSuccess = testLedCom.InitializeSCL() == 0 ? true : false;

                if (!bInitSuccess)
                {
                    MessageBox.Show(this, "初始化LED库失败!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "testLedCom LED库失败!");
            }

            BtnSendContent.IsEnabled = false;
        }
Exemplo n.º 2
0
        protected override void OnStart(string[] args)
        {
            LogHelper.WriteWithMethod($"State:OnStart");
            try
            {
                if (tcpListenerServer == null)
                {
                    InitTCPServer();
                }
                string path = Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
                path = $"\"{Path.Combine(path, "LEDEngine.dll")}\"";
                LogHelper.WriteWithMethod(path);
                Cmd.Instance.Regsvr32(path);
                try
                {
                    ledCom       = new LEDDrive();
                    bInitSuccess = ledCom.InitializeSCL() == 0 ? true : false;

                    if (!bInitSuccess)
                    {
                        LogHelper.WriteWithMethod("初始化LED库失败!");

                        Stop();
                        return;
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteWithMethod("LedCom LED库失败!");
                    Stop();
                    return;
                    //throw ex;
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteException(ex);
                Stop();
                return;
            }

            base.OnStart(args);
        }