• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Clock类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Clock的典型用法代码示例。如果您正苦于以下问题:C# Clock类的具体用法?C# Clock怎么用?C# Clock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Clock类属于命名空间,在下文中一共展示了Clock类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnStartup

		protected override void OnStartup(StartupEventArgs e)
		{
			base.OnStartup(e);

			new TaskTrayIcon().AddTo(this);

			Clock clock = null;

			var detector = new ShortcutKeyDetector().AddTo(this);
			detector.KeySetPressedAsObservable()
					.Where(_ => Settings.Default.ClockTypeSetting == ClockTypeSetting.Win8)
					.Where(_ => clock?.IsDisposed ?? true)
					.Where(args => args.ShortcutKey == Settings.Default.ModkeySetting.ToShortcutKey())
					.Subscribe(args =>
					{
						args.Handled = true;
						clock = new Clock();
					}).AddTo(this);

			detector.KeySetPressedAsObservable()
			        .Where(_ => Settings.Default.ClockTypeSetting == ClockTypeSetting.Calendar)
			        .Where(args => args.ShortcutKey == Settings.Default.ModkeySetting.ToShortcutKey())
			        .Subscribe(args =>
			        {
				        args.Handled = true;
				        ShowCalendar.Show();
			        });
		}
开发者ID:twinkfrag,项目名称:Timepiece,代码行数:28,代码来源:Application.xaml.cs


示例2: Execute

        public virtual void Execute(Clock.Clock clock, MOS6502 cpu, byte pageCrossProlong, byte cycle)
        {
            byte mem = cpu.Target.Read();
            byte a = cpu.State.A.Value;
            int tmp = 0, vCheck = 0;

            if (cpu.State.P.Decimal)
            {
                tmp = (a & 0x0f) + (mem & 0x0f) + cpu.State.P.CarryValue;
                if (tmp > 0x09)
                    tmp += 0x06;

                tmp += (a & 0xf0) + (mem & 0xf0);
                vCheck = tmp;

                if ((tmp & 0x1f0) > 0x90)
                    tmp += 0x60;

                cpu.State.P.Carry = (tmp & 0xff0) > 0xf0;
            }
            else
            {
                vCheck = tmp = a + mem + cpu.State.P.CarryValue;
                cpu.State.P.Carry = (tmp & 0xff00) != 0;
            }

            cpu.State.A.Value = (byte)tmp;

            cpu.State.P.Overflow = ((a ^ mem) & 0x80) == 0 && ((a ^ vCheck) & 0x80) != 0; //(mem & 0x80) == (a & 0x80) && (vCheck  & 0x80) != (a & 0x80);
            cpu.State.P.Zero = cpu.State.A.IsZero;
            cpu.State.P.Negative = cpu.State.A.IsNegative;

            if (cpu.Target.IsPageCrossed(cpu.State.PC.Value))
                clock.Prolong(pageCrossProlong, cpu.Phase);
        }
开发者ID:RonFields72,项目名称:C64Emulator,代码行数:35,代码来源:InstructionSet.cs


示例3: Main

        public static void Main(string[] args)
        {
            Console.WriteLine("Input file: ");
            var inPath = Console.ReadLine();
            inPath = !string.IsNullOrEmpty(inPath) ? inPath : "SampleInput.txt";

            var lines = File.ReadAllLines(inPath);
            var n = Convert.ToInt32(lines[0]);

            var output = new List<string> { n + "" };

            for (var i = 1; i < lines.Length; i++)
            {
                var clock = new Clock(lines[i]);

                var hourMinute = AngleUtility.Difference(clock.HourHandDegrees, clock.MinuteHandDegrees);
                var hourSecond = AngleUtility.Difference(clock.HourHandDegrees, clock.SecondHandDegrees);
                var minuteSecond = AngleUtility.Difference(clock.MinuteHandDegrees, clock.SecondHandDegrees);

                output.Add(string.Format("{0}, {1}, {2}", hourMinute, hourSecond, minuteSecond));
            }

            Console.WriteLine("Output file: ");
            var outPath = Console.ReadLine();
            outPath = !string.IsNullOrEmpty(outPath) ? outPath : "Output.txt";
            File.WriteAllLines(outPath, output);
        }
开发者ID:ryanerdmann,项目名称:programming-puzzles,代码行数:27,代码来源:Program.cs


