示例#1
0
        public BlackScreen(int stationIndex, string endpoint_confname, string endpoint_address)
        {
            try
            {
                InitializeComponent();
                this.Load -= this.BlackScreen_Load;
                this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.BlackScreen_MouseDown);
                this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BlackScreen_MouseMove);

                this.myFormTimer              = new FormTimer();
                this.myFormTimer.CounterTick += new myEventHandler(timerHandler);
                this.stationIndex             = stationIndex; //Convert.ToInt32(Properties.Settings.Default.StationIndex);
                this.fLogMessage("Connect to Station #" + this.stationIndex.ToString() + " ...");
                this.laStation.Text = "Station ID: " + stationIndex.ToString();

                this.laFinishBtnValue.TextChanged += new EventHandler(finishButtonPressed_handler);
                this.laStopBtnValue.TextChanged   += new EventHandler(stopButtonPressed_handler);
                this.laHelpBtnValue.TextChanged   += new EventHandler(helpButtonPressed_handler);
                this.laBitState.TextChanged       += new EventHandler(laBitState_TextChanged);

                this.timerStop.Tick += new EventHandler(timerStop_Tick);
                this.myLineClient    = new ServiceReference2.AssembLineClient(endpoint_confname, endpoint_address);
                this.connected       = true;
                this.laBitState.Text = "0";

                mplayer = new MediaClient.MediaPlayer(this);
            }
            catch (Exception ex)
            {
                this.myLog.LogAlert(AppLog.AlertType.Error, "Client", ex.Message);
            }
        }
示例#2
0
        public BlackScreen()
        {
            try
            {
                InitializeComponent();
                this.myFormTimer              = new FormTimer();
                this.myFormTimer.CounterTick += new myEventHandler(timerHandler);
                this.stationIndex             = Convert.ToInt32(Properties.Settings.Default.StationIndex);
                this.fLogMessage("Connect to Station #" + this.stationIndex.ToString() + " ...");
                this.laStation.Text = "Station ID: " + stationIndex.ToString();

                this.laFinishBtnValue.TextChanged += new EventHandler(finishButtonPressed_handler);
                this.laStopBtnValue.TextChanged   += new EventHandler(stopButtonPressed_handler);
                this.laHelpBtnValue.TextChanged   += new EventHandler(helpButtonPressed_handler);
                this.laBitState.TextChanged       += new EventHandler(laBitState_TextChanged);

                this.formSize = this.Size;

                this.timerStop.Tick += new EventHandler(timerStop_Tick);
                this.myLineClient    = new ServiceReference2.AssembLineClient();
                this.connected       = true;
                this.laBitState.Text = "0";

                mplayer = new MediaClient.MediaPlayer(this);
            }
            catch (Exception ex)
            {
                this.myLog.LogAlert(AppLog.AlertType.Error, "Client", ex.Message);
            }
        }
示例#3
0
        public BlackScreen1920()
        {
            InitializeComponent();
            this.myLineClient             = new ServiceReference2.AssembLineClient();
            this.myFormTimer              = new FormTimer();
            this.myFormTimer.CounterTick += new myEventHandler(timerHandler);
            this.stationIndex             = Convert.ToInt32(Properties.Settings.Default.StationIndex);
            this.fLogMessage("Connect to Station #" + this.stationIndex.ToString() + " ...");
            this.laStation.Text = "Station ID: " + stationIndex.ToString();

            this.laFinishBtnValue.TextChanged += new EventHandler(finishButtonPressed_handler);
            this.laStopBtnValue.TextChanged   += new EventHandler(stopButtonPressed_handler);
            this.laHelpBtnValue.TextChanged   += new EventHandler(helpButtonPressed_handler);


            this.timerStop.Tick += new EventHandler(timerStop_Tick);
        }
