Пример #1
0
 /// <summary>
 /// Clicking the Stop button
 /// </summary>
 private void Stop_Click(object sender, EventArgs e)
 {
     // stop the timer
     textBoxMusicProgram.Enabled = true;
     textBoxDelay.Enabled        = true;
     TheTimer.Stop();
 }
Пример #2
0
 // Start is called before the first frame update
 void Start()
 {
     //ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.JG_OTHER_EVENT, otherEvent), this);
     ObjectEventDispatcher.dispatcher.addEventListener(EventTypeName.JG_OTHER_EVENT, GetJGEvent);
     if (!_theTime)
     {
         _theTime = GetComponent <TheTimer>();
     }
 }
Пример #3
0
 private void ToolStripButton2_Click(object sender, EventArgs e)
 {
     //TheTimer.Enabled = false;
     TheTimer.Stop();
     IsRunning             = false;
     propertyGrid1.Enabled = true;
     btnStart.Enabled      = true;
     btnStop.Enabled       = false;
     statusPanel.Text      = "off";
 }
Пример #4
0
 void Daojishi(int n)
 {
     if (!jishiTime)
     {
         jishiTime = new TheTimer();
     }
     jishiTime.GetStopByTime(n);
     isDaojishi = true;
     print("倒计时开始" + n + "秒!");
 }
Пример #5
0
 // Start is called before the first frame update
 void Start()
 {
     if (!_TheTimer)
     {
         _TheTimer = GetComponent <TheTimer>();
     }
     if (huoyan)
     {
         huoyan.Stop();
     }
     HitKuai.SetActive(false);
     TheLight.gameObject.SetActive(false);
 }
Пример #6
0
    public static void UseTimers()
    {
        // Create objects
        TheTimer         theTimer = new TheTimer();
        HandlerFunctions handler1 = new HandlerFunctions();
        HandlerFunctions handler2 = new HandlerFunctions();

        // SUbscribe events
        theTimer.OnTimer += handler1.HandleTimer;
        theTimer.OnTimer += handler2.HandleTimer;
        // un-susbcribe
        theTimer.OnTimer -= handler1.HandleTimer;
    }
Пример #7
0
 private void OnEnable()
 {
     HitFK.SetActive(true);
     ZhuTX.gameObject.SetActive(true);
     if (!_jnDate)
     {
         _jnDate = GetComponent <JN_Date>();
     }
     if (!_theTime)
     {
         _theTime = GetComponent <TheTimer>();
     }
     _theTime.TimesAdd(_jnDate.TXDisTime, DisTX);
     //print("-----------------------> zhutexiao  延迟消失的时间  ");
 }
Пример #8
0
        /// <summary>
        /// Clicking the Start button
        /// </summary>
        private void buttonStart_Click(object sender, EventArgs e)
        {
            string musicProgramName        = textBoxMusicProgram.Text.Trim();
            string musicProgramWindowTitle = GetWindowTitleFromProcessByName(musicProgramName);
            int    musicProgramId          = GetIdFromProcessByName(musicProgramName);

            // show info about the music program
            DisplayMusicProgramInfo(musicProgramId, musicProgramName);

            // start the timer
            textBoxMusicProgram.Enabled = false;
            textBoxDelay.Enabled        = false;
            TheTimer.Interval           = ToInteger(textBoxDelay.Text.Trim());
            TheTimer.Start();
        }
Пример #9
0
 private void TheTimer_Tick(object sender, EventArgs e)
 {
     try
     {
         _timeSpan          = DateTime.Now - _past;
         toolPanelTime.Text = ElapsedTime = _timeSpan.Minutes.ToString() + ":" + _timeSpan.Seconds.ToString();
         ///Запускает эмулицию продукции на производстве
         Simulation();
     }
     catch (Exception ex)
     {
         TheTimer.Stop();
         MessageBox.Show(ex.Message);
         //return;
     }
 }
