Esempio n. 1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 4 "..\..\MainWindow.xaml"
                ((动画.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.TextBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.RealText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.MyTextEffect = ((System.Windows.Media.TextEffect)(target));
                return;

            case 5:
                this.TextEffectSkewTransform = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 6:
                this.ReflectedText = ((System.Windows.Shapes.Rectangle)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.rect = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 2:
                this.skew = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 3:
                this.tbAngleX = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.tbAngleY = ((System.Windows.Controls.TextBox)(target));
                return;

            case 5:
                this.rect1 = ((System.Windows.Shapes.Rectangle)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.myStoryboard = ((System.Windows.Media.Animation.Storyboard)(target));
                return;

            case 2:
                this.BottomBackgroundColor = ((System.Windows.Media.GradientStop)(target));
                return;

            case 3:
                this.EllipseRotater = ((System.Windows.Media.RotateTransform)(target));
                return;

            case 4:
                this.MiddleGradientStop = ((System.Windows.Media.GradientStop)(target));
                return;

            case 5:
                this.TextSkewTransform = ((System.Windows.Media.SkewTransform)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 4
0
        private static void CenterXPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SkewTransform target = ((SkewTransform)d);


            target.PropertyChanged(CenterXProperty);
        }
Esempio n. 5
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.sbOpen = ((System.Windows.Media.Animation.BeginStoryboard)(target));
                return;

            case 2:
                this.sbClose = ((System.Windows.Media.Animation.BeginStoryboard)(target));
                return;

            case 3:
                this.SkDoorTransform = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 4:
                this.ScDoorTransform = ((System.Windows.Media.ScaleTransform)(target));
                return;

            case 5:
                this.BtnOpen = ((System.Windows.Controls.Button)(target));
                return;

            case 6:
                this.BtnClose = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
        //Editor Ed = new Editor(Edit);

        public Manager(TabControl tabs, StackPanel Background, StackPanel Edit)
        {
            // TODO: Complete member initialization
            this.tabs = tabs;
            this.Background = Background;
            this.Edit = Edit;
            trSkw = new SkewTransform(0, 0);
            trRot = new RotateTransform(0);
            trTns = new TranslateTransform(0, 0);
            trScl = new ScaleTransform(1, 1);
            trSkw2 = new SkewTransform(0, 0);
            trRot2 = new RotateTransform(0);
            trTns2 = new TranslateTransform(0, 0);
            trScl2 = new ScaleTransform(1, 1);
            trGrp2 = new TransformGroup();
            trGrp2.Children.Add(trSkw2);
            trGrp2.Children.Add(trRot2);
            trGrp2.Children.Add(trTns2);
            trGrp2.Children.Add(trScl2);
            trGrp = new TransformGroup();
            trGrp.Children.Add(trSkw);
            trGrp.Children.Add(trRot);
            trGrp.Children.Add(trTns);
            trGrp.Children.Add(trScl);
        }
Esempio n. 7
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.GradientStop1 = ((System.Windows.Media.GradientStop)(target));
                return;

            case 2:
                this.TextBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.RealText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.MyTextEffect = ((System.Windows.Media.TextEffect)(target));
                return;

            case 5:
                this.TextEffectSkewTransform = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 6:
                this.ReflectedText = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 7:
                this.timeTextBlock = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 8
0
        private Manager()
        {
            #region Creates Loading Threads

            _loaderThreadForThumbnails = new Thread(LoaderThreadThumbnails)
            {
                IsBackground = true,
                Priority = ThreadPriority.BelowNormal
            };
            _loaderThreadForThumbnails.Start();

            _loaderThreadForNormalSize = new Thread(LoaderThreadNormalSize)
            {
                IsBackground = true,
                Priority = ThreadPriority.BelowNormal
            };
            _loaderThreadForNormalSize.Start();

            #endregion

            Application.Current.Exit += Current_Exit;

            #region Loading Images from Resources

            var resourceDictionary = new ResourceDictionary
            {
                Source = new Uri("csCommon;component/Resources/Styles/Resources.xaml", UriKind.Relative)
            };
            _loadingImage = resourceDictionary["ImageLoading"] as DrawingImage;
            _loadingImage.Freeze();
            _errorThumbnail = resourceDictionary["ImageError"] as DrawingImage;
            _errorThumbnail.Freeze();

            #endregion

            # region Create Loading Animation

            ScaleTransform scaleTransform = new ScaleTransform(0.5, 0.5);
            SkewTransform skewTransform = new SkewTransform(0, 0);
            RotateTransform rotateTransform = new RotateTransform(0);
            TranslateTransform translateTransform = new TranslateTransform(0, 0);

            TransformGroup group = new TransformGroup();
            group.Children.Add(scaleTransform);
            group.Children.Add(skewTransform);
            group.Children.Add(rotateTransform);
            group.Children.Add(translateTransform);

            DoubleAnimation doubleAnimation = new DoubleAnimation(0, 359, new TimeSpan(0, 0, 0, 1));
            doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;

            rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);

            _loadingAnimationTransform = group;

            #endregion
        }
Esempio n. 9
0
        public CompositeTransform()
        {
            scale     = new ScaleTransform();
            skew      = new SkewTransform();
            rotate    = new RotateTransform();
            translate = new TranslateTransform();

            group = new TransformGroup();
            group.Children.Add(scale);
            group.Children.Add(skew);
            group.Children.Add(rotate);
            group.Children.Add(translate);
        }
Esempio n. 10
0
        public LogicPadDragDropAdornerBase()
        { 
            ScaleTransform scale = new ScaleTransform(1f, 1f);
            SkewTransform skew = new SkewTransform(0f, 0f);
            RotateTransform rotate = new RotateTransform(0f);
            TranslateTransform trans = new TranslateTransform(0f, 0f);
            TransformGroup transGroup = new TransformGroup();
            transGroup.Children.Add(scale);
            transGroup.Children.Add(skew);
            transGroup.Children.Add(rotate);
            transGroup.Children.Add(trans);

            this.RenderTransform = transGroup;
        }
Esempio n. 11
0
        TransformGroup GetDefaultTransformGroup()
        {
            ScaleTransform scale = new ScaleTransform();
            SkewTransform skew = new SkewTransform();
            RotateTransform rotate = new RotateTransform();
            TranslateTransform translate = new TranslateTransform();

            TransformGroup tg = new TransformGroup();
            tg.Children.Add(scale);
            tg.Children.Add(skew);
            tg.Children.Add(rotate);
            tg.Children.Add(translate);

            return tg;
        }
Esempio n. 12
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Hoan_Xich_Huong;component/Tables/Table2.xaml", System.UriKind.Relative));
     this.animation1     = ((System.Windows.Media.Animation.Storyboard)(this.FindName("animation1")));
     this.main_border    = ((System.Windows.Controls.Border)(this.FindName("main_border")));
     this.rotate1        = ((System.Windows.Media.SkewTransform)(this.FindName("rotate1")));
     this.main_textblock = ((System.Windows.Controls.TextBlock)(this.FindName("main_textblock")));
     this.xemthem        = ((System.Windows.Controls.Border)(this.FindName("xemthem")));
     this.textxemthem    = ((System.Windows.Controls.HyperlinkButton)(this.FindName("textxemthem")));
 }
Esempio n. 13
0
        /// <summary>
        /// 根据数值,返回TransformGroup对象
        /// </summary>
        public static TransformGroup GetTransformGroupForXYOffset(double X, double Y, double scaleX, double scaleY)
        {
            ScaleTransform scaleTrans = new ScaleTransform() { ScaleX = scaleX, ScaleY = scaleY };
            RotateTransform rotateTrans = new RotateTransform() { Angle = 0.00D };
            TranslateTransform translateTrans = new TranslateTransform() { X = X, Y = Y };
            SkewTransform skewTrans = new SkewTransform();

            TransformGroup transGroup = new TransformGroup();
            transGroup.Children.Add(scaleTrans);
            transGroup.Children.Add(skewTrans);
            transGroup.Children.Add(rotateTrans);
            transGroup.Children.Add(translateTrans);

            return transGroup;
        }
Esempio n. 14
0
        private Manager()
        {
            #region Create Loading Threads
            for (int i = 0; i < MaxThreads; i++)
            {
                Thread loaderThread = new Thread(LoaderWork)
                {
                    IsBackground = true,
                    Priority = ThreadPriority.BelowNormal,
                    Name = $"ImageLoaderThread{i + 1}"
                };
                loaderThread.Start();
            }
            #endregion

            #region Load Images from Resources
            ResourceDictionary resourceDictionary = new ResourceDictionary();
            resourceDictionary.Source = new Uri("ImageLoader;component/Resources.xaml", UriKind.Relative);
            _loadingImage = resourceDictionary["ImageLoading"] as DrawingImage;
            _loadingImage?.Freeze();
            _errorThumbnail = resourceDictionary["ImageError"] as DrawingImage;
            _errorThumbnail?.Freeze();
            #endregion

            # region Create Loading Animation
            ScaleTransform scaleTransform = new ScaleTransform(0.5, 0.5);
            SkewTransform skewTransform = new SkewTransform(0, 0);
            RotateTransform rotateTransform = new RotateTransform(0);
            TranslateTransform translateTransform = new TranslateTransform(0, 0);

            TransformGroup group = new TransformGroup();
            group.Children.Add(scaleTransform);
            group.Children.Add(skewTransform);
            group.Children.Add(rotateTransform);
            group.Children.Add(translateTransform);

            DoubleAnimation doubleAnimation = new DoubleAnimation(0, 359, new TimeSpan(0, 0, 0, 1))
            {
                RepeatBehavior = RepeatBehavior.Forever
            };

            rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);

            _loadingAnimationTransform = group;
            #endregion
        }
Esempio n. 15
0
 public Frame(double Height, double Width, FrameworkElement content)
 {
     InitializeComponent();
     this.Height = Height + 30;
     this.Width = Width + 30;
     this.ClipToBounds = false;
     ScaleTransform st = new ScaleTransform(1, 1, this.Width / 2, this.Height / 2);
     RotateTransform rt = new RotateTransform(0, this.Width / 2, this.Height / 2);
     TranslateTransform tt = new TranslateTransform();
     SkewTransform sKt = new SkewTransform();
     TransformGroup transGroup = new TransformGroup();
     transGroup.Children.Add(st);
     transGroup.Children.Add(rt);
     transGroup.Children.Add(tt);
     transGroup.Children.Add(sKt);
     this.RenderTransform = transGroup;
     this.content = content;
 }
Esempio n. 16
0
        private Manager()
        {
            #region Creates Loading Threads
            _loaderThreadForThumbnails = new Thread(new ThreadStart(LoaderThreadThumbnails));
            _loaderThreadForThumbnails.IsBackground = true;  // otherwise, the app won't quit with the UI...
            _loaderThreadForThumbnails.Priority = ThreadPriority.BelowNormal;
            _loaderThreadForThumbnails.Start();

            _loaderThreadForNormalSize = new Thread(new ThreadStart(LoaderThreadNormalSize));
            _loaderThreadForNormalSize.IsBackground = true;  // otherwise, the app won't quit with the UI...
            _loaderThreadForNormalSize.Priority = ThreadPriority.BelowNormal;
            _loaderThreadForNormalSize.Start();
            #endregion

            #region Loading Images from Resources
            ResourceDictionary resourceDictionary = new ResourceDictionary();
            resourceDictionary.Source = new Uri("/ByteFlood;component/Controls/PhotoLoader/Resources.xaml", UriKind.Relative);
            _loadingImage = resourceDictionary["ImageLoading"] as DrawingImage;
            _loadingImage.Freeze();
            _errorThumbnail = resourceDictionary["ImageError"] as DrawingImage;
            _errorThumbnail.Freeze();
            #endregion

            # region Create Loading Animation
            ScaleTransform scaleTransform = new ScaleTransform(0.5, 0.5);
            SkewTransform skewTransform = new SkewTransform(0, 0);
            RotateTransform rotateTransform = new RotateTransform(0);
            TranslateTransform translateTransform = new TranslateTransform(0, 0);

            TransformGroup group = new TransformGroup();
            group.Children.Add(scaleTransform);
            group.Children.Add(skewTransform);
            group.Children.Add(rotateTransform);
            group.Children.Add(translateTransform);

            DoubleAnimation doubleAnimation = new DoubleAnimation(0, 359, new TimeSpan(0, 0, 0, 1));
            doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;

            rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);

            _loadingAnimationTransform = group;
            #endregion
        }
