Ejemplo n.º 1
0
 public void UpdateOverlayItemPosition(OverlayView overlayView)
 {
     if (m_overlayItemView != null)
     {
         m_overlayItemView.gameObject.transform.position = ProjectHelper.WorldCameraToNGUIPos(overlayView.worldCamera, overlayView.NGUICamera, RoleObject.transform.position);//parent.position);
     }
 }
Ejemplo n.º 2
0
        void DismissWorker()
        {
            SetFadeoutTimer(null);

            UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn | UIViewAnimationOptions.AllowUserInteraction,
                           delegate {
                HudView.Transform.Scale(0.8f, 0.8f);
                this.Alpha = 0;
            }, delegate {
                if (Alpha == 0)
                {
                    InvokeOnMainThread(delegate {
                        NSNotificationCenter.DefaultCenter.RemoveObserver(this);
                        CancelRingLayerAnimation();
                        StringLabel.RemoveFromSuperview();
                        SpinnerView.RemoveFromSuperview();
                        ImageView.RemoveFromSuperview();
                        CancelHudButton.RemoveFromSuperview();

                        StringLabel     = null;
                        SpinnerView     = null;
                        ImageView       = null;
                        CancelHudButton = null;

                        HudView.RemoveFromSuperview();
                        HudView = null;
                        OverlayView.RemoveFromSuperview();
                        OverlayView = null;
                        this.RemoveFromSuperview();
                    });
                }
            });
        }
Ejemplo n.º 3
0
        void Initialize(bool isCurrentScope = false)
        {
            OnceInitializeAction = null;

            OverlayView.BackgroundColor = _loadingView.OverlayColor.ToUIColor();
            OverlayView.Alpha           = 0f;
            OverlayView.TranslatesAutoresizingMaskIntoConstraints = false;

            SetOverlayConstrants(isCurrentScope);

            _loadingView.Parent = Application.Current.MainPage;

            _renderer = Dialogs.CreateNativeView(_loadingView);

            if (_loadingView.CornerRadius > 0)
            {
                _renderer.NativeView.Layer.CornerRadius  = _loadingView.CornerRadius;
                _renderer.NativeView.Layer.MasksToBounds = true;
            }

            var measure = Dialogs.Measure(_loadingView);

            _renderer.SetElementSize(measure);

            var nativeView = _renderer.NativeView;

            nativeView.TranslatesAutoresizingMaskIntoConstraints = false;

            OverlayView.AddSubview(nativeView);

            nativeView.WidthAnchor.ConstraintEqualTo((System.nfloat)_loadingView.Bounds.Width).Active   = true;
            nativeView.HeightAnchor.ConstraintEqualTo((System.nfloat)_loadingView.Bounds.Height).Active = true;

            Dialogs.SetLayoutAlignment(nativeView, OverlayView, _loadingView);
        }
Ejemplo n.º 4
0
        void Initialize(bool isCurrentScope = false)
        {
            OnceInitializeAction = null;


            OverlayView.BackgroundColor = _config.OverlayColor.ToUIColor();
            OverlayView.Alpha           = 0f;
            OverlayView.TranslatesAutoresizingMaskIntoConstraints = false;

            SetOverlayConstrants(isCurrentScope);

            _activitySpinner       = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            _activitySpinner.Color = _config.IndicatorColor.ToUIColor();
            _activitySpinner.TranslatesAutoresizingMaskIntoConstraints = false;

            OverlayView.AddSubview(_activitySpinner);

            _activitySpinner.CenterXAnchor.ConstraintEqualTo(OverlayView.CenterXAnchor, _config.OffsetX).Active = true;
            _activitySpinner.CenterYAnchor.ConstraintEqualTo(OverlayView.CenterYAnchor, _config.OffsetY).Active = true;

            _messageLabel = new UILabel();
            _messageLabel.BackgroundColor = UIColor.Clear;
            _messageLabel.TextColor       = _config.FontColor.ToUIColor();
            _messageLabel.Font            = _messageLabel.Font.WithSize((System.nfloat)_config.FontSize);
            _messageLabel.TextAlignment   = UITextAlignment.Center;
            _messageLabel.Lines           = 0;
            _messageLabel.LineBreakMode   = UILineBreakMode.WordWrap;
            _messageLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            _messageLabel.Text = _message;

            OverlayView.AddSubview(_messageLabel);

            _messageLabel.TopAnchor.ConstraintEqualTo(_activitySpinner.BottomAnchor, 20).Active = true;
            _messageLabel.CenterXAnchor.ConstraintEqualTo(OverlayView.CenterXAnchor, _config.OffsetX).Active = true;
        }
