// We can't call this.  See: https://bugzilla.xamarin.com/show_bug.cgi?id=30843
        //public override View Inflate(XmlReader parser, ViewGroup root, bool attachToRoot)
        //{
        //    SetPrivateFactoryInternal();
        //    return base.Inflate(parser, root, attachToRoot);
        //}

        // Calligraphy doesn't override this one...
        public override View Inflate(int resource, ViewGroup root, bool attachToRoot)
        {
            // Make sure our private factory is set since LayoutInflater > Honeycomb
            // uses a private factory.
            SetPrivateFactoryInternal();

            // Save the old factory in case we are recursing because of an MvxAdapter etc.
            IMvxLayoutInflaterHolderFactory originalFactory = _bindingVisitor.Factory;

            try
            {
                IMvxLayoutInflaterHolderFactory factory = null;

                // Get the current binding context
                var currentBindingContext = MvxAndroidBindingContextHelpers.Current();
                if (currentBindingContext != null)
                {
                    factory = FactoryFactory?.Create(currentBindingContext.DataContext);

                    // Set the current factory used to generate bindings
                    if (factory != null)
                    {
                        _bindingVisitor.Factory = factory;
                    }
                }

                // Inflate the resource
                var view = base.Inflate(resource, root, attachToRoot);

                // Register bindings with clear key
                if (currentBindingContext != null)
                {
                    if (factory != null)
                    {
                        currentBindingContext.RegisterBindingsWithClearKey(view, factory.CreatedBindings);
                    }
                }

                return(view);
            }
            finally
            {
                _bindingVisitor.Factory = originalFactory;
            }
        }
示例#2
0
        public void TestFactory()
        {
            int count = Enum.GetNames(typeof(FactoryType)).Length;

            for (int i = 0; i < count; i++)
            {
                CFactory fact = FactoryFactory.CreateFactory((FactoryType)i);
                if (fact == null)
                {
                    continue;
                }
                bool good = fact.TestFactory();
                if (!good)
                {
                    Assert.IsTrue(good);
                }
            }
        }
示例#3
0
        public void TextExcludeWhatHave()
        {
            CFactory    test1  = FactoryFactory.CreateFactory(FactType.ftBackary);
            CFactory    test2  = FactoryFactory.CreateFactory(FactType.ftBackary);
            CSmartArray array1 = new CSmartArray();
            CSmartArray array2 = new CSmartArray();

            array1.Add("хлеб", 1);
            array2.Add("хлеб", 1);
            Assert.AreEqual(array1.GetCount(), 1);
            test1.SetInput(array1);
            Assert.AreEqual(array1.GetCount(), 0);
            Assert.AreEqual(array2.GetCount(), 1);
            test2.SetInput(array2);
            Assert.AreEqual(array2.GetCount(), 0);
            test1.ExcludeWhatHave(test2);
            Assert.AreEqual(test1.GetSmartInput().GetCount(), 0);
            Assert.AreEqual(test2.GetSmartInput().GetCount(), 1);
        }
示例#4
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            // Configure Web API to use only bearer token authentication.
            config.SuppressDefaultHostAuthentication();
            config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));

            // Web API routes
            config.MapHttpAttributeRoutes();

            SetupCustomHandlers(config);
            //config.Routes.MapHttpRoute(
            //    name: "Users",
            //    routeTemplate: "api/{controller}/{id}",
            //    defaults: new { id = RouteParameter.Optional }

            //);

            //config.Routes.MapHttpRoute(
            //   name: "Account",
            //   routeTemplate: "api/Users/{userId}/accounts/{id}",
            //   defaults: new { controller = "accounts", id = RouteParameter.Optional }
            //   );

            //config.Routes.MapHttpRoute(
            //name: "AccountWithUsername",
            //routeTemplate: "api/accounts/{username}",
            //defaults: new { controller = "accounts"}
            //);
            FactoryFactory.Init();

            config.EnableQuerySupport();
            config.Routes.MapHttpRoute("REST", "{" + ROUTE_PARAM_CONTROLLER + "}/{id}", new { id = RouteParameter.Optional });
            config.Routes.MapHttpRoute("QUESTIONS", "Questions/{Qid}/{" + ROUTE_PARAM_CONTROLLER + "}/{id}", new { id = RouteParameter.Optional });
            config.Routes.MapHttpRoute("Users", "Users/{uid}/{" + ROUTE_PARAM_CONTROLLER + "}/{id}", new { id = RouteParameter.Optional });


            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling
                = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
        }
