protected override void OnCreate (Bundle bundle)
		{
			RequestWindowFeature(WindowFeatures.NoTitle);
			base.OnCreate (bundle); 
			this.SetContentView(Resource.Layout.Home);

			String package = PackageName;


			Glistener = new GestureListener();
			Gdetector = new GestureDetector (this, Glistener);
			var trans = FragmentManager.BeginTransaction ();
			trans.Add (Resource.Id.frame_home,mHomeFragment3,"HomeFragment3");
			trans.Hide (mHomeFragment3);
			trans.Add (Resource.Id.frame_home,mHomeFragment2,"HomeFragment2");
			trans.Hide (mHomeFragment2);
			trans.Add (Resource.Id.frame_home,mHomeFragment1,"HomeFragment1");
			trans.Commit();
			currentFragment = mHomeFragment1;

			Button haz_plif = FindViewById <Button> (Resource.Id.haz_plif);
			FrameLayout fcontainer = FindViewById<FrameLayout> (Resource.Id.frame_home);

			haz_plif.Click += (object sender, EventArgs e) => {
					StartActivity(typeof(login));
					Finish ();
			};
			fcontainer.Touch += Fcontainer_Touch;

			RemoteViews rmv = new RemoteViews(package, Resource.Layout.Home);
			rmv.SetTextViewText(Resource.Id.haz_plif,"Elias was here");
		}
Ejemplo n.º 2
0
        public static void SetGestureListener(DependencyObject obj, GestureListener value)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            SetGestureListenerInternal(obj, value);
        }
        public gAlbumImagesPage()
        {
            InitializeComponent();

            gestureListener = GestureService.GetGestureListener(ContentPanel);// Initialize GestureListener

            gestureListener.DragCompleted += new EventHandler<DragCompletedGestureEventArgs>(gestureListener_DragCompleted);// Handle Dragging (to show next or previous image from Album)

        }
Ejemplo n.º 4
0
 /// <summary>
 /// Gets the GestureListener on an element. If one is not set, can create a new one
 /// so that this will never return null, depending on the state of the createIfMissing
 /// flag.
 /// </summary>
 /// <param name="obj">The object to get the GestureListener from.</param>
 /// <param name="createIfMissing">When this is true, if the attached property was not set on the element, it will create one and set it on the element.</param>
 /// <returns></returns>
 internal static GestureListener GetGestureListenerInternal(DependencyObject obj, bool createIfMissing)
 {
     GestureListener listener = (GestureListener)obj.GetValue(GestureListenerProperty);
     if (listener == null && createIfMissing)
     {
         listener = new GestureListener();
         SetGestureListenerInternal(obj, listener);
     }
     return listener;
 }
Ejemplo n.º 5
0
        public Photos()
        {
            InitializeComponent();
           
            // Initialize GestureListener
            gestureListener = GestureService.GetGestureListener(ContentPanel);
            // Handle Dragging (to show next or previous image from Album)
            gestureListener.DragCompleted += new EventHandler<DragCompletedGestureEventArgs>(gestureListener_DragCompleted);
            // app.selectedImageIndex = 0;

        }
Ejemplo n.º 6
0
    IEnumerator Start()
    {
        //Screen.fullScreen = false; // Set to false to reset window mode
        //yield return new WaitForSeconds(2f);
        if(!Screen.fullScreen)
            Screen.fullScreen = true; // Set to true to set window to full screen

        // get the gestures listener
        Gesture = GameObject.Find("KinectObject");
        gestureListener = Gesture.GetComponent<GestureListener>();

        yield return null;
    }
Ejemplo n.º 7
0
        public KinectMainController(MouseInput listener)
        {
            this.listener = listener;
            SetupKinectManually();      //enable the kinect
            Console.WriteLine("Ready");

            //hand -> mouse input object
            h = new TouchInputRecogniser(_sensor, listener);

            //Calibration object
            c = new Calibrator(_sensor);

            //Gesture recognition object
            GestureRecogniser g = new GestureRecogniser(_sensor);

            //Gesture listener object
            gestureListener = new DefaultListener();
        }