示例4: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            ticker = new Clock();

            /*
             * We could also use the Action type instead of NoArg and save some code.
             * But then we'd need to understand Generics...
             * so I'll stick with NoArg for now.
            */
            NoArg start = ticker.Start;

            /*
             *  .NET prevents us from updating UI elements from another thread.
             *  Our clock uses Thread.Sleep which would make our app look like it crashed.
             *  We'll use a separate thread for the clock.Start method, then use the Dispatcher
             *  to update the UI in its own sweet time on its own sweet thread.  Think of
             *  queing up a message that is then processed by the UI thread when it's able.
             *
             *  Importantly, we don't have to change the Clock class to take advantage of threading.
             *  All the Dispatch/BeginInvoke magic happens here in the client code.
             *
             */
            ticker.MillisecondsChanged += Ticker_MillisecondsChangedOnDifferentThread;
            ticker.SecondsChanged += Ticker_SecondsChangedOnDifferentThread;
            ticker.MinutesChanged += Ticker_MinutesChangedOnDifferentThread;
            ticker.HoursChanged += Ticker_HoursChangedOnDifferentThread;
            ticker.DaysChanged += Ticker_DaysChangedOnDifferentThread;
            start.BeginInvoke(null, null);
        }
开发者ID:CrashTheBandicoot,项目名称:CSC160ApplicationDevelopment,代码行数:31,代码来源:MainWindow.xaml.cs


示例5: TimeTracker

 public TimeTracker()
 {
     _timeline = new ParallelTimeline(null, Duration.Forever);
     _timeClock = _timeline.CreateClock();
     _timeClock.Controller.Begin();
     _lastTime = TimeSpan.FromSeconds(0);
 } 
开发者ID:legendmaker,项目名称:Wpf,代码行数:7,代码来源:TimeTracker.cs


示例6: initialize

        //man hat 60 sekunden um 10 Items zu sammeln, schafft man es gewinnt man, schafft man es nicht so verliert man
        public override void initialize()
        {
            base.initialize();

            //anzahl der eingesammelten Items
            numberItemsCollected = new Text[playerList.Count];
            int i = 0;
            foreach (Player p in playerList)
            {
                numberItemsCollected[i] = new Text("Items Collected: 0/10", new Vector2(0, 0));
                numberItemsCollected[i].setIndividualScale(scale);//mehr geht nicht wegen minimap im multiplayer
                numberItemsCollected[i].setPosition(new Vector2(p.getViewport().X + p.getViewport().Width / 2 - numberItemsCollected[i].getWidth() / 2,p.getViewport().Y + p.getViewport().Height - numberItemsCollected[i].getHeight()));
                i++;
            }

            if (playerList.Count == 1)
            {//singleplayer ligic
                clock = new Clock(new Vector2(0, 0));
                clock.setIndividualScale(scale);
                clock.setPosition(new Vector2(playerList.First().getViewport().Width / 2 - clock.getWidth() / 2, playerList.First().getViewport().Height - clock.getHeight() - numberItemsCollected[0].getHeight()));

                clock.start();
            }

            currentInGameState = EInGameState.RushHour;
        }
开发者ID:tobeneck,项目名称:WitchMaze,代码行数:27,代码来源:RushHour.cs


示例7: Main

        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n1 = Int32.Parse(input.Split(' ')[0]);
            int n2 = Int32.Parse(input.Split(' ')[1]);

            Clock c1 = new Clock();
            Clock c2 = new Clock();

            int n = 0;
            do {
                n++;
                c1.hours++;
                c2.hours++;
                c1.mins += n1;
                c2.mins += n2;
                c1.hours += c1.mins / 60;
                c2.hours += c2.mins / 60;
                c1.mins %= 60;
                c2.mins %= 60;
                c1.hours %= 24;
                c2.hours %= 24;
            }
            while(!c1.Equals(c2));

            Console.WriteLine((c2.hours > 10 ? "" + c2.hours : "0" + c2.hours) + ":" + (c2.mins > 10 ? "" + c2.mins : "0" + c2.mins));
            Console.WriteLine(n);

            Console.ReadLine();
        }
开发者ID:xSmallDeadGuyx,项目名称:BIO2012,代码行数:30,代码来源:Program.cs


示例8: TimeMeasuringContext

 public TimeMeasuringContext(Clock clock, Action<long> disposeAction)
 {
     this.clock = clock;
     this.start = clock.Nanoseconds;
     this.action = disposeAction;
     this.disposed = false;
 }
开发者ID:284247028,项目名称:Metrics.NET,代码行数:7,代码来源:TimeMeasuringContext.cs


示例9: OnTick

 void OnTick(Clock clock)
 {
     if (Input.GetKeyDown(KeyCode.Z)) Played(new Note(clock, NoteNumber.C));
     if (Input.GetKeyDown(KeyCode.X)) Played(new Note(clock, NoteNumber.D));
     if (Input.GetKeyDown(KeyCode.C)) Played(new Note(clock, NoteNumber.E));
     if (Input.GetKeyDown(KeyCode.V)) Played(new Note(clock, NoteNumber.F));
 }
开发者ID:chiepomme,项目名称:solfege,代码行数:7,代码来源:UserMusicalInput.cs


