Esempio n. 1
0
 private void TextViewDidEndEditingEventHandler(object sender, NSNotificationEventArgs e)
 {
     if (ActiveTextView == e.Notification.Object)
     {
         _activeTextView = null;
     }
 }
Esempio n. 2
0
 internal void OnFinishedPlaying(object sender, NSNotificationEventArgs args)
 {
     if (DonePlaying != null)
     {
         DonePlaying(sender, args);
     }
 }
        private void playBackIsPreparedToPlayHandler(object sender, NSNotificationEventArgs args)
        {
            Logger.Log("UIChaptersEnabledVideoView.playBackIsPreparedToPlayHandler:" +
                       "PlaybackState = '" + moviePlayer.MoviePlayer.PlaybackState + "', LoadState='" + moviePlayer.MoviePlayer.LoadState + "'");

            moviePlayer.MoviePlayer.Play();
        }
        private void OnLoadStateChanged(object sender, NSNotificationEventArgs e)
        {
            if (moviePlayer.LoadState == MPMovieLoadState.Playable)
            {

            }
        }
Esempio n. 5
0
        private void OnDidPlayToEndTime(object sender, NSNotificationEventArgs e)
        {
            player.Dispose();
            player = null;

            Status = Status.Recorded;
        }
        void OnClose(object sender, NSNotificationEventArgs e)
        {
            _btnResultsClipboardObserver?.Dispose();
            _btnResultsNotificationCenterObserver?.Dispose();

            BindGlobalShortcuts();
        }
Esempio n. 7
0
        private void RotationDidChanged(object sender, NSNotificationEventArgs nsNotificationEventArgs)
        {
            var orientation = UIDevice.CurrentDevice.Orientation;

            if (orientation.IsFlat())
            {
                return;
            }

            var directional = orientation.IsPortrait()
                ? UICollectionViewScrollDirection.Horizontal
                : UICollectionViewScrollDirection.Vertical;

            _flowLayout.ScrollDirection = directional;

            if (_selectedIndex == 0)
            {
                return;
            }

            var indexPath      = NSIndexPath.FromItemSection(_selectedIndex, 0);
            var scrollPosition = orientation.IsPortrait()
                ? UICollectionViewScrollPosition.CenteredHorizontally
                : UICollectionViewScrollPosition.CenteredVertically;

            CollectionView.ScrollToItem(indexPath, scrollPosition, false);
        }
Esempio n. 8
0
 private async void StopPreview(object o = null, NSNotificationEventArgs args = null)
 {
     await Task.Run(() =>
     {
         _captureSession.StopRunning();
     });
 }
Esempio n. 9
0
 private void FullInit(object o = null, NSNotificationEventArgs args = null)
 {
     SetupCamera(true);
     StartPreview();
     NativeView.Add(_liveCameraStream);
     NativeView.ClipsToBounds = true;
 }
Esempio n. 10
0
        protected void OnOrientationChanged(object sender, NSNotificationEventArgs args)
        {
            var rotaion = DeviceRotation;

            switch (UIDevice.CurrentDevice.Orientation)
            {
            case UIDeviceOrientation.Portrait:
                DeviceRotation = DeviceRotation.Portrait;
                break;

            case UIDeviceOrientation.LandscapeRight:
                DeviceRotation = DeviceRotation.Landscape;
                break;

            case UIDeviceOrientation.PortraitUpsideDown:
                DeviceRotation = DeviceRotation.ReversePortrait;
                break;

            case UIDeviceOrientation.LandscapeLeft:
                DeviceRotation = DeviceRotation.ReverseLandscape;
                break;
            }

            if (rotaion != DeviceRotation)
            {
                OrientationChanged?.Invoke(this, DeviceRotation);
            }
        }
        private void PlayToEndNotificationHandler(object sender, NSNotificationEventArgs args)
        {
            IsPlaying = false;
            seekToZeroBeforePlaying = true;

            UpdatePlayPauseButton();
        }