Ejemplo n.º 5
0
        private void ShowOverlay(OverlayViewModel vm)
        {
            var view = new OverlayView
            {
                DataContext = vm
            };

            vm.CloseOverlay = () => view.Close();
            view.ShowDialog();
        }
Ejemplo n.º 6
0
        private void ShowContentOverlay(dynamic args)
        {
            OverlayView overlay = new OverlayView()
            {
                Close = RemoveOverlay
            };

            overlay.grdOverlay.Children.Add(args.Control);
            overlay.SetTitle((string)args.Title);
            Root.Children.Add(overlay);
        }
Ejemplo n.º 7
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (e.Args.Contains("/hint"))
            {
                // support headless mode
                var session       = _generalHintProviderService.EnumHints();
                var overlayWindow = new OverlayView()
                {
                    DataContext = new OverlayViewModel(session, _hintLabelService)
                };
                overlayWindow.Show();
            }
            else if (e.Args.Contains("/tray"))
            {
                // support headless tray mode
                var taskbarHWnd   = User32.FindWindow("Shell_traywnd", "");
                var session       = _generalHintProviderService.EnumHints(taskbarHWnd);
                var overlayWindow = new OverlayView()
                {
                    DataContext = new OverlayViewModel(session, _hintLabelService)
                };
                overlayWindow.Show();
            }
            else
            {
                // Prevent multiple startup in non-headless mode
                if (_singleLaunchMutex.AlreadyRunning)
                {
                    Current.Shutdown();
                    return;
                }

                // Create this as late as possible as it has a window
                _keyListenerService = new KeyListenerService();

                var shellViewModel = new ShellViewModel(
                    ShowOverlay,
                    ShowDebugOverlay,
                    ShowOptions,
                    _hintLabelService,
                    _generalHintProviderService,
                    _debugHintProviderService,
                    _keyListenerService);

                var shellView = new ShellView
                {
                    DataContext = shellViewModel
                };
                shellView.Show();
            }
            base.OnStartup(e);
        }
        void DismissWorker()
        {
            SetFadeoutTimer(null);
            SetProgressTimer(null);

            UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn | UIViewAnimationOptions.AllowUserInteraction,
                           delegate {
                HudView.Transform.Scale(0.8f, 0.8f);
                if (isClear)
                {
                    HudView.Alpha = 0f;
                }
                else
                {
                    Alpha = 0f;
                }
            }, delegate {
                if (Alpha == 0f || HudView.Alpha == 0f)
                {
                    InvokeOnMainThread(delegate {
                        Alpha         = 0f;
                        HudView.Alpha = 0f;

                        //Removing observers
                        UnRegisterNotifications();
                        NSNotificationCenter.DefaultCenter.RemoveObserver(this);

                        Ring.ResetStyle(UIColor.White);

                        CancelRingLayerAnimation();
                        StringLabel.RemoveFromSuperview();
                        SpinnerView.RemoveFromSuperview();
                        ImageView.RemoveFromSuperview();
                        if (_cancelHud != null)
                        {
                            _cancelHud.RemoveFromSuperview();
                        }

                        StringLabel = null;
                        SpinnerView = null;
                        ImageView   = null;
                        _cancelHud  = null;

                        HudView.RemoveFromSuperview();
                        HudView = null;
                        OverlayView.RemoveFromSuperview();
                        OverlayView = null;
                        this.RemoveFromSuperview();
                    });
                }
            });
        }
