Exemple #1
0
        public virtual void Navigate(ViewModelBase page, bool cache = true)
        {
            if (page == null)
            {
                return;
            }
            var args = new BeforeNavigateEventArgs()
            {
                Page     = CurrentPage,
                NextPage = page
            };

            BeforeNavigate?.Invoke(this, args);
            if (args.Cancel)
            {
                return;
            }
            if (cache)
            {
                _history.Add(page);
            }
            CurrentPage = page;
            if (_navigationHistory.Count > 200)
            {
                _navigationHistory.RemoveAt(0);
            }
            _navigationHistory.Add(page.GetType().FullName);
            AfterNavigate?.Invoke(this, EventArgs.Empty);
        }
Exemple #2
0
        public int TranslateUrl(int dwTranslate, string strURLIn, out string pstrURLOut)
        {
            BeforeNavigateEventArgs args = new BeforeNavigateEventArgs(strURLIn);

            this.htmlEditor.OnBeforeNavigate(args);
            if (args.Cancel)
            {
                // This is how we cancel it, a bit weird to provide a blank, but String.Empty will not work!
                pstrURLOut = " ";
            }
            else
            {
                pstrURLOut = args.Url;
            }
            return(pstrURLOut.Equals(strURLIn) ? Interop.S_FALSE : Interop.S_OK);
        }
Exemple #3
0
        public virtual void GoBack(int count = 1)
        {
            var args = new BeforeNavigateEventArgs();

            OnBack(args);
            if (args.Cancel)
            {
                return;
            }
            if (_history.Last() != CurrentPage)
            {
                count--;
            }
            if (_history.Count() - count > 1)
            {
                _history.RemoveRange(_history.Count() - 1, count);
            }
            else
            {
                _history.RemoveRange(1, _history.Count() - 1);
            }

            Navigate(_history.Last(), false);
        }
Exemple #4
0
 protected void OnBack(BeforeNavigateEventArgs args)
 {
     Back?.Invoke(this, args);
 }