private async void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
        {
            await HidePopupStoryboard.BeginAsync();

            UserControl_Loaded(null, null);
            await ShowPopupStoryboard.BeginAsync();
        }
        /// <summary>
        /// Hides and dispose the popup and the content inside
        /// </summary>
        public async void Dispose()
        {
            if (_isdisposing || HidePopupStoryboard == null)
            {
                return;
            }
            _isdisposing = true;
            Window.Current.SizeChanged -= Current_SizeChanged;
            await HidePopupStoryboard.BeginAsync();

            HidePopupStoryboard.Stop();
            HidePopupStoryboard.Children.Clear();
            HidePopupStoryboard = null;
            ShowPopupStoryboard.Stop();
            ShowPopupStoryboard.Children.Clear();
            ShowPopupStoryboard = null;
            _contentgr.Children.Clear();
            _contentgr = null;
            _popup.Children.Clear();
            if (_uicontent is IDisposable disposable)
            {
                disposable.Dispose();
            }
            BackgroundColorBrsh     = null;
            LightDismissColor       = null;
            ContentPresentationGrid = null;
            _translatetransform     = null;
            _popup       = null;
            _isdisposing = false;
            GC.Collect();
        }
Esempio n. 3
0
        private async void _popup_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
        {
            var Host = (FrameworkElement)this.Parent;
            var y    = e.Position.Y;

            if (e.Cumulative.Translation.Y > 50)
            {
                (HidePopupStoryboard.Children[0] as DoubleAnimation).To = Host.ActualHeight;
                (HidePopupStoryboard.Children[1] as DoubleAnimation).To = 0;
                await HidePopupStoryboard.BeginAsync();
            }
            else
            {
                await ShowPopupStoryboard.BeginAsync();
            }
        }
        /// <summary>
        /// This event will complete the manipulation of the user. This will completes hide or reverts the slidedown
        /// </summary>
        /// <param name="sender">Not important</param>
        /// <param name="e">Not important</param>
        private async void _popup_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
        {
            if (outofrangeslide)
            {
                return;
            }
            var Host = (FrameworkElement)this.Parent;

            if (e.Cumulative.Translation.Y > 50)
            {
                (HidePopupStoryboard.Children[0] as DoubleAnimation).To = Host.ActualHeight;
                (HidePopupStoryboard.Children[1] as DoubleAnimation).To = 0;
                await HidePopupStoryboard.BeginAsync();

                await PopupPresenterHost.HideSlideupPopupAsync(this);
            }
            else
            {
                await ShowPopupStoryboard.BeginAsync();
            }
        }
        public async void Dispose()
        {
            if (_isdisposing || HidePopupStoryboard == null)
            {
                return;
            }
            _isdisposing = true;
            await HidePopupStoryboard.BeginAsync();

            HidePopupStoryboard.Stop();
            HidePopupStoryboard.Children.Clear();
            HidePopupStoryboard = null;
            ShowPopupStoryboard.Stop();
            ShowPopupStoryboard.Children.Clear();
            ShowPopupStoryboard = null;
            _contentgr.Children.Clear();
            _contentgr = null;
            _popup.Children.Clear();
            _popup       = null;
            _isdisposing = false;
            GC.Collect();
        }
 /// <summary>
 /// This method will pops up the popup frame Syncronosly
 /// </summary>
 public async void ShowPopup()
 {
     await ShowPopupStoryboard.BeginAsync();
 }
 /// <summary>
 /// This method will pops up the popup frame Asynchronously
 /// </summary>
 /// <returns></returns>
 public async Task ShowPopupAsync()
 {
     await ShowPopupStoryboard.BeginAsync();
 }