Ejemplo n.º 9
0
 void FadeOverlay(OverlayView overlay, bool fadeIn, float duration)
 {
     if (fadeIn)
     {
         overlay.FadeOut(0);
         overlay.FadeIn(duration);
     }
     else
     {
         overlay.FadeIn(0);
         overlay.FadeOut(duration);
     }
 }
        void ReleaseDesignerOutlets()
        {
            if (AmountToConvertTF != null)
            {
                AmountToConvertTF.Dispose();
                AmountToConvertTF = null;
            }

            if (ClosePickerButton != null)
            {
                ClosePickerButton.Dispose();
                ClosePickerButton = null;
            }

            if (ConvertedAmountLabel != null)
            {
                ConvertedAmountLabel.Dispose();
                ConvertedAmountLabel = null;
            }

            if (CurrencyPicker != null)
            {
                CurrencyPicker.Dispose();
                CurrencyPicker = null;
            }

            if (FromLabel != null)
            {
                FromLabel.Dispose();
                FromLabel = null;
            }

            if (OverlayView != null)
            {
                OverlayView.Dispose();
                OverlayView = null;
            }

            if (ToLabel != null)
            {
                ToLabel.Dispose();
                ToLabel = null;
            }
        }
Ejemplo n.º 11
0
        void ReleaseDesignerOutlets()
        {
            if (AddBarButton != null)
            {
                AddBarButton.Dispose();
                AddBarButton = null;
            }

            if (CancelBarButton != null)
            {
                CancelBarButton.Dispose();
                CancelBarButton = null;
            }

            if (MainView != null)
            {
                MainView.Dispose();
                MainView = null;
            }

            if (NavItem != null)
            {
                NavItem.Dispose();
                NavItem = null;
            }

            if (OverlayView != null)
            {
                OverlayView.Dispose();
                OverlayView = null;
            }

            if (TableView != null)
            {
                TableView.Dispose();
                TableView = null;
            }

            if (AccountSwitchingBarButton != null)
            {
                AccountSwitchingBarButton.Dispose();
                AccountSwitchingBarButton = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (OverlayView != null)
            {
                OverlayView.Dispose();
                OverlayView = null;
            }

            if (BadgeView != null)
            {
                BadgeView.Dispose();
                BadgeView = null;
            }

            if (BadgeLabel != null)
            {
                BadgeLabel.Dispose();
                BadgeLabel = null;
            }

            if (AmountLabel != null)
            {
                AmountLabel.Dispose();
                AmountLabel = null;
            }

            if (ItemImageView != null)
            {
                ItemImageView.Dispose();
                ItemImageView = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (TotalPriceLabel != null)
            {
                TotalPriceLabel.Dispose();
                TotalPriceLabel = null;
            }
        }
Ejemplo n.º 13
0
        private void InitializeNewNoteUI()
        {
            backgroundColor.Hidden = false;
            OverlayView.Hidden     = false;

            backgroundColor.Frame           = new RectangleF(0, 0, View.Frame.Width, View.Frame.Height);
            backgroundColor.BackgroundColor = UIColor.Black;
            backgroundColor.Alpha           = 0.5f;
            View.Add(backgroundColor);

            lblTitle.Text = dataHelper.GetCurrentDossierDataName();

            var x = View.Frame.Width / 2 - 210;
            var y = View.Frame.Height / 2 - 250;

            OverlayView.Frame = new RectangleF(x, y, 423, 498);
            OverlayView.Add(newNoteViewController.View);

            View.Add(OverlayView);
        }
        void ReleaseDesignerOutlets()
        {
            if (BackgroundView != null)
            {
                BackgroundView.Dispose();
                BackgroundView = null;
            }

            if (OverlayView != null)
            {
                OverlayView.Dispose();
                OverlayView = null;
            }

            if (ScoreLabel != null)
            {
                ScoreLabel.Dispose();
                ScoreLabel = null;
            }
        }
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     OverlayView.SetNeedsDisplay();
 }
Ejemplo n.º 16
0
        void DismissWorker()
        {
            SetFadeoutTimer(null);
            SetProgressTimer(null);

            UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn | UIViewAnimationOptions.AllowUserInteraction,
                           delegate
            {
                HudView.Transform.Scale(0.8f, 0.8f);
                if (isClear)
                {
                    HudView.Alpha = 0f;
                }
                else
                {
                    Alpha = 0f;
                }
            }, delegate
            {
                if (Alpha == 0f || HudView.Alpha == 0f)
                {
                    InvokeOnMainThread(delegate
                    {
                        Alpha         = 0f;
                        HudView.Alpha = 0f;

                        //Removing observers
                        UnRegisterNotifications();
                        NSNotificationCenter.DefaultCenter.RemoveObserver(this);

                        Ring.ResetStyle(IsiOS7ForLookAndFeel, (IsiOS7ForLookAndFeel ? TintColor : UIColor.White));

                        CancelRingLayerAnimation();
                        StringLabel.RemoveFromSuperview();
                        SpinnerView.RemoveFromSuperview();
                        ImageView.RemoveFromSuperview();
                        if (_cancelHud != null)
                        {
                            _cancelHud.RemoveFromSuperview();
                        }

                        StringLabel = null;
                        SpinnerView = null;
                        ImageView   = null;
                        _cancelHud  = null;

                        HudView.RemoveFromSuperview();
                        HudView = null;
                        OverlayView.RemoveFromSuperview();
                        OverlayView = null;
                        this.RemoveFromSuperview();

                        if (IsiOS7ForLookAndFeel)
                        {
                            var rootController = UIApplication.SharedApplication.GetKeyWindow().RootViewController;
                            if (rootController != null)
                            {
                                rootController.SetNeedsStatusBarAppearanceUpdate();
                            }
                        }
                    });
                }
            });
        }