Esempio n. 17
0
		public void Inverses_sl2 ()
		{
			GeneralTransform inverse;
			
			RotateTransform rotate = new RotateTransform { Angle = 10.0 };
			inverse = rotate.Inverse;
			Assert.IsNull (inverse, "#0");
			
			ScaleTransform scale = new ScaleTransform { ScaleX = 2.0, ScaleY = 2.0 };
			inverse = scale.Inverse;
			Assert.IsNull (inverse, "#1");
			
			SkewTransform skew = new SkewTransform { AngleX = 1.0, AngleY = 1.0 };
			inverse = skew.Inverse;
			Assert.IsNull (inverse, "#2");
			
			TranslateTransform translate = new TranslateTransform { X = 5.0, Y = 5.0 };
			inverse = translate.Inverse;
			Assert.IsNull (inverse, "#3");
		}
        public override void OnApplyTemplate()
        {
            _matrixTransform = GetTemplateChild(MatrixTransformPartName) as MatrixTransform;
            _rotateTransform = GetTemplateChild(RotateTransformPartName) as RotateTransform;
            _scaleTransform = GetTemplateChild(ScaleTransformPartName) as ScaleTransform;
            _skewTransform = GetTemplateChild(SkewTransformPartName) as SkewTransform;
            _translateTransform = GetTemplateChild(TranslateTransformPartName) as TranslateTransform;

            UnregisterNames(MatrixTransformPartName, RotateTransformPartName, ScaleTransformPartName, SkewTransformPartName, TranslateTransformPartName);
            if (_matrixTransform != null)
                RegisterName(MatrixTransformPartName, _matrixTransform);
            if (_rotateTransform != null)
                RegisterName(RotateTransformPartName, _rotateTransform);
            if (_scaleTransform != null)
                RegisterName(ScaleTransformPartName, _scaleTransform);
            if (_skewTransform != null)
                RegisterName(SkewTransformPartName, _skewTransform);
            if (_translateTransform != null)
                RegisterName(TranslateTransformPartName, _translateTransform);

            base.OnApplyTemplate();
        }
