Esempio n. 1
0
        public void ObservePathChangedArray()
        {
            var obj = new ContainerObject();
            string value = "error";
            obj.ObserveProperty<ContainerObject, string>(typeof(ContainerObject).GetProperty("Test"), typeof(TestObject).GetProperty("StringProperty")).Subscribe(x => value = x);

            Assert.IsNull(value);

            var test = new TestObject();
            obj.Test = test;
            Assert.IsNull(value);

            obj.Test.StringProperty = "foo";
            Assert.AreEqual("foo", value);

            value = "error";
            obj.Test = null;

            value = "pass";
            test.StringProperty = "bar";
            Assert.AreEqual("pass", value);

            obj.Test = test;
            Assert.AreEqual("bar", value);
        }
Esempio n. 2
0
        public void ObservePathChanged()
        {
            var obj = new ContainerObject();
            string value = "error";
            obj.ObserveProperty(x => x.Test.StringProperty).Subscribe(x => value = x);

            Assert.IsNull(value);

            var test = new TestObject();
            obj.Test = test;
            Assert.IsNull(value);

            obj.Test.StringProperty = "foo";
            Assert.AreEqual("foo", value);

            value = "error";
            obj.Test = null;

            value = "pass";
            test.StringProperty = "bar";
            Assert.AreEqual("pass", value);

            obj.Test = test;
            Assert.AreEqual("bar", value);
        }
Esempio n. 3
0
 public ImageTextObject(float x, float y, float scale, Image texture, string text, Color color, Font font)
 {
     containerObject = new ContainerObject(x, y);
     if (texture != null)
         containerObject.Add(scale, texture);
     if (text != null)
         containerObject.Add(new SolidBrush(color), font, text);
 }
Esempio n. 4
0
 public void ObserveNonObservable()
 {
     var container = new ContainerObject();
     string s = null;
     container.ObserveProperty(x => x.Test.NonObservableStringProperty).Subscribe(x =>
     {
         s = x;
     });
     var testObject = new TestObject();
     testObject.NonObservableStringProperty = "foo";
     container.Test = testObject;
     Assert.AreEqual("foo", s);
 }
Esempio n. 5
0
        public void ObservablePathInt()
        {
            var container = new ContainerObject();
            int i = 0;
            container.ObserveProperty(x => x.Test.IntProperty).Subscribe(x =>
            {
                i = x;
            });
            var testObject = new TestObject();
            container.Test = testObject;
            testObject.IntProperty = 5;

            Assert.AreEqual(5, i);
        }
 public override IFrameworkContainer RegisterInstance <TContract>(TContract @object)
 {
     ContainerObject.Register(Component.For <TContract>().ImplementedBy <TContract>());
     return(this);
 }
 /// <summary>
 ///     타입을 <see cref="IFrameworkContainer"/> 에 등록합니다.
 /// </summary>
 /// <typeparam name="TContract">	등록되는 개체의 계약 타입입니다. </typeparam>
 /// <typeparam name="TImplements">	등록되는 개체의 구현 타입입니다. </typeparam>
 /// <param name="key">	객체의 키 값입니다. </param>
 /// <returns>
 ///     개체 등록을 마친 후 현재의 <see cref="IFrameworkContainer"/> 를 반환합니다.
 /// </returns>
 public override IFrameworkContainer RegisterType <TContract, TImplements>(string key)
 {
     ContainerObject.Register(Component.For <TContract>().ImplementedBy <TImplements>());
     return(this);
 }
Esempio n. 8
0
 public void setOwner(ContainerObject obj)
 {
     localBag = obj;
         GetComponent<OmniQuickBar>().setOwner(localBag);
 }
        public void TestFindAllWithFilter()
        {
            var containerObjects = ContainerObject.FindAll(this.ADOperator, new Is(AttributeNames.CN, this.ContainerCN));

            Assert.AreEqual(1, containerObjects.Count);
        }
 /// <summary>
 /// Sets the Interal Alias to a new Uniq value
 /// </summary>
 public void CreateNewIdentifier()
 {
     CurrentIdentifier = string.Format("{0}_{1}", Cache.TableName, ContainerObject.GetNextParameterId());
 }
Esempio n. 11
0
		void OnFocusedControllableMoved(MovableObject ob, ContainerObject dst, IntPoint3 loc)
		{
			this.MapControl.FocusedTileView.SetTarget(ob.Environment, ob.Location);
		}
Esempio n. 12
0
 public void setOwner(ContainerObject obj)
 {
     localBag = obj;
 }
Esempio n. 13
0
 public void ObservePropertyIsDistinct()
 {
     var testObject = new TestObject();
     var containerObject = new ContainerObject();
     var list = new List<string>();
     containerObject.ObserveProperty(x => x.Test.StringProperty).Subscribe(x => list.Add(x));
     containerObject.Test = testObject;
     Assert.AreEqual(1, list.Count);
 }