Esempio n. 12
0
 void onOrientationChanged(object sender, NSNotificationEventArgs e)
 {
     if (cameraIsObservingDeviceOrientation)
     {
         Debug.WriteLine("~~ onOrientationChanged ~~");
         _orientationChanged();
     }
 }
Esempio n. 13
0
 private void ApplicationDidBecomeActive(object sender, NSNotificationEventArgs args)
 {
     // Start if _flyover is available
     if (_flyover != null)
     {
         Start(_flyover);
     }
 }
Esempio n. 14
0
 private static void _defaultMoviePlayerNotificationHandler(object sender, NSNotificationEventArgs e)
 {
     if (_playerVC.moviePlayer.loadState == MPMovieLoadState.Playable)
     {
         Debug.Log("PLAY MOVIE");
         _playerVC.moviePlayer.Play();
     }
 }
Esempio n. 15
0
 void HandleQueryFileListReceived(object sender, NSNotificationEventArgs e)
 {
     try {
         ReadQueryResults();
     } catch (Exception ex) {
         Log.Error(ex);
     }
 }
Esempio n. 16
0
 void OnEditingChanged(object sender, NSNotificationEventArgs e)
 {
     if (isKeyboardPresent)
     {
         activeTextInputView = (UIView)e.Notification.Object;
         OnKeyboardShow(null, null);
     }
 }
Esempio n. 17
0
 private void OnBatteryNotification(object sender, NSNotificationEventArgs args)
 {
     CoreDispatcher.Current.Run(
         () =>
     {
         this.BatteryStatusChanged?.Invoke(this, this.BatteryStatus);
         this.RemainingChargePercentChanged?.Invoke(this, this.RemainingChargePercent);
     });
 }
        private void didEnterBackgroundHandler(object sender, NSNotificationEventArgs args)
        {
            Logger.Log("UIChaptersEnabledVideoView.didEnterBackgroundHandler");

            if (!moviePlayer.MoviePlayer.AirPlayVideoActive)
            {
                moviePlayer.MoviePlayer.Pause();
            }
        }
        private void willEnterForegroundHandler(object sender, NSNotificationEventArgs args)
        {
            Logger.Log("UIChaptersEnabledVideoView.willEnterForegroundHandler");

            if (moviePlayer.MoviePlayer.PlaybackState != MPMoviePlaybackState.Playing)
            {
                moviePlayer.MoviePlayer.Play();
            }
        }
Esempio n. 20
0
        protected void OnWindowWillCloseNotification(object sender, NSNotificationEventArgs e)
        {
            var window = e.Notification.Object as NSWindow;

            if (Windows.Contains(window))
            {
                Windows.Remove(window);
            }
        }
Esempio n. 21
0
            internal void HandleTextChange(NSNotificationEventArgs args)
            {
                var field = args.Notification.Object as UITextView;

                if (field == TextInputView)
                {
                    UpdateTextViewHeight();
                    SendButton.Enabled = TextInputView.HasText;
                }
            }
        void DidPlayToEndTime(object sender, NSNotificationEventArgs args)
        {
            if (args.Notification.Object != Player.CurrentItem)
            {
                return;
            }

            // Update play pause button.
            PlayPauseButton.SetImage(UIImage.FromBundle("PlayButton"), UIControlState.Normal);
        }