Ejemplo n.º 8
0
        public GestureControl()
        {
            InitializeComponent();

            SetStyle( ControlStyles.AllPaintingInWmPaint |
                      ControlStyles.UserPaint |
                      ControlStyles.ResizeRedraw |
                      ControlStyles.OptimizedDoubleBuffer, true );

            // Subscribe to all the touch events
            _gesture = new GestureListener( this );
            _gesture.Pan += OnPan;
            _gesture.PressAndTap += OnPressAndTap;
            _gesture.Rotate += OnRotate;
            _gesture.TwoFingerTap += OnTwoFingerTap;
            _gesture.Zoom += OnZoom;

            m_image = Properties.Resources.icon;
        }
Ejemplo n.º 9
0
        private void Init(Context context)
        {
            this.density = context.Resources.DisplayMetrics.Density;
            this.SetEGLConfigChooser(8, 8, 8, 8, 16, 0);
            this.Holder.SetFormat(Format.Rgba8888);

            this.gestureListener = new GestureListener(context);
            this.renderer = new OpenGlobeRenderer(context);

            this.SetRenderer(this.renderer);

            this.gestureListener.Scroll += OnScroll;
            this.gestureListener.Scale += OnScale;
            this.gestureListener.Down += OnDown;
            this.gestureListener.Move += OnMove;

            this.gestureListener.SingleTapUp += OnSingleTapUp;
            this.gestureListener.PointerCountChanged += OnPointerCountChanged;
        }
Ejemplo n.º 10
0
        public ImagesPage()
        {
            InitializeComponent();

            //Timer slideshow

            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(2);
            timer.Tick += new EventHandler(timer_Tick);
            // Initialize GestureListener
            gestureListener = GestureService.GetGestureListener(ContentPanel);
            // Handle Dragging (to show next or previous image from Album)
            gestureListener.DragCompleted += new EventHandler<DragCompletedGestureEventArgs>(gestureListener_DragCompleted);

            //Initialize application bar
            ApplicationBar = new ApplicationBar();

            ApplicationBar.Opacity = 1.0;
            ApplicationBar.IsVisible = true;
            ApplicationBar.IsMenuEnabled = true;


            //Download Button creation

            btnDownload.Click += new EventHandler(Download_Click);
            btnDownload.IconUri = new Uri("Icons/appbar.download.rest.png", UriKind.Relative);
            btnDownload.Text = AppResources.downloadbtn;
            ApplicationBar.Buttons.Add(btnDownload);

            //Play/stop slideshow button
            btnPlay.Click += new EventHandler(Play_Click);
            btnPlay.IconUri = new Uri("Icons/play.png", UriKind.Relative);
            btnPlay.Text = AppResources.playbtn;
            ApplicationBar.Buttons.Add(btnPlay);


        }
