Exemple #1
0
        public void Navigate <T>(object paramter) where T : class
        {
            var targetType = typeof(T);

            ((_root.Content as Page)?.DataContext as ViewModelBase)?.OnNavigatedFrom(paramter);
            _root.Navigate(targetType);
            ((_root.Content as Page)?.DataContext as ViewModelBase)?.OnNavigatedTo(paramter);
            Navigated.Invoke(this, new NavigatedEventArgs()
            {
                NavigatedPageType = targetType
            });
        }
Exemple #2
0
        void VLCPageNavigated(VLCPage page)
        {
            if (CurrentPage == page)
            {
                return;
            }
            CurrentPage = page;
            Debug.WriteLine(CurrentPage);
            ViewNavigated.Invoke(null, CurrentPage);

            if (!App.SplitShell.IsTopBarOpen)
            {
                App.SplitShell.ShowTopBar();
            }
            ShowBackButtonIfCanGoBack();
        }
Exemple #3
0
        private bool InnerNavigate(PageStackEntry entry, NavigationMode mode)
        {
            try
            {
                // Navigating
                var navigatingFromArgs = new NavigatingCancelEventArgs(
                    mode,
                    entry.NavigationTransitionInfo,
                    entry.Parameter,
                    entry.SourcePageType
                    );

                Navigating?.Invoke(this, navigatingFromArgs);

                CurrentEntry?.Instance.OnNavigatingFrom(navigatingFromArgs);

                if (navigatingFromArgs.Cancel)
                {
                    NavigationStopped?.Invoke(this, new NavigationEventArgs(
                                                  entry.Instance,
                                                  mode,
                                                  entry.NavigationTransitionInfo,
                                                  entry.Parameter,
                                                  entry.SourcePageType,
                                                  null
                                                  ));
                    return(false);
                }

                // Navigate
                var previousEntry = CurrentEntry;
                CurrentEntry = entry;

                if (mode == NavigationMode.New)
                {
                    // Doing this first allows CurrentEntry to reuse existing page if pooling is enabled
                    ReleasePages(ForwardStack);
                }

                if (CurrentEntry.Instance == null)
                {
                    var page = CreatePageInstanceCached(entry.SourcePageType);
                    if (page == null)
                    {
                        return(false);
                    }

                    page.Frame            = this;
                    CurrentEntry.Instance = page;
                }

                Content = CurrentEntry.Instance;

                switch (mode)
                {
                case NavigationMode.New:
                    ForwardStack.Clear();
                    if (previousEntry != null)
                    {
                        BackStack.Add(previousEntry);
                    }
                    break;

                case NavigationMode.Back:
                    ForwardStack.Add(previousEntry);
                    BackStack.Remove(CurrentEntry);
                    break;

                case NavigationMode.Forward:
                    BackStack.Add(previousEntry);
                    ForwardStack.Remove(CurrentEntry);
                    break;

                case NavigationMode.Refresh:
                    break;
                }

                // Navigated
                var navigationEvent = new NavigationEventArgs(
                    CurrentEntry.Instance,
                    mode,
                    entry.NavigationTransitionInfo,
                    entry.Parameter,
                    entry.SourcePageType,
                    null
                    );

                previousEntry?.Instance.OnNavigatedFrom(navigationEvent);
                CurrentEntry.Instance.OnNavigatedTo(navigationEvent);
                Navigated?.Invoke(this, navigationEvent);

                VisualTreeHelper.CloseAllPopups();

                return(true);
            }
            catch (Exception exception)
            {
                NavigationFailed?.Invoke(this, new NavigationFailedEventArgs(entry.SourcePageType, exception));
                return(false);
            }
        }
Exemple #4
0
 protected override void NavigateToCore(string uri, bool forceLoad)
 {
     Navigated?.Invoke(uri, forceLoad);
 }
 void SendNavigated()
 {
     Navigated?.Invoke(this, EventArgs.Empty);
 }