Ejemplo n.º 17
0
        void ShowProgressWorker(float progress = -1, string status = null, MaskType maskType = MaskType.None, bool textOnly = false,
                                ToastPosition toastPosition = ToastPosition.Center, string cancelCaption = null, Action cancelCallback  = null,
                                double timeoutMs            = 1000, bool showContinuousProgress = false, UIImage displayContinuousImage = null)
        {
            Ring.ResetStyle(IsiOS7ForLookAndFeel, (IsiOS7ForLookAndFeel ? TintColor : UIColor.White));


            if (OverlayView.Superview == null)
            {
                var windows = UIApplication.SharedApplication.Windows;
                Array.Reverse(windows);
                foreach (UIWindow window in windows)
                {
                    if (!window.Hidden && window.IsKeyWindow)
                    {
                        window.AddSubview(OverlayView);
                        break;
                    }
                }
            }


            if (Superview == null)
            {
                OverlayView.AddSubview(this);
            }

            _fadeoutTimer    = null;
            ImageView.Hidden = true;
            _maskType        = maskType;
            _progress        = progress;

            StringLabel.Text = status;

            if (!string.IsNullOrEmpty(cancelCaption))
            {
                CancelHudButton.SetTitle(cancelCaption, UIControlState.Normal);
                CancelHudButton.TouchUpInside += delegate
                {
                    Dismiss();
                    if (cancelCallback != null)
                    {
                        obj.InvokeOnMainThread(() => cancelCallback.DynamicInvoke(null));
                        //cancelCallback.DynamicInvoke(null);
                    }
                };
            }

            UpdatePosition(textOnly);

            if (showContinuousProgress)
            {
                if (displayContinuousImage != null)
                {
                    _displayContinuousImage = true;
                    ImageView.Image         = displayContinuousImage;
                    ImageView.Hidden        = false;
                }

                RingLayer.StrokeEnd = 0.0f;
                StartProgressTimer(TimeSpan.FromMilliseconds(Ring.ProgressUpdateInterval));
            }
            else
            {
                if (progress >= 0)
                {
                    ImageView.Image  = null;
                    ImageView.Hidden = false;

                    SpinnerView.StopAnimating();
                    RingLayer.StrokeEnd = progress;
                }
                else if (textOnly)
                {
                    CancelRingLayerAnimation();
                    SpinnerView.StopAnimating();
                }
                else
                {
                    CancelRingLayerAnimation();
                    SpinnerView.StartAnimating();
                }
            }

            bool cancelButtonVisible = _cancelHud != null && _cancelHud.IsDescendantOfView(_hudView);

            // intercept user interaction with the underlying view
            if (maskType != MaskType.None || cancelButtonVisible)
            {
                OverlayView.UserInteractionEnabled = true;
                //AccessibilityLabel = status;
                //IsAccessibilityElement = true;
            }
            else
            {
                OverlayView.UserInteractionEnabled = false;
                //hudView.IsAccessibilityElement = true;
            }

            OverlayView.Hidden = false;
            this.toastPosition = toastPosition;
            PositionHUD(null);


            if (Alpha != 1)
            {
                RegisterNotifications();
                HudView.Transform.Scale(1.3f, 1.3f);

                if (isClear)
                {
                    Alpha         = 1f;
                    HudView.Alpha = 0f;
                }

                UIView.Animate(0.15f, 0,
                               UIViewAnimationOptions.AllowUserInteraction | UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.BeginFromCurrentState,
                               delegate
                {
                    HudView.Transform.Scale((float)1 / 1.3f, (float)1f / 1.3f);
                    if (isClear)
                    {
                        HudView.Alpha = 1f;
                    }
                    else
                    {
                        Alpha = 1f;
                    }
                }, delegate
                {
                    //UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, string);

                    if (textOnly)
                    {
                        StartDismissTimer(TimeSpan.FromMilliseconds(timeoutMs));
                    }
                });

                SetNeedsDisplay();
            }
        }