Ejemplo n.º 11
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if ((Kmanager != null) && (Imanager != null) && Imanager.IsInteractionInited() && _cameraEnabled == true && _checkingImage == false)
        {
            StartCoroutine(CheckImage ());
            if (Kmanager.IsUserDetected())
            {
                //appController.Instance.Send("is player in: " + Imanager.isPlayerIN().ToString());
                // TO DO SEND SIGNAL TO OTHER PROGRAM IF USER IS DETECTED
                if (!Imanager.isPlayerIN())
                {
                    if(Application.loadedLevel == 1) {
                        FindObjectOfType<TipController>().ShowMan();
                    }
        //                    StartCoroutine(ShowSplash());
                    Kmanager.DetectClosestUser = true;

                    // Write the image file only if player is detected and when the zone is not active
                    if (appController.AppShown != appController.AppList.ZONE)
                    {
                        WriteImage();
                    }
                }

                Idle_Timer = 0;
                gestureListener = Kmanager.GetComponent<GestureListener>();
                Imanager.SetPlayerDetected(true);

                Vector3 ShoulderPos = Kmanager.GetJointPosition(Imanager.GetUserID(), (int)KinectWrapper.SkeletonJoint.RIGHT_SHOULDER);
                Vector3 HandRightPos = Kmanager.GetJointPosition(Imanager.GetUserID(), (int)KinectWrapper.SkeletonJoint.RIGHT_HAND);
                Vector3 HandLeftPos = Kmanager.GetJointPosition(Imanager.GetUserID(), (int)KinectWrapper.SkeletonJoint.LEFT_HAND);
                DectectedPSI = false;
                if (HandRightPos.y > ShoulderPos.y && HandLeftPos.y > ShoulderPos.y)
                {
                    //if (!DectectedPSI)
                    Gesture_timer += Time.deltaTime;

                    if (Gesture_timer > 1.25f)
                    {
                        DectectedPSI = true;
                        Gesture_timer = 0;
                    }
                }
                else
                {
                    Gesture_timer = 0;
                    HandsDown = true;
                }
                GestureInfo.guiText.text = Kmanager.GetLastPlayerID().ToString() + "  " + Imanager.GetUserID().ToString();
                if (DectectedPSI && !Imanager.isPlayerIN() && Kmanager.GetLastPlayerID() != Imanager.GetUserID())
                {
                    ShowZone();
                    Kmanager.DetectClosestUser = false;
                    Imanager.SetDisableCursor(false);
                    Imanager.SetSceneReady(true);
                    Imanager.SetResetScene(true);
                    Imanager.SetPlayerIN(true);
                    HandsDown = false;

                    FindObjectOfType<TipController>().HideMan();
                    FindObjectOfType<CurtainController>().ShowCurtains(true, 2);
                }
                //else if ((DectectedPSI && Imanager.isPlayerIN() && HandsDown) || Imanager.isplayerLogout())
                //{
                //    HideSplash();
                //    appController.AppShown = appController.AppList.ZONE;
                //    ShowCMS();

                //    //GestureInfo.guiText.text = "PLAYERS LOGOUT!";
                //    Kmanager.SetLastPlayerID((int)Imanager.GetUserID());
                //    //Kmanager.RemoveUser(Imanager.GetUserID());
                //    Imanager.SetResetScene(false);
                //    Imanager.SetSceneReady(false);
                //    Imanager.SetPlayerDetected(false);
                //    Imanager.SetPlayerIN(false);
                //    Imanager.SetPlayerLogout(false);
                //    Idle_Timer = 0;
                //    PlayerPrefs.SetInt("prodPlayAgain", 0); // Enables the splash screen on load
                //    Application.LoadLevel(1);

                //}
            }
            else
            {
                HideSplash_Timer += Time.deltaTime;
                if (HideSplash_Timer > 10.0f)
                {
                    ForceHideSplash();
                    HideSplash_Timer = 0.0f;
                    if(Application.loadedLevel == 1) {
                        FindObjectOfType<TipController>().HideMan();
                    }
                }

                HideSplash();

                if (Imanager.isResetScene())
                {
                    Idle_Timer += Time.deltaTime;
                    if (Idle_Timer > 5.0f)
                    {
                        ExitGame();
                        if(Application.loadedLevel == 1) {
                            FindObjectOfType<TipController>().HideMan();
                        }

                        if(Application.loadedLevel != 1) {
                            FindObjectOfType<CurtainController> ().EndGame();
                        }
                    }
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            Kmanager.SensorAngle += 2;
            KinectWrapper.NuiCameraElevationSetAngle(Kmanager.SensorAngle);
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            Kmanager.SensorAngle -= 2;
            KinectWrapper.NuiCameraElevationSetAngle(Kmanager.SensorAngle);
        }
    }
Ejemplo n.º 12
0
 // LongPressTask
 public GestureDetector(GestureListener listener)
     : this(20, .4f, 1.1f, .15f, listener)
 {
 }
Ejemplo n.º 13
0
 protected override void EndListen(GestureListener listener)
 {
     listener.DragStarted -= ListenerDragStarted;
 }
Ejemplo n.º 14
0
 void Awake()
 {
     instance = this;
 }
 // Use this for initialization
 void Start()
 {
     completed = false;
     angle = PlayerPrefs.GetInt("Angle");
     if (Pause != null)
         Pause.SetActive(pause);
     count = 1;
     lerpObject = FindObjectOfType<LerpObject>();
     gestureListener = FindObjectOfType<GestureListener>();
     if (Application.loadedLevelName == "Menu")
     {
         lerpObject.enabled = true;
     }
     completed = true;
 }
Ejemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     controller = GetComponent <CharacterController>();
     // get the gestures listener
     gestureListener = Camera.main.GetComponent <GestureListener>();
 }