Esempio n. 23
0
        private static void _OnStoreChanged(object sender, NSNotificationEventArgs e)
        {
            if (_valuesChangedHandlers != null)
            {
                var reason = (NSUbiquitousKeyValueStoreChangeReasonValues)Enum.ToObject(
                    typeof(NSUbiquitousKeyValueStoreChangeReasonValues),
                    Convert.ToInt32(e.userInfo[NSUbiquitousKeyValueStore.ChangeReasonKey]));

                object[]            keys    = e.userInfo[NSUbiquitousKeyValueStore.ChangedKeysKey] as object[];
                iCloudPrefsChange[] changes = new iCloudPrefsChange[keys.Length];

                for (int i = 0; i < keys.Length; i++)
                {
                    string key = keys[i] as string;

                    // get old value
                    object oldValue = _userDefaults.Object(USER_DEFAULTS_PREFIX + key);
                    if ((oldValue is int) || (oldValue is long))
                    {
                        oldValue = Convert.ToInt32(oldValue);
                    }
                    else if ((oldValue is double) || (oldValue is float))
                    {
                        oldValue = (float)Convert.ToDouble(oldValue);
                    }

                    // clean new value, and set it in cache
                    object newValue = store.Object(key);
                    if (newValue == null)
                    {
                        _userDefaults.RemoveObject(USER_DEFAULTS_PREFIX + key);
                    }
                    else if (newValue is string)
                    {
                        _userDefaults.SetObject(newValue, USER_DEFAULTS_PREFIX + key);
                    }
                    else if ((newValue is int) || (newValue is long))
                    {
                        // in case of long, convert it to int first
                        newValue = Convert.ToInt32(newValue);
                        _userDefaults.SetInteger((int)newValue, USER_DEFAULTS_PREFIX + key);
                    }
                    else if ((newValue is double) || (newValue is float))
                    {
                        // in case of double, convert it to float first
                        newValue = (float)Convert.ToDouble(newValue);
                        _userDefaults.SetDouble((float)newValue, USER_DEFAULTS_PREFIX + key);
                    }

                    changes[i] = new iCloudPrefsChange(key, newValue, oldValue);
                }

                _valuesChangedHandlers(null, new iCloudPrefsChangedEventArgs(reason, changes));
            }
        }
Esempio n. 24
0
        private void OnMediaEnded(object sender, NSNotificationEventArgs args)
        {
            MediaEnded?.Invoke(this, null);

            if (Source is MediaPlaybackList && (AVPlayerItem)args.Notification.Object != _player.Items.Last())
            {
                return;
            }

            PlaybackSession.PlaybackState = MediaPlaybackState.None;
        }
        //////////////////
        ////////////////// END OF WORKAROUND
        //////////////////
        ///

        /// <summary>
        /// Tokens the refresh notification.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void TokenRefreshNotification(object sender, NSNotificationEventArgs e)
        {
            // This method will be fired everytime a new token is generated, including the first
            // time. So if you need to retrieve the token as soon as it is available this is where that
            // should be done.
            //var refreshedToken = InstanceId.SharedInstance.Token;

            ConnectToFCM(_window.RootViewController);

            // TODO: If necessary send token to application server.
        }
 /// <summary>
 /// Battery changed notification triggered, bubble up.
 /// </summary>
 void BatteryChangedNotification(object sender, NSNotificationEventArgs args)
 {
   Helpers.EnsureInvokedOnMainThread(() =>
   {
     OnBatteryChanged(new BatteryChangedEventArgs
       {
         RemainingChargePercent = RemainingChargePercent,
         IsLow = RemainingChargePercent <= 15,
         Status = Status,
         PowerSource = PowerSource
       });
   });
 }
Esempio n. 27
0
 /// <summary>
 /// Battery changed notification triggered, bubble up.
 /// </summary>
 void BatteryChangedNotification(object sender, NSNotificationEventArgs args)
 {
     Helpers.EnsureInvokedOnMainThread(() =>
     {
         OnBatteryChanged(new BatteryChangedEventArgs
         {
             RemainingChargePercent = RemainingChargePercent,
             IsLow       = RemainingChargePercent <= 15,
             Status      = Status,
             PowerSource = PowerSource
         });
     });
 }
Esempio n. 28
0
 /// <summary>
 /// UIApplicationWillResignActive notification handler
 /// </summary>
 private void ApplicationWillResignActive(object sender, NSNotificationEventArgs args)
 {
     if (State != FlyoverCameraState.Stopped)
     {
         // Stop flyover as application is no longer active
         Stop();
     }
     else
     {
         // Clear flyover to prevent start on DidBecomeActive
         _flyover = null;
     }
 }
Esempio n. 29
0
        public void ApplicationWillEnterForeGround(object sender, NSNotificationEventArgs e)
        {
            switch (OnForegroundAction)
            {
            case HidingNavigationForegroundAction.Show:
                _navBarController.Expand();
                _tabBarController?.Expand();
                break;

            case HidingNavigationForegroundAction.Hide:
                _navBarController.Contract();
                _tabBarController?.Contract();
                break;
            }
        }