示例10: QuickPulseTelemetryProcessor

        /// <summary>
        /// Initializes a new instance of the <see cref="QuickPulseTelemetryProcessor"/> class. Internal constructor for unit tests only.
        /// </summary>
        /// <param name="next">The next TelemetryProcessor in the chain.</param>
        /// <param name="timeProvider">Time provider.</param>
        /// <param name="maxTelemetryQuota">Max telemetry quota.</param>
        /// <param name="initialTelemetryQuota">Initial telemetry quota.</param>
        /// <exception cref="ArgumentNullException">Thrown if next is null.</exception>
        internal QuickPulseTelemetryProcessor(
            ITelemetryProcessor next,
            Clock timeProvider,
            int? maxTelemetryQuota = null,
            int? initialTelemetryQuota = null)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            this.Register();

            this.Next = next;

            this.requestQuotaTracker = new QuickPulseQuotaTracker(
                timeProvider,
                maxTelemetryQuota ?? MaxTelemetryQuota,
                initialTelemetryQuota ?? InitialTelemetryQuota);

            this.dependencyQuotaTracker = new QuickPulseQuotaTracker(
                timeProvider,
                maxTelemetryQuota ?? MaxTelemetryQuota,
                initialTelemetryQuota ?? InitialTelemetryQuota);

            this.exceptionQuotaTracker = new QuickPulseQuotaTracker(
                timeProvider,
                maxTelemetryQuota ?? MaxTelemetryQuota,
                initialTelemetryQuota ?? InitialTelemetryQuota);
        }
开发者ID:Microsoft,项目名称:ApplicationInsights-dotnet-server,代码行数:38,代码来源:QuickPulseTelemetryProcessor.cs


示例11: AddDevice

 public void AddDevice(string device = "", string name = "", string fabricator = "")
 {
     DatabaseMapping databaseMapping = null;
     switch (device)
     {
         case "clock":
             Clock clock = new Clock(name);
             _deviceContext.Clocks.Add(clock);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 1, Clock = clock };
             break;
         case "microwave":
             MicrowaveFabricatorInfo mi = microwaveFabricatorInfo[fabricator];
             Microwave microwave = new Microwave(name, mi.Volume, mi.Lamp);
             _deviceContext.Microwaves.Add(microwave);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 2, Microwave = microwave };
             break;
         case "oven":
             OvenFabricatorInfo oi = ovenFabricatorInfo[fabricator];
             Oven oven = new Oven(name, oi.Volume, oi.Lamp);
             _deviceContext.Ovens.Add(oven);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 3, Oven = oven };
             break;
         case "fridge":
             FridgeFabricatorInfo fi = fridgeFabricatorInfo[fabricator];
             Fridge fridge = new Fridge(name, fi.Coldstore, fi.Freezer);
             _deviceContext.Fridges.Add(fridge);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 4, Fridge = fridge };
             break;
         default: return;
     }
     _deviceContext.DatabaseMappings.Add(databaseMapping);
     _deviceContext.SaveChanges();
 }
开发者ID:Nebelwerfergranate,项目名称:SmartHouseMVC,代码行数:33,代码来源:DatabaseDeviceManager.cs


示例12: Guess

 public Guess()
 {
     random = new Random();
     clock = new Clock(480);
     clock.Start();
     availableNotes = new List<Pitch>();
     availableNotes.Add(Pitch.C3);
     availableNotes.Add(Pitch.CSharp3);
     availableNotes.Add(Pitch.D3);
     availableNotes.Add(Pitch.DSharp3);
     availableNotes.Add(Pitch.E3);
     availableNotes.Add(Pitch.F3);
     availableNotes.Add(Pitch.FSharp3);
     availableNotes.Add(Pitch.G3);
     availableNotes.Add(Pitch.GSharp3);
     availableNotes.Add(Pitch.A3);
     availableNotes.Add(Pitch.ASharp3);
     availableNotes.Add(Pitch.B4);
     availableNotes.Add(Pitch.C4);
     availableNotes.Add(Pitch.CSharp4);
     availableNotes.Add(Pitch.D4);
     availableNotes.Add(Pitch.DSharp4);
     availableNotes.Add(Pitch.E4);
     availableNotes.Add(Pitch.F4);
     availableNotes.Add(Pitch.FSharp4);
     availableNotes.Add(Pitch.G4);
     availableNotes.Add(Pitch.GSharp4);
     availableNotes.Add(Pitch.A4);
     availableNotes.Add(Pitch.ASharp4);
     availableNotes.Add(Pitch.B4);
 }
开发者ID:shadow7412,项目名称:Shimidi,代码行数:31,代码来源:Guess.cs