Ejemplo n.º 17
0
 public ViewGesturesRenderer(Context context)
     : base(context)
 {
     _listener = new GestureListener();
     _detector = new GestureDetector(context, _listener);
 }
 // Start is called before the first frame update
 void Start()
 {
     gestureListener = GestureListener.Instance;
 }
 public void addGestureConfirmListener(GestureListener listener)
 {
     listeners.Add(listener);
 }
Ejemplo n.º 20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Window.SetSoftInputMode(SoftInput.StateHidden);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ShoppingCart);

            voicePrefs = new ActivityPreferences(this, VOICE_PREFS_NAME);
            CheckVoicePrefs();

            talkBackEnabled = IsTalkBackEnabled();

            if (!talkBackEnabled)
            {
                InitiateNoTalkBackMode();
            }

            prefs = new ActivityPreferences(this, PREFS_NAME);
            items = prefs.GetPreferencesToList();

            listView             = FindViewById <ListView>(Resource.Id.ShopCartList);
            addItemButton        = FindViewById <Button>(Resource.Id.ShopCartAddItemButton);
            addItemEditText      = FindViewById <EditText>(Resource.Id.ShopCartAddItemEditText);
            removeItemButton     = FindViewById <Button>(Resource.Id.ShopCartRemoveItemButton);
            removeAllItemsButton = FindViewById <Button>(Resource.Id.ShopCartDeleteAllButton);

            gestureListener            = new GestureListener();
            gestureListener.LeftEvent += GestureLeft;
            gestureDetector            = new GestureDetector(this, gestureListener);

            cartItemsAdapter    = new CartItemsAdapter(prefs.GetCartItemPreferencesToList());
            listView.Adapter    = cartItemsAdapter;
            listView.ChoiceMode = ChoiceMode.Multiple;

            addItemButton.Click        += AddTextBoxProductToList;
            removeItemButton.Click     += RemoveTextBoxProductFromList;
            removeAllItemsButton.Click += RemoveAllItems;

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.DrawerLayout);
            toolbar      = FindViewById <SupportToolbar>(Resource.Id.Toolbar);
            navView      = FindViewById <NavigationView>(Resource.Id.NavView);

            drawerToggle = new ActionBarDrawerToggle(
                this,
                drawerLayout,
                Resource.String.openDrawer,
                Resource.String.closeDrawer
                );
            drawerLayout.AddDrawerListener(drawerToggle);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            drawerToggle.SyncState();

            navView.NavigationItemSelected += (sender, e) =>
            {
                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.NavItemShoppingCart:
                    OnOptionsItemSelected(e.MenuItem);
                    break;

                case Resource.Id.NavItemShoppingList:
                    GoToShoppingList();
                    break;
                }
            };
        }
