コード例 #1
0
ファイル: BatchQueue.cs プロジェクト: ni11c/AkkaJobs
 private void OnTimerTick(object sender, TimeEventArgs args)
 {
     lock (this)
     {
         Monitor.Pulse(this);
     }
 }
コード例 #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);
        }
コード例 #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]);
         }
     }
 }
コード例 #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;
    }
コード例 #5
0
 static void CompareTime2(object sender, TimeEventArgs e)   //时间是否到了
 {
     if (e.Hour == e.CurrentHour && e.Minute == e.CurrentMinute)
     {
         e.ClockRing = true;
     }
 }
コード例 #6
0
ファイル: Clock.cs プロジェクト: jasonweibel/TrainingMaterial
        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;
                }
            }
        }
コード例 #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;
     }
 }
コード例 #9
0
        protected virtual void OnTimeChanged(TimeEventArgs e)
        {
            EventHandler <TimeEventArgs> handler = TimeChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #10
0
 private void StartTimer_OnStop(IClockTimer sender, TimeEventArgs e)
 {
     Debug.Log("Timer Started");
     //var timer = sender as CountdownTimer;
     if (TimerUIText != null)
     {
         TimerUIText.text = "";
     }
 }
コード例 #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);
     }
 }
コード例 #12
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 && _watch != null)
     {
         _viewModel.Time = time.Time.UtcTimestamp;
         _watch.MoveHands();
     }
 }
コード例 #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();
     }
 }
コード例 #14
0
ファイル: GameTime.cs プロジェクト: GrimMaple/NFSLR
        internal void Update(long ms)
        {
            TimeEventArgs args = new TimeEventArgs(ms);

            game.Update(this, args);
            if (args.CountIn)
            {
                time += ms;
            }
        }
コード例 #15
0
 static void CompareTime(object sender, TimeEventArgs e)  //输入时间是否合法
 {
     if (e.Hour > e.CurrentHour)
     {
         if (e.Minute > e.CurrentMinute)
         {
             e.IfTimeIslegal = true;
         }
     }
 }
コード例 #16
0
    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();
        }
    }
コード例 #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();
     }
 }
コード例 #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;
     }
 }
コード例 #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;
            }
        }
コード例 #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);
        }
    }
コード例 #21
0
        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);
        }
コード例 #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));
     }
 }
コード例 #23
0
        //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
        }
コード例 #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;
 }
コード例 #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);
     }
 }
コード例 #26
0
ファイル: Program.cs プロジェクト: GudaozhishangYz/C-homework
        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;
            }
        }
コード例 #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);
 }
コード例 #28
0
    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);
    }
コード例 #29
0
ファイル: Client.cs プロジェクト: SumireTeam/Cubach
        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);
        }
コード例 #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("设置时间到");

                        }
                    }
                }
            }
コード例 #31
0
    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();
            }
        }
    }
コード例 #32
0
ファイル: NowTimelinePlayer.cs プロジェクト: TNOCS/csTouch
 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;
   }
 }
コード例 #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());
 }
コード例 #34
0
ファイル: NowTimelinePlayer.cs プロジェクト: TNOCS/csTouch
 void Timeline_TimeContentChanged(object sender, TimeEventArgs e)
 {
   SendUpdate();
 }