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

C# NSTimer类代码示例

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

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



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

示例1: StartTimer

        public void StartTimer(CLLocationManager manager)
        {
            hasLastAttempt = false;

            Manager = manager;
            locationTimer = NSTimer.CreateScheduledTimer(TimeSpan.FromSeconds(30), TerminateLocationUpdate);
        }
开发者ID:nicwise,项目名称:londonbikeapp,代码行数:7,代码来源:NearDialogViewController.cs


示例2: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			sessionManager = new SessionManager ();
			sessionManager.StartRunning ();

			previewLayer = new AVCaptureVideoPreviewLayer (sessionManager.CaptureSession) {
				Frame = previewView.Bounds,
				LayerVideoGravity = AVLayerVideoGravity.ResizeAspectFill
			};

			if (previewLayer.Connection != null && previewLayer.Connection.SupportsVideoOrientation)
				previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeLeft;
			previewView.Layer.AddSublayer (previewLayer);
			previewView.Layer.MasksToBounds = true;

			barcodeTargetLayer = new CALayer () {
				Frame = View.Layer.Bounds
			};
			View.Layer.AddSublayer (barcodeTargetLayer);

			synth = new Synth ();
			synth.LoadPreset (this);

			stepTimer = NSTimer.CreateRepeatingScheduledTimer (0.15, step);
		}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:27,代码来源:ReceiveViewController.cs


示例3: DraggingEnded

        public void DraggingEnded(UIScrollView scrollView, bool willDecelerate)
        {
            if (_table.ContentOffset.Y <= -65f) {

                //ReloadTimer = NSTimer.CreateRepeatingScheduledTimer (new TimeSpan (0, 0, 0, 10, 0), () => dataSourceDidFinishLoadingNewData ());
                _reloadTimer = NSTimer.CreateScheduledTimer (TimeSpan.FromSeconds (2f), delegate {
                    // for this demo I cheated and am just going to pretend data is reloaded
                    // in real world use this function to really make sure data is reloaded

                    _reloadTimer = null;
                    Console.WriteLine ("dataSourceDidFinishLoadingNewData() called from NSTimer");

                    _reloading = false;
                    _refreshHeaderView.FlipImageAnimated (false);
                    _refreshHeaderView.ToggleActivityView ();
                    UIView.BeginAnimations ("DoneReloadingData");
                    UIView.SetAnimationDuration (0.3);
                    _table.ContentInset = new UIEdgeInsets (0f, 0f, 0f, 0f);
                    _refreshHeaderView.SetStatus (TableViewPullRefresh.RefreshTableHeaderView.RefreshStatus.PullToReloadStatus);
                    UIView.CommitAnimations ();
                    _refreshHeaderView.SetCurrentDate ();
                });

                _reloading = true;
                _table.ReloadData ();
                _refreshHeaderView.ToggleActivityView ();
                UIView.BeginAnimations ("ReloadingData");
                UIView.SetAnimationDuration (0.2);
                _table.ContentInset = new UIEdgeInsets (60f, 0f, 0f, 0f);
                UIView.CommitAnimations ();
            }

            _checkForRefresh = false;
        }
开发者ID:Snowing,项目名称:MTTweetieTableViewPullRefresh,代码行数:34,代码来源:RefreshingUITableViewController.cs


示例4: UpdateUserInterface

		void UpdateUserInterface(NSTimer t)
		{
			WKInterfaceController.OpenParentApplication (new NSDictionary (), (replyInfo, error) => {
				if(error != null) {
					Console.WriteLine (error);
					return;
				}

				var status = (CLAuthorizationStatus)((NSNumber)replyInfo["status"]).UInt32Value;
				var longitude = ((NSNumber)replyInfo["lon"]).DoubleValue;
				var latitude = ((NSNumber)replyInfo["lat"]).DoubleValue;

				Console.WriteLine ("authorization status {0}", status);
				switch(status) {
					case CLAuthorizationStatus.AuthorizedAlways:
						SetCooridinate(longitude, latitude);
						HideWarning();
						break;

					case CLAuthorizationStatus.NotDetermined:
						SetNotAvailable();
						ShowWarning("Launch the iOS app first");
						break;

					case CLAuthorizationStatus.Denied:
						SetNotAvailable();
						ShowWarning("Enable Location Service on iPhone");
						break;

					default:
						throw new NotImplementedException();
				}
			});
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:34,代码来源:InterfaceController.cs


示例5: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
     
			var url = MonoTouch.CoreFoundation.CFUrl.FromFile ("loop_stereo.aif");
			_player = new ExtAudioBufferPlayer (url);

			// setting audio session
			_slider.ValueChanged += new EventHandler (_slider_ValueChanged);

			_slider.MaxValue = _player.TotalFrames;

			_isTimerAvailable = true;
			_timer = NSTimer.CreateRepeatingTimer (TimeSpan.FromMilliseconds (100),
                delegate {
				if (_isTimerAvailable) {
					long pos = _player.CurrentPosition;
					_slider.Value = pos;
					_signalLevelLabel.Text = _player.SignalLevel.ToString ("0.00E0");
				}                    
			}
			);

			NSRunLoop.Current.AddTimer (_timer, NSRunLoopMode.Default);            
		}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:25,代码来源:MainView.xib.cs