Ejemplo n.º 21
0
        public RouteEditor()
        {
            // remove the navigation visibility.
            // This control is redundant with the multi-touch capabilities of the phone.
            //this.BingMap.NavigationVisibility = System.Windows.Visibility.Collapsed;
            // removes the copyright note
            this.BingMap.CopyrightVisibility = System.Windows.Visibility.Collapsed;
            // removes the Bing logo
            this.BingMap.LogoVisibility = System.Windows.Visibility.Collapsed;
            //this.BingMap.NavigationVisibility = System.Windows.Visibility.Collapsed;

            this.BingMap.Mode = new Microsoft.Phone.Controls.Maps.RoadMode();
            //this.BingMap.MouseDoubleClick += new EventHandler<Microsoft.Phone.Controls.Maps.MapMouseEventArgs>(BingMap_MouseDoubleClick);
            // this.BingMap.MousePan += new EventHandler<Microsoft.Phone.Controls.Maps.MapMouseDragEventArgs>(BingMap_MousePan);
            //this.BingMap.MapZoom += new EventHandler<Microsoft.Phone.Controls.Maps.MapZoomEventArgs>(BingMap_MapZoom);
            //this.BingMap.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(BingMap_MouseLeftButtonUp);

            layer = new Microsoft.Phone.Controls.Maps.MapLayer();
            this.BingMap.Children.Add(layer);

            List <RouteAvoidPair> avoids = new List <RouteAvoidPair>();

            int i             = 0;
            int selectedIndex = 0;

            while (Enum.IsDefined(typeof(MobileSrc.Commuter.Shared.RouteServices.Rest.RouteAvoid), i))
            {
                if ((int)DataContextManager.SelectedRoute.AvoidanceMeasures == i)
                {
                    selectedIndex = i;
                }
                avoids.Add(new RouteAvoidPair((MobileSrc.Commuter.Shared.RouteServices.Rest.RouteAvoid)i));
                i++;
            }

            highwayToggle.ItemsSource   = avoids;
            highwayToggle.SelectedIndex = selectedIndex;

            Binding highwayBinding = new Binding();

            highwayBinding.Source = DataContextManager.SelectedRoute;
            highwayBinding.Path   = new PropertyPath("AvoidanceMeasures");
            highwayBinding.Mode   = BindingMode.TwoWay;

            highwayToggle.SelectionChanged += new SelectionChangedEventHandler(highwayToggle_SelectionChanged);

            if (DataContextManager.SelectedRoute.RoutePoints.Count > 0)
            {
                RenderRoute();
            }
            else
            {
                // We have a new route
                PerformRouting(true);
            }

            if (DataContextManager.SelectedRoute.Name == null)
            {
                DataContextManager.SelectedRoute.Name = "untitled";
                this.Loaded += new RoutedEventHandler(RouteEditor_Loaded);
            }

            wayPointList.ItemsSource = DataContextManager.SelectedRoute.WayPoints;
            nameTextBox.Text         = DataContextManager.SelectedRoute.Name;

            menu = new ContextMenu();
            MenuItem routeMenu = new MenuItem();

            routeMenu.Header = "Route through here...";
            routeMenu.Click += new RoutedEventHandler(routeMenu_Click);

            MenuItem headerMenu = new MenuItem();

            headerMenu.Header      = "Route through...";
            headerMenu.FontSize    = 20;
            headerMenu.IsEnabled   = false;
            headerMenu.FontStretch = FontStretches.UltraExpanded;

            MenuItem customMenu = new MenuItem();

            customMenu.Header    = "Specify Custom Address...";
            customMenu.IsEnabled = true;
            customMenu.Click    += new RoutedEventHandler(customMenu_Click);

            menu.Items.Add(headerMenu);
            menu.Items.Add(new Separator());
            menu.Items.Add(routeMenu);
            menu.Items.Add(customMenu);

            GestureListener listener = GestureService.GetGestureListener(this.BingMap);

            listener.Hold += new EventHandler <GestureEventArgs>(listener_Hold);
        }
Ejemplo n.º 22
0
 public void InitializeComponent()
 {
     if (!this._contentLoaded)
     {
         this._contentLoaded = true;
         Application.LoadComponent(this, new Uri("/DBMeasurer;component/MainPage.xaml", 2));
         this.LayoutRoot = base.FindName("LayoutRoot");
         this.Gesture = base.FindName("Gesture");
         this.TimePanel = base.FindName("TimePanel");
         this.TB_Time = base.FindName("TB_Time");
         this.TB_TimeOfDay = base.FindName("TB_TimeOfDay");
         this.TB_Second = base.FindName("TB_Second");
         this.ContentPanel = base.FindName("ContentPanel");
         this.TB_DB = base.FindName("TB_DB");
         this.TB_MINDB = base.FindName("TB_MINDB");
         this.TB_MAXDB = base.FindName("TB_MAXDB");
     }
 }
Ejemplo n.º 23
0
 protected override void EndListen(GestureListener listener)
 {
     listener.PinchStarted -= ListenerPinchStarted;
 }
Ejemplo n.º 24
0
 protected override void EndListen(GestureListener listener)
 {
     listener.DoubleTap -= ListenerDoubleTap;
 }
 void Start()
 {
     isMoving        = false;
     dir             = 0;
     gestureListener = GestureListener.Instance;
 }