示例13: Run

        public void Run()
        {
            //initialization
            window.SetActive();

            Clock clock = new Clock();
            clock.Restart();
            //loop
            while(window.IsOpen)
            {
                //make sure windows events are handled
                window.DispatchEvents();

                //handle logic here
                Time elapsed = clock.Restart(); //elapsed is the amount of time elapsed since the last loop
                GameStates.Peek().Update(elapsed);

                //clear the window
                window.Clear();

                //draw objects here
                GameStates.Peek().Draw(window);

                //draw the object we placed on our frame
                window.Display();
            }

            //clean up
            GameStates.Clear();
                
        }
开发者ID:Jespyr,项目名称:Invasion-Grid,代码行数:31,代码来源:Game.cs


示例14: AmbientColor

    public static Color AmbientColor(Clock c)
    {
        if (c.Hours() < HourDawn || c.Hours() >= HourDusk)
        {
            return Night;
        }
        else if (c.Hours() == HourDawn)
        {
            return Utils.Mix(c.Minutes() + (c.Seconds() / 60f), Night, Twilight);
        }
        else if (c.Hours() == HourSunrise)
        {
            return Utils.Mix(c.Minutes() + (c.Seconds() / 60f), Twilight, Day);
        }

        else if (c.Hours() == HourDayEnd)
        {
            return Utils.Mix(c.Minutes() + (c.Seconds() / 60f), Day, TwilightNight);
        }
        else if (c.Hours() == HourSunset)
        {
            return Utils.Mix(c.Minutes() + (c.Seconds() / 60f), TwilightNight, Night);
        }
        else

            return Day;
    }
开发者ID:WJLiddy,项目名称:CastleSpire,代码行数:27,代码来源:AmbientLight.cs


示例15: SetupTests

        public void SetupTests()
        {
            reservoir = new ExponentiallyDecayingReservoir();
            clock = new TimerTestClock();
            this.timer = new Timer(reservoir, clock);

        }
开发者ID:thattolleyguy,项目名称:metrics-net,代码行数:7,代码来源:TimerTests.cs


示例16: Start

        private Clock clock; // 时钟对象

        void Start()
        {

            clock = new Clock();

            clock.AddClockListener(this); // 对时钟监听
        }
开发者ID:AllanUnity,项目名称:Unity_Sample,代码行数:9,代码来源:ClockTest.cs


示例17: Start

	// Use this for initialization
	void Start () {
		finished = GameOverScreen.GetComponent<Clock> ();
		WarpCD.value = 0f;
		TimeCD.value = 0f;
		Wspeed = 50f;
		aud = this.gameObject.GetComponent<AudControl> ();
	}
开发者ID:amyliu38,项目名称:PajamaJam,代码行数:8,代码来源:PlayerStats.cs


示例18: Main

    static void Main(string[] args)
    {
        NetConfig.LatencySimulation = true;
        Connector client = new Connector("Sample1.1", false);

        Clock fastClock = new Clock(0.02f);
        Clock slowClock = new Clock(1.0f);
        fastClock.OnFixedUpdate += SendPayload;
        slowClock.OnFixedUpdate += SendNotification;

        Program.peer = client.Connect("127.0.0.1:42324");

        while (true)
        {
          fastClock.Tick();
          slowClock.Tick();
          client.Update();

          if (Console.KeyAvailable)
          {
        ConsoleKeyInfo key = Console.ReadKey(true);
        switch (key.Key)
        {
          case ConsoleKey.F1:
            client.Stop();
            return;

          default:
            break;
        }
          }
        }
    }
开发者ID:ashoulson,项目名称:MiniUDP,代码行数:33,代码来源:Program.cs


示例19: Copybook

    public Copybook(Clock startsAt, Clock finishesAt, IEnumerable<Note> notes)
    {
        StartsAt = startsAt;
        FinishesAt = finishesAt;

        Notes.AddRange(notes);
    }
开发者ID:chiepomme,项目名称:solfege,代码行数:7,代码来源:Copybook.cs


示例20: Main

        public static void Main()
        {
            // Create a new clock - the publisher, which will publish the SecondChangeEvent
            Clock theClock = new Clock();

            // Create the display and tell it to
            // subscribe to the clock just created
            DisplayTimeOfClock dc = new DisplayTimeOfClock();
            dc.Subscribe(theClock);

            // Create a Log object and tell it
            // to subscribe to the clock
            LogTimeOfClock lc = new LogTimeOfClock();
            lc.Subscribe(theClock);

            //Write separator for clearer console
            Console.WriteLine("=====");

            // Get the clock started, let it run for 10 secs
            theClock.Run(1);

            //Stop DisplayTimeOfClock from observer the Clock
            dc.Unsubscribe(theClock);

            //Write separator for clearer console
            Console.WriteLine("=====");

            //Let the clock run for another 5 secs
            theClock.Run(1);
        }
开发者ID:sassy224,项目名称:DelegateAndEvent,代码行数:30,代码来源:Program2.cs



注:本文中的Clock类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CloneContext类代码示例发布时间:2022-05-24
下一篇:
C# ClipType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap