Example #1
0
        public ShellPage(IDialogService dialogService, IDataService dataService, IEventAggregator eventAggregator)
        {
            InitializeComponent();

            if (win.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                return;
            }

            _dialogService = dialogService;
            _dataService   = dataService;

            _gestureService = GestureService.GetForCurrentView();
            _gestureService.MenuRequested   += (s, e) => ShellView.IsPaneOpen = true;
            _gestureService.SearchRequested += (s, e) =>
            {
                ShellView.IsPaneOpen = true;
                ShellView.AutoSuggestBox?.Focus(FocusState.Programmatic);
            };

            _eventAggregator = eventAggregator;
            _eventAggregator.GetEvent <Messages.ShowEditorMessage>().Subscribe(item =>
            {
                EditSplitView.IsPaneOpen = true;
                SideEditView.DataContext = item;
            });

            ShellView.Initialize();
        }
Example #2
0
        public static INavigationService AttachGestures(this INavigationService service, Window window, params Gesture[] gestures)
        {
            INavigationService2 service2        = service as INavigationService2;
            IGestureService     gesture_service = GestureService.GetForCurrentView(window.CoreWindow);

            foreach (Gesture gesture in gestures)
            {
                switch (gesture)
                {
                case Gesture.Back:
                    AddOnlyOne(gesture_service.BackRequestedCallbacks, service2.FrameFacade.Id, async() => await service.GoBackAsync());
                    break;

                case Gesture.Forward:
                    AddOnlyOne(gesture_service.ForwardRequestedCallbacks, service2.FrameFacade.Id, async() => await service.GoForwardAsync());
                    break;

                case Gesture.Refresh:
                    AddOnlyOne(gesture_service.RefreshRequestedCallbacks, service2.FrameFacade.Id, async() => await service.RefreshAsync());
                    break;
                }
            }
            return(service);

            void AddOnlyOne(Dictionary <string, Action> dictionary, string id, Action action)
            {
                dictionary.Remove(id);
                dictionary.Add(id, action);
            }
        }