Ejemplo n.º 26
0
        public override bool OnTouchEvent(MotionEvent e)
        {
            TouchLocation   tlocation;
            TouchCollection collection = TouchPanel.Collection;
            Vector2         position   = Vector2.Zero;

            position.X = e.GetX(e.ActionIndex);
            position.Y = e.GetY(e.ActionIndex);
            UpdateTouchPosition(ref position);
            int id = e.GetPointerId(e.ActionIndex);
            int index;

            switch (e.ActionMasked)
            {
            // DOWN
            case MotionEventActions.Down:
            case MotionEventActions.PointerDown:
                index = collection.FindIndexById(e.GetPointerId(e.ActionIndex), out tlocation);
                if (index < 0)
                {
                    tlocation = new TouchLocation(id, TouchLocationState.Pressed, position);
                    collection.Add(tlocation);
                }
                else
                {
                    tlocation.State    = TouchLocationState.Pressed;
                    tlocation.Position = position;
                }
                break;

            // UP
            case MotionEventActions.Up:
            case MotionEventActions.PointerUp:
                index = collection.FindIndexById(e.GetPointerId(e.ActionIndex), out tlocation);
                if (index >= 0)
                {
                    tlocation.State   = TouchLocationState.Released;
                    collection[index] = tlocation;
                }
                break;

            // MOVE
            case MotionEventActions.Move:
                for (int i = 0; i < e.PointerCount; i++)
                {
                    id         = e.GetPointerId(i);
                    position.X = e.GetX(i);
                    position.Y = e.GetY(i);
                    UpdateTouchPosition(ref position);
                    index = collection.FindIndexById(id, out tlocation);
                    if (index >= 0)
                    {
                        tlocation.State    = TouchLocationState.Moved;
                        tlocation.Position = position;
                        collection[index]  = tlocation;
                    }
                }
                break;

            // CANCEL, OUTSIDE
            case MotionEventActions.Cancel:
            case  MotionEventActions.Outside:
                index = collection.FindIndexById(id, out tlocation);
                if (index >= 0)
                {
                    tlocation.State   = TouchLocationState.Invalid;
                    collection[index] = tlocation;
                }
                break;
            }


            if (gesture != null)
            {
                GestureListener.CheckForDrag(e, position);
                gesture.OnTouchEvent(e);
            }

            return(true);
        }