示例#4
0
        private void timerHandler()
        {
            this.laTime.Text = DateTime.Now.ToLongTimeString().ToString();
            try
            {
                if (!this.connected)
                {
                    this.myLineClient = new ServiceReference2.AssembLineClient();
                    this.connected    = true;
                }

                ServiceReference2.ClientInstruction instruction = myLineClient.GetClientInstruction();
                switch (instruction.Mode)
                {
                case 1:
                    mplayer.PlayVideo("http://localhost:8080/shark.flv");
                    break;

                case 2:
                    mplayer.ShowPicture("http://localhost:8080/pic.jpg");
                    break;

                default:
                    mplayer.ResetView();
                    break;
                }

                if (instruction.Mode != 0)
                {
                    return;
                }

                //ServiceReference2.StationRealtimeData[] lineData = myLineClient.ReadRealTimeDataForLine(1);
                //ServiceReference2.StationRealtimeData[] stationData = myLineClient.ReadRealTimeData(this.stationIndex);

                ServiceReference2.StationRealtimeData[] stationData = myLineClient.ReadRealTimeDataForLine(this.stationIndex);

                this.laLive.Text = formatCounter(Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("LIVE")).Value));

                int counter     = 0;
                int taktCounter = Convert.ToInt32(stationData.First(p => p.Key.Equals("T")).Value);

                int codeWord = this.getButtonsWord();
                if ((codeWord & 0x0008) == 0x0008) //stop
                {
                    counter = Convert.ToInt32(stationData.First(p => p.Key.Equals("TIMER_STOPLAST")).Value);
                }
                else if (
                    (((BSFlag)codeWord & BSFlag.Late) == BSFlag.Late)
                    & (((BSFlag)codeWord & BSFlag.LiveLate) == BSFlag.LiveLate)
                    & (((BSFlag)codeWord & BSFlag.Finished) == 0)
                    )
                {
                    counter = Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("LIVE")).Value);


                    int tmp = Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("TIMER_SumLate")).Value);
                    //if ((tmp > 0) & (counter < 0))
                    //{
                    counter = -tmp;
                    //}

                    //counter = -Convert.ToInt32(stationData.First(p => p.Key.Equals("TIMER_STOP")).Value);
                    ////counter = -Convert.ToInt32(stationData.First(p => p.Key.Equals("TIMER_Late")).Value);
                }
                else if (
                    ((((BSFlag)codeWord & BSFlag.Late) == BSFlag.Late)
                     & (((BSFlag)codeWord & BSFlag.LiveLate) == BSFlag.LiveLate)
                     & (((BSFlag)codeWord & BSFlag.Finished) == BSFlag.Finished))

                    | ((((BSFlag)codeWord & (BSFlag.Finished | BSFlag.LiveLate)) == (BSFlag.Finished | BSFlag.LiveLate))
                       & (((BSFlag)codeWord & ~BSFlag.Late & ~BSFlag.Outgo) == (BSFlag)codeWord))

                    )
                {
                    counter = -Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("TIMER_STOP")).Value);
                }

                else if ((codeWord & (int)BSFlag.Late) == (int)BSFlag.Late)
                {
                    counter = taktCounter;
                }
                else
                {
                    counter = taktCounter;
                }

                this.laMem.Text      = formatCounter(counter);
                this.laTimeLeft.Text = formatCounter(taktCounter);

                ////---------------------------------------------------
                //// DEBUG - section begin
                //    string buttonsWord = this.getButtonsWord().ToString("X4");
                //    string TIMER_Late = stationData.First(p => p.Key.Equals("TIMER_Late")).Value;
                //    string TIMER_STOPLAST = stationData.First(p => p.Key.Equals("TIMER_STOPLAST")).Value;
                //    string message = String.Format("counter={0}, taktCounter={1}, TIMER_Late={2}, TIMER_STOPLAST={3}, buttonsWord={4}",
                //        counter.ToString(), taktCounter.ToString(), TIMER_Late, TIMER_STOPLAST, buttonsWord);
                //    this.myLog.LogAlert(AppLog.AlertType.System, "Client", message);
                //// DEBUG - section end
                ////---------------------------------------------------

                this.laStation.Text = "Station ID: " + stationData.First(p => p.Key.Equals("S")).Value;
                this.laProduct.Text = "Batch: " + stationData.First(p => p.Key.Equals("B")).Value;
                this.laFrame.Text   = stationData.First(p => p.Key.Equals("F")).Value;

                this.laSumstopValue.Text  = formatCounter(Convert.ToInt32(stationData.First(p => p.Key.Equals("TIMER_STOP")).Value));
                this.laHelpTimeValue.Text = formatCounter(Convert.ToInt32(stationData.First(p => p.Key.Equals("TIMER_HELP")).Value));

                this.laPlanValue.Text      = Convert.ToInt32(stationData.First(p => p.Key.Equals("GAP_DAY")).Value).ToString();
                this.laMonthplanValue.Text = Convert.ToInt32(stationData.First(p => p.Key.Equals("GAP_MONTH")).Value).ToString();
                this.laMessage.Text        = ""; // empty string if connected

                int dayPlan = 98;
                int dayFact = 98;

                dayPlan = (stationData.FirstOrDefault(p => p.Key.Equals("REGP.D")) != null) ?
                          Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("REGP.D")).Value) : 99;

                dayFact = (stationData.FirstOrDefault(p => p.Key.Equals("REGF.D")).Value != null) ?
                          Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("REGF.D")).Value) : 99;

                this.laDayPlan.Text = "DPF: " + dayPlan.ToString() + "/" + dayFact.ToString();


                int monthPlan = 98;
                int monthFact = 98;

                monthPlan = (stationData.FirstOrDefault(p => p.Key.Equals("REGP.M")) != null) ?
                            Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("REGP.M")).Value) : 99;

                monthFact = (stationData.FirstOrDefault(p => p.Key.Equals("REGF.M")).Value != null) ?
                            Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("REGF.M")).Value) : 99;

                this.laMonthPlan.Text = "MPF: " + monthPlan.ToString() + "/" + monthFact.ToString();



                this.laFinishBtnValue.Text = stationData.First(p => p.Key.Equals("FINISH")).Value.ToString();
                this.laStopBtnValue.Text   = stationData.First(p => p.Key.Equals("STOP")).Value.ToString();
                this.laHelpBtnValue.Text   = stationData.First(p => p.Key.Equals("HELP")).Value.ToString();

                //int bitState = Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("BST")).Value.ToString());

                int newBitWord = Convert.ToInt32(stationData.FirstOrDefault(p => p.Key.Equals("BST")).Value.ToString());
                newBitWord = newBitWord & (int)~BSFlag.Blocked; // useless bit "Blocked"

                //int curBitWord = Convert.ToInt32(this.laBitState.Text);
                //newBitWord = (curBitWord & 0x0F00) + (newBitWord & 0x00F0);
                this.laBitState.Text  = newBitWord.ToString();
                this.laBitState2.Text = "BS: " + newBitWord.ToString("X");//String.Format("{0:X}", newBitWord);
            }

            catch (System.ServiceModel.EndpointNotFoundException e)
            {
                this.connected = false;
                this.myLineClient.Abort();
                this.myLog.LogAlert(AlertType.System, this.GetType().ToString(), e.Message.ToString());
                this.laMessage.Text = "Connecting " + new String('.', (this.myFormTimer.Counter % 4));
                this.myLog.LogAlert(AppLog.AlertType.Error, "Client", e.Message);
            }
            catch (System.TimeoutException e)
            {
                this.connected = false;
                this.myLineClient.Abort();
                this.myLog.LogAlert(AlertType.System, this.GetType().ToString(), e.Message.ToString());
                this.laMessage.Text = "Connecting " + new String('.', (this.myFormTimer.Counter % 4));
                this.myLog.LogAlert(AppLog.AlertType.Error, "Client", e.Message);
            }
            catch (Exception e1)
            {
                this.connected = false;
                if (this.myLineClient != null)
                {
                    this.myLineClient.Abort();
                }
                this.myLog.LogAlert(AlertType.System, this.GetType().ToString(), e1.Message.ToString());
                this.myLog.LogAlert(AppLog.AlertType.Error, "Client", e1.Message);
            }
        }