Exemplo n.º 1
0
 public TCanvas()
 {
     _gesturesinterpreter = new TouchGestures(this);
     _gesturesinterpreter.Translate += new TouchGestures.GestureTranslateHandler(_gesturesinterpreter_Translate);
     _gesturesinterpreter.Rotate += new TouchGestures.GestureRotateHandler(_gesturesinterpreter_Rotate);
     _gesturesinterpreter.Scale += new TouchGestures.GestureScaleHandler(_gesturesinterpreter_Scale);
     _gesturesinterpreter.Release += new TouchGestures.GestureRelease(_gesturesinterpreter_Release);
     _gesturesinterpreter.Hold += new TouchGestures.GestureHold(_gesturesinterpreter_Hold);
     _gesturesinterpreter.Tap += new TouchGestures.GestureTapHandler(_gesturesinterpreter_Tap);
     _gesturesinterpreter.GestureDetected += new TouchGestures.GestureDetectedHandler(_gesturesinterpreter_GestureDetected);
     _transformhelper = new Animations.TransformHelper(this);
     _transformhelper.Delay = 2.5;
 }
Exemplo n.º 2
0
        private void _init()
        {
            if (VisualTreeHelper.GetChildrenCount(this) == 0) return;

            if (_scrollerpanel != null) // already inited
                return;

            DependencyObject child = VisualTreeHelper.GetChild(this, 0);
            if (child != null && child is Panel)
            {
                _scrollerpanel = (Panel)child;

                _scrollertransformhelper = new Animations.TransformHelper(_scrollerpanel);
                _scrollertransformhelper.AnimationStarting += new TransformHelper.AnimationStartingHandler(_scrollertransformhelper_AnimationStarting);
                _scrollertransformhelper.AnimationComplete += new TransformHelper.AnimationCompleteHandler(_scrollertransformhelper_AnimationComplete);

                _gesturesinterpreter = new TouchGestures(_scrollerpanel);
                _gesturesinterpreter.Translate += new TouchGestures.GestureTranslateHandler(_gesturesinterpreter_Translate); //Translate;
                _gesturesinterpreter.Tap += new TouchGestures.GestureTapHandler(_gesturesinterpreter_Tap);
                _gesturesinterpreter.Hold += new TouchGestures.GestureHold(_gesturesinterpreter_Hold);
                _gesturesinterpreter.Scale += new TouchGestures.GestureScaleHandler(_gesturesinterpreter_Scale);
                _gesturesinterpreter.GestureDetected += new TouchGestures.GestureDetectedHandler(_gesturesinterpreter_GestureDetected);

                // add scrollbars
                //
                _scrollbarscanvas = new Canvas();
                _scrollbarscanvas.SetValue(Canvas.ZIndexProperty, 255);
                //
                _scrollbarh = new Border();
                _scrollbarh.BorderBrush = new SolidColorBrush(Colors.White);
                _scrollbarh.BorderThickness = new Thickness(2.0);
                _scrollbarh.CornerRadius = new CornerRadius(5.0);
                _scrollbarh.Background = new SolidColorBrush(Colors.Black);
                _scrollbarh.Opacity = 0.3;
                _scrollbarh.Width = this.Width;
                _scrollbarh.Height = 40D;
                _scrollbarh.Cursor = Cursors.Hand;
                _scrollbarscanvas.Children.Add(_scrollbarh);
                //
                _scrollbarv = new Border();
                _scrollbarv.BorderBrush = new SolidColorBrush(Colors.White);
                _scrollbarv.BorderThickness = new Thickness(2.0);
                _scrollbarv.CornerRadius = new CornerRadius(5.0);
                _scrollbarv.Background = new SolidColorBrush(Colors.Black);
                _scrollbarv.Opacity = 0.3;
                _scrollbarv.Width = 40D;
                _scrollbarv.Height = this.Height;
                _scrollbarv.Cursor = Cursors.Hand;
                _scrollbarscanvas.Children.Add(_scrollbarv);
                //
                this.Children.Add(_scrollbarscanvas);
                //
                _scrollbarsupdate();
            }
            else
            {
                // THROW EXCEPTION IF NO PANEL FOUND
                throw(new Exception("MIRIA.UIKIT.ScrollView child element must be subclass of Panel"));
            }
        }
Exemplo n.º 3
0
        private void _init()
        {
            this.Projection = new PlaneProjection() { };
            this.Background = new SolidColorBrush(Colors.Transparent);
            //
            _backgroundcanvas = new TCanvas();
            _backgroundcanvas.Width = this.Width;
            _backgroundcanvas.Height = this.Height;
            _backgroundcanvas.Background = new SolidColorBrush(Colors.Transparent);
            _backgroundcanvas.FingerAdded += new TCanvas.FingerAdddedHandler(_backgroundcanvas_FingerAdd);
            _backgroundcanvas.FingerRemoved += new TCanvas.FingerRemovedHandler(_backgroundcanvas_FingerRemove);
            _backgroundcanvas.FingerUpdated += new TCanvas.FingerUpdatedHandler(_backgroundcanvas_FingerUpdate);
            (this.Parent as Panel).Children.Insert((this.Parent as Panel).Children.IndexOf(this), _backgroundcanvas);
            //
            _dispatchertimer = new DispatcherTimer();
            _dispatchertimer.Interval = new TimeSpan(0, 0, 0, 0, 20);
            _dispatchertimer.Tick += (sender, e) => {
                if (_currentaction == 1 && _currentitem < _itemscount && _ticks == 2)
                    _folditem();
                else if (_currentaction == 0 && _currentitem != -1 && _ticks == 2)
                    _unfolditem();
                else
                    _animate();
                if (_ticks == 2)
                    _ticks = 0;
                else
                    _ticks++;
            };
            _dispatchertimer.Start();

            _transformhelper = new TransformHelper(this);

            _gesturesinterpreter = new TouchGestures(_backgroundcanvas);
            _gesturesinterpreter.GestureDetected += new TouchGestures.GestureDetectedHandler(_gesturesinterpreter_GestureDetected);
            _gesturesinterpreter.Scale += new TouchGestures.GestureScaleHandler(_gesturesinterpreter_Scale);
            _gesturesinterpreter.Tap += new TouchGestures.GestureTapHandler(_gesturesinterpreter_Tap);
        }