Ejemplo n.º 27
0
 public ViewGesturesRenderer()
 {
     _listener = new GestureListener();
     _detector = new GestureDetector(_listener);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// This is used to set the value of the attached DependencyProperty internally.
 /// </summary>
 /// <param name="obj">The object to set the GestureListener on.</param>
 /// <param name="value">The GestureListener.</param>
 private static void SetGestureListenerInternal(DependencyObject obj, GestureListener value)
 {
     obj.SetValue(GestureListenerProperty, value);
 }
    void Start()
    {
        // hide mouse cursor
        Screen.showCursor = false;

        // calculate max slides
        maxSides = horizontalSides.Count;

        // delay the first slide
        slideWaitUntil = Time.realtimeSinceStartup + slideChangeAfterDelay;

        targetRotation = transform.rotation;
        isSpinning = false;

        side = 0;
        menuX = 0;
        menuY = 0;

        if (horizontalSides[side] && horizontalSides[side].renderer)
        {
            horizontalSides[side].renderer.material.mainTexture = texList[menuX].tex[menuY];
        }

        // get the gestures listener
        gestureListener = Camera.main.GetComponent<GestureListener>();
    }
Ejemplo n.º 30
0
        protected override void StartController(GestureListener listener)
        {
            // Subscribe to desktop events
            var mouseZoom = new MouseScrollGesture(Zoom)
            {
                Multiplier = DesktopScrollSensitivity
            };
            var mouseAltZoom = new MouseMoveGesture(v => Zoom(v.x))
            {
                NeededButtons = new KeyCode[] {
                    KeyCode.LeftAlt,
                    KeyCode.Mouse1
                },
                Multiplier = Vector2.one * DesktopAltZoomSensitivity
            };
            var mousePan = new MouseMoveGesture(Pan)
            {
                NeededButtons = new KeyCode[] {
                    KeyCode.Mouse2
                },
                Multiplier = -Vector2.one * DesktopPanSensitivity
            };
            var mouseLeftClickRotate = new MouseMoveGesture(RotateAroundPivot)
            {
                NeededButtons = new KeyCode[] {
                    KeyCode.Mouse0
                },
                Multiplier = Vector2.one * DesktopRotateAroundPivotSensitivity
            };

            mouseLeftClickRotate.startMove += StartRotateAroundPivot;
            var mouseRotateCamera = new MouseMoveGesture(RotateCamera)
            {
                NeededButtons = new KeyCode[] {
                    KeyCode.Mouse1
                },
                ExcludedButtons = new KeyCode[] {
                    KeyCode.LeftAlt
                },
                Multiplier = Vector2.one * DesktopRotateCameraSensitivity,
            };

            mouseRotateCamera.startMove += StartRotateCamera;
            var moveCamera = new DirectionButtonsGesture(MoveCamera)
            {
                Multiplier      = DesktopMoveSensitivity,
                ExcludedButtons = new KeyCode[]
                {
                    KeyCode.LeftShift
                }
            };
            var moveCameraDouble = new DirectionButtonsGesture(MoveCamera)
            {
                Multiplier    = DesktopMoveSensitivity * DesktopShiftFactor,
                NeededButtons = new KeyCode[]
                {
                    KeyCode.LeftShift
                }
            };
            var mouseTeleport = new MouseClickGesture(OnDoubleClickOrTap)
            {
                ClickNumber = 2
            };

            listener.AddListeners(mouseZoom, mouseAltZoom, mousePan, mouseLeftClickRotate, mouseRotateCamera,
                                  moveCamera, moveCameraDouble, mouseTeleport);

            // Subscribe to touch events
            var touchZoom = new TouchPinchGesture(ZoomMobile)
            {
                Multiplier         = TouchZoomSensitivity,
                DetectionThreshold = TouchZoomThreshold
            };
            var touchPan = new TouchPanGesture(Pan)
            {
                FingersNumber      = 2,
                Multiplier         = -Vector2.one * TouchPanSensitivity,
                DetectionThreshold = TouchPanThreshold
            };
            var touchRotate = new TouchPanGesture(RotateAroundPivot)
            {
                Multiplier = Vector2.one * TouchRotateSensitivity
            };

            touchRotate.onPanStart += StartRotateAroundPivot;
            var touchTeleport = new TouchMultiTapGesture(OnDoubleClickOrTap)
            {
                TapNumber = 2
            };

            listener.AddListeners(touchZoom, touchPan, touchRotate, touchTeleport);
        }
Ejemplo n.º 31
0
 // Start is called before the first frame update
 void Start()
 {
     gestureListener = Camera.main.GetComponent <GestureListener>();
 }
Ejemplo n.º 32
0
    public PhotoViewerControl()
    {
      InitializeComponent();

      //
      // GetGestureListener creates new gesture listener
      // and attach it to _img.
      // By design from Toolkit.
      //
      _gesturelistener = GestureService.GetGestureListener(_img);

      _subscription = Observable.FromEvent<SizeChangedEventHandler, SizeChangedEventArgs>(
        a =>
        {
          return new SizeChangedEventHandler((x, xe) => a(xe));
        },
        h => this.SizeChanged += h,
        h => this.SizeChanged -= h)
        .Select(evtpat => evtpat.NewSize)
        .Subscribe(
        sz =>
        {
          if (_bmp == null)
            return;

          this.BitmapToFit(_bmp);
        }
        );
    }
Ejemplo n.º 33
0
        // LongPressTask

        public GestureDetector(GestureListener listener)
            : this(20, .4f, 1.1f, .15f, listener)
        {
        }
Ejemplo n.º 34
0
 protected override void EndListen(GestureListener listener)
 {
     listener.Flick -= ListenerFlick;
 }
Ejemplo n.º 35
0
 public GestureDetector(float halfTapSquareSize, float tapCountInterval, float longPressDuration, float maxFlingDelay, GestureListener listener)
 {
     TapSquareSize       = halfTapSquareSize;
     _tapCounterInterval = (long)(tapCountInterval * 1000000000L);
     LongPressSeconds    = longPressDuration;
     MaxFlingDelay       = (long)(maxFlingDelay * 1000000000L);
     _listener           = listener;
 }
Ejemplo n.º 36
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            ConfigurationManager.Initialise(PCLAppConfig.FileSystemStream.PortableStream.Current);
            DependencyInjection.RegisterInterfaces();

            cmdOpenCamera           = ConfigurationManager.AppSettings["CmdOpenCamera"];
            cmdTakePhoto            = ConfigurationManager.AppSettings["CmdTakePhoto"];
            cmdOpenCart             = ConfigurationManager.AppSettings["CmdOpenCart"];
            cmdOpenList             = ConfigurationManager.AppSettings["CmdOpenList"];
            cmdHelp                 = ConfigurationManager.AppSettings["CmdHelp"];
            cmdRemind               = ConfigurationManager.AppSettings["CmdRemind"];
            cmdTutorialRequest      = ConfigurationManager.AppSettings["CmdTutorialRequest"];
            cmdTutorialLikeShopLens = ConfigurationManager.AppSettings["CmdTutorialLikeShopLens"];

            userGuidPrefKey = ConfigurationManager.AppSettings["UserGuidPrefKey"];

            shopLensDbContext = ConnectToDatabase();

            prefs = PreferenceManager.GetDefaultSharedPreferences(this);

            talkBackEnabledIntentKey = ConfigurationManager.AppSettings["TalkBackKey"];

            voicePrefs = new ActivityPreferences(this, ConfigurationManager.AppSettings["VoicePrefs"]);
            CheckVoicePrefs();

            talkBackEnabled = IsTalkBackEnabled();

            if (!talkBackEnabled)
            {
                InitiateNoTalkBackMode();
            }

            // Set our view from the "main" layout resource.
            SetContentView(Resource.Layout.Main);
            camera2Frag = Camera2Fragment.NewInstance(this, this);

            if (savedInstanceState == null)
            {
                new Thread(() => { FragmentManager.BeginTransaction().Replace(Resource.Id.container, camera2Frag).Commit(); }
                           ).Start();
            }

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.DrawerLayout);
            toolbar      = FindViewById <SupportToolbar>(Resource.Id.Toolbar);
            navView      = FindViewById <NavigationView>(Resource.Id.NavView);
            rootView     = FindViewById <CoordinatorLayout>(Resource.Id.root_view);

            drawerToggle = new Android.Support.V7.App.ActionBarDrawerToggle(
                this,
                drawerLayout,
                Resource.String.openDrawer,
                Resource.String.closeDrawer
                );
            drawerLayout.AddDrawerListener(drawerToggle);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            drawerToggle.SyncState();

            gestureListener            = new GestureListener();
            gestureListener.LeftEvent += GestureLeft;
            gestureDetector            = new GestureDetector(this, gestureListener);

            navView.NavigationItemSelected += (sender, e) =>
            {
                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.NavItemShoppingCart:
                    StartCartIntent();
                    break;

                case Resource.Id.NavItemShoppingList:
                    StartListIntent();
                    break;
                }
            };
        }
 void Awake()
 {
     instance = this;
 }