Ejemplo n.º 18
0
        void ReleaseDesignerOutlets()
        {
            if (JoinContainerView != null)
            {
                JoinContainerView.Dispose();
                JoinContainerView = null;
            }

            if (ChatView != null)
            {
                ChatView.Dispose();
                ChatView = null;
            }

            if (OverlayView != null)
            {
                OverlayView.Dispose();
                OverlayView = null;
            }

            if (JoinButton != null)
            {
                JoinButton.Dispose();
                JoinButton = null;
            }

            if (RoomTextField != null)
            {
                RoomTextField.Dispose();
                RoomTextField = null;
            }

            if (AudioButton != null)
            {
                AudioButton.Dispose();
                AudioButton = null;
            }

            if (ButtonContainerView != null)
            {
                ButtonContainerView.Dispose();
                ButtonContainerView = null;
            }

            if (ButtonContainerViewLeftConstraint != null)
            {
                ButtonContainerViewLeftConstraint.Dispose();
                ButtonContainerViewLeftConstraint = null;
            }

            if (FooterView != null)
            {
                FooterView.Dispose();
                FooterView = null;
            }

            if (FooterViewBottomConstraint != null)
            {
                FooterViewBottomConstraint.Dispose();
                FooterViewBottomConstraint = null;
            }

            if (HangupButton != null)
            {
                HangupButton.Dispose();
                HangupButton = null;
            }

            if (LocalView != null)
            {
                LocalView.Dispose();
                LocalView = null;
            }

            if (LocalViewBottomConstraint != null)
            {
                LocalViewBottomConstraint.Dispose();
                LocalViewBottomConstraint = null;
            }

            if (LocalViewHeightConstraint != null)
            {
                LocalViewHeightConstraint.Dispose();
                LocalViewHeightConstraint = null;
            }

            if (LocalViewRightConstraint != null)
            {
                LocalViewRightConstraint.Dispose();
                LocalViewRightConstraint = null;
            }

            if (LocalViewWidthConstraint != null)
            {
                LocalViewWidthConstraint.Dispose();
                LocalViewWidthConstraint = null;
            }

            if (RemoteView != null)
            {
                RemoteView.Dispose();
                RemoteView = null;
            }

            if (RemoteViewBottomConstraint != null)
            {
                RemoteViewBottomConstraint.Dispose();
                RemoteViewBottomConstraint = null;
            }

            if (RemoteViewLeftConstraint != null)
            {
                RemoteViewLeftConstraint.Dispose();
                RemoteViewLeftConstraint = null;
            }

            if (RemoteViewRightConstraint != null)
            {
                RemoteViewRightConstraint.Dispose();
                RemoteViewRightConstraint = null;
            }

            if (RemoteViewTopConstraint != null)
            {
                RemoteViewTopConstraint.Dispose();
                RemoteViewTopConstraint = null;
            }

            if (UrlLabel != null)
            {
                UrlLabel.Dispose();
                UrlLabel = null;
            }

            if (VideoButton != null)
            {
                VideoButton.Dispose();
                VideoButton = null;
            }
        }
