예제 #1
0
 private static void IsOpenChangedAction(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (IsOpenChanged != null)
     {
         IsOpenChanged.Invoke(d, e);
     }
 }
예제 #2
0
        public async Task _hide(bool invokeCallback = true, bool isBackdrop = false)
        {
            using (await locker.LockAsync())
            {
                if (isBackdrop && _isIgnoreClickOnBackdrop)
                {
                    return;
                }

                _isOpen = false;
                await new JsService(JSRuntime).SetModalClose();
                await InvokeAsync(StateHasChanged);

                if (invokeCallback)
                {
                    await IsOpenChanged.InvokeAsync(_isOpen);
                }
                await Task.Delay(5);

                if (IsDraggable)
                {
                    await new JsService(JSRuntime).RemoveDraggable(Id);
                }
            }
        }
예제 #3
0
 protected void OnEscape(object sender, EventArgs e)
 {
     _isOpen = false;
     Closed  = true;
     IsOpenChanged.InvokeAsync(false);
     BlazorStrapInterop.OnEscapeEvent -= OnEscape;
     InvokeAsync(StateHasChanged);
 }
예제 #4
0
 protected void onEscape(UIKeyboardEventArgs e)
 {
     if (e.Key.ToLower() == "escape" && !IgnoreEscape)
     {
         _isOpen = false;
         IsOpenChanged.InvokeAsync(false);
         StateHasChanged();
     }
 }
예제 #5
0
 public virtual void Hide()
 {
     if (_manual)
     {
         throw new InvalidOperationException("Boolean IsOpen and @Ref show/hide/toggle. May not be used together. ");
     }
     _isOpen = false;
     IsOpenChanged.InvokeAsync(false);
     StateHasChanged();
 }
예제 #6
0
 /// <summary>
 /// 点击背景遮罩方法
 /// </summary>
 public void OnContainerClick()
 {
     if (IsBackdrop)
     {
         IsOpen = false;
         if (IsOpenChanged.HasDelegate)
         {
             IsOpenChanged.InvokeAsync(IsOpen);
         }
         OnClickBackdrop?.Invoke();
     }
 }
예제 #7
0
        private void OnIsOpenChanged()
        {
            UpdateResizingAdorner();

            IsOpenChanged?.Invoke(this, EventArgs.Empty);

            if (IsPinned)
            {
                // Stop pinning
                SetCurrentValue(IsPinnedProperty, false);
            }
        }
 public virtual void Toggle()
 {
     if (_manual != null)
     {
         throw new InvalidOperationException("Boolean IsOpen and @Ref show/hide/toggle. May not be used together. ");
     }
     _isOpen    = !_isOpen;
     JustOpened = _isOpen;
     Changed(_isOpen);
     IsOpenChanged.InvokeAsync(_isOpen);
     StateHasChanged();
 }
예제 #9
0
        public void Close()
        {
            if (!CurrentSp.IsOpen)
            {
                return;
            }

            CurrentSp.Close();
            if (IsOpenChanged != null)
            {
                IsOpenChanged.Invoke(CurrentSp.IsOpen);
            }
        }
예제 #10
0
        private void OnIsOpenChanged()
        {
            IsOpenChanged?.Invoke(this, EventArgs.Empty);

            if (!IsOpen)
            {
                if (PopupAnimation == PopupAnimation.Fade && SuppressFadeAnimation)
                {
                    StopAnimation();
                }

                Closing?.Invoke(this, EventArgs.Empty);
            }
        }
예제 #11
0
 /// <summary>
 /// 点击背景遮罩方法
 /// </summary>
 public async Task OnContainerClick()
 {
     if (IsBackdrop)
     {
         IsOpen = false;
         if (IsOpenChanged.HasDelegate)
         {
             await IsOpenChanged.InvokeAsync(IsOpen);
         }
         if (OnClickBackdrop != null)
         {
             await OnClickBackdrop.Invoke();
         }
     }
 }