Ejemplo n.º 38
0
 public GestureDetector(float halfTapSquareSize, float tapCountInterval, float longPressDuration, float maxFlingDelay, GestureListener listener)
 {
     TapSquareSize = halfTapSquareSize;
     _tapCounterInterval = (long)(tapCountInterval * 1000000000L);
     LongPressSeconds = longPressDuration;
     MaxFlingDelay = (long)(maxFlingDelay * 1000000000L);
     _listener = listener;
 }
Ejemplo n.º 39
0
 protected override void EndListen(GestureListener listener)
 {
     listener.Hold -= ListenerHold;
 }
Ejemplo n.º 40
0
    void Start()
    {
        // hide mouse cursor
        Cursor.visible = false;

        // calculate max slides and textures
        maxSides = horizontalSides.Count;
        maxTextures = slideTextures.Count;

        // delay the first slide
        slideWaitUntil = Time.realtimeSinceStartup + slideChangeAfterDelay;

        targetRotation = transform.rotation;
        isSpinning = false;

        tex = 0;
        side = 0;

        if(horizontalSides[side] && horizontalSides[side].GetComponent<Renderer>())
        {
            horizontalSides[side].GetComponent<Renderer>().material.mainTexture = slideTextures[tex];
        }

        // get the gestures listener
        gestureListener = Camera.main.GetComponent<GestureListener>();
    }
Ejemplo n.º 41
0
 public SwipeViewRenderer(Context context) : base(context)
 {
     _listener = new GestureListener();
     _detector = new GestureDetector(_listener);
 }
Ejemplo n.º 42
0
 protected override void EndListen(GestureListener listener)
 {
     listener.PinchDelta -= ListenerPinchDelta;
 }
Ejemplo n.º 43
0
 public static void addListener(GestureListener listener)
 {
     listeners.Add(listener);
 }