Ejemplo n.º 19
0
        /*
         * void ShowProgressWorker(string cancelCaption, Delegate cancelCallback, float progress = -1, string status = null, MaskType maskType = MaskType.None){
         *      CancelHudButton.SetTitle(cancelCaption, UIControlState.Normal);
         *      CancelHudButton.TouchUpInside += delegate {
         *              BTProgressHUD.Dismiss();
         *              if(cancelCallback != null){
         *                      cancelCallback.DynamicInvoke(null);
         *              }
         *      };
         *      UpdatePosition();
         *      ShowProgressWorker(progress, status, maskType);
         * }
         */
        void ShowProgressWorker(float progress         = -1, string status = null, MaskType maskType = MaskType.None, bool textOnly = false,
                                bool showToastCentered = true, string cancelCaption = null, Action cancelCallback = null, double timeoutMs = 1000)
        {
            if (OverlayView.Superview == null)
            {
                UIApplication.SharedApplication.KeyWindow.AddSubview(OverlayView);
            }

            if (Superview == null)
            {
                OverlayView.AddSubview(this);
            }

            _fadeoutTimer    = null;
            ImageView.Hidden = true;
            _maskType        = maskType;
            _progress        = progress;

            StringLabel.Text = status;

            if (!string.IsNullOrEmpty(cancelCaption))
            {
                CancelHudButton.SetTitle(cancelCaption, UIControlState.Normal);
                CancelHudButton.TouchUpInside += delegate {
                    BTProgressHUD.Dismiss();
                    if (cancelCallback != null)
                    {
                        obj.InvokeOnMainThread(() => cancelCallback.DynamicInvoke(null));
                        //cancelCallback.DynamicInvoke(null);
                    }
                };
            }

            UpdatePosition(textOnly);

            if (progress >= 0)
            {
                ImageView.Image  = null;
                ImageView.Hidden = false;
                SpinnerView.StopAnimating();
                RingLayer.StrokeEnd = progress;
            }
            else if (textOnly)
            {
                CancelRingLayerAnimation();
                SpinnerView.StopAnimating();
            }
            else
            {
                CancelRingLayerAnimation();
                SpinnerView.StartAnimating();
            }

            if (maskType != MaskType.None)
            {
                OverlayView.UserInteractionEnabled = true;
                //AccessibilityLabel = status;
                //IsAccessibilityElement = true;
            }
            else
            {
                OverlayView.UserInteractionEnabled = true;
                //hudView.IsAccessibilityElement = true;
            }

            OverlayView.Hidden     = false;
            this.showToastCentered = showToastCentered;
            PositionHUD(null);


            if (Alpha != 1)
            {
                RegisterNotifications();
                HudView.Transform.Scale(1.3f, 1.3f);

                UIView.Animate(0.15f, 0,
                               UIViewAnimationOptions.AllowUserInteraction | UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.BeginFromCurrentState,
                               delegate {
                    HudView.Transform.Scale((float)1 / 1.3f, (float)1f / 1.3f);
                    Alpha = 1;
                }, delegate {
                    //UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, string);

                    if (textOnly)
                    {
                        StartDismissTimer(TimeSpan.FromMilliseconds(timeoutMs));
                    }
                });

                SetNeedsDisplay();
            }
        }