예제 #12
0
        public override void ResponseReceived(byte[] parameter)
        {
            switch ((HvncCommunication)parameter[0])
            {
            case HvncCommunication.ResponseDesktopCreated:
                IsOpen = true;
                IsOpenChanged?.Invoke(this, EventArgs.Empty);

                RenderEngine = new RenderEngine(BitConverter.ToInt32(parameter, 1),
                                                BitConverter.ToInt32(parameter, 5), RequestInformationDelegate);
                RenderEngineUpdated?.Invoke(this, EventArgs.Empty);

                LogService.Receive("Desktop created");
                break;

            case HvncCommunication.ResponseUpdate:
                RenderEngine.Update(new Serializer(typeof(WindowUpdate)).Deserialize <WindowUpdate>(parameter, 1));
                break;

            case HvncCommunication.ResponseUpdateFailed:
                RenderEngine?.UpdateFailed();
                break;

            case HvncCommunication.ResponseDesktopNotOpened:
                LogService.Error("Desktop was not initialized");
                break;

            case HvncCommunication.ResponseDesktopClosed:
                IsOpen = false;
                IsOpenChanged?.Invoke(this, EventArgs.Empty);

                RenderEngine.Stop();
                RenderEngine.Dispose();
                RenderEngine = null;
                RenderEngineUpdated?.Invoke(this, EventArgs.Empty);
                break;

            case HvncCommunication.ResponseProcessExecuted:
                LogService.Receive("Process executed");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #13
0
        private async Task _show(bool invokeCallback = true)
        {
            using (await locker.LockAsync())
            {
                _isOpen = true;
                await new JsService(JSRuntime).SetModalOpen();
                await InvokeAsync(StateHasChanged);

                if (invokeCallback)
                {
                    await IsOpenChanged.InvokeAsync(_isOpen);
                }
                await Task.Delay(5);

                if (IsDraggable)
                {
                    await new JsService(JSRuntime).MakeDraggable(Id);
                }
            }
        }
예제 #14
0
 private void OnVisableChange(object sender, bool e)
 {
     _isOpen = e;
     Invoke(() => { IsOpenChanged.InvokeAsync(e); });
 }
예제 #15
0
 public void OnToggleOpen(MouseEventArgs mouseEventArgs)
 {
     IsOpenChanged.InvokeAsync(!IsOpen);
     //isLoadingVisible = !isCollapsed && IsGroupLoading != null; // && IsGroupLoading(group);
 }
예제 #16
0
 private void Close()
 {
     IsOpen = false;
     IsOpenChanged.InvokeAsync(IsOpen);
 }
예제 #17
0
        private void OnIsOpenChanged()
        {
            UpdateResizingAdorner();

            IsOpenChanged.SafeInvoke(this);
        }
예제 #18
0
 private void RaiseIsOpenChanged()
 {
     IsOpenChanged?.Invoke(this, null);
 }
예제 #19
0
 private void OnIsOpenChanged()
 {
     IsOpenChanged.SafeInvoke(this);
 }
 private void RaiseIsOpenChangedEvent()
 {
     IsOpenChanged?.Invoke(this, new EventArgs());
 }
예제 #21
0
        /// <summary>
        /// Called when popup IsOpened changes
        /// </summary>
        private void OnIsOpenChanged(bool oldValue, bool newValue)
        {
            if (PlacementTarget == null || Content == null)
            {
                throw new Exception("PlacementTarget is null");
            }

            if (PopupLayout == null)
            {
                throw new Exception("PopupLayout is null. Set app popup layout when app start.");
            }

            this.AbortAnimation(_openingAnimationName);
            this.AbortAnimation(_closingAnimationName);

            if (newValue)
            {
                // If actual content is not created
                if (_actualContent == null)
                {
                    if (Content is View content)
                    {
                        _actualContent = content;
                    }
                    else if (ContentTemplate != null)
                    {
                        _actualContent = ContentTemplate.CreateContent() as View;

                        if (Content != null)
                        {
                            Binding bind = new Binding("Content");
                            bind.Source = this;
                            bind.Mode   = BindingMode.OneWay;
                            _actualContent.SetBinding(View.BindingContextProperty, bind);
                        }
                    }
                }

                if (_popupRootLayout.Content != _actualContent)
                {
                    _popupRootLayout.Content = _actualContent;
                }

                _openPopups.Add(this);

                InitializeForOpeningAnimation();
                SetContentLayoutOptions(Placement);

                // Create opening animation
                _openingAnimationGroup = CreateOpeningAnimation();

                if (PopupLayout.Children.Contains(_popupRootLayout) == false)
                {
                    // Add popup to layout
                    PopupLayout.Children.Add(_popupRootLayout);
                }

                if (_openingAnimationGroup != null)
                {
                    _openingAnimationGroup.Commit(this, _openingAnimationName, 64, (uint)OpeningAnimation.Duration, Easing.Linear, (double p, bool isAborted) =>
                    {
                        AnimationFinished?.Invoke(this, IsOpen);
                    });
                }
                else
                {
                    AnimationFinished?.Invoke(this, IsOpen);
                }

                IsOpenChanged?.Invoke(this, IsOpen);
                OnOpened();
            }
            else
            {
                _openPopups.Remove(this);

                // Create closing animation
                _closingAnimationGroup = CreateClosingAnimation();

                if (_closingAnimationGroup != null)
                {
                    _closingAnimationGroup.Commit(this, _closingAnimationName, 64, (uint)ClosingAnimation.Duration, Easing.Linear, (arg1, arg2) =>
                    {
                        if (arg2 == false)
                        {
                            PopupLayout.Children.Remove(_popupRootLayout);
                        }

                        AnimationFinished?.Invoke(this, IsOpen);
                    });
                }
                else
                {
                    PopupLayout.Children.Remove(_popupRootLayout);
                    AnimationFinished?.Invoke(this, IsOpen);
                }

                IsOpenChanged?.Invoke(this, IsOpen);
                OnClosed();
            }
        }