示例6: RootController

        public RootController()
            : base(new RootElement ("Netstat"))
        {
            Settings = Settings.Instance;

            section = new Section ();
            Root.Add (section);

            displayedEntries = new Dictionary<NetstatEntry,DateTime> ();

            RefreshRequested += (sender, e) => {
                Populate ();
                ReloadComplete ();
            };

            Settings.Modified += (sender, e) => InvokeOnMainThread (() => {
                displayedEntries.Clear ();
                Populate ();
            });

            timer = NSTimer.CreateRepeatingTimer (1.0, () => {
                if (View.Hidden || !Settings.AutoRefresh)
                    return;
                Populate ();
            });
            NSRunLoop.Main.AddTimer (timer, NSRunLoopMode.Default);
        }
开发者ID:pjbeaman,项目名称:bugfree-octo-nemesis,代码行数:27,代码来源:RootController.cs


示例7: ClockTimer

		public ClockTimer () : base()
		{
			outputString = DateTime.Now.ToString("hh:mm:ss");
			myTTimer = NSTimer.CreateRepeatingScheduledTimer (1,delegate { 
				outputString = DateTime.Now.ToString("hh:mm:ss");
			});
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:7,代码来源:ClockTimer.cs


示例8: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
     
            /*
            var path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            path = System.IO.Path.Combine(path, "loop_stereo.aif"); // loop_mono.wav
            if (!System.IO.File.Exists(path))
                throw new ArgumentException("file not found; " + path);*/

            var url = MonoTouch.CoreFoundation.CFUrl.FromFile("loop_stereo.aif");
            _player = new ExtAudioFilePlayer(url);

            // setting audio session
            _slider.ValueChanged += new EventHandler(_slider_ValueChanged);
            _playButton.TouchDown += new EventHandler(_playButton_TouchDown);
            _stopButton.TouchDown += new EventHandler(_stopButton_TouchDown);

            _slider.MaxValue = _player.TotalFrames;

            _isTimerAvailable = true;
            _timer = NSTimer.CreateRepeatingTimer(TimeSpan.FromMilliseconds(100),
                delegate {
                    if (_isTimerAvailable)
                    {
                        long pos = _player.CurrentPosition;
                        _slider.Value = pos;
                        //System.Diagnostics.Debug.WriteLine("CurPos: " + _player.CurrentPosition.ToString());
                    }                    
                }
                );
            NSRunLoop.Current.AddTimer(_timer, "NSDefaultRunLoopMode");            
        }
开发者ID:9drops,项目名称:MonoTouch.AudioUnit,代码行数:33,代码来源:MainView.xib.cs


示例9: Animate

		public void Animate()
		{
			if (timer != null)
				timer.Invalidate();
			timer = NSTimer.CreateRepeatingScheduledTimer(ImageDuration, nextImage);
			timer.Fire();
		}
开发者ID:AsiyaLearn,项目名称:xamarin-store-app,代码行数:7,代码来源:JBKenBurnsView.cs


示例10: OnStartProgressTapped

		void OnStartProgressTapped (object sender, EventArgs e)
		{
			standardProgressView.Progress = 0;
			bigRadialProgressView.Reset ();
			smallRadialProgressView.Reset ();
			tinyRadialProgressView.Reset ();

			if (timer != null) {
				timer.Invalidate ();
				timer = null;
			}

			// Start a timer to increment progress regularly until complete
			timer = NSTimer.CreateRepeatingScheduledTimer (1.0 / 30.0, () => {
				bigRadialProgressView.Value += 0.005f;
				smallRadialProgressView.Value += 0.005f;
				tinyRadialProgressView.Value += 0.005f;
				standardProgressView.Progress += 0.005f;

				if (bigRadialProgressView.IsDone) {
					timer.Invalidate ();
					timer = null;
				}
			});
		}