Esempio n. 19
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MyBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 2:
                this.MyTextBlock = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 3:
                this.mytexteffect = ((System.Windows.Media.TextEffect)(target));
                return;

            case 4:
                this.texteffecttransform = ((System.Windows.Media.SkewTransform)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 20
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.TextBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 2:
                this.RealText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 3:
                this.MyTextEffect = ((System.Windows.Media.TextEffect)(target));
                return;

            case 4:
                this.TextEffectSkewTransform = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 5:
                this.ReflectedText = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 6:
                this.userNameBox = ((System.Windows.Controls.TextBox)(target));
                return;

            case 7:

            #line 220 "..\..\LoginDialog.xaml"
                ((System.Windows.Controls.PasswordBox)(target)).PasswordChanged += new System.Windows.RoutedEventHandler(this.PasswordBox_OnPasswordChanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
 public TransformGroup newTransformations()
 {
     TransformGroup tg = new TransformGroup();
     ScaleTransform st = new ScaleTransform();
     RotateTransform rt = new RotateTransform();
     TranslateTransform tt = new TranslateTransform();
     SkewTransform sKt = new SkewTransform();
     tg.Children.Add(st);
     tg.Children.Add(rt);
     tg.Children.Add(tt);
     tg.Children.Add(sKt);
     return tg;
 }
Esempio n. 22
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 12 "..\..\Login.xaml"
                ((_12306BySelfService.Login)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.MyText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 3:
                this.AnimatedTranslate = ((System.Windows.Media.TranslateTransform)(target));
                return;

            case 4:
                this.AnimatedRotate = ((System.Windows.Media.RotateTransform)(target));
                return;

            case 5:
                this.AnimatedScale = ((System.Windows.Media.ScaleTransform)(target));
                return;

            case 6:
                this.AnimatedSkew = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 7:
                this.imageLogo = ((System.Windows.Controls.Image)(target));
                return;

            case 8:
                this.tbUserName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 9:
                this.tbPassword = ((System.Windows.Controls.PasswordBox)(target));
                return;

            case 10:
                this.btnLogin = ((System.Windows.Controls.Button)(target));

            #line 122 "..\..\Login.xaml"
                this.btnLogin.Click += new System.Windows.RoutedEventHandler(this.BtnLogin_Click);

            #line default
            #line hidden
                return;

            case 11:
                this.popUserName = ((System.Windows.Controls.Primitives.Popup)(target));
                return;

            case 12:
                this.popPassword = ((System.Windows.Controls.Primitives.Popup)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 23
0
        private void SetRandomMailBoxNumber()
        {
            TransformGroup tranformGr = new TransformGroup();
            ScaleTransform scaleTf = new ScaleTransform();
            SkewTransform skewTf = new SkewTransform();
            RotateTransform rotateTf = new RotateTransform();
            TranslateTransform translateTf = new TranslateTransform();

            tranformGr.Children.Add(scaleTf);
            tranformGr.Children.Add(skewTf);
            tranformGr.Children.Add(rotateTf);
            tranformGr.Children.Add(translateTf);

            //Remove all exists ctrlMailBoxNumber before Add
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber01) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber01);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber02) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber02);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber03) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber03);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber04) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber04);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber05) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber05);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber06) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber06);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber07) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber07);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber08) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber08);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber09) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber09);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber10) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber10);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber11) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber11);
            if (canvasMailBoxNumber.Children.Contains(ctrlMailBoxNumber12) == true)
                canvasMailBoxNumber.Children.Remove(ctrlMailBoxNumber12);
            //END

            int numBox01 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox01);
            ctrlMailBoxNumber01 = new MapNumbersToImages(numBox01, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber01.Name = "ctrlMailBoxNumber01";
            ctrlMailBoxNumber01.RenderTransform = tranformGr;
            ctrlMailBoxNumber01.SetValue(Canvas.LeftProperty, (double)66);
            ctrlMailBoxNumber01.SetValue(Canvas.TopProperty, (double)527);
            ctrlMailBoxNumber01.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox02 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox02);
            ctrlMailBoxNumber02 = new MapNumbersToImages(numBox02, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber02.Name = "ctrlMailBoxNumber02";
            ctrlMailBoxNumber02.RenderTransform = tranformGr;
            ctrlMailBoxNumber02.SetValue(Canvas.LeftProperty, (double)206);
            ctrlMailBoxNumber02.SetValue(Canvas.TopProperty, (double)527);
            ctrlMailBoxNumber02.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox03 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox03);
            ctrlMailBoxNumber03 = new MapNumbersToImages(numBox03, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber03.Name = "ctrlMailBoxNumber03";
            ctrlMailBoxNumber03.RenderTransform = tranformGr;
            ctrlMailBoxNumber03.SetValue(Canvas.LeftProperty, (double)350);
            ctrlMailBoxNumber03.SetValue(Canvas.TopProperty, (double)527);
            ctrlMailBoxNumber03.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox04 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox04);
            ctrlMailBoxNumber04 = new MapNumbersToImages(numBox04, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber04.Name = "ctrlMailBoxNumber04";
            ctrlMailBoxNumber04.RenderTransform = tranformGr;
            ctrlMailBoxNumber04.SetValue(Canvas.LeftProperty, (double)491);
            ctrlMailBoxNumber04.SetValue(Canvas.TopProperty, (double)527);
            ctrlMailBoxNumber04.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox05 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox05);
            ctrlMailBoxNumber05 = new MapNumbersToImages(numBox05, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber05.Name = "ctrlMailBoxNumber05";
            ctrlMailBoxNumber05.RenderTransform = tranformGr;
            ctrlMailBoxNumber05.SetValue(Canvas.LeftProperty, (double)66);
            ctrlMailBoxNumber05.SetValue(Canvas.TopProperty, (double)639);
            ctrlMailBoxNumber05.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox06 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox06);
            ctrlMailBoxNumber06 = new MapNumbersToImages(numBox06, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber06.Name = "ctrlMailBoxNumber06";
            ctrlMailBoxNumber06.RenderTransform = tranformGr;
            ctrlMailBoxNumber06.SetValue(Canvas.LeftProperty, (double)206);
            ctrlMailBoxNumber06.SetValue(Canvas.TopProperty, (double)639);
            ctrlMailBoxNumber06.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox07 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox07);
            ctrlMailBoxNumber07 = new MapNumbersToImages(numBox07, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber07.Name = "ctrlMailBoxNumber07";
            ctrlMailBoxNumber07.RenderTransform = tranformGr;
            ctrlMailBoxNumber07.SetValue(Canvas.LeftProperty, (double)350);
            ctrlMailBoxNumber07.SetValue(Canvas.TopProperty, (double)639);
            ctrlMailBoxNumber07.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox08 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox08);
            ctrlMailBoxNumber08 = new MapNumbersToImages(numBox08, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber08.Name = "ctrlMailBoxNumber08";
            ctrlMailBoxNumber08.RenderTransform = tranformGr;
            ctrlMailBoxNumber08.SetValue(Canvas.LeftProperty, (double)491);
            ctrlMailBoxNumber08.SetValue(Canvas.TopProperty, (double)639);
            ctrlMailBoxNumber08.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox09 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox09);
            ctrlMailBoxNumber09 = new MapNumbersToImages(numBox09, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber09.Name = "ctrlMailBoxNumber09";
            ctrlMailBoxNumber09.RenderTransform = tranformGr;
            ctrlMailBoxNumber09.SetValue(Canvas.LeftProperty, (double)66);
            ctrlMailBoxNumber09.SetValue(Canvas.TopProperty, (double)746);
            ctrlMailBoxNumber09.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox10 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox10);
            ctrlMailBoxNumber10 = new MapNumbersToImages(numBox10, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber10.Name = "ctrlMailBoxNumber10";
            ctrlMailBoxNumber10.RenderTransform = tranformGr;
            ctrlMailBoxNumber10.SetValue(Canvas.LeftProperty, (double)208);
            ctrlMailBoxNumber10.SetValue(Canvas.TopProperty, (double)746);
            ctrlMailBoxNumber10.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox11 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox11);
            ctrlMailBoxNumber11 = new MapNumbersToImages(numBox11, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber11.Name = "ctrlMailBoxNumber11";
            ctrlMailBoxNumber11.RenderTransform = tranformGr;
            ctrlMailBoxNumber11.SetValue(Canvas.LeftProperty, (double)350);
            ctrlMailBoxNumber11.SetValue(Canvas.TopProperty, (double)746);
            ctrlMailBoxNumber11.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            int numBox12 = Commons.GetRandomNumberMailBox(Constants.Mailbox_Number_From, Constants.Mailbox_Number_To);
            Commons.AddToMailBoxListNumber(numBox12);
            ctrlMailBoxNumber12 = new MapNumbersToImages(numBox12, Constants.BoldYellowNumber, 15, 15, false);
            ctrlMailBoxNumber12.Name = "ctrlMailBoxNumber12";
            ctrlMailBoxNumber12.RenderTransform = tranformGr;
            ctrlMailBoxNumber12.SetValue(Canvas.LeftProperty, (double)491);
            ctrlMailBoxNumber12.SetValue(Canvas.TopProperty, (double)746);
            ctrlMailBoxNumber12.SetValue(RenderTransformOriginProperty, new Point(0.5, 0.5));

            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber01);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber02);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber03);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber04);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber05);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber06);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber07);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber08);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber09);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber10);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber11);
            canvasMailBoxNumber.Children.Add(ctrlMailBoxNumber12);
        }
