async Task RefreshLinkAction(ILinkActionBase linkActionBase)
        {
            try
            {
                if (this.UseRandomWipe)
                {
                    this.CurrentWipe = this.RandomWipes[random.Next(this.RandomWipes.Count)];
                }
                else
                {
                    if (linkActionBase is LinkAction linkAction)
                    {
                        this.CurrentWipe = linkAction.TransitionWipe ?? new CircleWipe();
                    }
                }

                var result = await Task.Run(() =>
                {
                    return(linkActionBase?.ActionResult());
                });

                //var result = await MessageService.ShowWaittingResultMessge(() =>
                // {
                //     return linkActionBase?.ActionResult().Result;
                // });


                await this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() =>
                {
                    if (this.Content == result?.View)
                    {
                        //this.Content = new Button() { Visibility = Visibility.Collapsed };
                        this.Content = result?.View;
                    }
                    else
                    {
                        this.Content = result?.View;
                    }

                    //this.Content = result?.View;
                }));

                // this.Dispatcher.Invoke(() =>
                //{
                //    if (this.Content == result?.View)
                //    {
                //        this.Content = new Button() { Visibility = Visibility.Collapsed };
                //        this.Content = result?.View;
                //    }
                //    else
                //    {
                //        this.Content = result?.View;
                //    }
                //});
            }
            catch (Exception ex)
            {
                this.Content = ex;
            }
        }
        void RefreshActions(ILinkActionBase linkAction)
        {
            if (linkAction == null)
            {
                return;
            }

            if (this.LinkActions.Contains(linkAction))
            {
                return;
            }

            this.LinkActions.Add(linkAction);
        }
예제 #3
0
        async void Refresh(ILinkActionBase neww)
        {
            if (this.LinkAction == null)
            {
                return;
            }

            if (this.Children.Count > 0)
            {
                this.Remove(this.Children[0]);
            }

            var result = await this.LinkAction.ActionResult();

            this.Add(result.View as UIElement);
        }
        async Task RefreshLinkAction(ILinkActionBase linkActionBase)
        {
            try
            {
                if (this.UseRandomWipe)
                {
                    this.CurrentWipe = this.RandomWipes[random.Next(this.RandomWipes.Count)];
                }
                else
                {
                    if (linkActionBase is LinkAction linkAction)
                    {
                        this.CurrentWipe = linkAction.TransitionWipe ?? new CircleWipe();
                    }
                }

                var result = await Task.Run(() =>
                {
                    return(linkActionBase?.ActionResult());
                });


                this.Dispatcher.Invoke(() =>
                {
                    if (this.Content == result?.View)
                    {
                        this.Content = new Button()
                        {
                            Visibility = Visibility.Collapsed
                        };
                        this.Content = result?.View;
                    }
                    else
                    {
                        this.Content = result?.View;
                    }
                });
            }
            catch (Exception ex)
            {
                this.Content = ex;
            }
        }
예제 #5
0
        /// <summary> 重写跳转页面 用'/' 区分页面层级关系 如:[Route("OverView/Toggle")] 表示 </summary>
        protected override IActionResult View([CallerMemberName] string name = "")
        {
            if (this.GetType().GetMethod(name).GetCustomAttributes(typeof(RouteAttribute), true).FirstOrDefault() is RouteAttribute route)
            {
                var routes = route.Name.Split('/');

                List <ILinkActionBase> result = new List <ILinkActionBase>();

                foreach (var item in routes)
                {
                    ILinkActionBase link = this.ViewModel.GetLinkAction(item);

                    result.Add(link);
                }

                this.ViewModel.Navigation = result.ToObservable();
            }

            return(base.View(name));
        }
예제 #6
0
 private bool CanGoToLink(ILinkActionBase args)
 {
     return(true);
 }
예제 #7
0
        private void GoToLink(ILinkActionBase args)
        {
            args.Controller = args.Controller ?? this.GetController();

            this.SelectLink = args;
        }
예제 #8
0
 private bool CanMvc(ILinkActionBase args)
 {
     return(true);
 }
예제 #9
0
 private void Mvc(ILinkActionBase args)
 {
     this.SelectLink = args;
 }