Example #1
0
        public Dialog()
        {
            _dialog = DependencyService.Get <IDialog>(DependencyFetchTarget.NewInstance);
            if (_dialog == null)
            {
                throw new Exception("Object reference not set to an instance of a Dialog.");
            }

            _dialog.Hidden += (s, e) =>
            {
                Hidden?.Invoke(this, EventArgs.Empty);
            };

            _dialog.OutsideClicked += (s, e) =>
            {
                OutsideClicked?.Invoke(this, EventArgs.Empty);
            };

            _dialog.Shown += (s, e) =>
            {
                Shown?.Invoke(this, EventArgs.Empty);
            };

            _dialog.BackButtonPressed += (s, e) =>
            {
                BackButtonPressed?.Invoke(this, EventArgs.Empty);
            };

            SetBinding(ContentProperty, new Binding(nameof(Content), mode: BindingMode.OneWayToSource, source: _dialog));
            SetBinding(PositiveProperty, new Binding(nameof(Positive), mode: BindingMode.OneWayToSource, source: _dialog));
            SetBinding(NeutralProperty, new Binding(nameof(Neutral), mode: BindingMode.OneWayToSource, source: _dialog));
            SetBinding(NegativeProperty, new Binding(nameof(Negative), mode: BindingMode.OneWayToSource, source: _dialog));
            SetBinding(TitleProperty, new Binding(nameof(Title), mode: BindingMode.OneWayToSource, source: _dialog));
        }
Example #2
0
        /// <summary>
        /// Creates and initializes a new instance of the Popup class.
        /// </summary>
        /// <param name="parent">The EvasObject to which the new Popup will be attached as a child.</param>
        /// <since_tizen> preview </since_tizen>
        public Popup(EvasObject parent) : base(parent)
        {
            _dismissed     = new SmartEvent(this, "dismissed");
            _dismissed.On += (sender, e) =>
            {
                Dismissed?.Invoke(this, EventArgs.Empty);
            };

            _blockClicked     = new SmartEvent(this, "block,clicked");
            _blockClicked.On += (sender, e) =>
            {
                OutsideClicked?.Invoke(this, EventArgs.Empty);
            };

            _timeout     = new SmartEvent(this, "timeout");
            _timeout.On += (sender, e) =>
            {
                TimedOut?.Invoke(this, EventArgs.Empty);
            };

            _showFinished     = new SmartEvent(this, "show,finished");
            _showFinished.On += (sender, e) =>
            {
                ShowAnimationFinished?.Invoke(this, EventArgs.Empty);
            };
        }
Example #3
0
 private bool Popup_TouchEvent(object source, TouchEventArgs e)
 {
     if (previousState == PointStateType.Down && e.Touch.GetState(0) == PointStateType.Finished)
     {
         OutsideClicked?.Invoke(this, null);
     }
     previousState = e.Touch.GetState(0);
     return(true);
 }
        protected override IntPtr CreateHandle(EvasObject parent)
        {
            _popup = new Popup(parent);

            _popup.Dismissed += (s, e) =>
            {
                OnDismissed();
                Dismissed?.Invoke(s, e);
            };
            _popup.OutsideClicked += (s, e) =>
            {
                OutsideClicked?.Invoke(s, e);
            };
            _popup.TimedOut += (s, e) =>
            {
                TimedOut?.Invoke(s, e);
            };
            _popup.ShowAnimationFinished += (s, e) =>
            {
                ShowAnimationFinished?.Invoke(s, e);
            };

            return(_popup);
        }
 void OutsideClickedHandler(object sender, EventArgs e)
 {
     OutsideClicked?.Invoke(this, EventArgs.Empty);
 }