Beispiel #1
0
        public void LoadWithRootInstance()
        {
            var dummy = new DummyClass
            {
                AnotherProperty = "Other value",
                SampleProperty = "Will be overwritten"
            };

            var loader = new XamlLoader(new DummyXamlParserFactory(WiringContext));

            var actual = loader.Load("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />", dummy);

            Assert.IsInstanceOfType(actual, dummy.GetType());
            Assert.AreEqual("Value", ((DummyClass)actual).SampleProperty);
            Assert.AreEqual("Other value", ((DummyClass)actual).AnotherProperty);
        }
Beispiel #2
0
 public WpfXamlLoader()
 {
     innerLoader = new XamlLoader(new WpfParserFactory(new WpfXamlLoaderTypeFactory()));
 }
 protected GivenAXamlXmlLoader()
 {
     XamlLoader = new XamlLoader(new DummyXamlParserFactory(WiringContext));
 }
 private void InitializeComponent()
 {
     ResourceLoader.ResourceLoadingQuery resourceLoadingQuery = new ResourceLoader.ResourceLoadingQuery();
     resourceLoadingQuery.set_AssemblyName(typeof(MessagesPage).GetTypeInfo().Assembly.GetName());
     resourceLoadingQuery.set_ResourcePath("Views/MessagesPage.xaml");
     resourceLoadingQuery.set_Instance((object)this);
     if (ResourceLoader.CanProvideContentFor(resourceLoadingQuery))
     {
         this.__InitComponentRuntime();
     }
     else if (XamlLoader.get_XamlFileProvider() != null && XamlLoader.get_XamlFileProvider()(((object)this).GetType()) != null)
     {
         this.__InitComponentRuntime();
     }
     else
     {
         BindingExtension        bindingExtension1  = new BindingExtension();
         StaticResourceExtension resourceExtension1 = new StaticResourceExtension();
         BindingExtension        bindingExtension2  = new BindingExtension();
         EmptyView emptyView = new EmptyView();
         StaticResourceExtension resourceExtension2 = new StaticResourceExtension();
         BindingExtension        bindingExtension3  = new BindingExtension();
         BindingExtension        bindingExtension4  = new BindingExtension();
         BindingExtension        bindingExtension5  = new BindingExtension();
         DataTemplate            dataTemplate1      = new DataTemplate();
         ListView listView = new ListView((ListViewCachingStrategy)1);
         StaticResourceExtension resourceExtension3 = new StaticResourceExtension();
         BindingExtension        bindingExtension6  = new BindingExtension();
         StaticResourceExtension resourceExtension4 = new StaticResourceExtension();
         BoxView boxView = new BoxView();
         StaticResourceExtension resourceExtension5 = new StaticResourceExtension();
         CircleImage             circleImage        = new CircleImage();
         BindingExtension        bindingExtension7  = new BindingExtension();
         BindingExtension        bindingExtension8  = new BindingExtension();
         ActivityIndicator       activityIndicator  = new ActivityIndicator();
         Grid         grid1 = new Grid();
         Grid         grid2 = new Grid();
         MessagesPage messagesPage;
         NameScope    nameScope = (NameScope)(NameScope.GetNameScope((BindableObject)(messagesPage = this)) ?? (INameScope) new NameScope());
         NameScope.SetNameScope((BindableObject)messagesPage, (INameScope)nameScope);
         ((INameScope)nameScope).RegisterName("Page", (object)messagesPage);
         if (((Element)messagesPage).get_StyleId() == null)
         {
             ((Element)messagesPage).set_StyleId("Page");
         }
         ((INameScope)nameScope).RegisterName("MessageListView", (object)listView);
         if (((Element)listView).get_StyleId() == null)
         {
             ((Element)listView).set_StyleId("MessageListView");
         }
         this.Page            = (MvxContentPage <MessagesViewModel>)messagesPage;
         this.MessageListView = listView;
         bindingExtension1.set_Path("TitleIncludeConnectivityState");
         BindingBase bindingBase1 = ((IMarkupExtension <BindingBase>)bindingExtension1).ProvideValue((IServiceProvider)null);
         ((BindableObject)messagesPage).SetBinding((BindableProperty)Xamarin.Forms.Page.TitleProperty, bindingBase1);
         ((BindableObject)messagesPage).SetValue((BindableProperty)Xamarin.Forms.PlatformConfiguration.iOSSpecific.Page.UseSafeAreaProperty, (object)true);
         resourceExtension1.set_Key("PageBackgroundColor");
         StaticResourceExtension resourceExtension6   = resourceExtension1;
         XamlServiceProvider     xamlServiceProvider1 = new XamlServiceProvider();
         Type     type1     = typeof(IProvideValueTarget);
         object[] objArray1 = new object[0 + 1];
         objArray1[0] = (object)messagesPage;
         SimpleValueTargetProvider valueTargetProvider1;
         object obj1 = (object)(valueTargetProvider1 = new SimpleValueTargetProvider(objArray1, (object)VisualElement.BackgroundColorProperty, (INameScope)nameScope));
         xamlServiceProvider1.Add(type1, (object)valueTargetProvider1);
         xamlServiceProvider1.Add(typeof(IReferenceProvider), obj1);
         Type type2 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver1 = new XmlNamespaceResolver();
         namespaceResolver1.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver1.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver1.Add("controls", "clr-namespace:Ekreta.Mobile.Core.Controls;assembly=Ekreta.Mobile.Core");
         namespaceResolver1.Add("d", "http://xamarin.com/schemas/2014/forms/design");
         namespaceResolver1.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         namespaceResolver1.Add("ios", "clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core");
         namespaceResolver1.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
         namespaceResolver1.Add("mvvmcross", "clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms");
         namespaceResolver1.Add("viewModels", "clr-namespace:Ekreta.Mobile.Core.ViewModels;assembly=Ekreta.Mobile.Core");
         namespaceResolver1.Add("pluginImage", "clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions");
         XamlTypeResolver xamlTypeResolver1 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver1, typeof(MessagesPage).GetTypeInfo().Assembly);
         xamlServiceProvider1.Add(type2, (object)xamlTypeResolver1);
         xamlServiceProvider1.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(18, 5)));
         object obj2 = ((IMarkupExtension)resourceExtension6).ProvideValue((IServiceProvider)xamlServiceProvider1);
         ((VisualElement)messagesPage).set_BackgroundColor((Color)obj2);
         bindingExtension2.set_Path("PostaladaElemek.Count");
         BindingBase bindingBase2 = ((IMarkupExtension <BindingBase>)bindingExtension2).ProvideValue((IServiceProvider)null);
         ((BindableObject)emptyView).SetBinding((BindableProperty)BindableObject.BindingContextProperty, bindingBase2);
         ((ICollection <View>)grid2.get_Children()).Add((View)emptyView);
         resourceExtension2.set_Key("ListViewMonthGroupHeaderTemplate");
         StaticResourceExtension resourceExtension7   = resourceExtension2;
         XamlServiceProvider     xamlServiceProvider2 = new XamlServiceProvider();
         Type     type3     = typeof(IProvideValueTarget);
         object[] objArray2 = new object[0 + 3];
         objArray2[0] = (object)listView;
         objArray2[1] = (object)grid2;
         objArray2[2] = (object)messagesPage;
         SimpleValueTargetProvider valueTargetProvider2;
         object obj3 = (object)(valueTargetProvider2 = new SimpleValueTargetProvider(objArray2, (object)ListView.GroupHeaderTemplateProperty, (INameScope)nameScope));
         xamlServiceProvider2.Add(type3, (object)valueTargetProvider2);
         xamlServiceProvider2.Add(typeof(IReferenceProvider), obj3);
         Type type4 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver2 = new XmlNamespaceResolver();
         namespaceResolver2.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver2.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver2.Add("controls", "clr-namespace:Ekreta.Mobile.Core.Controls;assembly=Ekreta.Mobile.Core");
         namespaceResolver2.Add("d", "http://xamarin.com/schemas/2014/forms/design");
         namespaceResolver2.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         namespaceResolver2.Add("ios", "clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core");
         namespaceResolver2.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
         namespaceResolver2.Add("mvvmcross", "clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms");
         namespaceResolver2.Add("viewModels", "clr-namespace:Ekreta.Mobile.Core.ViewModels;assembly=Ekreta.Mobile.Core");
         namespaceResolver2.Add("pluginImage", "clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions");
         XamlTypeResolver xamlTypeResolver2 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver2, typeof(MessagesPage).GetTypeInfo().Assembly);
         xamlServiceProvider2.Add(type4, (object)xamlTypeResolver2);
         xamlServiceProvider2.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(28, 13)));
         object obj4 = ((IMarkupExtension)resourceExtension7).ProvideValue((IServiceProvider)xamlServiceProvider2);
         listView.set_GroupHeaderTemplate((DataTemplate)obj4);
         ((BindableObject)listView).SetValue((BindableProperty)ListView.HasUnevenRowsProperty, (object)true);
         ((BindableObject)listView).SetValue((BindableProperty)ListView.IsPullToRefreshEnabledProperty, (object)true);
         bindingExtension3.set_Path("PostaladaElemek");
         BindingBase bindingBase3 = ((IMarkupExtension <BindingBase>)bindingExtension3).ProvideValue((IServiceProvider)null);
         ((BindableObject)listView).SetBinding((BindableProperty)ItemsView <Cell> .ItemsSourceProperty, bindingBase3);
         bindingExtension4.set_Path("RefreshCommand");
         BindingBase bindingBase4 = ((IMarkupExtension <BindingBase>)bindingExtension4).ProvideValue((IServiceProvider)null);
         ((BindableObject)listView).SetBinding((BindableProperty)ListView.RefreshCommandProperty, bindingBase4);
         bindingExtension5.set_Mode((BindingMode)1);
         bindingExtension5.set_Path("SelectedItem");
         BindingBase bindingBase5 = ((IMarkupExtension <BindingBase>)bindingExtension5).ProvideValue((IServiceProvider)null);
         ((BindableObject)listView).SetBinding((BindableProperty)ListView.SelectedItemProperty, bindingBase5);
         ((BindableObject)listView).SetValue((BindableProperty)View.VerticalOptionsProperty, (object)(LayoutOptions)LayoutOptions.FillAndExpand);
         DataTemplate dataTemplate2 = dataTemplate1;
         // ISSUE: object of a compiler-generated type is created
         // ISSUE: variable of a compiler-generated type
         MessagesPage.\u003CInitializeComponent\u003E_anonXamlCDataTemplate_28 xamlCdataTemplate28 = new MessagesPage.\u003CInitializeComponent\u003E_anonXamlCDataTemplate_28();
         object[] objArray3 = new object[0 + 4];
         objArray3[0] = (object)dataTemplate1;
         objArray3[1] = (object)listView;
         objArray3[2] = (object)grid2;
         objArray3[3] = (object)messagesPage;
         // ISSUE: reference to a compiler-generated field
         xamlCdataTemplate28.parentValues = objArray3;
         // ISSUE: reference to a compiler-generated field
         xamlCdataTemplate28.root = messagesPage;
         // ISSUE: reference to a compiler-generated method
         Func <object> func = new Func <object>(xamlCdataTemplate28.LoadDataTemplate);
         ((IDataTemplate)dataTemplate2).set_LoadTemplate(func);
         ((BindableObject)listView).SetValue((BindableProperty)ItemsView <Cell> .ItemTemplateProperty, (object)dataTemplate1);
         ((ICollection <View>)grid2.get_Children()).Add((View)listView);
         resourceExtension3.set_Key("OverlayColor");
         StaticResourceExtension resourceExtension8   = resourceExtension3;
         XamlServiceProvider     xamlServiceProvider3 = new XamlServiceProvider();
         Type     type5     = typeof(IProvideValueTarget);
         object[] objArray4 = new object[0 + 3];
         objArray4[0] = (object)grid1;
         objArray4[1] = (object)grid2;
         objArray4[2] = (object)messagesPage;
         SimpleValueTargetProvider valueTargetProvider3;
         object obj5 = (object)(valueTargetProvider3 = new SimpleValueTargetProvider(objArray4, (object)VisualElement.BackgroundColorProperty, (INameScope)nameScope));
         xamlServiceProvider3.Add(type5, (object)valueTargetProvider3);
         xamlServiceProvider3.Add(typeof(IReferenceProvider), obj5);
         Type type6 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver3 = new XmlNamespaceResolver();
         namespaceResolver3.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver3.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver3.Add("controls", "clr-namespace:Ekreta.Mobile.Core.Controls;assembly=Ekreta.Mobile.Core");
         namespaceResolver3.Add("d", "http://xamarin.com/schemas/2014/forms/design");
         namespaceResolver3.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         namespaceResolver3.Add("ios", "clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core");
         namespaceResolver3.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
         namespaceResolver3.Add("mvvmcross", "clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms");
         namespaceResolver3.Add("viewModels", "clr-namespace:Ekreta.Mobile.Core.ViewModels;assembly=Ekreta.Mobile.Core");
         namespaceResolver3.Add("pluginImage", "clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions");
         XamlTypeResolver xamlTypeResolver3 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver3, typeof(MessagesPage).GetTypeInfo().Assembly);
         xamlServiceProvider3.Add(type6, (object)xamlTypeResolver3);
         xamlServiceProvider3.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(101, 13)));
         object obj6 = ((IMarkupExtension)resourceExtension8).ProvideValue((IServiceProvider)xamlServiceProvider3);
         ((VisualElement)grid1).set_BackgroundColor((Color)obj6);
         bindingExtension6.set_Path("IsLoading");
         BindingBase bindingBase6 = ((IMarkupExtension <BindingBase>)bindingExtension6).ProvideValue((IServiceProvider)null);
         ((BindableObject)grid1).SetBinding((BindableProperty)VisualElement.IsVisibleProperty, bindingBase6);
         resourceExtension4.set_Key("PageBackgroundColor");
         StaticResourceExtension resourceExtension9   = resourceExtension4;
         XamlServiceProvider     xamlServiceProvider4 = new XamlServiceProvider();
         Type     type7     = typeof(IProvideValueTarget);
         object[] objArray5 = new object[0 + 4];
         objArray5[0] = (object)boxView;
         objArray5[1] = (object)grid1;
         objArray5[2] = (object)grid2;
         objArray5[3] = (object)messagesPage;
         SimpleValueTargetProvider valueTargetProvider4;
         object obj7 = (object)(valueTargetProvider4 = new SimpleValueTargetProvider(objArray5, (object)VisualElement.BackgroundColorProperty, (INameScope)nameScope));
         xamlServiceProvider4.Add(type7, (object)valueTargetProvider4);
         xamlServiceProvider4.Add(typeof(IReferenceProvider), obj7);
         Type type8 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver4 = new XmlNamespaceResolver();
         namespaceResolver4.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver4.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver4.Add("controls", "clr-namespace:Ekreta.Mobile.Core.Controls;assembly=Ekreta.Mobile.Core");
         namespaceResolver4.Add("d", "http://xamarin.com/schemas/2014/forms/design");
         namespaceResolver4.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         namespaceResolver4.Add("ios", "clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core");
         namespaceResolver4.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
         namespaceResolver4.Add("mvvmcross", "clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms");
         namespaceResolver4.Add("viewModels", "clr-namespace:Ekreta.Mobile.Core.ViewModels;assembly=Ekreta.Mobile.Core");
         namespaceResolver4.Add("pluginImage", "clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions");
         XamlTypeResolver xamlTypeResolver4 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver4, typeof(MessagesPage).GetTypeInfo().Assembly);
         xamlServiceProvider4.Add(type8, (object)xamlTypeResolver4);
         xamlServiceProvider4.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(103, 22)));
         object obj8 = ((IMarkupExtension)resourceExtension9).ProvideValue((IServiceProvider)xamlServiceProvider4);
         ((VisualElement)boxView).set_BackgroundColor((Color)obj8);
         ((ICollection <View>)grid1.get_Children()).Add((View)boxView);
         ((BindableObject)circleImage).SetValue((BindableProperty)CircleImage.FillColorProperty, (object)(Color)Color.White);
         resourceExtension5.set_Key("ListItemIconStyle");
         StaticResourceExtension resourceExtension10  = resourceExtension5;
         XamlServiceProvider     xamlServiceProvider5 = new XamlServiceProvider();
         Type     type9     = typeof(IProvideValueTarget);
         object[] objArray6 = new object[0 + 4];
         objArray6[0] = (object)circleImage;
         objArray6[1] = (object)grid1;
         objArray6[2] = (object)grid2;
         objArray6[3] = (object)messagesPage;
         SimpleValueTargetProvider valueTargetProvider5;
         object obj9 = (object)(valueTargetProvider5 = new SimpleValueTargetProvider(objArray6, (object)VisualElement.StyleProperty, (INameScope)nameScope));
         xamlServiceProvider5.Add(type9, (object)valueTargetProvider5);
         xamlServiceProvider5.Add(typeof(IReferenceProvider), obj9);
         Type type10 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver5 = new XmlNamespaceResolver();
         namespaceResolver5.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver5.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver5.Add("controls", "clr-namespace:Ekreta.Mobile.Core.Controls;assembly=Ekreta.Mobile.Core");
         namespaceResolver5.Add("d", "http://xamarin.com/schemas/2014/forms/design");
         namespaceResolver5.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         namespaceResolver5.Add("ios", "clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core");
         namespaceResolver5.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
         namespaceResolver5.Add("mvvmcross", "clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms");
         namespaceResolver5.Add("viewModels", "clr-namespace:Ekreta.Mobile.Core.ViewModels;assembly=Ekreta.Mobile.Core");
         namespaceResolver5.Add("pluginImage", "clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions");
         XamlTypeResolver xamlTypeResolver5 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver5, typeof(MessagesPage).GetTypeInfo().Assembly);
         xamlServiceProvider5.Add(type10, (object)xamlTypeResolver5);
         xamlServiceProvider5.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(104, 56)));
         object obj10 = ((IMarkupExtension)resourceExtension10).ProvideValue((IServiceProvider)xamlServiceProvider5);
         ((NavigableElement)circleImage).set_Style((Style)obj10);
         ((ICollection <View>)grid1.get_Children()).Add((View)circleImage);
         bindingExtension7.set_Path("IsLoading");
         BindingBase bindingBase7 = ((IMarkupExtension <BindingBase>)bindingExtension7).ProvideValue((IServiceProvider)null);
         ((BindableObject)activityIndicator).SetBinding((BindableProperty)ActivityIndicator.IsRunningProperty, bindingBase7);
         bindingExtension8.set_Path("IsLoading");
         BindingBase bindingBase8 = ((IMarkupExtension <BindingBase>)bindingExtension8).ProvideValue((IServiceProvider)null);
         ((BindableObject)activityIndicator).SetBinding((BindableProperty)VisualElement.IsVisibleProperty, bindingBase8);
         ((ICollection <View>)grid1.get_Children()).Add((View)activityIndicator);
         ((ICollection <View>)grid2.get_Children()).Add((View)grid1);
         ((BindableObject)messagesPage).SetValue((BindableProperty)ContentPage.ContentProperty, (object)grid2);
     }
 }
