public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            m_version = reader.ReadInt();

            switch (m_version)
            {
            case 1:
            {
                goto case 0;
            }

            case 0:
            {
                m_Focus = reader.ReadMobile();

                if (m_Focus != null)
                {
                    m_AttackTimer = new AttackTimer(this);
                    m_AttackTimer.Start();
                }
                else
                {
                    m_IdleTimer = new IdleTimer(this, m_LastFocus, PoofingGuard);
                    m_IdleTimer.Start();
                }

                break;
            }
            }
        }
Beispiel #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_Focus = reader.ReadMobile();

                if (m_Focus != null)
                {
                    m_AttackTimer = new AttackTimer(this);
                    m_AttackTimer.Start();
                }
                else
                {
                    m_IdleTimer = new IdleTimer(this);
                    m_IdleTimer.Start();
                }

                break;
            }
            }
        }
        private async void btnSubmitError_Click(object sender, EventArgs e)
        {
            DowntimeTimer.Stop();

            try
            {
                //await _connection.InvokeAsync("Send", "WinFormsApp", messageTextBox.Text);
                await _connection.InvokeAsync("SendMachineError", DateTime.Now.ToString(), cmbErrorReason.Text, txtErrorDescription.Text);

                Log(Color.Brown, "SendError to server " + ": " + cmbErrorReason.Text, messagesList);
            }
            catch (Exception ex)
            {
                Log(Color.Red, ex.ToString(), messagesList);
                serverRequestData   = false;
                countSenddataToHubs = 0;
            }

            txtErrorDescription.Text = "";
            //Send data Hubs

            tikerTime                   = DateTime.Now.TimeOfDay;
            countIdletimes              = tikerTime - startTime - countRunningtimes - countDownTimetimes - countSettingtimes;
            bbcountIdletimes            = countIdletimes;
            PanelAlertMessage.BackColor = Color.DarkOrange;

            IdleTimer.Start();
        }
        private void btnResetConfig_Click(object sender, EventArgs e)
        {
            PanelAlertMessage.BackColor = Color.Gray;
            lbAlertMessage.Text         = "RESET TIME";
            lbAlertMessage.Left         = (PanelAlertMessage.Width - lbAlertMessage.Width) / 2;

            //reset data and save to local
            IdleTimer.Stop();
            RuningTimer.Stop();
            SettingTimer.Stop();
            DowntimeTimer.Stop();

            countSettingtimes  = new TimeSpan(0);
            countIdletimes     = new TimeSpan(0);
            countDownTimetimes = new TimeSpan(0);
            countRunningtimes  = new TimeSpan(0);

            txtRunningTimes.Text = "00h:00m:00s";
            txtSettingTimes.Text = "00h:00m:00s";
            txtDownTimes.Text    = "00h:00m:00s";
            txtIdleTimes.Text    = "00h:00m:00s";


            Properties.Settings.Default.RunningTimes = countRunningtimes;
            Properties.Settings.Default.DownTimes    = countDownTimetimes;
            Properties.Settings.Default.SettingTimes = countSettingtimes;

            Properties.Settings.Default.Save();

            planQty         = 0;
            expectValue     = 0;
            totalInputValue = 0;
            totalPassValue  = 0;
            yieldValue      = 0.0;
            OEEValue        = 0.0;

            expectRatio = 0;
            qtyPerInput = 0;

            txtQtyPlan.Text   = planQty.ToString();
            txtQtyExpect.Text = expectValue.ToString();
            txtQtyInput.Text  = totalInputValue.ToString();
            btnQtyPass.Text   = totalPassValue.ToString();
            txtQtyYield.Text  = yieldValue.ToString("N2") + "%";
            txtOEEvalue.Text  = OEEValue.ToString("N3") + "%";

            tikerTime                   = DateTime.Now.TimeOfDay;
            countIdletimes              = tikerTime - startTime - countRunningtimes - countDownTimetimes - countSettingtimes;
            bbcountIdletimes            = countIdletimes;
            PanelAlertMessage.BackColor = Color.DarkOrange;
            IdleTimer.Start();
        }
        public async void Call()
        {
            try
            {
                //_webSocket.PopularNotifyPage("Meditech");
                if (await OpenMeditech(true))
                {
                    if (_core.TryGetAppBar(out IAppBar bar))
                    {
                        bar.Show();
                    }
                }
                await Task.Delay(1000);

                _timer.Start();
                _checker.Start();
            }
            catch
            {
                //Host.Window.SwitchToAppBar(null);
            }
        }
        private void btnStop_Click(object sender, EventArgs e)
        {
            getJobFromHubs     = false;
            txtBarcode.Enabled = true;
            txtBarcode.Text    = "SCAN BARCODE";
            txtMessage.Text    = "Machine is stop";
            RuningTimer.Stop();
            SettingTimer.Stop();
            DowntimeTimer.Stop();

            PanelAlertMessage.BackColor = Color.DarkOrange;
            tikerTime = DateTime.Now.TimeOfDay;

            countIdletimes   = tikerTime - startTime - countRunningtimes - countDownTimetimes - countSettingtimes;
            bbcountIdletimes = countIdletimes;
            IdleTimer.Start();
        }
        public async Task ProcessStart(ActionButtonModel action)
        {
            if (_action != null)
            {
                throw new InvalidOperationException("Cannot start a new process if another one is running");
            }
            _action = action;
            if (!string.IsNullOrEmpty(_action.Settings.PreRunScript))
            {
                try
                {
                    await ExecuteScriptAsync(_action.Settings.PreRunScript);
                }
                catch (Exception ex)
                {
                    _core.Logger.Error(this, $"PreRun script failed with message: {ex.Message}");
                    OnProcessCompleted();
                    return;
                }
            }
            try
            {
                var mainProcess = new Process
                {
                    StartInfo = new ProcessStartInfo(_action.Settings.Path)
                    {
                        Arguments = _action.Settings.ProgramParams ?? ""
                    }
                };

                mainProcess.Start();
                mainProcess.WaitForInputIdle();
                _processTimer = new IdleTimer(TimeSpan.FromSeconds(_action.Settings.IdleTime * 1000 * 60));
                _processTimer.Start();

                _processTimer.Tick += ProcessTimerCheck;
            }
            catch (Exception ex)
            {
                _core.Logger.Error(this, $"Main process failed with message: {ex.Message}");
                OnProcessCompleted();
                return;
            }
        }
        private async void ProcessTimerCheck(object sender, EventArgs e)
        {
            var isRunning = await IsRunning();

            if (_action.Settings.IdleTime != 0 && isRunning)
            {
                await CloseCurrentAction();

                return;
            }
            if (isRunning)
            {
                _processTimer.Start();
                return;
            }

            await CloseCurrentAction();

            //Console.WriteLine(isRunning);
        }
