void StopDisplayLink () { if (displayLink != null) { displayLink.Invalidate (); displayLink = null; } }
void StartDisplayLinkIfNeeded () { if (displayLink == null) { displayLink = CADisplayLink.Create (() => CubeView.Display ()); displayLink.AddToRunLoop (NSRunLoop.Main, NSRunLoop.UITrackingRunLoopMode); } }
public void Start () { waveBoundaryPath = new UIBezierPath (); waveLayer = new CAShapeLayer (); waveLayer.FillColor = new CGColor (0, 0, 0, 1); Layer.AddSublayer (waveLayer); waveDisplaylink = CADisplayLink.Create (() => GetCurrentWave (waveDisplaylink)); waveDisplaylink.AddToRunLoop (NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); }
public override void ViewDidLoad () { base.ViewDidLoad (); backgroundQueue = new DispatchQueue ("com.videotimeline.backgroundqueue", false); displayLink = CADisplayLink.Create (DisplayLinkCallback); displayLink.AddToRunLoop (NSRunLoop.Current, NSRunLoopMode.Default); displayLink.Paused = true; lastCallbackTime = 0.0; bufferSemaphore = new SemaphoreSlim (0); }
public void StopAnimating() { if (!IsAnimating) { return; } displayLink.Invalidate(); displayLink = null; DestroyFrameBuffer(); IsAnimating = false; }
private void ReleaseDisplayLink() { if (_isAttachedToLooper) { //Detach the _displayLink to the MainLoop (uiThread). _displayLink?.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); //detaches from the UI thread _displayLink?.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoop.UITrackingRunLoopMode); _displayLink = null; _isAttachedToLooper = false; } }
public void StopRendering() { if (!_isRendering) { return; } _displayLink.Invalidate(); _displayLink = null; DestroyFrameBuffer(); _isRendering = false; }
public void StartAnimation() { if (!animating) { displayLink = CADisplayLink.Create(drawView); displayLink.FrameInterval = AnimationFrameInterval; displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); animating = true; } }
public override void ViewDidLoad() { base.ViewDidLoad(); backgroundQueue = new DispatchQueue("com.videotimeline.backgroundqueue", false); displayLink = CADisplayLink.Create(DisplayLinkCallback); displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Default); displayLink.Paused = true; lastCallbackTime = 0.0; bufferSemaphore = new SemaphoreSlim(0); }
public CADisplayLinkTimeSource (iPhoneOSGameView view, int frameInterval) { this.view = view; if (displayLink != null) displayLink.Invalidate (); displayLink = CADisplayLink.Create (this, selRunIteration); displayLink.FrameInterval = frameInterval; displayLink.Paused = true; }
public void StartAnimating() { if (IsAnimating) return; CreateFrameBuffer (); CADisplayLink displayLink = UIScreen.MainScreen.CreateDisplayLink (this, new Selector ("drawFrame")); displayLink.FrameInterval = _frameInterval; displayLink.AddToRunLoop (NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); _displayLink = displayLink; IsAnimating = true; }
protected override void Dispose(bool disposing) { // stop the render loop if (_displayLink != null) { _displayLink.Invalidate(); _displayLink.Dispose(); _displayLink = null; } base.Dispose(disposing); }
public void StartRendering() { LayerColorFormat = EAGLColorFormat.RGBA8; CreateFrameBuffer(); GL.ClearColor(1, 1, 1, 1); CADisplayLink displayLink = UIScreen.MainScreen.CreateDisplayLink(this, new Selector("drawFrame")); displayLink.FrameInterval = 1; displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); Map.ViewChanged(true); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.SystemPinkColor; // device init GraphicsDeviceOptions options = new GraphicsDeviceOptions(false, null, false, ResourceBindingModel.Improved); #if DEBUG options.Debug = true; #endif SwapchainSource ss = SwapchainSource.CreateUIView(this.View.Handle); SwapchainDescription scd = new SwapchainDescription( ss, width, height, PixelFormat.R32_Float, false); graphicsDevice = GraphicsDevice.CreateMetal(options); swapchain = graphicsDevice.ResourceFactory.CreateSwapchain(ref scd); factory = graphicsDevice.ResourceFactory; // resource init CreateSizeDependentResources(); VertexPosition[] quadVertices = { new VertexPosition(new Vector3(-1, 1, 0)), new VertexPosition(new Vector3(1, 1, 0)), new VertexPosition(new Vector3(-1, -1, 0)), new VertexPosition(new Vector3(1, -1, 0)) }; uint[] quadIndices = new uint[] { 0, 1, 2, 1, 3, 2 }; vertexBuffer = factory.CreateBuffer(new BufferDescription(4 * VertexPosition.SizeInBytes, BufferUsage.VertexBuffer)); indexBuffer = factory.CreateBuffer(new BufferDescription(6 * sizeof(uint), BufferUsage.IndexBuffer)); graphicsDevice.UpdateBuffer(vertexBuffer, 0, quadVertices); graphicsDevice.UpdateBuffer(indexBuffer, 0, quadIndices); commandList = factory.CreateCommandList(); viewLoaded = true; displayLink = CADisplayLink.Create(Render); displayLink.PreferredFramesPerSecond = 60; displayLink.AddToRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); }
public DisplayLinkTimer() { var link = CADisplayLink.Create(OnLinkTick); TimerThread = new Thread(() => { link.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Common); NSRunLoop.Current.Run(); }); TimerThread.Start(); UIApplication.Notifications.ObserveDidEnterBackground((_,__) => link.Paused = true); UIApplication.Notifications.ObserveWillEnterForeground((_, __) => link.Paused = false); }
private void SetupTimer() { if (this.updateTimer != null) { this.updateTimer.Invalidate(); this.updateTimer.Dispose(); this.updateTimer = null; } this.updateTimer = CADisplayLink.Create(this.Refresh); this.updateTimer.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Default); }
public void Open(LiquidFloatingCell[] cells) { Stop(); displayLink = CADisplayLink.Create(DidDisplayRefresh); displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Common); opening = true; foreach (var cell in cells) { cell.Layer.RemoveAllAnimations(); cell.Layer.EraseShadow(); openingCells.Add(cell); } }
public CADisplayLinkTimeSource(iOSGameView view, int preferredFramesPerSecond) { this.view = view; if (displayLink != null) { displayLink.Invalidate(); } displayLink = CADisplayLink.Create(this, selRunIteration); displayLink.PreferredFramesPerSecond = preferredFramesPerSecond; displayLink.Paused = true; }
protected void StopAutoScroll() { if (displayLink == null) { return; } displayLink.Paused = true; displayLink.Dispose(); displayLink = null; isAutoScrollingUp = false; isAutoScrollingDown = false; }
private void showStartTimerSuccess(string description) { descriptionLabel.Text = string.IsNullOrEmpty(description) ? "No Description" : description; timeLabel.Text = ""; timeFrameLabel.Text = ""; var start = DateTimeOffset.Now; var displayLink = CADisplayLink.Create(() => { var passed = DateTimeOffset.Now - start; timeLabel.Text = secondsToString(passed.Seconds); }); displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Default); }
void UpdateAnimation() { if (ShouldAnimate()) { displayLink = CADisplayLink.Create(TimerFired); displayLink.AddToRunLoop(NSRunLoop.Main, NSRunLoopMode.Common); displayLink.PreferredFramesPerSecond = 60; } else { displayLink?.Invalidate(); displayLink = null; } }
void addInputTraitsObservers() { // note that KVO doesn't work on textDocumentProxy, so we have to poll if (traitPollingTimer != null) { traitPollingTimer.Invalidate(); } traitPollingTimer = UIScreen.MainScreen.CreateDisplayLink(() => pollTraits()); if (traitPollingTimer != null) { traitPollingTimer.AddToRunLoop(NSRunLoop.Current, mode: NSRunLoopMode.Default); } //Console.WriteLine("addInputTraitsObservers done"); }
public override void ViewDidLoad() { base.ViewDidLoad(); constantDataBufferIndex = 0; inflightSemaphore = new Semaphore(max_inflight_buffers, max_inflight_buffers); SetupMetal(); LoadAssets(); timer = CADisplayLink.Create(Gameloop); timer.FrameInterval = 1; timer.AddToRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); }
public void StartAnimating() { if (IsAnimating) { return; } CreateFrameBuffer(); displayLink = UIScreen.MainScreen.CreateDisplayLink(this, new Selector("drawFrame")); displayLink.FrameInterval = frameInterval; displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); IsAnimating = true; }
public void Close(LiquidFloatingCell[] cells) { Stop(); opening = false; displayLink = CADisplayLink.Create(DidDisplayRefresh); displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Common); foreach (var cell in cells) { cell.Layer.RemoveAllAnimations(); cell.Layer.EraseShadow(); openingCells.Add(cell); cell.UserInteractionEnabled = false; } }
public void Open(LiquidFloatingCell[] cells) { Stop(); _displayLink = CADisplayLink.Create(DidDisplayRefresh); _displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Common); _opening = true; foreach (var cell in cells) { // ISSUE: reference to a compiler-generated method cell.Layer.RemoveAllAnimations(); cell.Layer.EraseShadow(); _openingCells.Add(cell); } }
protected override void SetupRenderLoop(bool oneShot) { // only start if we haven't already if (_displayLink != null) { return; } // bail out if we are requesting something that the view doesn't want to if (!oneShot && !Element.HasRenderLoop) { return; } // if this is a one shot request, don't bother with the display link if (oneShot) { var nativeView = Control; nativeView?.BeginInvokeOnMainThread(() => { if (nativeView.Handle != IntPtr.Zero) { nativeView.Display(); } }); return; } // create the loop _displayLink = CADisplayLink.Create(() => { var nativeView = Control; var formsView = Element; // stop the render loop if this was a one-shot, or the views are disposed if (nativeView == null || formsView == null || nativeView.Handle == IntPtr.Zero || !formsView.HasRenderLoop) { _displayLink.Invalidate(); _displayLink.Dispose(); _displayLink = null; return; } // redraw the view nativeView.Display(); }); _displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); }
public IOSWindow(IOSAppDelegate appDelegate) { _displaySize = new Vector2Int( (int)UIScreen.MainScreen.NativeBounds.Size.Width, (int)UIScreen.MainScreen.NativeBounds.Size.Height ); _stopwatch = new Stopwatch(); _stopwatch2 = new Stopwatch(); // Create the window Window = new UIWindow(UIScreen.MainScreen.Bounds); Window.RootViewController = new NozNavigationController(); Window.BackgroundColor = UIColor.White; Window.MakeKeyAndVisible(); appDelegate.Window = Window; // Create GL context GLContext = new EAGLContext(EAGLRenderingAPI.OpenGLES3); EAGLContext.SetCurrentContext(GLContext); // Create teh view _view = new NozView(this, Window.Bounds); _view.MultipleTouchEnabled = true; _view.UserInteractionEnabled = true; Window.AddSubview(_view); Graphics.Driver = OpenGLDriver.Create(); // Create render buffer.. _renderBufferId = GL.GenRenderBuffer(); GL.BindRenderBuffer(_renderBufferId); GLContext.RenderBufferStorage((uint)GL.Imports.GL_RENDERBUFFER, (CAEAGLLayer)_view.Layer); // Create frame buffer _frameBufferId = GL.GenFrameBuffer(); GL.BindFrameBuffer(_frameBufferId); GL.FrameBufferRenderBuffer(_renderBufferId); var link = CADisplayLink.Create(() => { Application.Step(); }); link.PreferredFramesPerSecond = 60; link.AddToRunLoop(NSRunLoop.Main, NSRunLoopMode.Default); }
protected override void Dispose(bool disposing) { if (this.displayLink != null) { // ISSUE: reference to a compiler-generated method this.displayLink.Invalidate(); this.displayLink.Dispose(); this.displayLink = (CADisplayLink)null; if (this.Element != null) { this.Element.remove_DisplayRequested(new EventHandler(this.Display)); } } base.Dispose(disposing); }
void UpdateValue() { double now = NSDate.Now.SecondsSinceReferenceDate; progress += now - lastUpdate; lastUpdate = now; if (progress >= totalTime) { timer.Invalidate(); timer = null; progress = totalTime; } SetTextValue(CurrentValue()); }
public void StartRendering() { if (_isRendering) { return; } CreateFrameBuffer(); CADisplayLink displayLink = UIScreen.MainScreen.CreateDisplayLink(this, new Selector("drawFrame")); displayLink.FrameInterval = _frameInterval; displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); _displayLink = displayLink; _isRendering = true; }
private void CreateDisplayLink() { if (_displayLink != null) { _displayLink.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); } _displayLink = UIScreen.MainScreen.CreateDisplayLink(_viewController.View as iOSGameView, new Selector("doTick")); // FrameInterval represents how many frames must pass before the selector // is called again. We calculate this by dividing our target elapsed time by // the duration of a frame on iOS (Which is 1/60.0f at the time of writing this). _displayLink.FrameInterval = (int)Math.Round(60f * Game.TargetElapsedTime.TotalSeconds); _displayLink.AddToRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (context != null) { context.Dispose(); context = null; } if (displayLink != null) { displayLink.Dispose(); displayLink = null; } }
protected override void Dispose(bool disposing) { if (_displayLink != null) { _displayLink.Invalidate(); _displayLink.Dispose(); _displayLink = null; if (Element != null) { Element.DisplayRequested -= Display; } } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (_displayLink != null) { _displayLink.Invalidate(); _displayLink.Dispose(); _displayLink = null; if (Element != null) { ((IOpenGlViewController)Element).DisplayRequested -= Display; } } base.Dispose(disposing); }
public void StartAnimating() { if (IsAnimating) { return; } base.UpdateFrame += onUpdateFrame; base.RenderFrame += onRenderFrame; IOSGameWindow.Instance.OnLoad(new EventArgs()); _displayLink = UIScreen.MainScreen.CreateDisplayLink(this, new Selector("drawFrame")); _displayLink.FrameInterval = _frameInterval; _displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); IsAnimating = true; }
/// <summary> /// Dispose the specified disposing. /// </summary> /// <param name="disposing">If set to <c>true</c> disposing.</param> protected override void Dispose(bool disposing) { base.Dispose(disposing); if (_displayLink != null) { _displayLink.Invalidate (); _displayLink = null; } OsmSharp.Logging.Log.TraceEvent ("MapView", TraceEventType.Verbose, "Disposing MapView"); if (_onScreenBuffer != null && _onScreenBuffer.NativeImage != null) { _onScreenBuffer.NativeImage.Dispose(); } StopRenderingLoop (); }
public void DispatchGameLoop () { timer = CADisplayLink.Create (Gameloop); timer.FrameInterval = 1; timer.AddToRunLoop (NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); }
public void StartAnimation() { if(!Animating) { if(displayLinkSupported) { // CADisplayLink is API new to iPhone SDK 3.1. Compiling against earlier versions will result in a warning, but can // be dismissed. If the system version runtime check for CADisplayLink exists in the Constructor. The runtime ensure // this code will not be called in system versions earlier than 3.1. displayLink = CADisplayLink.Create(DrawView); displayLink.FrameInterval = AnimationFrameInterval; displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); } else { animationTimer = NSTimer.CreateScheduledTimer((1.0 / 60.0) * AnimationFrameInterval, DrawView); } Animating = true; } }
public void StopAnimation() { if(!Animating) { if(displayLinkSupported) { displayLink.Invalidate(); displayLink = null; } else { animationTimer.Invalidate(); animationTimer = null; } Animating = false; } }
private void CreateFrameBuffer() { // Setup layer eaglLayer = (CAEAGLLayer)this.Layer; eaglLayer.Opaque = false; bool layerRetainsBacking = false; NSString layerColorFormat = EAGLColorFormat.RGBA8; eaglLayer.DrawableProperties = NSDictionary.FromObjectsAndKeys(new NSObject[] { NSNumber.FromBoolean(layerRetainsBacking), layerColorFormat }, new NSObject[] { EAGLDrawableProperty.RetainedBacking, EAGLDrawableProperty.ColorFormat }); // Create OpenGL drawing context EAGLRenderingAPI api = EAGLRenderingAPI.OpenGLES2; context = new EAGLContext(api); if (context == null) { throw new InvalidOperationException("Failed to initialize OpenGLES 2.0 context"); } if (!EAGLContext.SetCurrentContext(context)) { throw new InvalidOperationException("Failed to set current OpenGL context"); } // Create render buffer and assign it to the context GL.GenRenderbuffers(1, ref colorRenderBuffer); GL.BindRenderbuffer(All.Renderbuffer, colorRenderBuffer); context.RenderBufferStorage((uint)All.Renderbuffer, eaglLayer); // Create frame buffer uint frameBuffer = 0; GL.GenFramebuffers(1, ref frameBuffer); GL.BindFramebuffer(All.Framebuffer, frameBuffer); GL.FramebufferRenderbuffer(All.Framebuffer, All.ColorAttachment0, All.Renderbuffer, colorRenderBuffer); // Set viewport Size size = new Size((int)Math.Round((double)eaglLayer.Bounds.Size.Width), (int)Math.Round((double)eaglLayer.Bounds.Size.Height)); GL.Viewport(0, 0, size.Width, size.Height); // Create CADisplayLink for animation loop displayLink = CADisplayLink.Create(this, new Selector("render")); displayLink.FrameInterval = 1; displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); }
public void Invalidate() { if (displayLink != null) { displayLink.Invalidate (); displayLink = null; } }
public void StopAnimation () { if (animating) { displayLink.Invalidate (); displayLink = null; animating = false; } }
/// <summary> /// Stops the updating meter. /// </summary> private void StopUpdatingMeter() { mmeterUpdateDisplayLink.Invalidate (); mmeterUpdateDisplayLink = null; }
protected SkiaView() : base(UIScreen.MainScreen.ApplicationFrame, GetContext()) { (_link = CADisplayLink.Create(() => OnFrame())).AddToRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); }
/// <summary> /// Starts the updating meter. /// </summary> private void StartUpdatingMeter() { if (mmeterUpdateDisplayLink != null) mmeterUpdateDisplayLink.Invalidate (); mmeterUpdateDisplayLink = CADisplayLink.Create (UpdateMeters); mmeterUpdateDisplayLink.AddToRunLoop (NSRunLoop.Current, NSRunLoopMode.Common); }
public void Initialize() { CAEAGLLayer eaglLayer = (CAEAGLLayer)Layer; eaglLayer.Opaque = true; eaglLayer.DrawableProperties = NSDictionary.FromObjectsAndKeys( new object[] { NSNumber.FromBoolean(false), EAGLColorFormat.RGBA8 }, new object[] { EAGLDrawableProperty.RetainedBacking, EAGLDrawableProperty.ColorFormat }); m_context = new EAGLContext(EAGLRenderingAPI.OpenGLES2); if(m_context == null || !EAGLContext.SetCurrentContext(m_context)) { throw new ApplicationException("Could not create/set EAGLContext"); } m_renderer = new ES2Renderer(); m_renderer.InitWithContext(m_context, (CAEAGLLayer)Layer); Animating = false; displayLinkSupported = false; animationFrameInterval = 1; displayLink = null; animationTimer = null; // A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer // class is used as fallback when it isn't available. var reqSysVer = new NSString("3.1"); var currSysVer = new NSString(UIDevice.CurrentDevice.SystemVersion); if(currSysVer.Compare(reqSysVer, NSStringCompareOptions.NumericSearch) != NSComparisonResult.Ascending) displayLinkSupported = true; }
public void BeginAnimationWithLazyViews(ScrollingTickerLazyLoadingHandler dataSource,List<NSValue>subviewsSizes,ScrollDirection direction=ScrollDirection.FromRight, float scrollSpeed=0.0f, int loops=0,ScrollingTickerAnimationCompletition completition=null) { if (isAnimating) EndAnimation(false); lazyLoadingHandler = dataSource; animationCompletitionHandler = completition; numberOfLoops = loops; scrollViewDirection = direction; scrollViewSpeed = (scrollSpeed == 0 ? kLPScrollingAnimationPixelsPerSecond : scrollSpeed); displayLink = CADisplayLink.Create(this,new Selector("tickerDidScroll")); displayLink.AddToRunLoop(NSRunLoop.Main,NSRunLoop.NSDefaultRunLoopMode); LayoutTickerSubviewsWithItemSizes(subviewsSizes); BeginAnimation(); }
PlatformThreadingInterface() { // For some reason it doesn't work when I specify OnFrame method directly // ReSharper disable once ConvertClosureToMethodGroup (_link = CADisplayLink.Create(() => OnFrame())).AddToRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); }
public void BeginAnimationWithViews(List<UIView> views, ScrollDirection direction=ScrollDirection.FromRight, float scrollSpeed=0.0f, int loops=0,ScrollingTickerAnimationCompletition completition=null) { if (isAnimating) EndAnimation(false); lazyLoadingHandler = null; animationCompletitionHandler = completition; numberOfLoops = loops; scrollViewDirection = direction; scrollViewSpeed = (scrollSpeed == 0 ? kLPScrollingAnimationPixelsPerSecond : scrollSpeed); if (displayLink!=null) { // Display link is used to catch the current visible area of the scrolling view during the animation displayLink.RemoveFromRunLoop(NSRunLoop.Main,NSRunLoop.NSDefaultRunLoopMode); displayLink = null; } LayoutTickerSubviewsWithItems(views); BeginAnimation(); }
private void CreateDisplayLink() { if (_caDisplayLink != null) _caDisplayLink.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); _caDisplayLink = UIScreen.MainScreen.CreateDisplayLink(_viewController.View as iOSGameView, new Selector("doTick")); // FrameInterval represents how many frames must pass before the selector // is called again. We calculate this by dividing our target elapsed time by // the duration of a frame on iOS (Which is 1/60.0f at the time of writing this). _caDisplayLink.FrameInterval = (int)Math.Round(60f * Game.TargetElapsedTime.TotalSeconds); _caDisplayLink.AddToRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode); }
private bool PerformPendingExit() { if (!_isExitPending) return false; _isExitPending = false; if (_caDisplayLink != null) { _caDisplayLink.Invalidate(); _caDisplayLink.Dispose(); _caDisplayLink = null; } UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.Fade); if (_viewController != null) { _viewController.InterfaceOrientationChanged -= ViewController_InterfaceOrientationChanged; _viewController.View.RemoveFromSuperview (); _viewController.View.Dispose(); _viewController.RemoveFromParentViewController (); //this might crash ventus? _viewController.Dispose(); _viewController = null; } if (_mainWindow != null) { _mainWindow.RemoveFromSuperview(); _mainWindow.Dispose(); _mainWindow = null; } if (Window != null) { Window = null; } Net.NetworkSession.Exit(); StopObservingUIApplication (); RaiseAsyncRunLoopEnded (); //this.Game=null; return true; }
public void StopRendering() { if (!_isRendering) return; _displayLink.Invalidate (); _displayLink = null; DestroyFrameBuffer (); _isRendering = false; }
/// <summary> /// Plaies the action. /// </summary> /// <param name="item">Item.</param> /// <param name="args">Arguments.</param> private void PlayAction(object item, EventArgs args) { m_oldSessionCategory = AVAudioSession.SharedInstance().Category; AVAudioSession.SharedInstance ().SetCategory (AVAudioSessionCategory.Playback); // m_audioPlayer = AVAudioPlayer.FromUrl(NSUrl.FromFilename(m_recordingFilePath)); m_audioPlayer.WeakDelegate = this; m_audioPlayer.MeteringEnabled = true; m_audioPlayer.PrepareToPlay(); m_audioPlayer.Play(); //UI Update { this.SetToolbarItems (new UIBarButtonItem[]{ m_pauseButton,m_flexItem1, m_recordButton,m_flexItem2, m_trashButton}, true); this.ShowNavigationButton (false); m_recordButton.Enabled = false; m_trashButton.Enabled = false; } //Start regular update { m_playerSlider.Value = (float)m_audioPlayer.CurrentTime; m_playerSlider.MaxValue = (float)m_audioPlayer.Duration; m_viewPlayerDuration.Frame = this.NavigationController.NavigationBar.Bounds; m_labelCurrentTime.Text = NSStringExtensions.TimeStringForTimeInterval (m_audioPlayer.CurrentTime); m_labelRemainingTime.Text = NSStringExtensions.TimeStringForTimeInterval((m_ShouldShowRemainingTime) ? (m_audioPlayer.Duration - m_audioPlayer.CurrentTime): m_audioPlayer.Duration); m_viewPlayerDuration.SetNeedsLayout(); m_viewPlayerDuration.LayoutIfNeeded(); this.NavigationItem.TitleView = m_viewPlayerDuration; if (mplayProgressDisplayLink != null) mplayProgressDisplayLink.Invalidate (); mplayProgressDisplayLink = CADisplayLink.Create (UpdatePlayProgress); mplayProgressDisplayLink.AddToRunLoop (NSRunLoop.Current, NSRunLoopMode.Common); } }
public void StartAnimation () { if (!animating) { displayLink = CADisplayLink.Create (drawView); displayLink.FrameInterval = AnimationFrameInterval; displayLink.AddToRunLoop (NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); animating = true; } }
/// <summary> /// Pauses the action. /// </summary> /// <param name="item">Item.</param> /// <param name="args">Arguments.</param> private void PauseAction(object item, EventArgs args) { // //UI Update { this.SetToolbarItems (new UIBarButtonItem[]{m_playButton,m_flexItem1, m_recordButton,m_flexItem2, m_trashButton }, true); this.ShowNavigationButton (true); m_recordButton.Enabled = true; m_trashButton.Enabled = true; } // { mplayProgressDisplayLink.Invalidate (); mplayProgressDisplayLink = null; this.NavigationItem.TitleView = null; } // m_audioPlayer.Delegate = null; m_audioPlayer.Stop(); m_audioPlayer = null; AVAudioSession.SharedInstance ().SetCategory(new NSString(m_oldSessionCategory)); }
public void Stop () { waveDisplaylink.Invalidate (); waveDisplaylink = null; }
public CADisplayLinkTimeSource(iPhoneOSGameView view, int frameInterval) { this.view = view; if (displayLink != null) displayLink.Invalidate (); displayLink = CADisplayLink.Create (this, selRunIteration); displayLink.FrameInterval = frameInterval; displayLink.Paused = true; }
public void StopAnimating () { if (!IsAnimating) return; displayLink.Invalidate (); displayLink = null; DestroyFrameBuffer (); IsAnimating = false; }
void GetCurrentWave (CADisplayLink displayLink) { offsetX += WaveSpeed; waveLayer.Path = GetCurrentWavePath (); waveBoundaryPath.CGPath = waveLayer.Path; }