Beispiel #5
0
        private void InitializeComponent()
        {
            if (ResourceLoader.ResourceProvider != null && ResourceLoader.ResourceProvider(typeof(SelectCell).GetTypeInfo().Assembly.GetName(), "Layout/SelectCell.xaml") != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            if (XamlLoader.XamlFileProvider != null && XamlLoader.XamlFileProvider(base.GetType()) != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            ColumnDefinition     columnDefinition     = new ColumnDefinition();
            ColumnDefinition     columnDefinition2    = new ColumnDefinition();
            RowDefinition        rowDefinition        = new RowDefinition();
            TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer();
            Label          label          = new Label();
            NoBorderEntry  noBorderEntry  = new NoBorderEntry();
            Label          label2         = new Label();
            SvgCachedImage svgCachedImage = new SvgCachedImage();
            Grid           grid           = new Grid();
            NameScope      nameScope      = new NameScope();

            NameScope.SetNameScope(this, nameScope);
            NameScope.SetNameScope(grid, nameScope);
            ((INameScope)nameScope).RegisterName("view", grid);
            if (grid.StyleId == null)
            {
                grid.StyleId = "view";
            }
            NameScope.SetNameScope(columnDefinition, nameScope);
            NameScope.SetNameScope(columnDefinition2, nameScope);
            NameScope.SetNameScope(rowDefinition, nameScope);
            NameScope.SetNameScope(tapGestureRecognizer, nameScope);
            NameScope.SetNameScope(label, nameScope);
            ((INameScope)nameScope).RegisterName("label", label);
            if (label.StyleId == null)
            {
                label.StyleId = "label";
            }
            NameScope.SetNameScope(noBorderEntry, nameScope);
            ((INameScope)nameScope).RegisterName("entry", noBorderEntry);
            if (noBorderEntry.StyleId == null)
            {
                noBorderEntry.StyleId = "entry";
            }
            NameScope.SetNameScope(label2, nameScope);
            ((INameScope)nameScope).RegisterName("placeLabel", label2);
            if (label2.StyleId == null)
            {
                label2.StyleId = "placeLabel";
            }
            NameScope.SetNameScope(svgCachedImage, nameScope);
            ((INameScope)nameScope).RegisterName("arrow", svgCachedImage);
            if (svgCachedImage.StyleId == null)
            {
                svgCachedImage.StyleId = "arrow";
            }
            this.view       = grid;
            this.label      = label;
            this.entry      = noBorderEntry;
            this.placeLabel = label2;
            this.arrow      = svgCachedImage;
            grid.SetValue(VisualElement.BackgroundColorProperty, Color.White);
            grid.SetValue(Grid.RowSpacingProperty, 5.0);
            grid.SetValue(Layout.PaddingProperty, new Thickness(10.0, 5.0, 10.0, 5.0));
            columnDefinition.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition);
            columnDefinition2.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("3*"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition2);
            rowDefinition.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto"));
            grid.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition);
            tapGestureRecognizer.Tapped += this.TapGestureRecognizer_Tapped;
            grid.GestureRecognizers.Add(tapGestureRecognizer);
            BindableObject         bindableObject        = label;
            BindableProperty       fontSizeProperty      = Label.FontSizeProperty;
            IExtendedTypeConverter extendedTypeConverter = new FontSizeConverter();
            string value = "Default";
            XamlServiceProvider xamlServiceProvider = new XamlServiceProvider();
            Type typeFromHandle = typeof(IProvideValueTarget);

            object[] array = new object[0 + 3];
            array[0] = label;
            array[1] = grid;
            array[2] = this;
            xamlServiceProvider.Add(typeFromHandle, new SimpleValueTargetProvider(array, Label.FontSizeProperty));
            xamlServiceProvider.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle2 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver = new XmlNamespaceResolver();

            xmlNamespaceResolver.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider.Add(typeFromHandle2, new XamlTypeResolver(xmlNamespaceResolver, typeof(SelectCell).GetTypeInfo().Assembly));
            xamlServiceProvider.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(19, 20)));
            bindableObject.SetValue(fontSizeProperty, extendedTypeConverter.ConvertFromInvariantString(value, xamlServiceProvider));
            label.SetValue(Label.TextColorProperty, new Color(0.501960813999176, 0.501960813999176, 0.501960813999176, 1.0));
            label.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            label.SetValue(View.HorizontalOptionsProperty, LayoutOptions.FillAndExpand);
            label.SetValue(Label.HorizontalTextAlignmentProperty, new TextAlignmentConverter().ConvertFromInvariantString("Start"));
            label.SetValue(Grid.ColumnProperty, 0);
            grid.Children.Add(label);
            noBorderEntry.SetValue(VisualElement.BackgroundColorProperty, Color.White);
            noBorderEntry.SetValue(VisualElement.WidthRequestProperty, 1.0);
            BindableObject         bindableObject2        = noBorderEntry;
            BindableProperty       fontSizeProperty2      = Entry.FontSizeProperty;
            IExtendedTypeConverter extendedTypeConverter2 = new FontSizeConverter();
            string value2 = "Default";
            XamlServiceProvider xamlServiceProvider2 = new XamlServiceProvider();
            Type typeFromHandle3 = typeof(IProvideValueTarget);

            object[] array2 = new object[0 + 3];
            array2[0] = noBorderEntry;
            array2[1] = grid;
            array2[2] = this;
            xamlServiceProvider2.Add(typeFromHandle3, new SimpleValueTargetProvider(array2, Entry.FontSizeProperty));
            xamlServiceProvider2.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle4 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver2 = new XmlNamespaceResolver();

            xmlNamespaceResolver2.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver2.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver2.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver2.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider2.Add(typeFromHandle4, new XamlTypeResolver(xmlNamespaceResolver2, typeof(SelectCell).GetTypeInfo().Assembly));
            xamlServiceProvider2.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(20, 92)));
            bindableObject2.SetValue(fontSizeProperty2, extendedTypeConverter2.ConvertFromInvariantString(value2, xamlServiceProvider2));
            noBorderEntry.SetValue(Grid.ColumnProperty, 1);
            noBorderEntry.SetValue(View.HorizontalOptionsProperty, LayoutOptions.End);
            noBorderEntry.SetValue(VisualElement.IsEnabledProperty, false);
            grid.Children.Add(noBorderEntry);
            BindableObject         bindableObject3        = label2;
            BindableProperty       fontSizeProperty3      = Label.FontSizeProperty;
            IExtendedTypeConverter extendedTypeConverter3 = new FontSizeConverter();
            string value3 = "Default";
            XamlServiceProvider xamlServiceProvider3 = new XamlServiceProvider();
            Type typeFromHandle5 = typeof(IProvideValueTarget);

            object[] array3 = new object[0 + 3];
            array3[0] = label2;
            array3[1] = grid;
            array3[2] = this;
            xamlServiceProvider3.Add(typeFromHandle5, new SimpleValueTargetProvider(array3, Label.FontSizeProperty));
            xamlServiceProvider3.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle6 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver3 = new XmlNamespaceResolver();

            xmlNamespaceResolver3.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver3.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver3.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver3.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider3.Add(typeFromHandle6, new XamlTypeResolver(xmlNamespaceResolver3, typeof(SelectCell).GetTypeInfo().Assembly));
            xamlServiceProvider3.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(21, 20)));
            bindableObject3.SetValue(fontSizeProperty3, extendedTypeConverter3.ConvertFromInvariantString(value3, xamlServiceProvider3));
            label2.SetValue(Label.TextColorProperty, Color.Black);
            label2.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            label2.SetValue(View.HorizontalOptionsProperty, LayoutOptions.FillAndExpand);
            label2.SetValue(Label.HorizontalTextAlignmentProperty, new TextAlignmentConverter().ConvertFromInvariantString("Start"));
            label2.SetValue(Grid.ColumnProperty, 1);
            grid.Children.Add(label2);
            svgCachedImage.SetValue(CachedImage.SourceProperty, new FFImageLoading.Forms.ImageSourceConverter().ConvertFromInvariantString("rightarrow.svg"));
            svgCachedImage.SetValue(Grid.ColumnProperty, 1);
            svgCachedImage.SetValue(View.HorizontalOptionsProperty, LayoutOptions.End);
            svgCachedImage.SetValue(VisualElement.WidthRequestProperty, 15.0);
            svgCachedImage.SetValue(VisualElement.HeightRequestProperty, 15.0);
            svgCachedImage.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            grid.Children.Add(svgCachedImage);
            this.View = grid;
        }