Пример #10
0
        private void LoadConfiguration()
        {
            // from https://www.c-sharpcorner.com/article/four-ways-to-read-configuration-setting-in-c-sharp/
            var url                  = ConfigurationManager.AppSettings["url"];
            var currency             = ConfigurationManager.AppSettings["currency"];
            var refreshRateInSeconds = ConfigurationManager.AppSettings["refreshRateInSeconds"];

            // cb url
            cbRateURL = url + currency;

            // start the timer
            TheTimer.Interval = Convert.ToInt32(refreshRateInSeconds) * 1000;
            TheTimer.Start();

            // show the rate for the first time before the timer kicks in
            UpdateRate();
        }
Пример #11
0
        private void Source_OnEmpty(object sender, EventArgs e)
        {
            TheTimer.Stop();
            TheTimer.Enabled = false;
            IsRunning        = false;
            MessageBox.Show("Источник пуст!");
            Statisctics statisctics = new Statisctics()
            {
                Count       = this.Count,
                CrashCount  = this.CrashCount,
                ElapsedTime = this.ElapsedTime
            };

            if (CreateStatisctics(statisctics))
            {
                toolStripButtonStatisctics.Enabled = true;
                toolStripButtonStatisctics.Checked = true;
                btnStop.PerformClick();
                statusPanel.Text = "complete";
            }
        }
Пример #12
0
 private void ToolStripButton4_Click(object sender, EventArgs e)
 {
     TheTimer.Stop();
     IsRunning        = false;
     btnStart.Enabled = true;
 }
Пример #13
0
        private void ToolStripButton1_Click(object sender, EventArgs e)
        {
            try
            {
                ValidateInput(out int elements, out int interval);
                Count = elements;
                //preparing
                var source      = gViewer.Entities.Select(s => s.DrawingObject).FirstOrDefault(s => s.UserData is Source <ProductBase>) as Node;
                var seed        = gViewer.Entities.Select(s => s.DrawingObject).FirstOrDefault(s => s.UserData is Seed <ProductBase>) as Node;
                var productType = _factory.CreateProduct(Convert.ToInt32((source.UserData as Source <ProductBase>).Id));

                //Updatin for new run
                ResetSS(elements, interval, source, seed, productType);
                UpdateNodes <ProductBase>(source, seed);
                _objectsSequence.Clear();
                GetSequence(source, ref _objectsSequence);
                _objectsSequence.Reverse();

                if (_objectsSequence is null || _objectsSequence.Count < 2)
                {
                    throw new ArgumentNullException("Последовательность не может быть пуста");
                }
                if (_objectsSequence.FirstOrDefault() is Source <ProductBase> == false)
                {
                    throw new ArgumentNullException("Генератор продуктов должен начинать последовательность");
                }
                if (_objectsSequence.LastOrDefault() is Seed <ProductBase> == false)
                {
                    throw new ArgumentNullException("Утилизатор продуктов должен заканчивать последовательность");
                }

                //adding connections
                for (int current = 0, next = 1; current < _objectsSequence.Count; current++, next++)
                {
                    if (next < _objectsSequence.Count)
                    {
                        _objectsSequence[next].JoinPrevious(_objectsSequence[current]);
                    }
                }

                _past                 = DateTime.Now;
                IsRunning             = true;
                propertyGrid1.Enabled = false;
                btnStart.Enabled      = false;
                btnStop.Enabled       = true;
                toolStripButtonStatisctics.Enabled = false;
                statusPanel.Text = "on";
                //run
                TheTimer.Start();
            }
            catch (ArgumentNullException nullExp)
            {
                MessageBox.Show(nullExp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            catch (ArgumentException argExp)
            {
                MessageBox.Show(argExp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            catch (Exception)
            {
                MessageBox.Show("Возникла неопределенная ошибка", "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Пример #14
0
 /// <summary>
 /// 酷Q应用启用 回调
 /// </summary>
 /// <param name="sender">事件来源对象</param>
 /// <param name="e">附加的事件参数</param>
 public void AppEnable(object sender, CQAppEnableEventArgs e)
 {
     Common.CQApi = e.CQApi;
     Common.CQLog = e.CQLog;
     TheTimer.Countdown1();
 }