Ejemplo n.º 20
0
        private void UpdateOverlay()
        {
            if (OverlayView == null)
            {
                return;
            }
            foreach (var subview in this.OverlayView.Subviews)
            {
                subview.RemoveFromSuperview();
            }

            if (_borderVisible)
            {
                UIView borderView = new UIView(ScrollView.Frame.Inset(-1.0f, -1.0f));

                borderView.Layer.BorderColor = UIColor.White.ColorWithAlpha(0.5f).CGColor;
                borderView.Layer.BorderWidth = 1.0f;
                borderView.BackgroundColor   = UIColor.Clear;
                borderView.AutoresizingMask  = ScrollView.AutoresizingMask;
                if (_cropHoleType == CropHoleType.Circle)
                {
                    borderView.Layer.CornerRadius = borderView.Frame.Height / 2;
                }
                OverlayView.AddSubview(borderView);
            }

            CAShapeLayer maskWithHole = new CAShapeLayer();

            CGRect biggerRect  = OverlayView.Bounds;
            CGRect smallerRect = ScrollView.Frame;

            UIBezierPath maskPath = new UIBezierPath();

            maskPath.MoveTo(new CGPoint(biggerRect.GetMinX(), biggerRect.GetMinY()));
            maskPath.AddLineTo(new CGPoint(biggerRect.GetMinX(), biggerRect.GetMaxY()));
            maskPath.AddLineTo(new CGPoint(biggerRect.GetMaxX(), biggerRect.GetMaxY()));
            maskPath.AddLineTo(new CGPoint(biggerRect.GetMaxX(), biggerRect.GetMinY()));
            maskPath.AddLineTo(new CGPoint(biggerRect.GetMinX(), biggerRect.GetMinY()));

            switch (_cropHoleType)
            {
            case CropHoleType.Square:
            {
                maskPath.MoveTo(new CGPoint(smallerRect.GetMinX(), smallerRect.GetMinY()));
                maskPath.AddLineTo(new CGPoint(smallerRect.GetMinX(), smallerRect.GetMaxY()));
                maskPath.AddLineTo(new CGPoint(smallerRect.GetMaxX(), smallerRect.GetMaxY()));
                maskPath.AddLineTo(new CGPoint(smallerRect.GetMaxX(), smallerRect.GetMinY()));
                maskPath.AddLineTo(new CGPoint(smallerRect.GetMinX(), smallerRect.GetMinY()));
            }
            break;

            case CropHoleType.Circle:
            {
                maskPath.MoveTo(new CGPoint(smallerRect.GetMaxX(), smallerRect.GetMidY()));
                maskPath.AddArc(
                    center: ScrollView.Center,
                    radius: smallerRect.Height / 2,
                    startAngle: DegreesToRadians(0),
                    endAngle: DegreesToRadians(360),
                    clockWise: true);
            }
            break;
            }

            maskWithHole.Frame    = this.Bounds;
            maskWithHole.Path     = maskPath.CGPath;
            maskWithHole.FillRule = CAShapeLayer.FillRuleEvenOdd;

            OverlayView.Layer.Mask = maskWithHole;
        }
Ejemplo n.º 21
0
 private void MenuForm_FormClosed(object sender, EventArgs e)
 {
     OverlayView.Dispose();
     Dispose();
     Environment.Exit(0);
 }
 void ReleaseDesignerOutlets()
 {
     if (ControlsOverlay != null)
     {
         ControlsOverlay.Dispose();
         ControlsOverlay = null;
     }
     if (FinishRoundButton != null)
     {
         FinishRoundButton.Dispose();
         FinishRoundButton = null;
     }
     if (HintLabel != null)
     {
         HintLabel.Dispose();
         HintLabel = null;
     }
     if (OverlayView != null)
     {
         OverlayView.Dispose();
         OverlayView = null;
     }
     if (PlayerOnePlayerNameLabel != null)
     {
         PlayerOnePlayerNameLabel.Dispose();
         PlayerOnePlayerNameLabel = null;
     }
     if (PlayerOneProfilePictureImage != null)
     {
         PlayerOneProfilePictureImage.Dispose();
         PlayerOneProfilePictureImage = null;
     }
     if (PlayerOneTimeElapsed != null)
     {
         PlayerOneTimeElapsed.Dispose();
         PlayerOneTimeElapsed = null;
     }
     if (PlayerOneViewContainer != null)
     {
         PlayerOneViewContainer.Dispose();
         PlayerOneViewContainer = null;
     }
     if (PlayerTwoPlayerNameLabel != null)
     {
         PlayerTwoPlayerNameLabel.Dispose();
         PlayerTwoPlayerNameLabel = null;
     }
     if (PlayerTwoProfilePictureImage != null)
     {
         PlayerTwoProfilePictureImage.Dispose();
         PlayerTwoProfilePictureImage = null;
     }
     if (PlayerTwoTimeElapsed != null)
     {
         PlayerTwoTimeElapsed.Dispose();
         PlayerTwoTimeElapsed = null;
     }
     if (PlayerTwoViewContainer != null)
     {
         PlayerTwoViewContainer.Dispose();
         PlayerTwoViewContainer = null;
     }
 }