Beispiel #9
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_IsAutoGuard = reader.ReadBool();
                goto case 0;
            }

            case 0:
            {
                if (version < 1)
                {
                    m_IsAutoGuard = true;
                }
                m_Focus = reader.ReadMobile();

                if (m_Focus != null)
                {
                    m_AttackTimer = new AttackTimer(this);
                    m_AttackTimer.Start();
                }
                else if (m_IsAutoGuard)
                {
                    m_IdleTimer = new IdleTimer(this);
                    m_IdleTimer.Start();
                }

                break;
            }
            }
        }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					m_Focus = reader.ReadMobile();

					if ( m_Focus != null )
					{
						m_AttackTimer = new AttackTimer( this );
						m_AttackTimer.Start();
					}
					else
					{
						m_IdleTimer = new IdleTimer( this );
						m_IdleTimer.Start();
					}

					break;
				}
			}
		}
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 1:
                {
                    m_IsAutoGuard = reader.ReadBool();
                    goto case 0;
                }
                case 0:
                {
                    if ( version < 1 )
                        m_IsAutoGuard = true;
                    m_Focus = reader.ReadMobile();

                    if ( m_Focus != null )
                    {
                        m_AttackTimer = new AttackTimer( this );
                        m_AttackTimer.Start();
                    }
                    else if ( m_IsAutoGuard )
                    {
                        m_IdleTimer = new IdleTimer( this );
                        m_IdleTimer.Start();
                    }

                    break;
                }
            }
        }
        private void updateChartTimer_Tick(object sender, EventArgs e)
        {
            if ((DateTime.Now.TimeOfDay >= endTime) && (DateTime.Now.TimeOfDay > startTime))
            {
                if (resetDone == false)
                {
                    resetDone = true;
                    //startTime =startTime.Subtract(new TimeSpan(1, 0, 0, 0));
                    txtMessage.Text = "Stop all process because now is reset data time !!!";
                    //send data to server



                    //reset data and save to local
                    IdleTimer.Stop();
                    RuningTimer.Stop();
                    SettingTimer.Stop();
                    DowntimeTimer.Stop();

                    countSettingtimes  = new TimeSpan(0);
                    countIdletimes     = new TimeSpan(0);
                    countDownTimetimes = new TimeSpan(0);
                    countRunningtimes  = new TimeSpan(0);

                    txtRunningTimes.Text = "00h:00m:00s";
                    txtSettingTimes.Text = "00h:00m:00s";
                    txtDownTimes.Text    = "00h:00m:00s";
                    txtIdleTimes.Text    = "00h:00m:00s";


                    Properties.Settings.Default.RunningTimes = countRunningtimes;
                    Properties.Settings.Default.DownTimes    = countDownTimetimes;
                    Properties.Settings.Default.SettingTimes = countSettingtimes;

                    Properties.Settings.Default.Save();

                    lbAlertMessage.Text         = "RESET TIME";
                    PanelAlertMessage.BackColor = Color.Gray;
                    lbAlertMessage.Left         = (PanelAlertMessage.Width - lbAlertMessage.Width) / 2;
                }
                else
                {
                    lbAlertMessage.Text         = "END PROCESS TIME";
                    PanelAlertMessage.BackColor = Color.DarkOrange;
                    lbAlertMessage.Left         = (PanelAlertMessage.Width - lbAlertMessage.Width) / 2;
                    txtMessage.Text             = "Now is End of Process time";
                }
            }
            else if ((DateTime.Now.TimeOfDay < endTime) && (DateTime.Now.TimeOfDay > startTime))
            {
                TimeSpan countAlltime = countSettingtimes + countIdletimes + countDownTimetimes + countRunningtimes;

                if (countSettingtimes.TotalSeconds > 0)
                {
                    chart1.Series[0].Points[0].SetValueY((double)(countSettingtimes.TotalSeconds * 100 / (countAlltime.TotalSeconds)));
                }
                if (countIdletimes.TotalSeconds > 0)
                {
                    chart1.Series[0].Points[1].SetValueY((double)(countIdletimes.TotalSeconds * 100 / (countAlltime.TotalSeconds)));
                }
                if (countDownTimetimes.TotalSeconds > 0)
                {
                    chart1.Series[0].Points[2].SetValueY((double)(countDownTimetimes.TotalSeconds * 100 / (countAlltime.TotalSeconds)));
                }
                if (countRunningtimes.TotalSeconds > 0)
                {
                    chart1.Series[0].Points[3].SetValueY((double)(countRunningtimes.TotalSeconds * 100 / (countAlltime.TotalSeconds)));
                }

                calYieldandOEE();


                chart1.Refresh();

                resetDone = false;

                if (!DowntimeTimer.Enabled && !SettingTimer.Enabled && !RuningTimer.Enabled && !IdleTimer.Enabled)
                {
                    txtMessage.Text             = "Please key or scan job barcode before start process";
                    tikerTime                   = DateTime.Now.TimeOfDay;
                    countIdletimes              = tikerTime - startTime - countRunningtimes - countDownTimetimes - countSettingtimes;
                    bbcountIdletimes            = countIdletimes;
                    PanelAlertMessage.BackColor = Color.DarkOrange;
                    IdleTimer.Start();
                }
            }
        }
        public ChatForm()
        {
            InitializeComponent();

            txtAddressHubs.Text = Properties.Settings.Default.AddressHubs;
            txtAdminUsers.Text  = Properties.Settings.Default.AdminName;
            txtPassword.Text    = Properties.Settings.Default.AdminPassword;
            txtCompanyName.Text = Properties.Settings.Default.CompanyName;
            txtMachineName.Text = Properties.Settings.Default.MachineName;

            countRunningtimes  = Properties.Settings.Default.RunningTimes;
            countDownTimetimes = Properties.Settings.Default.DownTimes;
            countSettingtimes  = Properties.Settings.Default.SettingTimes;

            startTime = Properties.Settings.Default.StartTime;
            endTime   = Properties.Settings.Default.EndTime;

            dtStartTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, startTime.Hours, startTime.Minutes, startTime.Seconds);
            dtEndTime.Value   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, endTime.Hours, endTime.Minutes, endTime.Seconds);

            //startTime = DateTime.Now.TimeOfDay.Add(new TimeSpan(0,0,20));


            if (startTime > DateTime.Now.TimeOfDay)
            {
                countSettingtimes           = new TimeSpan(0, 0, 0);
                countIdletimes              = new TimeSpan(0);
                countDownTimetimes          = new TimeSpan(0, 0, 0);
                countRunningtimes           = new TimeSpan(0, 0, 0);
                lbAlertMessage.Text         = "Wait Until To Start Time";
                lbAlertMessage.Left         = (PanelAlertMessage.Width - lbAlertMessage.Width) / 2;
                PanelAlertMessage.BackColor = Color.DarkCyan;
                txtMessage.Text             = "Waiting...";
            }
            else
            {
                tikerTime        = DateTime.Now.TimeOfDay;
                countIdletimes   = tikerTime - startTime - countRunningtimes - countDownTimetimes - countSettingtimes;
                bbcountIdletimes = countIdletimes;
                IdleTimer.Start();
            }

            currentTimer.Start();
            updateChartTimer.Start();


            txtStartTime.Text    = startTime.ToString("hh'h:'mm'm:'ss's'");
            txtEndTime.Text      = endTime.ToString("hh'h:'mm'm:'ss's'");
            txtRunningTimes.Text = countRunningtimes.ToString("hh'h:'mm'm:'ss's'");
            txtDownTimes.Text    = countDownTimetimes.ToString("hh'h:'mm'm:'ss's'");
            txtIdleTimes.Text    = countIdletimes.ToString("hh'h:'mm'm:'ss's'");
            txtSettingTimes.Text = countSettingtimes.ToString("hh'h:'mm'm:'ss's'");


            chart1.Series[0].Points.AddXY("Setting", (int)countSettingtimes.TotalSeconds / 86400 * 100);
            chart1.Series[0].Points.AddXY("Idletime", (int)countIdletimes.TotalSeconds / 86400 * 100);
            chart1.Series[0].Points.AddXY("Downtime", (int)countDownTimetimes.TotalSeconds / 86400 * 100);
            chart1.Series[0].Points.AddXY("Running", (int)countRunningtimes.TotalSeconds / 86400 * 100);

            chart1.Series[0].Points[3].Color = Color.Lime;
        }
Beispiel #14
0
 public MusicPlayer()
 {
     InitializeComponent();
     IdleTimer.Start();
 }