Esempio n. 24
0
		private void dragX_Changed(DragListener drag)
		{
			Point currentPoint = Mouse.GetPosition(this.parent);
			Vector deltaVector = Point.Subtract(currentPoint, this.startPoint);
			
			var destAngle = (-0.5*deltaVector.X) + skewX;
			
			if (destAngle == 0 && skewY == 0)
			{
				this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformProperty).Reset();
				rtTransform = null;
				skewTransform = null;
			}
			else
			{
				if ((rtTransform == null) || !(rtTransform.Component is SkewTransform))
				{
					if (!this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).IsSet) {
						this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).SetValue(new Point(0.5,0.5));
					}
					
					if (this.skewTransform == null)
						this.skewTransform = new SkewTransform(0, 0);
					this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformProperty).SetValue(skewTransform);
					rtTransform = this.ExtendedItem.Properties[FrameworkElement.RenderTransformProperty].Value;
				}
				rtTransform.Properties["AngleX"].SetValue(destAngle);
			}
			
			_adornerLayer.UpdateAdornersForElement(this.ExtendedItem.View, true);
		}
Esempio n. 25
0
        /// <summary>
        /// Skews the shape with the specified name by the specified angles.
        /// </summary>
        /// <param name="shapeName">
        /// The name of the shape to skew.
        /// </param>
        /// <param name="angleX">
        /// The angle to skew the shape in the X direction.
        /// </param>
        /// <param name="angleY">
        /// The angle to skew the shape in the Y direction.
        /// </param>
        /// <returns>
        /// None.
        /// </returns>
        public static void Skew(Primitive shapeName, Primitive angleX, Primitive angleY)
        {
            try
            {
                if (!_objectsMap.TryGetValue((string)shapeName, out obj))
                {
                    Utilities.OnShapeError(Utilities.GetCurrentMethod(), shapeName);
                    return;
                }

                InvokeHelper ret = new InvokeHelper(delegate
                {
                    try
                    {
                        if (!(obj.RenderTransform is TransformGroup))
                        {
                            obj.RenderTransform = new TransformGroup();
                        }
                        SkewTransform skewTransform;
                        if (!_skewTransformMap.TryGetValue(shapeName, out skewTransform))
                        {
                            skewTransform = new SkewTransform();
                            _skewTransformMap[shapeName] = skewTransform;
                            FrameworkElement frameworkElement = obj as FrameworkElement;
                            if (frameworkElement != null)
                            {
                                skewTransform.CenterX = frameworkElement.ActualWidth / 2.0;
                                skewTransform.CenterY = frameworkElement.ActualHeight / 2.0;
                            }
                            ((TransformGroup)obj.RenderTransform).Children.Add(skewTransform);
                        }
                        skewTransform.AngleX = angleX;
                        skewTransform.AngleY = angleY;
                    }
                    catch (Exception ex)
                    {
                        Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                    }
                });
                FastThread.Invoke(ret);
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }
        }
        private void field_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // Get the Rectangle and its RenderTransform matrix.

            //Canvas rectToMove = e.OriginalSource as Canvas;
            Canvas rectToMove = (Canvas)field;

            Matrix rectsMatrix = ((MatrixTransform)rectToMove.RenderTransform).Matrix;

            // Rotate the Rectangle.
            //rectsMatrix.RotateAt(e.DeltaManipulation.Rotation,
            //                     e.ManipulationOrigin.X + 4000 - (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / 2),
            //                     e.ManipulationOrigin.Y + 5520 - (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height / 2));

            // Resize the Rectangle.  Keep it square
            // so use only the X value of Scale.
            rectsMatrix.ScaleAt(e.DeltaManipulation.Scale.X,
                                e.DeltaManipulation.Scale.X,
                                e.ManipulationOrigin.X + 4000 - (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / 2),
                                 e.ManipulationOrigin.Y + 5520 - (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height / 2));

            myCanvas.ControlScale = (1 / field.RenderTransform.Value.M22);

            for (int i = 0; i < field.Children.Count; i++)
            {
                if (field.Children[i] is FieldPlayer)
                {
                    FieldPlayer tempFieldPlayer = (FieldPlayer)field.Children[i];

                    //tempFieldPlayer.NormalizeTransformGroup();
                    //tempFieldPlayer.ScaleTo(1 / field.RenderTransform.Value.M22, 1 / field.RenderTransform.Value.M22);

                    ScaleTransform myScaleTransform = new ScaleTransform();
                    myScaleTransform.ScaleY = 1 / field.RenderTransform.Value.M22;
                    myScaleTransform.ScaleX = 1 / field.RenderTransform.Value.M22;

                    RotateTransform myRotateTransform = new RotateTransform();
                    myRotateTransform.Angle = 0;

                    //TranslateTransform myTranslate = new TranslateTransform();
                    //myTranslate.X = (tempFieldPlayer.RenderTransform.Value.OffsetX * field.RenderTransform.Value.M22);// -tempFieldPlayer.RenderTransform.Value.OffsetX;
                    //myTranslate.Y = (tempFieldPlayer.RenderTransform.Value.OffsetY * field.RenderTransform.Value.M22);// -tempFieldPlayer.RenderTransform.Value.OffsetY;

                    SkewTransform mySkew = new SkewTransform();
                    mySkew.AngleX = 0;
                    mySkew.AngleY = 0;

                    // Create a TransformGroup to contain the transforms
                    // and add the transforms to it.
                    TransformGroup myTransformGroup = new TransformGroup();
                    myTransformGroup.Children.Add(myScaleTransform);
                    myTransformGroup.Children.Add(myRotateTransform);
                   // myTransformGroup.Children.Add(myTranslate);
                    myTransformGroup.Children.Add(mySkew);

                    // Associate the transforms to the object
                    tempFieldPlayer.playerCanvas.RenderTransform = myTransformGroup;

                }
            }

            // Move the Rectangle.
            if (isFieldRotated == false)
            {
                rectsMatrix.Translate(e.DeltaManipulation.Translation.X,
                                      e.DeltaManipulation.Translation.Y);
            }
            else
            {
                rectsMatrix.Translate(e.DeltaManipulation.Translation.Y,
                                      -e.DeltaManipulation.Translation.X);
            }
            // Apply the changes to the Rectangle.
            rectToMove.RenderTransform = new MatrixTransform(rectsMatrix);

            Rect containingRect =
                new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);

            Rect shapeBounds =
                rectToMove.RenderTransform.TransformBounds(
                    new Rect(rectToMove.RenderSize));

            // Check if the rectangle is completely in the window.
            // If it is not and intertia is occuring, stop the manipulation.
            if (e.IsInertial && !containingRect.Contains(shapeBounds))
            {
                e.Complete();
            }

            e.Handled = true;
        }