Esempio n. 30
0
 private void DidBeginEditing(object sender, NSNotificationEventArgs e)
 {
     if (ScrollView != null)
     {
         var view   = e.Notification.Object as UIView;
         var parent = view.Superview;
         while (parent != null)
         {
             if (parent.Handle == ScrollView.Handle)
             {
                 ActiveView = view;
             }
             parent = parent.Superview;
         }
     }
 }
Esempio n. 31
0
        void GameControllerDidConnect(object sender, NSNotificationEventArgs e)
        {
            var controller = (GCController)e.Notification.Object;

            Console.WriteLine("Connected game controller: {0}", controller);

            var playerIndex = controller.PlayerIndex;

            if (playerIndex == GCController.PlayerIndexUnset)
            {
                AssignUnknownController(controller);
            }
            else
            {
                AssignPresetController(controller, playerIndex);
            }
        }
Esempio n. 32
0
        void GameControllerDidDisconnect(object sender, NSNotificationEventArgs e)
        {
            var controller = (GCController)e.Notification.Object;

            foreach (Player player in players)
            {
                if (player == null)
                {
                    continue;
                }

                if (player.Controller == controller)
                {
                    player.Controller = null;
                }
            }

            Console.WriteLine("Disconnected game controller: {0}", controller);
        }
Esempio n. 33
0
		static void CloudAccountAvailabilityChanged (object sender, NSNotificationEventArgs e)
		{
			Console.WriteLine ("UbiquityIdentityDidChange: {0}", CloudAvailable);
		}
Esempio n. 34
0
		void HandleQueryFileListReceived (object sender, NSNotificationEventArgs e)
		{
			try {
				ReadQueryResults ();
			} catch (Exception ex) {
				Log.Error (ex);
			}
		}
		void DidPlayToEndTime (object sender, NSNotificationEventArgs args)
		{
			if (args.Notification.Object != Player.CurrentItem)
				return;

			// Update play pause button.
			PlayPauseButton.SetImage (UIImage.FromBundle ("PlayButton"), UIControlState.Normal);
		}
Esempio n. 36
0
 private static void _defaultMoviePlayerNotificationHandler(object sender, NSNotificationEventArgs e)
 {
     if (_playerVC.moviePlayer.loadState == MPMovieLoadState.Playable) {
         Debug.Log("PLAY MOVIE");
         _playerVC.moviePlayer.Play();
     }
 }
Esempio n. 37
0
 private static void _defaultMoviePlayerFinishHandler(object sender, NSNotificationEventArgs e)
 {
     CloseMoviePlayer();
 }
		void MenuWillHide (object sender, NSNotificationEventArgs e)
		{
			var selected = tableView.IndexPathForSelectedRow;
			tableView.DeselectRow (selected, false);
		}
		void OnDidPlayToEndTime (object sender, NSNotificationEventArgs e)
		{
			player.Dispose ();
			player = null;
		}