Example #3
0
        bool RegisterGestures()
        {
            IGestureService gestureService;

            try
            {
                if (Preferences.Instance.UseRootForGestures)
                {
                    gestureService = new RootGestures(GetSuperUser());
                }
                else
                {
                    gestureService = new AccessibilityGestureService(this);
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(this, e.Message, ToastLength.Short).Show();
                return false;
            }

            _gestureService = gestureService;
            AutomataApi.RegisterGestures(_gestureService);
            return true;
        }
Example #4
0
        public bool Stop()
        {
            StopScript();

            if (!ServiceStarted)
            {
                return false;
            }

            _sshotService.Dispose();
            _sshotService = null;

            _gestureService.Dispose();
            _gestureService = null;

            _superUser?.Dispose();
            _superUser = null;

            ScreenshotManager.ReleaseMemory();
            ImageLocator.ClearCache();

            _windowManager.RemoveView(_layout);
            _windowManager.RemoveView(_highlightView);
            ServiceStarted = false;

            HideForegroundNotification();

            return true;
        }
Example #5
0
        public GestureViewModel(IGestureService gestureService, IShellEvents shellEvents)
        {
            Switch = ReactiveCommand.Create(() => { Block = !Block; });

            this.WhenActivated((CompositeDisposable disposable) =>
            {
                shellEvents.SetTitle("Gesture Example");

                Observable.FromEventPattern <GestureEventArgs>(
                    h => gestureService.GoBackRequested += h,
                    h => gestureService.GoBackRequested -= h)
                .Subscribe(e =>
                {
                    if (!e.EventArgs.Handled && Block)
                    {
                        e.EventArgs.Handled = true;
                    }
                })
                .DisposeWith(disposable);

                Disposable
                .Create(() =>
                {
                    // This is called when the view model is out of view.
                })
                .DisposeWith(disposable);
            });

            Summary = "This sample shows the GesstureService.\nWhen the switch is ON navigation will not work.\n" +
                      "This is because we handle it inside the viewmodel and we use the service in our main activity for back navigation.";
        }
Example #6
0
        protected override void OnAttached()
        {
            base.OnAttached();

            _gestureService = BootStrapper.Resolve <IGestureService>();

            AssociatedObject.RequestNavigate += HandleRequestNavigate;
        }
Example #7
0
 public ItemPageViewModel(IDataService dataService, Lazy <IGestureService> gestureService,
                          INavigationService navigationService, IJumpListService jumpListService)
 {
     _navigationService = navigationService ?? throw new ArgumentNullException(nameof(navigationService));
     _jumpListService   = jumpListService ?? throw new ArgumentNullException(nameof(jumpListService));
     _dataService       = dataService ?? throw new ArgumentNullException(nameof(dataService));
     _gestureService    = gestureService.Value ?? throw new ArgumentNullException(nameof(gestureService));
 }
 private IGestureService getGestureService()
 {
     if (null == gestureService)
     {
         gestureService = SpringUtil.getService<IGestureService>();
         gestureService.enableGestureService(getSensorService().getSensor(SENSOR_IDX));
     }
     return gestureService;
 }
Example #9
0
 public PopupEx(IGestureService gestureService)
     : this()
 {
     _gestureService = gestureService;
     if (_gestureService is IGestureService2 g && g != null)
     {
         g.BackRequested += Gesture_BackRequested2;
     }
 }
        public Child2ViewModel(IGestureService gestureService)
        {
            DelayCommand = new RelayCommand(() =>
            {
                gestureService.SetBusy();
                System.Threading.Thread.Sleep(3123);
            });

            _disposable = Disposable.Create(() =>
            {
                DelayCommand = null;
            });
        }
Example #11
0
 public DefaultBootStrapperStrategy(
     ILifecycleStrategy lifecycleStrategy,
     IMessengerService messengerService,
     IExtendedSessionStrategy extendedSessionStrategy,
     IGestureService gestureService)
 {
     _lifecycleStrategy       = lifecycleStrategy;
     _messengerService        = messengerService;
     _extendedSessionStrategy = extendedSessionStrategy;
     _gestureService          = gestureService;
     _status = new ValueWithHistory <BootstrapperStates>(BootstrapperStates.None, (date, before, after) =>
     {
         LogThis($"{nameof(Status)} changed from {before} to {after}", caller: $"{nameof(DefaultBootStrapperStrategy)}");
     });
 }
Example #12
0
        public ShellPage(IDialogService dialogService, IDataService dataService)
        {
            InitializeComponent();

            if (win.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                return;
            }

            _gestureService = GestureService.GetForCurrentView();
            _dialogService  = dialogService;
            _dataService    = dataService;

            ShellView.Initialize();
            ShellView.Loaded += (s, e) =>
            {
                SetupGestures();
            };
        }
        public ShellPage(IGestureService gestureService, IDialogService dialogService)
        {
            InitializeComponent();

            if (win.ApplicationModel.DesignMode.DesignModeEnabled ||
                win.ApplicationModel.DesignMode.DesignMode2Enabled)
            {
                return;
            }

            _gestureService = gestureService;
            _dialogService  = dialogService;

            ShellView.Start();

            ShellView.Loaded += (s, e) =>
            {
                SetupGestures();
                SetupBackButton();
                SetupControlBox();
            };
        }
 private void CreateGestureService()
 {
     GestureService = OnCreateGestureService();
     GestureService.GoBackRequested    += OnGoBackRequested;
     GestureService.GoForwardRequested += OnGoForwardRequested;
 }
        private void initialize(int sensorIdx)
        {
            Enabled = true;
            LastGesture = String.Empty;
            lastGestureTime = DateTime.Now;

            processService = SpringUtil.getService<IProcessService>();
            sensorService = SpringUtil.getService<ISensorService>();
            shortcutService = SpringUtil.getService<IShortcutService>();
            gestureService = SpringUtil.getService<IGestureService>();
            configService = SpringUtil.getService<IConfigService>();

            this.sensorIdx = sensorIdx;
            sensorService.startSensor(sensorIdx);
            gestureService.enableGestureService(sensorService.getSensor(sensorIdx));
        }
        private void initialize()
        {
            confService = SpringUtil.getService<IConfigService>();
            confService.ReadConfigFromFile();

            sensorService = SpringUtil.getService<ISensorService>();
            skeletonService = SpringUtil.getService<ISkeletonService>();
            gestureService = SpringUtil.getService<IGestureService>();

            updateTimer = new DispatcherTimer(DispatcherPriority.SystemIdle);
            updateTimer.Tick += new EventHandler(updateTimer_Tick);
            updateTimer.Interval = TimeSpan.FromMilliseconds(INTERVAL);
            updateTimer.Start();

            highlightView = new HighlightView(SENSOR_IDX);
            highlightView.Show();

            bubble_settingsControl.InitCloseAnimation(story_hide_settings_bubble_BeginStoryboard.Storyboard, this);
        }
        private void initialize(int sensorIdx)
        {
            Enabled = true;

            cameraService = SpringUtil.getService<ICameraService>();
            sensorService = SpringUtil.getService<ISensorService>();
            skeletonService = SpringUtil.getService<ISkeletonService>();
            gestureService = SpringUtil.getService<IGestureService>();

            sensorService.startSensor(sensorIdx);
            cameraService.startCameraService(sensorService.getSensor(sensorIdx));
            skeletonService.enableSkeleton(sensorService.getSensor(sensorIdx));
            gestureService.enableGestureService(sensorService.getSensor(sensorIdx));

            imgHandLeft = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_LEFT));
            imgHandRight = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_RIGHT));
            imgHandLeftActive = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_LEFT_ACTIVE));
            imgHandRightActive = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_RIGHT_ACTIVE));

            imgHandLeft.Freeze();
            imgHandRight.Freeze();
            imgHandLeftActive.Freeze();
            imgHandRightActive.Freeze();
        }
Example #18
0
 public static void RegisterGestures(IGestureService GestureService)
 {
     _gesture = GestureService;
 }