Beispiel #6
0
        private void InitializeComponent()
        {
            if (ResourceLoader.ResourceProvider != null && ResourceLoader.ResourceProvider(typeof(LoginPage).GetTypeInfo().Assembly.GetName(), "Views/LoginPage.xaml") != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            if (XamlLoader.XamlFileProvider != null && XamlLoader.XamlFileProvider(base.GetType()) != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            TranslateExtension translateExtension  = new TranslateExtension();
            TranslateExtension translateExtension2 = new TranslateExtension();
            BindingExtension   bindingExtension    = new BindingExtension();
            ToolbarItem        toolbarItem         = new ToolbarItem();
            RowDefinition      rowDefinition       = new RowDefinition();
            RowDefinition      rowDefinition2      = new RowDefinition();
            RowDefinition      rowDefinition3      = new RowDefinition();
            ColumnDefinition   columnDefinition    = new ColumnDefinition();
            ColumnDefinition   columnDefinition2   = new ColumnDefinition();
            SvgCachedImage     svgCachedImage      = new SvgCachedImage();
            TranslateExtension translateExtension3 = new TranslateExtension();
            BindingExtension   bindingExtension2   = new BindingExtension();
            NoBorderEntry      noBorderEntry       = new NoBorderEntry();
            Grid               grid                = new Grid();
            Frame              frame               = new Frame();
            ColumnDefinition   columnDefinition3   = new ColumnDefinition();
            ColumnDefinition   columnDefinition4   = new ColumnDefinition();
            SvgCachedImage     svgCachedImage2     = new SvgCachedImage();
            TranslateExtension translateExtension4 = new TranslateExtension();
            BindingExtension   bindingExtension3   = new BindingExtension();
            NoBorderEntry      noBorderEntry2      = new NoBorderEntry();
            Grid               grid2               = new Grid();
            Frame              frame2              = new Frame();
            StackLayout        stackLayout         = new StackLayout();
            TranslateExtension translateExtension5 = new TranslateExtension();
            BindingExtension   bindingExtension4   = new BindingExtension();
            Button             button              = new Button();
            StackLayout        stackLayout2        = new StackLayout();
            Grid               grid3               = new Grid();
            BindingExtension   bindingExtension5   = new BindingExtension();
            BindingExtension   bindingExtension6   = new BindingExtension();
            ActivityIndicator  activityIndicator   = new ActivityIndicator();
            Grid               grid4               = new Grid();
            NameScope          nameScope           = new NameScope();

            NameScope.SetNameScope(this, nameScope);
            NameScope.SetNameScope(toolbarItem, nameScope);
            NameScope.SetNameScope(grid4, nameScope);
            NameScope.SetNameScope(grid3, nameScope);
            NameScope.SetNameScope(rowDefinition, nameScope);
            NameScope.SetNameScope(rowDefinition2, nameScope);
            NameScope.SetNameScope(rowDefinition3, nameScope);
            NameScope.SetNameScope(stackLayout, nameScope);
            NameScope.SetNameScope(frame, nameScope);
            NameScope.SetNameScope(grid, nameScope);
            NameScope.SetNameScope(columnDefinition, nameScope);
            NameScope.SetNameScope(columnDefinition2, nameScope);
            NameScope.SetNameScope(svgCachedImage, nameScope);
            NameScope.SetNameScope(noBorderEntry, nameScope);
            NameScope.SetNameScope(frame2, nameScope);
            NameScope.SetNameScope(grid2, nameScope);
            NameScope.SetNameScope(columnDefinition3, nameScope);
            NameScope.SetNameScope(columnDefinition4, nameScope);
            NameScope.SetNameScope(svgCachedImage2, nameScope);
            NameScope.SetNameScope(noBorderEntry2, nameScope);
            NameScope.SetNameScope(stackLayout2, nameScope);
            NameScope.SetNameScope(button, nameScope);
            NameScope.SetNameScope(activityIndicator, nameScope);
            this.SetValue(VisualElement.BackgroundColorProperty, Color.White);
            this.SetValue(Page.BackgroundImageProperty, "main_bg.png");
            translateExtension.Text = "login";
            IMarkupExtension    markupExtension     = translateExtension;
            XamlServiceProvider xamlServiceProvider = new XamlServiceProvider();
            Type typeFromHandle = typeof(IProvideValueTarget);

            object[] array = new object[0 + 1];
            array[0] = this;
            xamlServiceProvider.Add(typeFromHandle, new SimpleValueTargetProvider(array, Page.TitleProperty));
            xamlServiceProvider.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle2 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver = new XmlNamespaceResolver();

            xmlNamespaceResolver.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver.Add("local", "clr-namespace:RFID");
            xmlNamespaceResolver.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider.Add(typeFromHandle2, new XamlTypeResolver(xmlNamespaceResolver, typeof(LoginPage).GetTypeInfo().Assembly));
            xamlServiceProvider.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(10, 5)));
            object title = markupExtension.ProvideValue(xamlServiceProvider);

            this.Title = title;
            translateExtension2.Text = "server";
            IMarkupExtension    markupExtension2     = translateExtension2;
            XamlServiceProvider xamlServiceProvider2 = new XamlServiceProvider();
            Type typeFromHandle3 = typeof(IProvideValueTarget);

            object[] array2 = new object[0 + 2];
            array2[0] = toolbarItem;
            array2[1] = this;
            xamlServiceProvider2.Add(typeFromHandle3, new SimpleValueTargetProvider(array2, MenuItem.TextProperty));
            xamlServiceProvider2.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle4 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver2 = new XmlNamespaceResolver();

            xmlNamespaceResolver2.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver2.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver2.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver2.Add("local", "clr-namespace:RFID");
            xmlNamespaceResolver2.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider2.Add(typeFromHandle4, new XamlTypeResolver(xmlNamespaceResolver2, typeof(LoginPage).GetTypeInfo().Assembly));
            xamlServiceProvider2.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(12, 22)));
            object text = markupExtension2.ProvideValue(xamlServiceProvider2);

            toolbarItem.Text      = text;
            toolbarItem.Order     = ToolbarItemOrder.Primary;
            bindingExtension.Path = "ServerCommand";
            BindingBase binding = ((IMarkupExtension <BindingBase>)bindingExtension).ProvideValue(null);

            toolbarItem.SetBinding(MenuItem.CommandProperty, binding);
            this.ToolbarItems.Add(toolbarItem);
            rowDefinition.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto"));
            grid3.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition);
            rowDefinition2.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*"));
            grid3.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition2);
            rowDefinition3.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto"));
            grid3.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition3);
            stackLayout.SetValue(Grid.RowProperty, 1);
            stackLayout.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            stackLayout.SetValue(View.HorizontalOptionsProperty, LayoutOptions.Center);
            stackLayout.SetValue(View.MarginProperty, new Thickness(20.0, 0.0, 20.0, 0.0));
            frame.SetValue(Frame.BorderColorProperty, Color.Black);
            frame.SetValue(Frame.CornerRadiusProperty, 10f);
            frame.SetValue(View.HorizontalOptionsProperty, LayoutOptions.FillAndExpand);
            frame.SetValue(Xamarin.Forms.Layout.PaddingProperty, new Thickness(10.0, 0.0, 10.0, 0.0));
            frame.SetValue(Frame.HasShadowProperty, false);
            grid.SetValue(Grid.ColumnSpacingProperty, 10.0);
            columnDefinition.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("30"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition);
            columnDefinition2.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition2);
            svgCachedImage.SetValue(View.HorizontalOptionsProperty, LayoutOptions.Center);
            svgCachedImage.SetValue(CachedImage.AspectProperty, Aspect.AspectFit);
            svgCachedImage.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            svgCachedImage.SetValue(Grid.ColumnProperty, 0);
            svgCachedImage.SetValue(VisualElement.WidthRequestProperty, 24.0);
            svgCachedImage.SetValue(VisualElement.HeightRequestProperty, 24.0);
            svgCachedImage.SetValue(CachedImage.SourceProperty, new FFImageLoading.Forms.ImageSourceConverter().ConvertFromInvariantString("user.svg"));
            grid.Children.Add(svgCachedImage);
            translateExtension3.Text = "user";
            IMarkupExtension    markupExtension3     = translateExtension3;
            XamlServiceProvider xamlServiceProvider3 = new XamlServiceProvider();
            Type typeFromHandle5 = typeof(IProvideValueTarget);

            object[] array3 = new object[0 + 7];
            array3[0] = noBorderEntry;
            array3[1] = grid;
            array3[2] = frame;
            array3[3] = stackLayout;
            array3[4] = grid3;
            array3[5] = grid4;
            array3[6] = this;
            xamlServiceProvider3.Add(typeFromHandle5, new SimpleValueTargetProvider(array3, Entry.PlaceholderProperty));
            xamlServiceProvider3.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle6 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver3 = new XmlNamespaceResolver();

            xmlNamespaceResolver3.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver3.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver3.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver3.Add("local", "clr-namespace:RFID");
            xmlNamespaceResolver3.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider3.Add(typeFromHandle6, new XamlTypeResolver(xmlNamespaceResolver3, typeof(LoginPage).GetTypeInfo().Assembly));
            xamlServiceProvider3.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(34, 51)));
            object placeholder = markupExtension3.ProvideValue(xamlServiceProvider3);

            noBorderEntry.Placeholder = placeholder;
            bindingExtension2.Mode    = BindingMode.TwoWay;
            bindingExtension2.Path    = "Username";
            BindingBase binding2 = ((IMarkupExtension <BindingBase>)bindingExtension2).ProvideValue(null);

            noBorderEntry.SetBinding(Entry.TextProperty, binding2);
            BindableObject         bindableObject        = noBorderEntry;
            BindableProperty       fontSizeProperty      = Entry.FontSizeProperty;
            IExtendedTypeConverter extendedTypeConverter = new FontSizeConverter();
            string value = "Default";
            XamlServiceProvider xamlServiceProvider4 = new XamlServiceProvider();
            Type typeFromHandle7 = typeof(IProvideValueTarget);

            object[] array4 = new object[0 + 7];
            array4[0] = noBorderEntry;
            array4[1] = grid;
            array4[2] = frame;
            array4[3] = stackLayout;
            array4[4] = grid3;
            array4[5] = grid4;
            array4[6] = this;
            xamlServiceProvider4.Add(typeFromHandle7, new SimpleValueTargetProvider(array4, Entry.FontSizeProperty));
            xamlServiceProvider4.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle8 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver4 = new XmlNamespaceResolver();

            xmlNamespaceResolver4.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver4.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver4.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver4.Add("local", "clr-namespace:RFID");
            xmlNamespaceResolver4.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider4.Add(typeFromHandle8, new XamlTypeResolver(xmlNamespaceResolver4, typeof(LoginPage).GetTypeInfo().Assembly));
            xamlServiceProvider4.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(34, 126)));
            bindableObject.SetValue(fontSizeProperty, extendedTypeConverter.ConvertFromInvariantString(value, xamlServiceProvider4));
            noBorderEntry.SetValue(Grid.ColumnProperty, 1);
            noBorderEntry.SetValue(Entry.TextColorProperty, Color.Black);
            grid.Children.Add(noBorderEntry);
            frame.SetValue(ContentView.ContentProperty, grid);
            stackLayout.Children.Add(frame);
            frame2.SetValue(Frame.BorderColorProperty, Color.Black);
            frame2.SetValue(Frame.CornerRadiusProperty, 10f);
            frame2.SetValue(View.HorizontalOptionsProperty, LayoutOptions.FillAndExpand);
            frame2.SetValue(Xamarin.Forms.Layout.PaddingProperty, new Thickness(10.0, 0.0, 10.0, 0.0));
            frame2.SetValue(Frame.HasShadowProperty, false);
            grid2.SetValue(Grid.ColumnSpacingProperty, 10.0);
            columnDefinition3.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("30"));
            grid2.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition3);
            columnDefinition4.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*"));
            grid2.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition4);
            svgCachedImage2.SetValue(View.HorizontalOptionsProperty, LayoutOptions.Center);
            svgCachedImage2.SetValue(CachedImage.AspectProperty, Aspect.AspectFit);
            svgCachedImage2.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            svgCachedImage2.SetValue(Grid.ColumnProperty, 0);
            svgCachedImage2.SetValue(VisualElement.WidthRequestProperty, 24.0);
            svgCachedImage2.SetValue(VisualElement.HeightRequestProperty, 24.0);
            svgCachedImage2.SetValue(CachedImage.SourceProperty, new FFImageLoading.Forms.ImageSourceConverter().ConvertFromInvariantString("lock.svg"));
            grid2.Children.Add(svgCachedImage2);
            translateExtension4.Text = "password";
            IMarkupExtension    markupExtension4     = translateExtension4;
            XamlServiceProvider xamlServiceProvider5 = new XamlServiceProvider();
            Type typeFromHandle9 = typeof(IProvideValueTarget);

            object[] array5 = new object[0 + 7];
            array5[0] = noBorderEntry2;
            array5[1] = grid2;
            array5[2] = frame2;
            array5[3] = stackLayout;
            array5[4] = grid3;
            array5[5] = grid4;
            array5[6] = this;
            xamlServiceProvider5.Add(typeFromHandle9, new SimpleValueTargetProvider(array5, Entry.PlaceholderProperty));
            xamlServiceProvider5.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle10 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver5 = new XmlNamespaceResolver();

            xmlNamespaceResolver5.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver5.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver5.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver5.Add("local", "clr-namespace:RFID");
            xmlNamespaceResolver5.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider5.Add(typeFromHandle10, new XamlTypeResolver(xmlNamespaceResolver5, typeof(LoginPage).GetTypeInfo().Assembly));
            xamlServiceProvider5.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(46, 51)));
            object placeholder2 = markupExtension4.ProvideValue(xamlServiceProvider5);

            noBorderEntry2.Placeholder = placeholder2;
            bindingExtension3.Mode     = BindingMode.TwoWay;
            bindingExtension3.Path     = "Password";
            BindingBase binding3 = ((IMarkupExtension <BindingBase>)bindingExtension3).ProvideValue(null);

            noBorderEntry2.SetBinding(Entry.TextProperty, binding3);
            BindableObject         bindableObject2        = noBorderEntry2;
            BindableProperty       fontSizeProperty2      = Entry.FontSizeProperty;
            IExtendedTypeConverter extendedTypeConverter2 = new FontSizeConverter();
            string value2 = "Default";
            XamlServiceProvider xamlServiceProvider6 = new XamlServiceProvider();
            Type typeFromHandle11 = typeof(IProvideValueTarget);

            object[] array6 = new object[0 + 7];
            array6[0] = noBorderEntry2;
            array6[1] = grid2;
            array6[2] = frame2;
            array6[3] = stackLayout;
            array6[4] = grid3;
            array6[5] = grid4;
            array6[6] = this;
            xamlServiceProvider6.Add(typeFromHandle11, new SimpleValueTargetProvider(array6, Entry.FontSizeProperty));
            xamlServiceProvider6.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle12 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver6 = new XmlNamespaceResolver();

            xmlNamespaceResolver6.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver6.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver6.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver6.Add("local", "clr-namespace:RFID");
            xmlNamespaceResolver6.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider6.Add(typeFromHandle12, new XamlTypeResolver(xmlNamespaceResolver6, typeof(LoginPage).GetTypeInfo().Assembly));
            xamlServiceProvider6.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(46, 130)));
            bindableObject2.SetValue(fontSizeProperty2, extendedTypeConverter2.ConvertFromInvariantString(value2, xamlServiceProvider6));
            noBorderEntry2.SetValue(Grid.ColumnProperty, 1);
            noBorderEntry2.SetValue(Entry.TextColorProperty, Color.Black);
            noBorderEntry2.SetValue(Entry.IsPasswordProperty, true);
            grid2.Children.Add(noBorderEntry2);
            frame2.SetValue(ContentView.ContentProperty, grid2);
            stackLayout.Children.Add(frame2);
            grid3.Children.Add(stackLayout);
            stackLayout2.SetValue(View.VerticalOptionsProperty, LayoutOptions.Start);
            stackLayout2.SetValue(Grid.RowProperty, 2);
            stackLayout2.SetValue(StackLayout.SpacingProperty, 15.0);
            stackLayout2.SetValue(View.MarginProperty, new Thickness(20.0, 0.0, 20.0, 40.0));
            BindableObject         bindableObject3        = button;
            BindableProperty       fontSizeProperty3      = Button.FontSizeProperty;
            IExtendedTypeConverter extendedTypeConverter3 = new FontSizeConverter();
            string value3 = "Medium";
            XamlServiceProvider xamlServiceProvider7 = new XamlServiceProvider();
            Type typeFromHandle13 = typeof(IProvideValueTarget);

            object[] array7 = new object[0 + 5];
            array7[0] = button;
            array7[1] = stackLayout2;
            array7[2] = grid3;
            array7[3] = grid4;
            array7[4] = this;
            xamlServiceProvider7.Add(typeFromHandle13, new SimpleValueTargetProvider(array7, Button.FontSizeProperty));
            xamlServiceProvider7.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle14 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver7 = new XmlNamespaceResolver();

            xmlNamespaceResolver7.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver7.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver7.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver7.Add("local", "clr-namespace:RFID");
            xmlNamespaceResolver7.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider7.Add(typeFromHandle14, new XamlTypeResolver(xmlNamespaceResolver7, typeof(LoginPage).GetTypeInfo().Assembly));
            xamlServiceProvider7.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(75, 32)));
            bindableObject3.SetValue(fontSizeProperty3, extendedTypeConverter3.ConvertFromInvariantString(value3, xamlServiceProvider7));
            button.SetValue(VisualElement.BackgroundColorProperty, Color.Black);
            button.SetValue(Button.TextColorProperty, Color.White);
            button.SetValue(Button.BorderColorProperty, Color.Black);
            button.SetValue(Button.BorderWidthProperty, 1.0);
            button.SetValue(Button.BorderRadiusProperty, 5);
            translateExtension5.Text = "login";
            IMarkupExtension    markupExtension5     = translateExtension5;
            XamlServiceProvider xamlServiceProvider8 = new XamlServiceProvider();
            Type typeFromHandle15 = typeof(IProvideValueTarget);

            object[] array8 = new object[0 + 5];
            array8[0] = button;
            array8[1] = stackLayout2;
            array8[2] = grid3;
            array8[3] = grid4;
            array8[4] = this;
            xamlServiceProvider8.Add(typeFromHandle15, new SimpleValueTargetProvider(array8, Button.TextProperty));
            xamlServiceProvider8.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle16 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver8 = new XmlNamespaceResolver();

            xmlNamespaceResolver8.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver8.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver8.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver8.Add("local", "clr-namespace:RFID");
            xmlNamespaceResolver8.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider8.Add(typeFromHandle16, new XamlTypeResolver(xmlNamespaceResolver8, typeof(LoginPage).GetTypeInfo().Assembly));
            xamlServiceProvider8.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(75, 145)));
            object text2 = markupExtension5.ProvideValue(xamlServiceProvider8);

            button.Text            = text2;
            bindingExtension4.Path = "LoginCommand";
            BindingBase binding4 = ((IMarkupExtension <BindingBase>)bindingExtension4).ProvideValue(null);

            button.SetBinding(Button.CommandProperty, binding4);
            stackLayout2.Children.Add(button);
            grid3.Children.Add(stackLayout2);
            grid4.Children.Add(grid3);
            activityIndicator.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            activityIndicator.SetValue(View.HorizontalOptionsProperty, LayoutOptions.Center);
            bindingExtension5.Path = "IsBusy";
            BindingBase binding5 = ((IMarkupExtension <BindingBase>)bindingExtension5).ProvideValue(null);

            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, binding5);
            bindingExtension6.Path = "IsBusy";
            BindingBase binding6 = ((IMarkupExtension <BindingBase>)bindingExtension6).ProvideValue(null);

            activityIndicator.SetBinding(VisualElement.IsVisibleProperty, binding6);
            grid4.Children.Add(activityIndicator);
            this.SetValue(ContentPage.ContentProperty, grid4);
        }