Esempio n. 40
0
        private static void _OnStoreChanged(object sender, NSNotificationEventArgs e)
        {
            if (_valuesChangedHandlers != null) {
                var reason = (NSUbiquitousKeyValueStoreChangeReasonValues)Enum.ToObject(
                    typeof(NSUbiquitousKeyValueStoreChangeReasonValues),
                    Convert.ToInt32(e.userInfo[NSUbiquitousKeyValueStore.ChangeReasonKey]));

                object[] keys = e.userInfo[NSUbiquitousKeyValueStore.ChangedKeysKey] as object[];
                iCloudPrefsChange[] changes = new iCloudPrefsChange[keys.Length];

                for (int i=0; i<keys.Length; i++) {
                    string key = keys[i] as string;

                    // get old value
                    object oldValue = _userDefaults.Object(USER_DEFAULTS_PREFIX + key);
                    if ((oldValue is int) || (oldValue is long)) {
                        oldValue = Convert.ToInt32(oldValue);
                    } else if ((oldValue is double) || (oldValue is float)) {
                        oldValue = (float)Convert.ToDouble(oldValue);
                    }

                    // clean new value, and set it in cache
                    object newValue = store.Object(key);
                    if (newValue == null) {
                        _userDefaults.RemoveObject(USER_DEFAULTS_PREFIX + key);

                    } else if (newValue is string) {
                        _userDefaults.SetObject(newValue, USER_DEFAULTS_PREFIX + key);

                    } else if ((newValue is int) || (newValue is long)) {
                        // in case of long, convert it to int first
                        newValue = Convert.ToInt32(newValue);
                        _userDefaults.SetInteger((int)newValue, USER_DEFAULTS_PREFIX + key);

                    } else if ((newValue is double) || (newValue is float)) {
                        // in case of double, convert it to float first
                        newValue = (float)Convert.ToDouble(newValue);
                        _userDefaults.SetDouble((float)newValue, USER_DEFAULTS_PREFIX + key);
                    }

                    changes[i] = new iCloudPrefsChange(key, newValue, oldValue);
                }

                _valuesChangedHandlers(null, new iCloudPrefsChangedEventArgs(reason, changes));
            }
        }
Esempio n. 41
0
 private void OnOrientationChanged(object sender, NSNotificationEventArgs args)
 {
     CommonInit();
 }
Esempio n. 42
0
		void DidEnterBackground (object sender, NSNotificationEventArgs notification)
		{
			Paused = true;
		}
Esempio n. 43
0
    private void _OnOrientationChanged(object sender, NSNotificationEventArgs e)
    {
        if (isPlaying) {

            DeviceOrientation newOrientation = Input.deviceOrientation;
            if (newOrientation == _oldOrientation)
                return;

            // check whether to reinit draw data now or later
            switch (newOrientation) {
                case DeviceOrientation.Portrait:
                case DeviceOrientation.PortraitUpsideDown:
                    if ((_oldOrientation == DeviceOrientation.LandscapeLeft) || (_oldOrientation == DeviceOrientation.LandscapeRight))
                        _needScreenChecking = true;
                    else
                        _InitDrawData();
                    break;
                case DeviceOrientation.LandscapeRight:
                case DeviceOrientation.LandscapeLeft:
                    if ((_oldOrientation == DeviceOrientation.Portrait) || (_oldOrientation == DeviceOrientation.PortraitUpsideDown))
                        _needScreenChecking = true;
                    else
                        _InitDrawData();
                    break;
                default:
                    break;
            }
        }
    }
Esempio n. 44
0
		void WillEnterForeground (object sender, NSNotificationEventArgs notification)
		{
			Paused = false;
		}
        void GameControllerDidDisconnect(object sender, NSNotificationEventArgs e)
        {
            var controller = (GCController)e.Notification.Object;
            foreach (Player player in players) {
                if (player == null)
                    continue;

                if (player.Controller == controller)
                    player.Controller = null;
            }

            Console.WriteLine ("Disconnected game controller: {0}", controller);
        }
        void GameControllerDidConnect(object sender, NSNotificationEventArgs e)
        {
            var controller = (GCController)e.Notification.Object;
            Console.WriteLine ("Connected game controller: {0}", controller);

            var playerIndex = controller.PlayerIndex;
            if (playerIndex == GCController.PlayerIndexUnset)
                AssignUnknownController (controller);
            else
                AssignPresetController (controller, playerIndex);
        }
		private void PlayToEndNotificationHandler (object sender, NSNotificationEventArgs args)
		{
			IsPlaying = false;
			seekToZeroBeforePlaying = true;

			UpdatePlayPauseButton ();
		}
Esempio n. 48
0
 private static void _defaultMoviePlayerExitFullscreen(object sender, NSNotificationEventArgs e)
 {
     _playerVC.moviePlayer.Stop();
 }
Esempio n. 49
0
        internal void OnFinishedPlaying (object sender, NSNotificationEventArgs args)
		{
			if (DonePlaying != null)
			    DonePlaying(sender, args);
		}