Esempio n. 27
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 41 "..\..\..\..\Controls\EventControl.xaml"
                ((System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames)(target)).Completed += new System.EventHandler(this.ProgressBarAnimation_Completed);

            #line default
            #line hidden
                return;

            case 2:

            #line 99 "..\..\..\..\Controls\EventControl.xaml"
                ((System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames)(target)).Completed += new System.EventHandler(this.AppearAnimation_Completed);

            #line default
            #line hidden
                return;

            case 3:

            #line 108 "..\..\..\..\Controls\EventControl.xaml"
                ((System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames)(target)).Completed += new System.EventHandler(this.SlideUp_Completed);

            #line default
            #line hidden
                return;

            case 4:
                this.outerBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 5:
                this.EventContainer = ((System.Windows.Controls.Grid)(target));
                return;

            case 6:
                this.image = ((System.Windows.Controls.Image)(target));
                return;

            case 7:
                this.ProgressBar = ((System.Windows.Controls.Grid)(target));
                return;

            case 8:
                this.imageScale = ((System.Windows.Media.ScaleTransform)(target));
                return;

            case 9:
                this.eventTilt = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 10:
                this.eventTranslate = ((System.Windows.Media.TranslateTransform)(target));
                return;

            case 11:
                this.EventSlide = ((System.Windows.Controls.Grid)(target));
                return;

            case 12:
                this.SlideTransform = ((System.Windows.Media.TranslateTransform)(target));
                return;

            case 13:
                this.Details = ((Teudu.InfoDisplay.EventDetailsControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 28
0
        /// <summary>
        /// Gets the parts from the template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            this.skewTransform = (SkewTransform)this.GetTemplateChild("PART_PerspectiveShadowSkewTransform");
            this.scaleTransform = (ScaleTransform)this.GetTemplateChild("PART_PerspectiveShadowScaleTransform");
            this.shadowOuterStop1 = (GradientStop)this.GetTemplateChild("PART_ShadowOuterStop1");
            this.shadowOuterStop2 = (GradientStop)this.GetTemplateChild("PART_ShadowOuterStop2");
            this.shadowVertical1 = (GradientStop)this.GetTemplateChild("PART_ShadowVertical1");
            this.shadowVertical2 = (GradientStop)this.GetTemplateChild("PART_ShadowVertical2");
            this.shadowHorizontal1 = (GradientStop)this.GetTemplateChild("PART_ShadowHorizontal1");
            this.shadowHorizontal2 = (GradientStop)this.GetTemplateChild("PART_ShadowHorizontal2");

            this.UpdateStops(new Size(this.ActualWidth, this.ActualHeight));
            this.UpdateShadowAngle(this.PerspectiveShadowAngle);
        }
Esempio n. 29
0
        public void RandomizeCrack()
        {
            Random random = new Random();
            crack1.Stroke = null;
            crack2.Stroke = null;
            crack3.Stroke = null;
            crack4.Stroke = null;

            Brush stroke = new SolidColorBrush(Colors.Black) { Opacity = 45 };

            TransformGroup transformGroup = new TransformGroup();
            double scalex = new Random().Next(1, 10) * .1;
            double scaley = new Random().Next(1, 10) * .1;
            ScaleTransform scaleTransform = new ScaleTransform() { ScaleX = scalex, ScaleY = scaley };

            double anglex = new Random().Next(-20, 20) * .1;
            double angley = new Random().Next(-20, 20) * .1;
            SkewTransform skewTransform = new SkewTransform() { AngleX = anglex, AngleY = angley };
            transformGroup.Children.Add(skewTransform);
            transformGroup.Children.Add(scaleTransform);

            randomNumber = random.Next(1, 5);
            HanoiDisc discBelow = GameManager.Instance.GetDiscBelowCurrent(this);
            if (discBelow != null)
            {
                while (randomNumber == discBelow.RandomCrackNumber)
                {
                    randomNumber = random.Next(1, 5);
                }
            }

            switch (randomNumber)
            {
                case 1:
                    crack1.Stroke = stroke;
                    crack1.RenderTransform = transformGroup;
                    break;
                case 2:
                    crack2.Stroke = stroke;
                    crack2.RenderTransform = transformGroup;
                    break;
                case 3:
                    crack3.Stroke = stroke;
                    crack3.RenderTransform = transformGroup;
                    break;
                case 4:
                    crack4.Stroke = stroke;
                    crack4.RenderTransform = transformGroup;
                    break;
                case 5:
                    break;
            }
        }
Esempio n. 30
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 10 "..\..\..\..\Gadget\TreeGadget.xaml"
     ((NewYear2011.Gadget.TreeGadget)(target)).PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.UserControl_PreviewMouseLeftButtonDown);
     
     #line default
     #line hidden
     return;
     case 2:
     this.ScaleTrans = ((System.Windows.Media.ScaleTransform)(target));
     return;
     case 3:
     this.SkewTrans = ((System.Windows.Media.SkewTransform)(target));
     return;
     case 4:
     this.RotateTrans = ((System.Windows.Media.RotateTransform)(target));
     return;
     case 5:
     this.TranslateTrans = ((System.Windows.Media.TranslateTransform)(target));
     return;
     case 6:
     this.MainBitmap = ((NewYear2011.Helper.BitmapEx)(target));
     return;
     }
     this._contentLoaded = true;
 }
Esempio n. 31
0
        /// <summary>
        /// Skews the image by 45, 0, -50, 50 
        /// </summary>
        private void mnuSkew_Click(object sender, RoutedEventArgs e)
        {
            if (_isSelected)
            {
                SkewTransform transform = new SkewTransform(45, 0, -50, 50);

                transformGroup.Children.Add(transform);
            }
        }