Esempio n. 14
0
        public ConditionalEvalQuery <TEntity> Entity <TEntity>(TEntity obj)
        {
            ContainerObject.Interceptors
            .Add(new EventPostProcessor(EventPostProcessor.EventType.Update, ContainerObject.AccessLayer));
            var dbClassInfoCache = ContainerObject.AccessLayer.GetClassInfo(typeof(TEntity));
            var targetAlias      = ContainerObject.CreateTableAlias(dbClassInfoCache.TableName);
            var queryIdentifier  = new QueryIdentifier()
            {
                Value       = dbClassInfoCache.TableName,
                QueryIdType = QueryIdentifier.QueryIdTypes.Table
            };

            switch (ContainerObject.AccessLayer.DbAccessType)
            {
            case DbAccessType.Experimental:
            case DbAccessType.Unknown:
            case DbAccessType.OleDb:
            case DbAccessType.Obdc:
            case DbAccessType.SqLite:
                targetAlias.Value = queryIdentifier.Value;
                break;
            }
            var updatePart = new UpdateTableWithQueryPart(queryIdentifier,
                                                          UpdateTableWithQueryPart.ColumsOfType(dbClassInfoCache, targetAlias, queryIdentifier, ContainerObject),
                                                          targetAlias);

            var identityInsert = DbIdentityInsertScope.Current != null;
            var include        =
                dbClassInfoCache
                .Propertys
                .Select(f => f.Value)
                .Where(s =>
            {
                if (s.InsertIgnore)
                {
                    return(false);
                }
                if (identityInsert && s.PrimaryKeyAttribute != null)
                {
                    return(true);
                }
                if (s.PrimaryKeyAttribute != null)
                {
                    return(false);
                }
                if (s.ForginKeyAttribute != null)
                {
                    return(false);
                }
                return(!s.UpdateIgnore);
            });

            foreach (var dbPropertyInfoCach in include)
            {
                var paramName = $"@setArg{ContainerObject.GetNextParameterId()}";
                updatePart.ColumnAssignments.Add(new UpdateTableWithQueryPart.ColumnAssignment()
                {
                    Column          = dbPropertyInfoCach.DbName,
                    Value           = paramName,
                    QueryParameters =
                    {
                        new QueryParameter(paramName, dbPropertyInfoCach.Getter.Invoke(obj),
                                           dbPropertyInfoCach.PropertyType)
                    }
                });
            }

            return(new ElementProducer <TEntity>(Add(updatePart))
                   .Where
                   .PrimaryKey()
                   .Is
                   .EqualsTo(dbClassInfoCache.PrimaryKeyProperty.Getter.Invoke(obj)));
        }
 /// <summary>
 ///     <see cref="IFrameworkContainer"/> 에 등록된 개체를 반환합니다.
 /// </summary>
 /// <param name="type">	반환하는 객체의 타입입니다. </param>
 /// <returns>
 ///     반환된 객체입니다.
 /// </returns>
 public override object Resolve(Type type)
 {
     return(ContainerObject.Resolve(type));
 }
Esempio n. 16
0
 void OnFocusedControllableMoved(MovableObject ob, ContainerObject dst, IntVector3 loc)
 {
     this.FocusedTileView.SetTarget(ob.Environment, ob.Location);
 }
Esempio n. 17
0
 void FollowedObjectMoved(MovableObject ob, ContainerObject dst, IntVector3 loc)
 {
     map.CameraLookAt(ob);
 }
Esempio n. 18
0
        public void PropertyBagInContainerTwoWayObjectSerializationTest()
        {
            var bag = new PropertyBag();

            bag.Add("key", "Value");
            bag.Add("Key2", 100.10M);
            bag.Add("Key3", Guid.NewGuid());
            bag.Add("Key4", DateTime.Now);
            bag.Add("Key5", true);
            bag.Add("Key7", new byte[3] { 42, 45, 66 });
            bag.Add("Key8", null);
            bag.Add("Key9", new ComplexObject() { Name = "Rick",
            Entered = DateTime.Now,
            Count = 10 });

            ContainerObject cont = new ContainerObject();
            cont.Name = "Rick";
            cont.Items = bag;


            string xml = SerializationUtils.SerializeObjectToString(cont);

            TestContext.WriteLine(xml);

            ContainerObject cont2 = SerializationUtils.DeSerializeObject(xml,
            typeof(ContainerObject)) as ContainerObject;

            Assert.IsTrue(cont2.Items["key"] as string == "Value");
            Assert.IsTrue(cont2.Items["Key3"].GetType() == typeof(Guid));

            Assert.IsNull(cont2.Items["Key8"]);

            //Assert.IsNull(bag["Key10"]);

            TestContext.WriteLine(cont.Items["Key3"].ToString());
            TestContext.WriteLine(cont.Items["Key4"].ToString());
        }
Esempio n. 19
0
 public SelectQuery <TPoco> Distinct()
 {
     ContainerObject.SearchLast <ISelectableQueryPart>().Distinct = true;
     return(this);
 }
Esempio n. 20
0
		void FollowedObjectMoved(MovableObject ob, ContainerObject dst, IntPoint3 loc)
		{
			EnvironmentObject env = dst as EnvironmentObject;
			if (env != null)
			{
				map.CenterPos = new Point(loc.X, loc.Y);
				map.Z = loc.Z;
			}
		}
Esempio n. 21
0
		void FollowedObjectMoved(MovableObject ob, ContainerObject dst, IntVector3 loc)
		{
			map.CameraLookAt(ob);
		}