private static void IsOpenChangedAction(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (IsOpenChanged != null) { IsOpenChanged.Invoke(d, e); } }
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); } } }
protected void OnEscape(object sender, EventArgs e) { _isOpen = false; Closed = true; IsOpenChanged.InvokeAsync(false); BlazorStrapInterop.OnEscapeEvent -= OnEscape; InvokeAsync(StateHasChanged); }
protected void onEscape(UIKeyboardEventArgs e) { if (e.Key.ToLower() == "escape" && !IgnoreEscape) { _isOpen = false; IsOpenChanged.InvokeAsync(false); StateHasChanged(); } }
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(); }
/// <summary> /// 点击背景遮罩方法 /// </summary> public void OnContainerClick() { if (IsBackdrop) { IsOpen = false; if (IsOpenChanged.HasDelegate) { IsOpenChanged.InvokeAsync(IsOpen); } OnClickBackdrop?.Invoke(); } }
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(); }
public void Close() { if (!CurrentSp.IsOpen) { return; } CurrentSp.Close(); if (IsOpenChanged != null) { IsOpenChanged.Invoke(CurrentSp.IsOpen); } }
private void OnIsOpenChanged() { IsOpenChanged?.Invoke(this, EventArgs.Empty); if (!IsOpen) { if (PopupAnimation == PopupAnimation.Fade && SuppressFadeAnimation) { StopAnimation(); } Closing?.Invoke(this, EventArgs.Empty); } }
/// <summary> /// 点击背景遮罩方法 /// </summary> public async Task OnContainerClick() { if (IsBackdrop) { IsOpen = false; if (IsOpenChanged.HasDelegate) { await IsOpenChanged.InvokeAsync(IsOpen); } if (OnClickBackdrop != null) { await OnClickBackdrop.Invoke(); } } }
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(); } }
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); } } }
private void OnVisableChange(object sender, bool e) { _isOpen = e; Invoke(() => { IsOpenChanged.InvokeAsync(e); }); }
public void OnToggleOpen(MouseEventArgs mouseEventArgs) { IsOpenChanged.InvokeAsync(!IsOpen); //isLoadingVisible = !isCollapsed && IsGroupLoading != null; // && IsGroupLoading(group); }
private void Close() { IsOpen = false; IsOpenChanged.InvokeAsync(IsOpen); }
private void OnIsOpenChanged() { UpdateResizingAdorner(); IsOpenChanged.SafeInvoke(this); }
private void RaiseIsOpenChanged() { IsOpenChanged?.Invoke(this, null); }
private void OnIsOpenChanged() { IsOpenChanged.SafeInvoke(this); }
private void RaiseIsOpenChangedEvent() { IsOpenChanged?.Invoke(this, new EventArgs()); }
/// <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(); } }