Esempio n. 32
0
        /// <summary>
        /// Get FrameworkElement.RenderTransform with Children in standard order [ ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, ... ]
        /// </summary>
        public static TransformGroup NormalizeTransformGroup(FrameworkElement obj)
        {
            /*
                rect.RenderTransformOrigin = new Point(.5, .5);
                rect.RenderTransform = ArtefactAnimator.NormalizeTransformGroup(rect);

                ArtefactAnimator.AddEase(rect, new string[] { "X", "Y", "alpha" }, new double[] { 300, 300, .1 }, 5.0, ArtefactAnimator.WrapPennerEquation(PennerEquations.Equations.CubicEaseOut), 0.2);
                ArtefactAnimator.AddEase((rect.RenderTransform as TransformGroup).Children[TransformGroupIndexes.ScaleTransform], new string[] { "scalX", "scaleY" }, new double[] { 2, 2 }, 5.0, ArtefactAnimator.WrapPennerEquation(PennerEquations.Equations.CubicEaseOut), 0.2);
                ArtefactAnimator.AddEase((rect.RenderTransform as TransformGroup).Children[TransformGroupIndexes.SkewTransform], new string[] { "skewY" }, new double[] { -8.0 }, 5.0, ArtefactAnimator.WrapPennerEquation(PennerEquations.Equations.CubicEaseOut), 0.2);
                ArtefactAnimator.AddEase((rect.RenderTransform as TransformGroup).Children[TransformGroupIndexes.TranslateTransform], new string[] { "rotation" }, new double[] { 720 }, 5.0, ArtefactAnimator.WrapPennerEquation(PennerEquations.Equations.CubicEaseOut), 0.2);
            */

            var orgGroup = obj.RenderTransform as TransformGroup;
            var group = new TransformGroup();
            ScaleTransform scale = null;
            SkewTransform skew = null;
            RotateTransform rotate = null;
            TranslateTransform trans = null;

            if (orgGroup != null)
            {
                foreach (var child in orgGroup.Children)
                {
                    // add any existing transforms
                    if (child is ScaleTransform) scale = child as ScaleTransform;
                    else if (child is SkewTransform) skew = child as SkewTransform;
                    else if (child is RotateTransform) rotate = child as RotateTransform;
                    else if (child is TranslateTransform) trans = child as TranslateTransform;
                    else group.Children.Add(child);
                }
            }

            //  create missing values
            if (scale == null) scale = new ScaleTransform();
            if (skew == null) skew = new SkewTransform();
            if (rotate == null) rotate = new RotateTransform();
            if (trans == null) trans = new TranslateTransform();

            // set order close to Blend defaults
            group.Children.Insert((int)TransformGroupIndexes.ScaleTransform, scale);
            group.Children.Insert((int)TransformGroupIndexes.SkewTransform, skew);
            group.Children.Insert((int)TransformGroupIndexes.RotateTransform, rotate);
            group.Children.Insert((int)TransformGroupIndexes.TranslateTransform, trans);

            return group;
        }
        private void player_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            // Get the Rectangle and its RenderTransform matrix.

            //Canvas rectToMove = e.OriginalSource as Canvas;
            FieldPlayer rectToMove = (FieldPlayer)sender;

            rectToMove.NormalizeTransformGroup();

            if (isFieldRotated == false)
            {
                rectToMove.OffsetTo((rectToMove.RenderTransform.Value.OffsetX + (e.DeltaManipulation.Translation.X / field.RenderTransform.Value.M22)), (rectToMove.RenderTransform.Value.OffsetY + (e.DeltaManipulation.Translation.Y / field.RenderTransform.Value.M22)));
            }
            else
            {
                rectToMove.OffsetTo((rectToMove.RenderTransform.Value.OffsetX + (e.DeltaManipulation.Translation.Y / field.RenderTransform.Value.M22)), (rectToMove.RenderTransform.Value.OffsetY + (-e.DeltaManipulation.Translation.X / field.RenderTransform.Value.M22)));
            }

            //Debugger.Break();

            double a = lastPlayerPointDot.X - (rectToMove.RenderTransform.Value.OffsetX + (e.DeltaManipulation.Translation.X / field.RenderTransform.Value.M22));
            double b = lastPlayerPointDot.Y - (rectToMove.RenderTransform.Value.OffsetY + (e.DeltaManipulation.Translation.Y / field.RenderTransform.Value.M22));
            double distance = Math.Sqrt(a * a + b * b);
            //lastPlayerPointDot = new Point(rectToMove.RenderTransform.Value.OffsetX, rectToMove.RenderTransform.Value.OffsetY);

            if (distance > (45 / field.RenderTransform.Value.M22))
            {
                lastPlayerPointDot = new Point(rectToMove.RenderTransform.Value.OffsetX, rectToMove.RenderTransform.Value.OffsetY);

                FieldPlayer tempFieldPlayer = (FieldPlayer)sender;

                Point locationFromWindow = tempFieldPlayer.TranslatePoint(new Point(0, 0), this);
                locationFromWindow.X = locationFromWindow.X / tempFieldPlayer.RenderTransform.Value.M22;

                Point locationFromScreen = tempFieldPlayer.PointToScreen(locationFromWindow);
                tempFieldPlayer.number.Text = (84 - (0.5 * ((1 / field.RenderTransform.Value.M22) - 1) * 168)).ToString();
                tempFieldPlayer.name.Text = (e.ManipulationOrigin.X - locationFromWindow.X).ToString();
                //if (e.ManipulationOrigin.X - locationFromWindow.X < 84 - (0.25 * ((1 / field.RenderTransform.Value.M22) - 1) * 168))
                if (tempFieldPlayer.playerTrailEnabled == true)
                {

                    Ellipse tempEllipse = new Ellipse();
                    tempEllipse.Height = 15 / field.RenderTransform.Value.M22;
                    tempEllipse.Width = 15 / field.RenderTransform.Value.M22;

                    tempEllipse.Fill = tempFieldPlayer.swatchBackground.Fill;
                    //tempEllipse.Fill = new SolidColorBrush(Colors.Red);

                    ScaleTransform ellipseScaleTransform = new ScaleTransform();
                    ellipseScaleTransform.ScaleY = 1;// / field.RenderTransform.Value.M22;
                    ellipseScaleTransform.ScaleX = 1;// / field.RenderTransform.Value.M22;
                    ellipseScaleTransform.CenterX = .5;
                    ellipseScaleTransform.CenterY = .5;

                    RotateTransform ellipseRotateTransform = new RotateTransform();
                    ellipseRotateTransform.Angle = 0;

                    TranslateTransform ellipseTranslate = new TranslateTransform();
                    ellipseTranslate.X = lastPlayerPointDot.X + rectToMove.Width / 2;// / field.RenderTransform.Value.M22;
                    ellipseTranslate.Y = lastPlayerPointDot.Y + rectToMove.Height / 2;// / field.RenderTransform.Value.M22;

                    SkewTransform ellipseSkew = new SkewTransform();
                    ellipseSkew.AngleX = 0;
                    ellipseSkew.AngleY = 0;

                    // Create a TransformGroup to contain the transforms
                    // and add the transforms to it.
                    TransformGroup ellipseTransformGroup = new TransformGroup();
                    ellipseTransformGroup.Children.Add(ellipseScaleTransform);
                    ellipseTransformGroup.Children.Add(ellipseRotateTransform);
                    ellipseTransformGroup.Children.Add(ellipseTranslate);
                    ellipseTransformGroup.Children.Add(ellipseSkew);

                    tempEllipse.RenderTransform = ellipseTransformGroup;

                    playerDots.Children.Add(tempEllipse);
                }
                //MessageBox.Show(playerDots.Children.Count.ToString());

            }
            //Matrix rectsMatrix = ((MatrixTransform)rectToMove.RenderTransform).Matrix;

            //// Move the Rectangle.
            //rectsMatrix.Translate(e.DeltaManipulation.Translation.X / field.RenderTransform.Value.M22,
            //                      e.DeltaManipulation.Translation.Y / field.RenderTransform.Value.M22);

            //// Apply the changes to the Rectangle.
            //rectToMove.RenderTransform = new MatrixTransform(rectsMatrix);

            Rect containingRect =
                new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);

            Rect shapeBounds =
                rectToMove.RenderTransform.TransformBounds(
                    new Rect(rectToMove.RenderSize));

            // Check if the rectangle is completely in the window.
            // If it is not and intertia is occuring, stop the manipulation.
            if (e.IsInertial && !containingRect.Contains(shapeBounds))
            {
                e.Complete();
            }

            e.Handled = true;
        }
