Exemplo n.º 1
0
 private void OnTimerTick(object sender, TimeEventArgs args)
 {
     lock (this)
     {
         Monitor.Pulse(this);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Callback invoked, in the ambient mode, for every watch application tick.
        /// In the ambient mode the callback is invoked once every minute.
        /// </summary>
        /// <param name="time">Structure containing the current time data.</param>
        protected override void OnAmbientTick(TimeEventArgs time)
        {
            base.OnAmbientTick(time);
            WatchTime wt = time.Time;

            _mainPage.SetTime(wt.Year, wt.Month, wt.Day, wt.Hour, wt.Minute, wt.Second);
        }
Exemplo n.º 3
0
 void PlaybackDevice_Time(object source, TimeEventArgs e)
 {
     mCurrentPos = e.CurrentTimePosition;
     SetTimeLabel();
     double[] maxDbs = e.MaxDbSinceLatestTime;
     if (maxDbs == null)
     {
         for (int i = 0; i < mHorizontalPPMeter.NumberOfChannels; i++)
         {
             mHorizontalPPMeter.SetValue(i, Double.NegativeInfinity);
         }
         for (int i = 0; i < mVerticalPPMeter.NumberOfChannels; i++)
         {
             mVerticalPPMeter.SetValue(i, Double.NegativeInfinity);
         }
     }
     else
     {
         for (int i = 0; i < maxDbs.Length; i++)
         {
             mHorizontalPPMeter.SetValue(i, maxDbs[i]);
         }
         for (int i = 0; i < mVerticalPPMeter.NumberOfChannels; i++)
         {
             mVerticalPPMeter.SetValue(i, maxDbs[i]);
         }
     }
 }
Exemplo n.º 4
0
    private void RespawnTimer_OnCompleted(IClockTimer sender, TimeEventArgs e)
    {
        Debug.Log("Respawn Timer completed");
        // Reset the clock
        RespawnTimer.StopClockTimer();

        // If the player is completely dead, dont respawn
        if (!Lives.HasLives)
        {
            return;
        }

        // Otherwise, Reset stats and Respawn the Player
        m_rigidbody2D.velocity = Vector3.zero;
        var spawnPoint = Game.Level.GetRandomSpawn();

        transform.position = spawnPoint.transform.position;

        Stamina.SetMaxStamina();

        // Enable the players scripts
        //var colliderPlayerScripts = new List<MonoBehaviour>();
        //colliderPlayerScripts.AddRange(gameObject.GetComponents<MonoBehaviour>());
        //colliderPlayerScripts.AddRange(gameObject.GetComponentsInChildren<MonoBehaviour>());
        //foreach (var script in colliderPlayerScripts)
        //{
        //    script.enabled = true;
        //}

        // Show the Player
        Lives.IsAlive = true;
    }
Exemplo n.º 5
0
 static void CompareTime2(object sender, TimeEventArgs e)   //时间是否到了
 {
     if (e.Hour == e.CurrentHour && e.Minute == e.CurrentMinute)
     {
         e.ClockRing = true;
     }
 }
Exemplo n.º 6
0
        public void RunClock()
        {
            while (true)
            {
                Thread.Sleep(100);
                DateTime currentTime = DateTime.Now;
                if (currentTime.Second != this.second)
                {
                    TimeEventArgs timeEvnetArgs = new TimeEventArgs()
                    {
                        Hour = currentTime.Hour,
                        Minute = currentTime.Minute,
                        Second = currentTime.Second
                    };

                    if (TimeChanged != null)
                    {
                        TimeChanged(this, timeEvnetArgs);
                    }

                    this.second = currentTime.Second;
                    this.minute = currentTime.Minute;
                    this.hour = currentTime.Hour;
                }
            }
        }
Exemplo n.º 7
0
 protected override void OnTick(TimeEventArgs time)
 {
     base.OnTick(time);
     if (ViewModel != null)
     {
         ViewModel.Time = time.Time.UtcTimestamp + TimeSpan.FromMilliseconds(time.Time.Millisecond);
     }
 }
 protected override void OnTick(TimeEventArgs time)
 {
     base.OnTick(time);
     if (_viewModel != null)
     {
         _viewModel.Time = time.Time.UtcTimestamp;
     }
 }
Exemplo n.º 9
0
        protected virtual void OnTimeChanged(TimeEventArgs e)
        {
            EventHandler <TimeEventArgs> handler = TimeChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
 private void StartTimer_OnStop(IClockTimer sender, TimeEventArgs e)
 {
     Debug.Log("Timer Started");
     //var timer = sender as CountdownTimer;
     if (TimerUIText != null)
     {
         TimerUIText.text = "";
     }
 }
Exemplo n.º 11
0
 // Called when the time tick event occurs.
 // It's called when the screen of the device is on.
 protected override void OnTick(TimeEventArgs time)
 {
     base.OnTick(time);
     // Update Time for UI update
     if (_viewModel != null)
     {
         _viewModel.Time = time.Time.UtcTimestamp + TimeSpan.FromMilliseconds(time.Time.Millisecond);
     }
 }
 /// <summary>
 /// Called when the time tick event comes.
 /// </summary>
 /// <param name="time">TimeEventArgs</param>
 protected override void OnTick(TimeEventArgs time)
 {
     base.OnTick(time);
     if (_viewModel != null && _watch != null)
     {
         _viewModel.Time = time.Time.UtcTimestamp;
         _watch.MoveHands();
     }
 }
Exemplo n.º 13
0
 /// <summary>Inform WatchFace ViewModel to update the clock</summary>
 /// <param name="time"></param>
 protected override void OnTick(TimeEventArgs time)
 {
     base.OnTick(time);
     if (_viewModel != null)
     {
         _viewModel.Time = time.Time.UtcTimestamp;
         _viewModel.Date = time.Time.UtcTimestamp.ToString("MMM dd").ToUpper();
     }
 }
Exemplo n.º 14
0
        internal void Update(long ms)
        {
            TimeEventArgs args = new TimeEventArgs(ms);

            game.Update(this, args);
            if (args.CountIn)
            {
                time += ms;
            }
        }
Exemplo n.º 15
0
 static void CompareTime(object sender, TimeEventArgs e)  //输入时间是否合法
 {
     if (e.Hour > e.CurrentHour)
     {
         if (e.Minute > e.CurrentMinute)
         {
             e.IfTimeIslegal = true;
         }
     }
 }
    private void StartTimer_OnStart(IClockTimer sender, TimeEventArgs e)
    {
        Debug.Log("Timer Started");
        var timer = sender as CountdownTimer;

        if (TimerUIText != null)
        {
            TimerUIText.text = (timer.CurrentTimeSpan.Seconds).ToString();
        }
    }
Exemplo n.º 17
0
 /// <summary>
 /// Called when the time tick event comes.
 /// </summary>
 /// <param name="time">TimeEventArgs</param>
 protected override void OnTick(TimeEventArgs time)
 {
     base.OnTick(time);
     if (_viewModel != null && _classicWatch != null)
     {
         _viewModel.Time = time.Time.UtcTimestamp;
         //Console.WriteLine($"OnTick Time.ToString:{_viewModel.Time.ToString()}");
         _classicWatch.MoveHands();
     }
 }
Exemplo n.º 18
0
 protected override void OnTick(TimeEventArgs time)
 {
     base.OnTick(time);
     if (_viewModel != null)
     {
         DateTime currentTime = time.Time.UtcTimestamp;
         _viewModel.Hour   = currentTime.Hour;
         _viewModel.Minute = currentTime.Minute;
     }
 }
Exemplo n.º 19
0
        void OnTick(object sender, TimeEventArgs e)
        {
            var viewport        = cameraProvider.Viewport;
            var currentPosition = Vector3.Project(positionProvider.Position, viewport.X, viewport.Y, viewport.Width, viewport.Height,
                                                  viewport.MinDepth, viewport.MinDepth, cameraProvider.View * cameraProvider.Projection);

            if (!Vector3.NearEqual(currentPosition, lastPosition, Epsilon))
            {
                AssociatedElement.Position = lastPosition + Offset;
                lastPosition = currentPosition;
            }
        }
Exemplo n.º 20
0
    public void Clockk(int hour, int minute)
    {
        TimeEventArgs Current = new TimeEventArgs();

        Current.Hour   = hour;
        Current.Minute = minute;
        while (!Current.ClockRing)
        {
            TheClock(this, Current);
            System.Threading.Thread.Sleep(1000);
        }
    }
        public void Should_Get_CurrentTimeEventArgs_When_Calling_CurrentTime()
        {
            // Arrange
            var           time          = DateTime.Now.Ticks;
            TimeEventArgs timeEventArgs = null;

            _apiEventDispatcher.Time += (sender, args) => { timeEventArgs = args; };

            // Act
            _apiEventDispatcher.currentTime(time);

            // Assert
            Assert.AreEqual(timeEventArgs.CurrentTime, time);
        }
Exemplo n.º 22
0
 private void Print_TimeChanged__(TimeEventArgs a)
 {
     if (InvokeRequired)
     {
         Print_TimeChanged_ d = new Print_TimeChanged_(Print_TimeChanged__);
         Invoke(d, new object[] { a });
     }
     else
     {
         time = a.time_spend;
         label_spendtime.Text = string.Format("??????????????????: {0:0.##}s({1:0.##}m)", (a.time_spend), (a.time_spend / 60));
         label_lefttime.Text  = string.Format("????????????????: {0:0.##}s({1:0.##}m)", (a.time_left), (a.time_left / 60));
     }
 }
        //EVENT set time
        private void EventSetClockTime(object sender, TimeEventArgs e)
        {
            string H = e.getH;
            string M = e.getM;

            if (H.Length < 2)
            {
                H = "0" + H;
            }
            btnH.Content = "H: " + H;
            btnM.Content = "M: " + M;

            //DINASH add time to DB
        }
Exemplo n.º 24
0
 public void Update(GameTime sender, TimeEventArgs args)
 {
     RefreshStatus();
     if (loading)
     {
         args.CountIn = false;
         if (timePassed < 100)
         {
             sender.Remove(timePassed);
         }
         timePassed = 0;
         return;
     }
     timePassed += args.TimePassed;
 }
Exemplo n.º 25
0
 public void Clock_Compare(int a, int b)
 {
     for (; ;)
     {
         System.DateTime currentTime = new System.DateTime();    //类的实例化
         currentTime = System.DateTime.Now;
         if (currentTime.Hour == a && currentTime.Minute == b)
         {
             TimeEventArgs args = new TimeEventArgs();
             args.hours   = Myhours;
             args.minutes = Myminutes;
             Alarm_clockEvent(this, args);
             break;
         }
         System.Threading.Thread.Sleep(1000);
     }
 }
Exemplo n.º 26
0
        public void Clock(int x, int y)
        {
            DateTime      time = DateTime.Now;
            TimeSpan      tm   = TimeSpan.FromSeconds(1);
            TimeEventArgs args = new TimeEventArgs();

            while (time.Hour <= 24)
            {
                Console.WriteLine(time);
                Thread.Sleep(1000);
                if (time.Hour == x && time.Minute == y)
                {
                    OnClock(this, args);
                }
                time = time + tm;
            }
        }
Exemplo n.º 27
0
 public void Update(GameTime sender, TimeEventArgs args)
 {
     if (!gameProcess.IsOpen)
     {
         crashRecovery = true;
         return;
     }
     isLoading    = gameProcess.ReadInt32(addr) != 2;
     isNisPlaying = gameProcess.ReadInt32(nisAddr) == 4;
     if (crashRecovery)
     {
         crashRecovery = isNisPlaying;
         args.CountIn  = !isLoading;
         return;
     }
     args.CountIn = !(isLoading && isNisPlaying);
 }
    private void StartTimer_Completed(IClockTimer sender, TimeEventArgs e)
    {
        Debug.Log("Timer Complete");
        //var timer = sender as CountdownTimer;
        if (TimerUIText != null)
        {
            TimerUIText.text = "";
        }

        // Create the Navigation Parameter
        LevelNavigationParameter navigationParameter = new LevelNavigationParameter();

        // Save the Players to static cache for recreation ingame
        foreach (var panel in PlayerPanels)
        {
            if (panel.HasJoinedGame)
            {
                navigationParameter.PlayersInGame.Add(panel.PlayerInfo);
            }
        }

        // Get the level vote winner
        LobbyLevelSelectPanelController levelMostVotes = LevelSelectionPanels[0];

        foreach (var level in LevelSelectionPanels)
        {
            if (level.TotalVotes > levelMostVotes.TotalVotes)
            {
                levelMostVotes = level;
            }
        }

        // If Random was selected, set a random one
        if (string.IsNullOrEmpty(levelMostVotes.Level.SceneName) || levelMostVotes.Level.Name == "Random")
        {
            var index = Random.Range(1, LevelSelectionPanels.Count);
            levelMostVotes = LevelSelectionPanels[index];
        }

        // Set the Selected Level
        navigationParameter.SelectedLevel = levelMostVotes.Level;

        // Begin loading the map
        NavigationManager.Instance.Navigate(navigationParameter.SelectedLevel.SceneName, navigationParameter);
    }
Exemplo n.º 29
0
        private void Window_RenderFrame(object sender, TimeEventArgs e)
        {
            serverConnection.ProcessMessages();

            HandleInput(e.Time);

            camera.Position    = world.Player.Position;
            camera.Orientation = world.Player.Orientation;

            world.Update(e.Time);

            while (DeferredTasks.Count > 0)
            {
                if (DeferredTasks.TryDequeue(out var task))
                {
                    task();
                }
            }

            GL.ClearColor(0.6f, 0.7f, 0.8f, 1);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);

            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.DepthTest);

            GL.Disable(EnableCap.Blend);
            GL.Disable(EnableCap.ScissorTest);
            GL.Disable(EnableCap.StencilTest);

            GL.PolygonMode(MaterialFace.Front, PolygonMode.Fill);
            GL.PolygonMode(MaterialFace.Back, PolygonMode.Line);

            blockTextureAtlas.Texture.Bind();

            var aspect = window.Width / (float)window.Height;

            worldRenderer.Draw(worldProgram, aspect, e.Time);

            userInterface.Draw(e.Time);

            GL.Disable(EnableCap.ScissorTest);
        }
Exemplo n.º 30
0
            public void Start()
            {
                while (true)
                {
                    //
                    // TimeOfTick time=new TimeOfTick();
                    string str = null;
                    clock ts = new clock();
                    ts.setter();
                    str = ts.getter();

                    DateTime dt1 = DateTime.Parse(str);

                    if (DateTime.Now > dt1)
                    {
                        Console.WriteLine("闹钟时间小于系统时间,请重新设置:");
                        continue;
                    }

                    while (true)
                    {
                        string strnow = DateTime.Now.ToString();
                        DateTime dt = DateTime.Parse(strnow);

                        string str1 = dt.ToString();
                        //判断时间到了吗
                        if (str1 == str)
                        {
                            if (Tick != null)
                            {

                                TimeEventArgs TEA = new TimeEventArgs();
                                TEA.Time = DateTime.Now;
                                Tick(this, TEA);
                            }
                            System.Console.WriteLine("设置时间到");

                        }
                    }
                }
            }
    private void StartTimer_Tick(IClockTimer sender, TimeEventArgs e)
    {
        Debug.Log("Timer Tick");
        var timer = sender as CountdownTimer;

        if (TimerUIText != null)
        {
            if (timer.CurrentTime == timer.StartTime)
            {
                TimerUIText.text = (timer.CurrentTimeSpan.Seconds).ToString();
            }
            else if (timer.CurrentTime == 0.0f)
            {
                TimerUIText.text = "0";
            }
            else
            {
                TimerUIText.text = (timer.CurrentTimeSpan.Seconds + 1).ToString();
            }
        }
    }
Exemplo n.º 32
0
 void Timeline_TimeChanged(object sender, TimeEventArgs e)
 {
   if (_lastImbTimelineUpdate.AddSeconds(0.1) < AppState.TimelineManager.CurrentTime && AppStateSettings.Instance.Imb != null && AppStateSettings.Instance.Imb.IsConnected && !_ignoreNext)
   {
     SendUpdate();
     _ignoreNext = false;
   }
 }
Exemplo n.º 33
0
 private void NewTime(object clock, TimeEventArgs e)
 {
     Console.WriteLine("Clock Time: {0},{1},{2}", e.Hour.ToString(), e.Minute.ToString(), e.Second.ToString());
 }
Exemplo n.º 34
0
 void Timeline_TimeContentChanged(object sender, TimeEventArgs e)
 {
   SendUpdate();
 }