开发者ID:nagyist,项目名称:mini-hacks,代码行数:25,代码来源:SampleViewController.cs


示例11: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			sessionManager = new SessionManager ();
			sessionManager.StartRunning ();

			previewLayer = new AVCaptureVideoPreviewLayer (sessionManager.CaptureSession) {
				Frame = previewView.Bounds,
				VideoGravity = AVLayerVideoGravity.ResizeAspectFill
			};

			if (previewLayer.Connection != null && previewLayer.Connection.SupportsVideoOrientation)
				previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeLeft;
			previewView.Layer.AddSublayer (previewLayer);
			previewView.Layer.MasksToBounds = true;

			barcodeTargetLayer = new CALayer () {
				Frame = View.Layer.Bounds
			};
			View.Layer.AddSublayer (barcodeTargetLayer);

			synth = new Synth ();
			synth.LoadPreset (this);

			// the loop that continuously looks for barcodes to detect
			stepTimer = NSTimer.CreateScheduledTimer (0.15, this, new Selector ("step:"), null, true);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:28,代码来源:ReceiveViewController.cs


示例12: DraggingEnded

        public new void DraggingEnded(UIScrollView scrollView, bool willDecelerate)
        {
            if (_tableView.ContentOffset.Y <= -65f) {

                _reloading = true;
                _tableView.ReloadData ();
                _refreshHeaderView.ToggleActivityView ();
                UIView.BeginAnimations ("ReloadingData");
                UIView.SetAnimationDuration (0.2);
                _tableView.ContentInset = new UIEdgeInsets (60f, 0f, 0f, 0f);
                UIView.CommitAnimations ();

                _nearbyViewController.SetNearbyBusStops();

                //ReloadTimer = NSTimer.CreateRepeatingScheduledTimer (new TimeSpan (0, 0, 0, 10, 0), () => dataSourceDidFinishLoadingNewData ());
                //_reloadTimer = NSTimer.CreateScheduledTimer (TimeSpan.FromSeconds (2f), delegate {
                    _reloadTimer = null;
                    _reloading = false;
                    //_refreshHeaderView.FlipImageAnimated (false);
                    _refreshHeaderView.ToggleActivityView ();
                    UIView.BeginAnimations ("DoneReloadingData");
                    UIView.SetAnimationDuration (0.3);
                    _tableView.ContentInset = new UIEdgeInsets (0f, 0f, 0f, 0f);
                    _refreshHeaderView.SetPullToUpdateStatus();
                    UIView.CommitAnimations ();
                    _refreshHeaderView.SetCurrentDate ();
                //});

            }

            _checkForRefresh = false;
        }
开发者ID:runegri,项目名称:MuPP,代码行数:32,代码来源:NearbyTableViewSource.cs


示例13: AnimateNextExpressionFrame

        public void AnimateNextExpressionFrame()
        {
            this._expressionFrameTimer = null;

            NSDictionary frameDictionary = this._curFrameArray.ObjectAtIndex(this._curFrameIndex).CastTo<NSDictionary>();

            // Grab image and force draw.  Use cache to reduce disk hits
            NSString frameImageName = frameDictionary[kCharacterExpressionFrameImageFileNameKey].CastTo<NSString>();
            Id imageName = this._imageCache[frameImageName];
            if (imageName != null)
            {
                this._curFrameImage = imageName.CastTo<NSImage>();
            }
            else
            {
                this._curFrameImage = new NSImage(NSBundle.MainBundle.PathForResourceOfType(frameImageName, NSString.Empty));
                this._imageCache[frameImageName] = this._curFrameImage;
                this._curFrameImage.Release();
            }
            this.Display();

            // If there is more than one frame, then schedule drawing of the next and increment our frame index.
            if (this._curFrameArray.Count > 1)
            {
                this._curFrameIndex++;
                this._curFrameIndex %= this._curFrameArray.Count;
                this._expressionFrameTimer = NSTimer.ScheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(frameDictionary[kCharacterExpressionFrameDurationKey].CastTo<NSNumber>().FloatValue,
                                                                                                                 this,
                                                                                                                 ObjectiveCRuntime.Selector("animateNextExpressionFrame"),
                                                                                                                 null,
                                                                                                                 false);
            }
        }
