コード例 #1
0
        public void PropertyConditionStepWithTwoStringParameters()
        {
            tlog.Debug(tag, $"PropertyConditionStepWithTwoStringParameters START");

            var testingTarget = PropertyCondition.Step(50, 100);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <PropertyCondition>(testingTarget, "should be an instance of testing target class!");

            Assert.AreEqual(3, testingTarget.GetArgumentCount(), $"Should be 3");
            Assert.AreEqual(100, testingTarget.GetArgument(0), $"Should be 100");
            Assert.AreEqual(0.02f, testingTarget.GetArgument(1), $"Should be 0.02");
            Assert.AreEqual(0, testingTarget.GetArgument(2), $"Should be 0");

            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyConditionStepWithTwoStringParameters END (OK)");
        }
コード例 #2
0
        private void InitializeItems()
        {
            for (int i = Children.Count - 1; i > -1; i--)
            {
                Children[i].Unparent();
                notifications[i].Notified -= OnItemSizeChanged;
                notifications.RemoveAt(i);
            }

            for (int i = 0; i < totalItemCount; i++)
            {
                RecycleItem item = adapter.CreateRecycleItem();
                item.DataIndex = i;
                item.Name      = "[" + i + "] recycle";

                if (i < adapter.Data.Count)
                {
                    adapter.BindData(item);
                }
                Add(item);

                PropertyNotification noti = item.AddPropertyNotification("size", PropertyCondition.Step(0.1f));
                noti.Notified += OnItemSizeChanged;
                notifications.Add(noti);
            }

            layoutManager.Layout(0.0f);

            if (ScrollingDirection == Direction.Horizontal)
            {
                ContentContainer.SizeWidth = layoutManager.CalculateLayoutOrientationSize();
            }
            else
            {
                ContentContainer.SizeHeight = layoutManager.CalculateLayoutOrientationSize();
            }
        }
コード例 #3
0
        public ScrollableBase() : base()
        {
            base.Layout         = new ScrollableBaseCustomLayout();
            mPanGestureDetector = new PanGestureDetector();
            mPanGestureDetector.Attach(this);
            mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
            mPanGestureDetector.Detected += OnPanGestureDetected;

            mTapGestureDetector = new TapGestureDetector();
            mTapGestureDetector.Attach(this);
            mTapGestureDetector.Detected += OnTapGestureDetected;

            ClippingMode = ClippingModeType.ClipChildren;

            //Default Scrolling child
            ContentContainer = new View()
            {
                WidthSpecification  = ScrollingDirection == Direction.Vertical ? LayoutParamPolicies.MatchParent : LayoutParamPolicies.WrapContent,
                HeightSpecification = ScrollingDirection == Direction.Vertical ? LayoutParamPolicies.WrapContent : LayoutParamPolicies.MatchParent,
                Layout = new AbsoluteLayout()
                {
                    SetPositionByLayout = false
                },
            };
            ContentContainer.Relayout     += OnScrollingChildRelayout;
            propertyNotification           = ContentContainer.AddPropertyNotification("position", PropertyCondition.Step(1.0f));
            propertyNotification.Notified += OnPropertyChanged;
            base.Add(ContentContainer);

            //Interrupt touching when panning is started
            mInterruptTouchingChild = new View()
            {
                Size            = new Size(Window.Instance.WindowSize),
                BackgroundColor = Color.Transparent,
            };
            mInterruptTouchingChild.TouchEvent += OnIterruptTouchingChildTouched;

            Scrollbar = new Scrollbar();
        }
コード例 #4
0
        public override void OnChildAdd(View view)
        {
            if (mScrollingChild.Name != "DefaultScrollingChild")
            {
                propertyNotification.Notified -= OnPropertyChanged;
                mScrollingChild.RemovePropertyNotification(propertyNotification);
            }

            mScrollingChild                = view;
            propertyNotification           = mScrollingChild?.AddPropertyNotification("position", PropertyCondition.Step(1.0f));
            propertyNotification.Notified += OnPropertyChanged;

            {
                if (Children.Count > 1)
                {
                    Log.Error("ScrollableBase", $"Only 1 child should be added to ScrollableBase.");
                }
            }
        }
コード例 #5
0
        public void Activate()
        {
            win = NUIApplication.GetDefaultWindow();
            win.BackgroundColor = Color.White;

            View view = new View()
            {
                Size            = new Size(100, 100),
                BackgroundColor = Color.Red,
                Name            = "test view",
            };

            PropertyNotification propertyNotification = view.AddPropertyNotification("size", PropertyCondition.Step(1.0f));

            propertyNotification.Notified += (object source, PropertyNotification.NotifyEventArgs args) =>
            {
                View target = args.PropertyNotification.GetTarget() as View;
                if (target != null)
                {
                    Tizen.Log.Error("NUI", $"Size changed! ({target.SizeWidth},{target.SizeHeight})");
                    global::System.Console.WriteLine($"Size changed! ({target.SizeWidth},{target.SizeHeight})");
                }
                Tizen.Log.Error("NUI", "Size changed");
            };

            Button button = new Button()
            {
                Size     = new Size(100, 100),
                Position = new Position(200, 200),
                Text     = "Click me",
                Name     = "test button",
            };

            button.Clicked += (object source, ClickedEventArgs args) =>
            {
                if (++cnt % 2 == 0)
                {
                    view.Size += new Size(5, 5);
                }
                else
                {
                    view.Position += new Position(10, 10);
                }
            };

            win.GetDefaultLayer().Add(view);
            win.GetDefaultLayer().Add(button);
        }
コード例 #6
0
        public override void OnChildAdd(View view)
        {
            if(view.Name != "InterruptTouchingChild")
            {
                if(mScrollingChild.Name != "DefaultScrollingChild")
                {
                    propertyNotification.Notified -= OnPropertyChanged;
                    mScrollingChild.RemovePropertyNotification(propertyNotification);
                }

                mScrollingChild = view;
                propertyNotification = mScrollingChild?.AddPropertyNotification("position", PropertyCondition.Step(1.0f));
                propertyNotification.Notified += OnPropertyChanged;
            }
        }