Beispiel #1
0
        public Form1()
        {
            InitializeComponent();

            TweenShark.Initialize(new TweenSharkWinformsTick(), new ConsoleLogger());
            TweenShark.RegisterPropertyTweener(typeof(ColorTweener), typeof(Color));

            Deactivate += (sender, e) => Destroy(GetForegroundWindow());

            this.Click += (sender, e) =>
            {
            };


//            this.BackgroundImage = Resources.background;
//
//            this.FormBorderStyle = FormBorderStyle.None;
//            this.TransparencyKey = Color.FromArgb(255, 0, 255);


            button1.MouseEnter += HandleButtonMouseEnter;
            button1.MouseLeave += HandleButtonMouseLeave;
            button2.MouseEnter += HandleButtonMouseEnter;
            button2.MouseLeave += HandleButtonMouseLeave;
        }
Beispiel #2
0
        public void RegisterPropertyTweenerTest()
        {
            TweenShark.Initialize(new TweenSharkTickImpl(), new NullLogger());

            var type = typeof(TweenShark);
            var info = type.GetField("_core", BindingFlags.NonPublic | BindingFlags.Static);
            var core = (TweenSharkCore)info.GetValue(null);

            // the core must be created
            Assert.IsInstanceOfType(core, typeof(TweenSharkCore));

            var param0   = new PrivateObject(core);
            var accessor = new TweenSharkCore_Accessor(param0);

            var beforeCount = accessor._registeredPropertyTweeners.Count;

            // if we overwrite an existing type the number of registered tweeners must not change
            TweenShark.RegisterPropertyTweener(typeof(SimpleTweenerImpl <SByte>), typeof(SByte));
            Assert.AreEqual(beforeCount, accessor._registeredPropertyTweeners.Count);
            // the tweener for sbyte must be overwritten
            Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(SByte).FullName], typeof(SimpleTweenerImpl <SByte>));

            // if we overwrite an existing type the number of registered tweeners must change
            TweenShark.RegisterPropertyTweener(typeof(SimpleTweenerImpl <SByte>), typeof(TweeningTestObject));
            Assert.AreEqual(beforeCount + 1, accessor._registeredPropertyTweeners.Count);
            // the tweener for sbyte must be overwritten
            Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(TweeningTestObject).FullName], typeof(SimpleTweenerImpl <SByte>));
        }