public static TXaml LoadFromXaml1<TXaml>(this TXaml view, Type callingType) { NameScopeExtensions.PushElement(view); XamlLoader.Load(view, callingType); NameScopeExtensions.PopElement(); return view; }
public HomePage() { InitializeComponent(); activeLayoutOrderView.ViewOrder = new List <View> { activeStateLabel, activeDescriptionLabel, activeQuestionImage, activeQuestionButton, activeConfirmationDateLabel }; _homeActiveIconImage = NameScopeExtensions.FindByName <CachedImage>(this, "home_active_icon"); }
public static T LoadObject <T>(string path) { var xaml = GetAnimationXaml(path); if (string.IsNullOrEmpty(xaml)) { throw new XamlParseException(string.Format("No embeddedresource found for {0}", path), new XmlLineInfo()); } Type type = typeof(T); T ret = (T)type.Assembly.CreateInstance(type.FullName); NameScopeExtensions.PushElement(ret); using (var textReader = new StringReader(xaml)) using (var reader = XmlReader.Create(textReader)) { while (reader.Read()) { //Skip until element if (reader.NodeType == XmlNodeType.Whitespace) { continue; } if (reader.NodeType == XmlNodeType.XmlDeclaration) { continue; } if (reader.NodeType != XmlNodeType.Element) { Debug.WriteLine("Unhandled node {0} {1} {2}", reader.NodeType, reader.Name, reader.Value); continue; } var rootnode = new RuntimeRootNode(new XmlType(reader.NamespaceURI, reader.Name, null), ret, (IXmlNamespaceResolver)reader); XamlParser.ParseXaml(rootnode, reader); var doNotThrow = ResourceLoader.ExceptionHandler != null || Internals.XamlLoader.DoNotThrowOnExceptions; void ehandler(Exception e) => ResourceLoader.ExceptionHandler?.Invoke((e, path)); Visit(rootnode, new HydrationContext { RootElement = ret, #pragma warning disable 0618 ExceptionHandler = doNotThrow ? ehandler : (Action <Exception>)null #pragma warning restore 0618 }); break; } } NameScopeExtensions.PopElement(); return(ret); }
public static TXaml LoadFromXaml <TXaml>(this TXaml view, string xaml) { if (view is Element) { NameScopeExtensions.PushElement(view); } XamlLoader.Load(view, xaml); if (view is Element) { NameScopeExtensions.PopElement(); } return(view); }
public void PushElementTest1() { tlog.Debug(tag, $"PushElementTest1 START"); try { NameScopeExtensions.PushElement(new View()); NameScopeExtensions.FindByNameInCurrentNameScope <View>("View1"); NameScopeExtensions.PopElement(); Assert.True(true, "Should be equal"); } catch (Exception e) { Assert.Fail("Caught Exception" + e.ToString()); } tlog.Debug(tag, $"PushElementTest1 END"); }
public HomePage() { InitializeComponent(); _homeActiveIconImage = NameScopeExtensions.FindByName <CachedImage>(this, "home_active_icon"); }
private void __InitComponentRuntime() { Xamarin.Forms.Xaml.Extensions.LoadFromXaml <ProfilesPage>((M0)this, typeof(ProfilesPage)); this.Page = (MvxContentPage <ProfilesViewModel>)NameScopeExtensions.FindByName <MvxContentPage <ProfilesViewModel> >((Element)this, "Page"); }
private void __InitComponentRuntime() { Extensions.LoadFromXaml <HomeWorkEditPage>((M0)this, typeof(HomeWorkEditPage)); this.UserNameEntry = (Editor)NameScopeExtensions.FindByName <Editor>((Element)this, "UserNameEntry"); }
private void __InitComponentRuntime() { Xamarin.Forms.Xaml.Extensions.LoadFromXaml <RootContentPage>((M0)this, typeof(RootContentPage)); this.Page = (MvxContentPage <RootContentViewModel>)NameScopeExtensions.FindByName <MvxContentPage <RootContentViewModel> >((Element)this, "Page"); this.EmptyView = (EmptyView)NameScopeExtensions.FindByName <EmptyView>((Element)this, "EmptyView"); }
private void __InitComponentRuntime() { Extensions.LoadFromXaml <ErrorView>((M0)this, typeof(ErrorView)); this.View = (ContentView)NameScopeExtensions.FindByName <ContentView>((Element)this, "View"); }
private void __InitComponentRuntime() { Xamarin.Forms.Xaml.Extensions.LoadFromXaml <EmptyView>((M0)this, typeof(EmptyView)); this.View = (ContentView)NameScopeExtensions.FindByName <ContentView>((Element)this, "View"); }
private void __InitComponentRuntime() { Extensions.LoadFromXaml <MessagesPage>((M0)this, typeof(MessagesPage)); this.Page = (MvxContentPage <MessagesViewModel>)NameScopeExtensions.FindByName <MvxContentPage <MessagesViewModel> >((Element)this, "Page"); this.MessageListView = (ListView)NameScopeExtensions.FindByName <ListView>((Element)this, "MessageListView"); }