开发者ID:Monobjc,项目名称:monobjc-samples,代码行数:33,代码来源:SpeakingCharacterView.cs


示例14: CustomAnnotationProvider

        public CustomAnnotationProvider(int pages)
            : base()
        {
            annotations = new PSPDFAnnotation[pages].ToList ();

            // add timer in a way so it works while we're dragging pages
            timer = NSTimer.CreateTimer (1, this, new Selector ("timerFired:"), null, true);
            NSRunLoop.Current.AddTimer (timer, NSRunLoopMode.Common);
        }
开发者ID:kingyond,项目名称:Xamarin-v3,代码行数:9,代码来源:CustomAnnotationProvider.cs


示例15: ViewDidAppear

		public override void ViewDidAppear (bool animated)
		{
			base.ViewDidAppear (animated);

			#if __UNIFIED__
			timer = NSTimer.CreateScheduledTimer (1/30, this, new ObjCRuntime.Selector ("MoveCamera"), null, true);
			#else
			timer = NSTimer.CreateScheduledTimer (1/30, this, new MonoTouch.ObjCRuntime.Selector ("MoveCamera"), null, true);
			#endif
		}
开发者ID:asthanarht,项目名称:XamarinDiscountsApp,代码行数:10,代码来源:CameraViewController.cs


示例16: Awake

		public override void Awake (NSObject context)
		{
			base.Awake (context);

			timer = NSTimer.CreateRepeatingScheduledTimer (5, UpdateUserInterface);
			UpdateUserInterface (timer);

			// Configure interface objects here.
			Console.WriteLine ("{0} awake with context", this);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:10,代码来源:InterfaceController.cs


示例17: ViewDidLoad

 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
       countdown = OptionsRepository.GetOptions().Seconds;
       timerLabel.Text = countdown.ToString();
       if (cameraTimer == null)
       {
     cameraTimer = NSTimer.CreateRepeatingScheduledTimer(1.0, TimerFire);
       }
 }
开发者ID:spaceyjase,项目名称:timer,代码行数:10,代码来源:CameraOverlay.cs


示例18: SocketScannerHelper

 public SocketScannerHelper()
 {
     if (MonoTouch.ObjCRuntime.Runtime.Arch == MonoTouch.ObjCRuntime.Arch.SIMULATOR)
         return;
     ScanApi = new ScanApiHelper ();
     ScanApi.Delegate = new ScanDelegate (this);
     ScanApi.Open ();
     timer = NSTimer.CreateRepeatingScheduledTimer (.2, () => {
         var r = ScanApi.DoScanApiReceive();
     });
 }
开发者ID:nagyist,项目名称:iPadPos,代码行数:11,代码来源:SocketScannerHelper.cs


示例19: Initialize

		public static void Initialize()
		{
			CoreLocationManager = new CLLocationManager();
			
			CoreLocationManager.StartUpdatingLocation();
			
			CoreLocationManager.UpdatedHeading += HandleCoreLocationManagerUpdatedHeading;
			CoreLocationManager.UpdatedLocation += HandleCoreLocationManagerUpdatedLocation;
			
			UpdateLocationTimer = NSTimer.CreateRepeatingTimer(TimeSpan.FromMinutes(1), InitializeLocationUpdate);
			UpdateHeadingTimer =NSTimer.CreateRepeatingTimer(TimeSpan.FromMinutes(1), InitializeHeadingUpdate);
		}
开发者ID:GSerjo,项目名称:Seminars,代码行数:12,代码来源:LocationManager.cs


示例20: SetFadeTimer

 public void SetFadeTimer(NSTimer timer)
 {
     if (this.fadeTimer != timer)
     {
         if (this.fadeTimer != null)
         {
             this.fadeTimer.Invalidate();
             this.fadeTimer.SafeRelease();
         }
         this.fadeTimer = timer.SafeRetain();
     }
 }
开发者ID:Monobjc,项目名称:monobjc-samples,代码行数:12,代码来源:InspectorController.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# NSUrl类代码示例发布时间:2022-05-24
下一篇:
C# NSTableView类代码示例发布时间: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