Esempio n. 34
0
		protected override void OnInitialized()
		{
			
			if (this.ExtendedItem.Component is WindowClone)
				return;
			base.OnInitialized();
			
			extendedItemArray[0] = this.ExtendedItem;
			this.ExtendedItem.PropertyChanged += OnPropertyChanged;
			
			var designerItem = this.ExtendedItem.Component as FrameworkElement;
			this.skewTransform = designerItem.RenderTransform as SkewTransform;
			
			if (skewTransform != null)
			{
				skewX = skewTransform.AngleX;
				skewY = skewTransform.AngleY;
			}
			
			thumb1 = new Thumb() { Cursor = Cursors.ScrollWE, Height = 14, Width = 4, Opacity = 1 };
			thumb2 = new Thumb() { Cursor = Cursors.ScrollNS, Width = 14, Height = 4, Opacity = 1 };
			
			OnPropertyChanged(null, null);
			
			adornerPanel.Children.Add(thumb1);
			adornerPanel.Children.Add(thumb2);
			
			DragListener drag1 = new DragListener(thumb1);
			drag1.Started += dragX_Started;
			drag1.Changed += dragX_Changed;
			drag1.Completed += dragX_Completed;
			DragListener drag2 = new DragListener(thumb2);
			drag2.Started += dragY_Started;
			drag2.Changed += dragY_Changed;
			drag2.Completed += dragY_Completed;
		}
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            scalingValue = Convert.ToDouble(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height) / 1080;
            ScaleTransform myScaleTransform = new ScaleTransform();
            myScaleTransform.ScaleY = scalingValue;
            myScaleTransform.ScaleX = scalingValue;
            myScaleTransform.CenterX = .5;
            myScaleTransform.CenterY = .5;

            RotateTransform myRotateTransform = new RotateTransform();
            myRotateTransform.Angle = 0;

            TranslateTransform myTranslate = new TranslateTransform();
            myTranslate.X = 0;
            myTranslate.Y = 0;

            SkewTransform mySkew = new SkewTransform();
            mySkew.AngleX = 0;
            mySkew.AngleY = 0;

            // Create a TransformGroup to contain the transforms
            // and add the transforms to it.
            TransformGroup myTransformGroup = new TransformGroup();
            myTransformGroup.Children.Add(myScaleTransform);
            myTransformGroup.Children.Add(myRotateTransform);
            myTransformGroup.Children.Add(myTranslate);
            myTransformGroup.Children.Add(mySkew);

            // Associate the transforms to the object
            //scaledElements.RenderTransform = myTransformGroup;
            //scaledVideoElements.RenderTransform = myTransformGroup;

            try
            {
                if (DesignerProperties.GetIsInDesignMode(this) == false)
                {
                    // not in Blend...
                    // see if we have a save file name specified
                    saveFileName = ConfigurationManager.AppSettings["saveFileName"];
                    if (saveFileName != null && saveFileName.Length > 0)
                    {
                        string savedData = objVCSCommon.GetXMLFromFile(saveFileName);
                        if (savedData.Length > 0)
                        {
                            LoadData(savedData);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //Debug.WriteLine("ERROR ** " + GetMethodName() + " ** " + ex.Message);
            }

            objVCSCommon.DoCommonSceneInitialization(this, false, false, false);

            // Hook into VCS Proxy
            objVCSCommon.InitializeProxySocket(ConfigurationManager.AppSettings["WPFProxyPort"], ConfigurationManager.AppSettings["WPFProxyAddress"]);
            objVCSCommon.MessageReceived += new WPF_VCS_COMMON.MessageReceivedEventHandler(objVCSCommon_MessageReceived);

            //rightTouchOrTapTimer.Interval = 200;
            //rightTouchOrTapTimer.Elapsed += new ElapsedEventHandler(rightTouchOrTapTimerElapsed);

            // catch the routed events

            // start off by initializing the tool palette
            // now initialize the drawing canvas
            this.InitializeDrawingCanvas();
            // get the palette colors from the XML file
            LoadColorsFromFile();
            //String[] colrs = availColors.GetColorNames();

            myCanvas.ControlScale = 1.33;

            //myCanvas.CurrentDrawColor = startingColor;
            //myCanvas.CurrentButtonType = startingChipType;

            fieldOn.Visibility = Visibility.Collapsed;
            playerOn.Visibility = Visibility.Visible;

            //lines.ManipulationDelta -= field_ManipulationDelta;
            //lines.ManipulationStarting -= field_ManipulationStarting;
            //lines.ManipulationInertiaStarting -= field_InertiaStarting;
            //lines.IsManipulationEnabled = false;

            for (int i = 0; i < field.Children.Count; i++)
            {
                if (field.Children[i] is FieldPlayer)
                {
                    FieldPlayer tempFieldPlayer = (FieldPlayer)field.Children[i];

                    tempFieldPlayer.ManipulationDelta += player_ManipulationDelta;
                    tempFieldPlayer.ManipulationStarting += player_ManipulationStarting;
                    tempFieldPlayer.ManipulationInertiaStarting += player_ManipulationInertiaStarting;
                    tempFieldPlayer.ManipulationCompleted += player_ManipulationCompleted;
                    tempFieldPlayer.IsManipulationEnabled = true;
                }

            }

            TransformGroup rotateTransformGroup = new TransformGroup();
            RotateTransform defaultRotateTransform = new RotateTransform();
            defaultRotateTransform.Angle = 0;

            rotateTransformGroup.Children.Add(defaultRotateTransform);

            // Associate the transforms to the object
            fieldPlayers.RenderTransform = rotateTransformGroup;
        }
Esempio n. 36
0
        /// <summary>
        /// Create 3D bar for a DataPoint
        /// </summary>
        /// <param name="barParams">Bar parameters</param>
        /// <returns>Faces for bar</returns>
        internal static Faces Get3DBar(RectangularChartShapeParams barParams)
        {
            Faces faces = new Faces();

            Canvas barVisual = new Canvas();

            barVisual.Width = barParams.Size.Width;
            barVisual.Height = barParams.Size.Height;

            Brush frontBrush = barParams.Lighting ? Graphics.GetFrontFaceBrush(barParams.BackgroundBrush) : barParams.BackgroundBrush;
            Brush topBrush = barParams.Lighting ? Graphics.GetTopFaceBrush(barParams.BackgroundBrush) : barParams.BackgroundBrush;
            Brush rightBrush = barParams.Lighting ? Graphics.GetRightFaceBrush(barParams.BackgroundBrush) : barParams.BackgroundBrush;

            Rectangle front = ExtendedGraphics.Get2DRectangle(barParams.TagReference, barParams.Size.Width, barParams.Size.Height,
                barParams.BorderThickness, barParams.BorderStyle, barParams.BorderBrush,
                frontBrush, new CornerRadius(0), new CornerRadius(0));

            faces.Parts.Add(front);
            faces.BorderElements.Add(front);

            Rectangle top = ExtendedGraphics.Get2DRectangle(barParams.TagReference, barParams.Size.Width, barParams.Depth,
                barParams.BorderThickness, barParams.BorderStyle, barParams.BorderBrush,
                topBrush, new CornerRadius(0), new CornerRadius(0));

            faces.Parts.Add(top);
            faces.BorderElements.Add(top);

            top.RenderTransformOrigin = new Point(0, 1);
            SkewTransform skewTransTop = new SkewTransform();
            skewTransTop.AngleX = -45;
            top.RenderTransform = skewTransTop;

            Rectangle right = ExtendedGraphics.Get2DRectangle(barParams.TagReference, barParams.Depth, barParams.Size.Height,
                barParams.BorderThickness, barParams.BorderStyle, barParams.BorderBrush,
                rightBrush, new CornerRadius(0), new CornerRadius(0));

            faces.Parts.Add(right);
            faces.BorderElements.Add(right);

            right.RenderTransformOrigin = new Point(0, 0);
            SkewTransform skewTransRight = new SkewTransform();
            skewTransRight.AngleY = -45;
            right.RenderTransform = skewTransRight;

            barVisual.Children.Add(front);
            barVisual.Children.Add(top);
            barVisual.Children.Add(right);

            top.SetValue(Canvas.TopProperty, -barParams.Depth);
            right.SetValue(Canvas.LeftProperty, barParams.Size.Width);

            faces.Visual = barVisual;

            faces.VisualComponents.Add(front);
            faces.VisualComponents.Add(top);
            faces.VisualComponents.Add(right);

            return faces;
        }
Esempio n. 37
0
 private void _updateSkew(bool xaxis, bool yaxis) {
    if (_skewTransform == null) {
       _skewTransform = new SkewTransform();
       _insertTransform(_countTransforms(_scaleTransform), _skewTransform);
    }
    if (xaxis) _skewTransform.AngleX = SkewX;
    if (yaxis) _skewTransform.AngleY = SkewY;
 }
Esempio n. 38
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.kep = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 2:
                this.elforditas = ((System.Windows.Media.RotateTransform)(target));
                return;

            case 3:
                this.transzform = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 4:
                this.vizszintes_p = ((System.Windows.Controls.Slider)(target));

            #line 29 "..\..\MainWindow.xaml"
                this.vizszintes_p.AddHandler(System.Windows.Controls.Primitives.Thumb.DragCompletedEvent, new System.Windows.Controls.Primitives.DragCompletedEventHandler(this.asd));

            #line default
            #line hidden

            #line 29 "..\..\MainWindow.xaml"
                this.vizszintes_p.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.vizszintes_p_ValueChanged);

            #line default
            #line hidden
                return;

            case 5:
                this.fuggoleges_p = ((System.Windows.Controls.Slider)(target));

            #line 30 "..\..\MainWindow.xaml"
                this.fuggoleges_p.AddHandler(System.Windows.Controls.Primitives.Thumb.DragCompletedEvent, new System.Windows.Controls.Primitives.DragCompletedEventHandler(this.asd));

            #line default
            #line hidden
                return;

            case 6:
                this.vizszintes_n = ((System.Windows.Controls.Slider)(target));

            #line 37 "..\..\MainWindow.xaml"
                this.vizszintes_n.AddHandler(System.Windows.Controls.Primitives.Thumb.DragCompletedEvent, new System.Windows.Controls.Primitives.DragCompletedEventHandler(this.asd));

            #line default
            #line hidden
                return;

            case 7:
                this.fuggoleges_n = ((System.Windows.Controls.Slider)(target));

            #line 38 "..\..\MainWindow.xaml"
                this.fuggoleges_n.AddHandler(System.Windows.Controls.Primitives.Thumb.DragCompletedEvent, new System.Windows.Controls.Primitives.DragCompletedEventHandler(this.asd));

            #line default
            #line hidden
                return;

            case 8:
                this.szog = ((System.Windows.Controls.Slider)(target));

            #line 43 "..\..\MainWindow.xaml"
                this.szog.AddHandler(System.Windows.Controls.Primitives.Thumb.DragCompletedEvent, new System.Windows.Controls.Primitives.DragCompletedEventHandler(this.asd));

            #line default
            #line hidden
                return;

            case 9:
                this.vizszintes_fe = ((System.Windows.Controls.Slider)(target));

            #line 48 "..\..\MainWindow.xaml"
                this.vizszintes_fe.AddHandler(System.Windows.Controls.Primitives.Thumb.DragCompletedEvent, new System.Windows.Controls.Primitives.DragCompletedEventHandler(this.asd));

            #line default
            #line hidden
                return;

            case 10:
                this.fuggoleges_fe = ((System.Windows.Controls.Slider)(target));

            #line 49 "..\..\MainWindow.xaml"
                this.fuggoleges_fe.AddHandler(System.Windows.Controls.Primitives.Thumb.DragCompletedEvent, new System.Windows.Controls.Primitives.DragCompletedEventHandler(this.asd));

            #line default
            #line hidden
                return;

            case 11:
                this.gomba = ((System.Windows.Controls.Button)(target));

            #line 59 "..\..\MainWindow.xaml"
                this.gomba.Click += new System.Windows.RoutedEventHandler(this.gomb);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 39
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 41 "..\..\..\..\Controls\EventControl.xaml"
     ((System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames)(target)).Completed += new System.EventHandler(this.ProgressBarAnimation_Completed);
     
     #line default
     #line hidden
     return;
     case 2:
     
     #line 99 "..\..\..\..\Controls\EventControl.xaml"
     ((System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames)(target)).Completed += new System.EventHandler(this.AppearAnimation_Completed);
     
     #line default
     #line hidden
     return;
     case 3:
     
     #line 108 "..\..\..\..\Controls\EventControl.xaml"
     ((System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames)(target)).Completed += new System.EventHandler(this.SlideUp_Completed);
     
     #line default
     #line hidden
     return;
     case 4:
     this.outerBorder = ((System.Windows.Controls.Border)(target));
     return;
     case 5:
     this.EventContainer = ((System.Windows.Controls.Grid)(target));
     return;
     case 6:
     this.image = ((System.Windows.Controls.Image)(target));
     return;
     case 7:
     this.ProgressBar = ((System.Windows.Controls.Grid)(target));
     return;
     case 8:
     this.imageScale = ((System.Windows.Media.ScaleTransform)(target));
     return;
     case 9:
     this.eventTilt = ((System.Windows.Media.SkewTransform)(target));
     return;
     case 10:
     this.eventTranslate = ((System.Windows.Media.TranslateTransform)(target));
     return;
     case 11:
     this.EventSlide = ((System.Windows.Controls.Grid)(target));
     return;
     case 12:
     this.SlideTransform = ((System.Windows.Media.TranslateTransform)(target));
     return;
     case 13:
     this.Details = ((Teudu.InfoDisplay.EventDetailsControl)(target));
     return;
     }
     this._contentLoaded = true;
 }