Exemple #6
0
        private static void LocationChanged(bool allowCallbackEvenIfLocationUnchanged)
        {
            var currentPathFromHash = (window.location.hash ?? "");

            if (!allowCallbackEvenIfLocationUnchanged && (_currentState is object))
            {
                if (AlreadyThere(_currentState.FullPath, currentPathFromHash))
                {
                    return;
                }
            }

            //The call to AlreadyThere above expects the hash to be still in the URL, so we only remove it here
            currentPathFromHash = currentPathFromHash.TrimStart('#');

            var p = currentPathFromHash.Split(new[] { '?' }, count: 2); // Do not remove empty entries, as we need the empty entry in the array

            var hash = (p.Length == 0) ? "" : p[0];

            var par   = new Dictionary <string, string>();
            var parts = hash.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var r in _routesToTryMatchingOnLocationChanged)
            {
                par.Clear();
                if (!r.IsMatch(parts, par))
                {
                    continue;
                }

                if (p.Length > 1)
                {
                    //TODO parse query parameters
                    var query      = p[1];
                    var queryParts = query.Split(new[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var qp in queryParts)
                    {
                        var qpp = qp.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
                        if (qpp.Length == 1)
                        {
                            par[es5.decodeURIComponent(qpp[0])] = "";
                        }
                        else
                        {
                            par[es5.decodeURIComponent(qpp[0])] = es5.decodeURIComponent(qpp[1]);
                        }
                    }
                }

                var toState = new State(
                    parameters: new Parameters(par),
                    path: hash,
                    fullPath: window.location.href,
                    routeName: r.Name
                    );

                if ((_beforeNavigate is null) || _beforeNavigate(toState, _currentState))
                {
                    // Allowed to navigate - do it!
                    var oldState = _currentState;
                    _currentState = toState;
                    r.Activate(toState.Parameters);
                    Navigated?.Invoke(toState, oldState);
                }
Exemple #7
0
 private static void Frame_Navigated(object sender, NavigationEventArgs e) => Navigated?.Invoke(sender, e);
Exemple #8
0
        public TaskDialog()
        {
            config.StructSize = ( uint )Marshal.SizeOf(config);
            config.Callback   = (IntPtr hwnd, TaskDialogNotification msg, IntPtr wParam, IntPtr lParam, IntPtr lpRefData) =>
            {
                TaskDialogEventArgs commonEventArgs;
                switch (msg)
                {
                case TaskDialogNotification.Created:
                {
                    var eventArgs = new TaskDialogEventArgs()
                    {
                        TaskDialogHandle = hwnd
                    };
                    Created?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.Destroyed:
                {
                    var eventArgs = new TaskDialogEventArgs()
                    {
                        TaskDialogHandle = hwnd
                    };
                    Destroyed?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.DialogConstructed:
                {
                    var eventArgs = new TaskDialogEventArgs()
                    {
                        TaskDialogHandle = hwnd
                    };
                    Constructed?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.Help:
                {
                    var eventArgs = new TaskDialogEventArgs()
                    {
                        TaskDialogHandle = hwnd
                    };
                    Help?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.ButtonClicked:
                {
                    var eventArgs = new ButtonClickedEventArgs(( int )wParam)
                    {
                        TaskDialogHandle = hwnd
                    };
                    ButtonClicked?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.RadioButtonClicked:
                {
                    var eventArgs = new ButtonClickedEventArgs(( int )wParam)
                    {
                        TaskDialogHandle = hwnd
                    };
                    RadioButtonClicked?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.HyperlinkClicked:
                {
                    string url = null;
                    unsafe { url = new string (( char * )lParam ); }
                    var eventArgs = new HyperLinkClickedEventArgs(url)
                    {
                        TaskDialogHandle = hwnd
                    };
                    HyperlinkClicked?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.ExpendOButtonClicked:
                {
                    var eventArgs = new ExpandButtonClickedEventArgs(wParam.ToInt32() == 0 ? false : true)
                    {
                        TaskDialogHandle = hwnd
                    };
                    ExpandButtonClicked?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.VerificationClicked:
                {
                    var eventArgs = new VerificationClickedEventArgs(wParam.ToInt32() == 0 ? false : true)
                    {
                        TaskDialogHandle = hwnd
                    };
                    VerificationClicked?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.Navigated:
                {
                    var eventArgs = new TaskDialogEventArgs()
                    {
                        TaskDialogHandle = hwnd
                    };
                    Navigated?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                case TaskDialogNotification.Timer:
                {
                    var eventArgs = new TimerEventArgs(TimeSpan.FromMilliseconds(( uint )wParam))
                    {
                        TaskDialogHandle = hwnd
                    };
                    Timer?.Invoke(this, eventArgs);
                    commonEventArgs = eventArgs;
                }
                break;

                default:
                    return(0);
                }
                return(commonEventArgs.ReturnValue);
            };
        }
Exemple #9
0
 public void RaiseNavigated(Portable.NavigatedEventArgs e)
 {
     Navigated?.Invoke(this, e);
     // for backwards compat
     FrameFacade.RaiseNavigated(e);
 }
 public void OnNavigated(NavigationEventArgs navigationEventArgs)
 {
     Navigated?.Invoke(this, navigationEventArgs);
 }
Exemple #11
0
 private void OnNavigated()
 {
     Navigated?.Invoke(this, EventArgs.Empty);
 }
Exemple #12
0
        public void ReadInput()
        {
            ConsoleKey command = Console.ReadKey(true).Key;

            switch (command)
            {
            case ConsoleKey.UpArrow:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Up
                });
                break;

            case ConsoleKey.DownArrow:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Down
                });
                break;

            case ConsoleKey.Enter:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Enter
                });
                break;

            case ConsoleKey.Backspace:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Back
                });
                break;

            case ConsoleKey.F3:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Root
                });
                break;

            case ConsoleKey.F4:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Drives
                });
                break;

            case ConsoleKey.Tab:
                TabSwitching?.Invoke();
                break;

            case ConsoleKey.F1:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.Copy
                });
                break;

            case ConsoleKey.F2:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.Move
                });
                break;

            case ConsoleKey.F5:
                PropertyRequest?.Invoke();
                break;

            case ConsoleKey.F6:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.Rename
                });
                break;

            case ConsoleKey.F7:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.Search
                });
                break;

            case ConsoleKey.F8:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.NewFolder
                });
                break;

            case ConsoleKey.Escape:
                CompletionOfWork?.Invoke();
                break;
            }
        }
 private void RaiseNavigated(NavigationContext navigationContext)
 {
     Navigated?.Invoke(this, new RegionNavigationEventArgs(navigationContext));
 }