示例#5
0
        public FBE_INTDEFINITION Build()
        {
            FactoryFactory    MASTERFACTORY = new FactoryFactory();
            FBE_INTDEFINITION RETURNVALUE   = MASTERFACTORY.func_produce_new_object_of_type <FBE_INTDEFINITION>();

            for (int i = 0; i < BUILDER_ACTIONS.Count; i++)
            {
                if (BUILDER_ACTIONS[i] == INTEGER_BUILDER_ACTIONS.INTBUILDER_ACTION_PLUSONE)
                {
                    RETURNVALUE.FBE_REGISTERACTION(FBE_INTDEFINITION.FIZZBUZZENTERPRISENET_OPERANDS.FBE_ADD, FBE_INTDEFINITION.FIZZBUZZENTERPRISENET_NUMBERS.FBE_ONE);
                }
                else if (BUILDER_ACTIONS[i] == INTEGER_BUILDER_ACTIONS.INTBUILDER_ACTION_MINUSONE)
                {
                    RETURNVALUE.FBE_REGISTERACTION(FBE_INTDEFINITION.FIZZBUZZENTERPRISENET_OPERANDS.FBE_SUBTRACT, FBE_INTDEFINITION.FIZZBUZZENTERPRISENET_NUMBERS.FBE_ONE);
                }
                else if (BUILDER_ACTIONS[i] == INTEGER_BUILDER_ACTIONS.INTBUILDER_ACTION_TIMESTWO)
                {
                    RETURNVALUE.FBE_REGISTERACTION(FBE_INTDEFINITION.FIZZBUZZENTERPRISENET_OPERANDS.FBE_MULTIPLY, FBE_INTDEFINITION.FIZZBUZZENTERPRISENET_NUMBERS.FBE_TWO);
                }
            }
            return(RETURNVALUE);
        }
示例#6
0
        static void Main()
        {
            IntPtr MEMLOC_MEMTEST = Marshal.AllocHGlobal(sizeof(byte));

            Marshal.WriteByte(MEMLOC_MEMTEST, byte.MaxValue);
            if (Marshal.ReadByte(MEMLOC_MEMTEST) == byte.MaxValue)
            {
                Marshal.FreeHGlobal(MEMLOC_MEMTEST);
                FactoryFactory        MasterObjectProducer   = new FactoryFactory();
                IntegerBuilderFactory IntegerBuilderProducer = MasterObjectProducer.func_produce_new_object_of_type <IntegerBuilderFactory>();
                IntegerBuilderProducer.SetGivenName("TODO: NAME THIS");
                ConsoleOutputer Outputer = MasterObjectProducer.func_produce_new_object_of_type <ConsoleOutputer>();
                for (int i = 0; i < FIZZBUZZENTERPRISE_ITERATIONAMOUNTS; i++)
                {
                    IntegerBuilder IntBuilder = IntegerBuilderProducer.ProduceNew();
                    IntBuilder.INIT();
                    while (true)
                    {
                        if (((FBE_IDEFINITION <int>)(IntBuilder.Build())).Evaluate() == i)
                        {
                            break;
                        }
                        IntBuilder.INTEGER_BUILDER_PLUSONE();
                    }
                    string ConsoleOutput = "";
                    if (((FBE_IDEFINITION <int>)(IntBuilder.Build())).Evaluate() % 3 == 0)
                    {
                        ConsoleOutput += FIZZ;
                    }
                    if (((FBE_IDEFINITION <int>)(IntBuilder.Build())).Evaluate() % 5 == 0)
                    {
                        ConsoleOutput += BUZZ;
                    }
                    Outputer._output_string_of_characters((ConsoleOutput.Equals("") ? i.ToString() : ConsoleOutput).ToCharArray());
                    System.Threading.Thread.Sleep(100);
                }
                Console.ReadKey();
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ParentWithFactoryFactory"/> class.
 /// </summary>
 /// <param name="factoryFactory">The factory factory.</param>
 public ParentWithFactoryFactory(FactoryFactory factoryFactory)
 {
     this.factoryFactory = factoryFactory;
 }
        public void FBE_REGISTERACTION(FIZZBUZZENTERPRISENET_OPERANDS operand, FIZZBUZZENTERPRISENET_NUMBERS number)
        {
            FactoryFactory MASTERFACTORY = new FactoryFactory();

            ACTIONCHAIN.Add(((FBE_IDEFINITION <Tuple <FIZZBUZZENTERPRISENET_OPERANDS, FIZZBUZZENTERPRISENET_NUMBERS> >)TupleBuilder <FIZZBUZZENTERPRISENET_OPERANDS, FIZZBUZZENTERPRISENET_NUMBERS> .@new <FIZZBUZZENTERPRISENET_OPERANDS, FIZZBUZZENTERPRISENET_NUMBERS>(MASTERFACTORY).item1(operand, MASTERFACTORY).item2(number, MASTERFACTORY).Build()).Evaluate());
        }
示例#9
0
 public CFactoryTest(FactType type)
 {
     m_pFactory = FactoryFactory.CreateFactory(type);
 }
 public static TupleBuilder <LT1, LT2> @new <LT1, LT2>(FactoryFactory producer)
 {
     return(producer.func_produce_new_object_of_type <TupleBuilder <LT1, LT2> >());
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ParentWithFactoryFactory"/> class.
 /// </summary>
 /// <param name="factoryFactory">The factory factory.</param>
 public ParentWithFactoryFactory(FactoryFactory factoryFactory)
 {
     this.factoryFactory = factoryFactory;
 }