当前位置: 首页>>代码示例>>C#>>正文


C# NSTimer类代码示例

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


NSTimer类属于命名空间,在下文中一共展示了NSTimer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ViewDidDisappear

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

			_autoRefreshTimer.Invalidate ();
			_autoRefreshTimer = null;
		}
开发者ID:GSerjo,项目名称:Seminars,代码行数:7,代码来源:ViewController07.cs

示例15: CancelHoldTimer

		void CancelHoldTimer ()
		{
			if (holdTimer == null)
				return;
			holdTimer.Invalidate ();
			holdTimer = null;
		}
开发者ID:21Off,项目名称:21Off,代码行数:7,代码来源:TapView.cs


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