Exemple #1
0
        public ValueTask DisposeAsync()
        {
            ReturnAction?.Invoke(Object);

            if (ReturnTask != null)
            {
                return(new ValueTask(ReturnTask(Object)));
            }

            return(new ValueTask(Task.FromResult <object>(null)));
        }
Exemple #2
0
        private void ExecuteResultAction(string buttomParameter)
        {
            if (buttomParameter.Equals("Repetir"))
            {
                RedoAction?.Invoke();
            }

            else if (buttomParameter.Equals("Retornar"))
            {
                ReturnAction?.Invoke();
            }
        }
Exemple #3
0
        public bool KeyDown(Key key)
        {
            if (listBox?.KeyDown(key) == true)
            {
                return(true);
            }

            // Note: Key may remove inputs or close the popup.
            for (int i = inputs.Count - 1; i >= 0; --i)
            {
                if (i >= inputs.Count)
                {
                    continue;
                }

                if (inputs[i].KeyDown(key))
                {
                    return(true);
                }
            }

            if (scrollbar != null && !scrollbar.Disabled)
            {
                int scrollOffset = scrollbar.ScrollOffset;

                switch (key)
                {
                case Key.Up:
                    if (scrollOffset > 0)
                    {
                        ScrollTo(scrollOffset - 1);
                    }
                    return(true);

                case Key.Down:
                    if (scrollOffset < scrollbar.ScrollRange)
                    {
                        ScrollTo(scrollOffset + 1);
                    }
                    return(true);

                case Key.PageUp:
                    if (scrollOffset > 0)
                    {
                        ScrollTo(Math.Max(0, scrollOffset - 5));
                    }
                    return(true);

                case Key.PageDown:
                    if (scrollOffset < scrollbar.ScrollRange)
                    {
                        ScrollTo(Math.Min(scrollbar.ScrollRange, scrollOffset + 5));
                    }
                    return(true);

                case Key.Home:
                    ScrollTo(0);
                    return(true);

                case Key.End:
                    ScrollTo(scrollbar.ScrollRange);
                    return(true);
                }
            }

            if (key == Key.Return && ReturnAction != null)
            {
                ReturnAction?.Invoke();
                return(true);
            }

            if (key == Key.Escape && CanAbort)
            {
                game.ClosePopup();
                return(true);
            }

            if (key == Key.Up || key == Key.PageUp || key == Key.Home)
            {
                var upButton = buttons.FirstOrDefault(button => button.ButtonType == Data.Enumerations.ButtonType.MoveUp);

                if (upButton != null)
                {
                    upButton.PressImmediately(game, key == Key.PageUp || key == Key.Home);
                    return(true);
                }
            }

            if (key == Key.Down || key == Key.PageDown || key == Key.End)
            {
                var downButton = buttons.FirstOrDefault(button => button.ButtonType == Data.Enumerations.ButtonType.MoveDown);

                if (downButton != null)
                {
                    downButton.PressImmediately(game, key == Key.PageDown || key == Key.End);
                    return(true);
                }
            }

            return(false);
        }
Exemple #4
0
        public void Dispose()
        {
            ReturnAction?.Invoke(Object);

            ReturnTask?.Invoke(Object).Wait();
        }
Exemple #5
0
 private void OnPostNewOpinion()
 {
     (App.Current as App).PopNavigation();
     ReturnAction?.Invoke(NewOpinion);
 }