Пример #1
0
        public override void OnNavigatedTo(object sender, object obj)
        {
            AlexzanderModel         = new AlexzanderModel();
            TrenPhillipKarissaModel = new TrenPhillipKarissaModel();
            KaydenSergioModel       = new KaydenSergioModel();

            ViewModel = new List <ViewModelPage>();

            ViewModel.Add(new ViewModelPage(AlexzanderModel));
            ViewModel.Add(new ViewModelPage(TrenPhillipKarissaModel));
            ViewModel.Add(new ViewModelPage(KaydenSergioModel));

            foreach (var temp in Application.Current.GetType().GetTypeInfo().Assembly.DefinedTypes.Where(temp => temp.IsSubclassOf(typeof(Page))))
            {
                //获取特性,特性有包含ViewModel
                var p = temp.GetCustomAttribute <ViewModelAttribute>();

                var viewmodel = this.ViewModel.FirstOrDefault(t => t.Equals(p?.ViewModel));
                if (viewmodel != null)
                {
                    viewmodel.Page = temp.AsType();
                }
            }

            foreach (var temp in Application.Current.GetType().GetTypeInfo().Assembly.DefinedTypes.Where(temp => temp.IsSubclassOf(typeof(Composite))))
            {
                Composite.Add((Composite)temp.AsType().GetConstructor(Type.EmptyTypes).Invoke(null));
            }

            //SendMessageHandler = ReceiveMessage;

            //AlexzanderModel.OnNavigatedTo(this, obj);
            //TrenPhillipKarissaModel.OnNavigatedTo(this, obj);
            //KaydenSergioModel.OnNavigatedTo(this, obj);

            //Read();
        }
Пример #2
0
 public override void OnNavigatedFrom(object sender, object obj)
 {
     AlexzanderModel.OnNavigatedFrom(this, obj);
     TrenPhillipKarissaModel.OnNavigatedFrom(this, obj);
     KaydenSergioModel.OnNavigatedFrom(this, obj);
 }
Пример #3
0
 private async Task Navigate()
 {
     Navigate(AlexzanderModel.GetType(), File, AlexzanderfFrame);
     Navigate(TrenPhillipKarissaModel.GetType(), File, TrenPhillipKarissaFrame);
     Navigate(KaydenSergioModel.GetType(), File, KaydenSergioFrame);
 }