Beispiel #7
0
        public void ItemsControlTemplatesTest()
        {
            string text = @"
            <ItemsControl xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <DockPanel/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.Template>
                    <ControlTemplate>
                        <Grid>
                            <TextBlock Text='Header'/>
                            <ItemsPresenter ItemContainerGenerator='{TemplateBinding ItemsControl.ItemContainerGenerator}' Template='{TemplateBinding ItemsControl.ItemsPanel}'/>
                        </Grid>
                    </ControlTemplate>
                </ItemsControl.Template>
                <ItemsControl.ItemContainerStyle>
                    <Style>
                        <Setter Property='DockPanel.Dock' Value='Bottom'/>
                    </Style>
                </ItemsControl.ItemContainerStyle>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text='{Binding}'/>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>";

            ItemsControl itemsControl = XamlLoader.Load(XamlParser.Parse(text)) as ItemsControl;

            itemsControl.Items.Add("item1");
            itemsControl.Items.Add("item2");
            itemsControl.Items.Add("item3");

            Grid grid = itemsControl.VisualChildren.FirstOrDefault() as Grid;

            Assert.IsNotNull(grid);
            Assert.AreEqual(2, grid.Children.Count);

            TextBlock      textBlock      = grid.Children[0] as TextBlock;
            ItemsPresenter itemsPresenter = grid.Children[1] as ItemsPresenter;

            Assert.IsNotNull(textBlock);
            Assert.IsNotNull(itemsPresenter);
            Assert.AreEqual("Header", textBlock.Text);

            DockPanel dockPanel = itemsPresenter.VisualChildren.FirstOrDefault() as DockPanel;

            Assert.IsNotNull(dockPanel);
            Assert.AreEqual(3, dockPanel.Children.Count);

            ContentPresenter presenter1 = dockPanel.Children[0] as ContentPresenter;
            ContentPresenter presenter2 = dockPanel.Children[1] as ContentPresenter;
            ContentPresenter presenter3 = dockPanel.Children[2] as ContentPresenter;

            Assert.IsNotNull(presenter1);
            Assert.IsNotNull(presenter2);
            Assert.IsNotNull(presenter3);
            Assert.AreEqual(Dock.Bottom, DockPanel.GetDock(presenter1));
            Assert.AreEqual(Dock.Bottom, DockPanel.GetDock(presenter2));
            Assert.AreEqual(Dock.Bottom, DockPanel.GetDock(presenter3));

            TextBlock textBlock1 = presenter1.VisualChildren.FirstOrDefault() as TextBlock;

            Assert.IsNotNull(textBlock1);
            Assert.AreEqual("item1", textBlock1.Text);

            itemsControl.Items[0] = "item4";
            Assert.IsFalse(presenter1.VisualChildren.Any());
            Assert.IsNull(textBlock1.Text);

            ContentPresenter presenter4 = dockPanel.Children[0] as ContentPresenter;

            Assert.AreNotEqual(presenter1, presenter4);

            TextBlock textBlock4 = presenter4.VisualChildren.FirstOrDefault() as TextBlock;

            Assert.AreEqual("item4", textBlock4.Text);
        }