public GestureCodeBehind()
        {
            InitializeComponent();

            //tap
            var tap = new TapProcessor();
            tap.Tap += Tap_Tap;
            Gesture.AddGesture(tap_postit,tap);

            //hold
            var hold = new HoldProcessor();
            hold.Hold += Hold_Hold;
            Gesture.AddGesture(hold_postit, hold);

            //manip
            var manip = new ManipulationProcessor();
            manip.ManipulationUpdate += Manip_ManipulationUpdate;
            Gesture.AddGesture(manipulate_postit, manip);

            //all
            /*tap = new TapProcessor();
            tap.Tap += Tap_Tap;
            Gesture.AddGesture(all_postit, tap);

            hold = new HoldProcessor();
            hold.Hold += Hold_Hold;
            Gesture.AddGesture(all_postit, hold);*/

            manip = new ManipulationProcessor();
            manip.ManipulationUpdate += Manip_ManipulationUpdate;
            Gesture.AddGesture(all_postit, manip);

        }      
Exemplo n.º 2
0
        public WelcomeWindow(Game game, MainWindow mainWindow)
        {
            this.Game = game;
            this.MainWindow = mainWindow;
            this.MainScaleTransform = new ScaleTransform(0.3, 0.3, 0, 0);

            //test gesture
            var border = new Border();
            var tap = new TapProcessor();
            border.AddGesture(tap);

            this.Game.State = GameState.Sleeping;
            this.Game.Sounds.playTheme();

            show();
        }
        private Connection AddLink(UIElement source,UIElement sink)
        {
            var con = new Connection()
            {
                RoutingStyle = new RoutingStraightLine(),
                VisualStyle = new VisualSimpleLine() { Stroke = new Pen() { Brush = Brushes.Gray, DashStyle = new DashStyle(new double[] { 5, 5 }, 0), Thickness = 3 } },
                Source = source,
                Sink = sink,
                BeginCap = new GeometryDrawing(
                    new SolidColorBrush(Color.FromArgb(255, 181, 243, 20)),
                    new Pen(Brushes.Black, 4),
                    Geometry.Parse("M -17,0 L -24,14 L 0,0 L -25,-14 Z")
                ),
                EndCap = new GeometryDrawing(
                    new SolidColorBrush(Color.FromArgb(255, 181, 243, 20)),
                    new Pen(Brushes.Black, 4),
                    Geometry.Parse("M -17,0 L -24,14 L 0,0 L -25,-14 Z")
                )
            };
           
            AddGesture(con, con.BeginThumb);
            AddGesture(con, con.EndThumb);

            #region addTextbox

            var text = new UbiTextBox()
            {
                Padding = new Thickness(5),
                Background = Brushes.WhiteSmoke,
                Text = RandomHelper.GetRandomString(),
                FontSize = 12,
                MaxWidth = 150,
                MaxHeight = 100,
                AcceptsReturn = true,
                TextWrapping = TextWrapping.Wrap,
                TextAlignment = TextAlignment.Center,
            };
            var border = new Border() { Child = text, BorderBrush = Brushes.Black, BorderThickness = new Thickness(2) };
            var tap = new TapProcessor();
            tap.Tap += delegate(object o, TapEventArgs arg)
            {
                if (!text.IsReadOnly)
                    return;
                text.IsReadOnly = false;
                var key = KeyboardManager.RequestKeyboard(new KeyboardRequestArgs(text) { Position = arg.Transform.ConvertToVisual(text).Center /*GetCurrentPositionForElement(text)*/ });
                key.KeyboardClosed += delegate(object oo, System.EventArgs ee)
                {
                    text.IsReadOnly = true;
                };
            };
            TouchSurfaceWPF.GetOrCreateTouchSurface(border).AddGestureProcessor(tap);

            Connection.SetPlacementPercentage(text, 0.5);
            Connection.SetUseTangent(border, true);
            con.Children.Add(border);

            #endregion addTextbox

            conlayer.Children.Add(con);

            return con;
        }