Exemple #14
0
 protected virtual void RaiseNavigated(NavigationEventArgs args)
 {
     Navigated?.Invoke(this, args);
 }
 private void OnNavigated(NavigatedEventArgs e)
 {
     Navigated?.Invoke(this, e);
 }
 protected virtual void OnNavigated(NavigatedEventArgs e)
 {
     Navigated?.Invoke(this, e);
 }
 protected void InvokeNavigatedEvent(CrystalNavigationEventArgs args)
 {
     Navigated?.Invoke(this, args);
 }
 public void RaiseNavigated(NavigatedEventArgs e)
 {
     Navigated?.Invoke(this, e);
     // for backwards compat
     FrameFacadeInternal.RaiseNavigated(e);
 }
 public virtual void OnNavigated(CookieNavigatedEventArgs args)
 {
     Navigated?.Invoke(this, args);
     Cookies = args.Cookies;
 }
 public void SendNavigated(WebNavigatedEventArgs args)
 {
     Navigated?.Invoke(this, args);
 }
Exemple #21
0
 public void RaiseNavigated(NavigatedEventArgs e)
 {
     Navigated?.Invoke(this, e);
 }
 private void Frame_Navigated(object sender, NavigationEventArgs e)
 {
     Navigated?.Invoke(sender, e);
 }
Exemple #23
0
 private void _navigationModel_Navigated(ViewType to)
 {
     Navigated?.Invoke(to);
 }
Exemple #24
0
 private void OnFrameFacadeNavigated(object sender, NavigatedEventArgs e) => Navigated?.Invoke(this, e);
 protected void FireNavigatedEvent() =>
 Navigated?.Invoke(this, new EventArgs());
 protected virtual void RaiseNavigated(INavigationContext context, bool isCanceled, Exception exception)
 {
     Navigated?.Invoke(this, new NavigatedEventArgs(context, isCanceled, exception));
 }
 /// <summary>
 /// Send the Navigated event
 /// </summary>
 /// <param name="args"></param>
 internal void SendNavigated(WebNavigatingEventArgs args)
 {
     Navigated?.Invoke(this, args);
 }
 /// <summary>
 /// Method called when a page is pushed onto the Navigation stack.
 /// </summary>
 /// <param name="sender">NavigationPage</param>
 /// <param name="e">Details</param>
 void OnPagePushed(object sender, Xamarin.Forms.NavigationEventArgs e)
 {
     Navigated?.Invoke(this, EventArgs.Empty);
 }
 private void navigated(object sender, NavigationEventArgs e) => Navigated?.Invoke(sender, e);
Exemple #30
0
 void INavigationService2.RaiseNavigated(NavigatedEventArgs e)
 {
     Navigated?.Invoke(this, e);
 }