void SetupRecoverDialogGestures() { var gestureListener = GestureService.GetGestureListener(RecoverDialog); gestureListener.DragDelta += RecoverDiag_DragDelta; gestureListener.DragCompleted += RecoverDiag_DragEnd; }
public static INavigationService AttachGestures(this INavigationService service, Window window, params Gesture[] gestures) { var service2 = service as INavigationService2; var gesture_service = GestureService.GetForCurrentView(window.CoreWindow); foreach (var 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); } }
public MyControl() { InitializeComponent(); var gl = GestureService.GetGestureListener(asd); gl.Flick += new EventHandler <FlickGestureEventArgs>(GestureListener_Flick); }
public PrismApplicationBase() { InternalInitialize(); (this as IPrismApplicationEvents).WindowCreated += (s, e) => { GestureService.SetupForCurrentView(e.Window.CoreWindow); }; base.Suspending += async(s, e) => { if (ApplicationData.Current.LocalSettings.Values.ContainsKey("Suspend_Data")) { ApplicationData.Current.LocalSettings.Values.Remove("Suspend_Data"); } ApplicationData.Current.LocalSettings.Values.Add("Suspend_Data", DateTime.Now.ToString()); var deferral = e.SuspendingOperation.GetDeferral(); try { OnSuspending(); await OnSuspendingAsync(); } finally { deferral.Complete(); } }; base.Resuming += async(s, e) => { await InternalStartAsync(new StartArgs(ResumeArgs.Create(ApplicationExecutionState.Suspended), StartKinds.Resume)); }; }
public static INavigationService Create(Frame frame, CoreWindow window, params Gestures[] gestures) { frame = frame ?? new Frame(); var gesture_service = GestureService.GetForCurrentView(window); var navigation_service = new NavigationService(frame); foreach (var gesture in gestures) { switch (gesture) { case Gestures.Back: gesture_service.BackRequested += async(s, e) => await navigation_service.GoBackAsync(); break; case Gestures.Forward: gesture_service.ForwardRequested += async(s, e) => await navigation_service.GoForwardAsync(); break; case Gestures.Refresh: gesture_service.RefreshRequested += async(s, e) => await navigation_service.RefreshAsync(); break; } } return(navigation_service); }
static int setSwipeListener(int L) { if (!LuaCommon.CheckAndShowArgsError(L, LConst.UserData, LConst.Function)) { return(0); } Object control = Lua.Lua_touserdata(L, 2); int callbackF = Lua.LuaL_ref(L, Lua._LUA_REGISTRYINDEX); if (control != null && callbackF != 0) { var pi = control.GetType().GetProperty("View_"); var fe = pi.GetValue(control, null); if (EventsList.Any(c => (c.FE == fe as FrameworkElement) && c.EventsName.Equals("setSwipeListener"))) { ClearLastUselessEvents(fe as FrameworkElement, "setSwipeListener"); } var lisenter = GestureService.GetGestureListener(fe as FrameworkElement); EventHandler <Microsoft.Phone.Controls.FlickGestureEventArgs> FlickGestureHandler = null; lisenter.Flick += FlickGestureHandler = (s, e) => { Dictionary <string, object> dict = new Dictionary <string, object>(); string value = string.Empty; if (e.Direction == Orientation.Horizontal) { if (e.HorizontalVelocity > 0) { value = "right"; } else { value = "left"; } } else if (e.Direction == Orientation.Vertical) { if (e.VerticalVelocity > 0) { value = "down"; } else { value = "up"; } } dict.Add("direction", value); LuaManager.GetLuaManager(L).ExecuteCallBackFunctionWithAnyParams(callbackF, dict, control); }; EventsList.Add(new GestureEventRegisterInfo() { FE = fe as FrameworkElement, EventsName = "setSwipeListener", FlickGestureEventHandler = FlickGestureHandler }); } return(0); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { _propertyInfos = typeof(Survelem).GetProperties().ToList(); gestureListener = GestureService.GetGestureListener(this); gestureListener.Flick += this.GlFlick; if (e.NavigationMode == NavigationMode.Back) { return; } cmb1.SelectionChanged += cmb1_SelectionChanged; _questions = StateService.CurrentQuestionGroup.Questions; if (_questions == null) { return; } _currentQuestion = _questions.First(); tb1ForCmb1.TextChanged += tb1ForCmb1_TextChanged; await LoadQuestionData(); }
void CreateGameGrid() { currentTime = new TimeSpan(0, 0, 0); //Settings.Grid.Clear(); gameGrid = new GameGrid(); gameGrid.NextLevel += new EventHandler(gameGrid_NextLevel); gameGrid.EndGame += new EventHandler(gameGrid_EndGame); gameGrid.ManipulationDelta += new EventHandler <ManipulationDeltaEventArgs>(gameGrid_ManipulationDelta); var gl = GestureService.GetGestureListener(gameGrid); //gl.PinchStarted += new EventHandler<PinchStartedGestureEventArgs>(gl_PinchStarted); //gl.PinchDelta += new EventHandler<PinchGestureEventArgs>(gl_PinchDelta); gl.DoubleTap += new EventHandler <Microsoft.Phone.Controls.GestureEventArgs>(gl_DoubleTap); scale = new ScaleTransform(); scale.ScaleX = 1.0; scale.ScaleY = 1.0; gameGrid.RenderTransform = scale; ContentPanel.Children.Add(gameGrid); tbTime.Text = String.Format("{0:D2}:{1:D2}", Settings.GameTime.Minutes, Settings.GameTime.Seconds); myDispatcherTimer.Interval = new TimeSpan(0, 0, 1); myDispatcherTimer.Tick += new EventHandler(Each_Tick); myDispatcherTimer.Start(); }
/// <summary> /// Gets all the template parts and initializes the corresponding state. /// </summary> public override void OnApplyTemplate() { if (_track != null) { _track.SizeChanged -= SizeChangedHandler; } if (_thumb != null) { _thumb.SizeChanged -= SizeChangedHandler; } base.OnApplyTemplate(); _root = GetTemplateChild(SwitchRootPart) as Grid; UIElement background = GetTemplateChild(SwitchBackgroundPart) as UIElement; _backgroundTranslation = background == null ? null : background.RenderTransform as TranslateTransform; _track = GetTemplateChild(SwitchTrackPart) as Grid; _thumb = GetTemplateChild(SwitchThumbPart) as Border; _thumbTranslation = _thumb == null ? null : _thumb.RenderTransform as TranslateTransform; if (_root != null && _track != null && _thumb != null && (_backgroundTranslation != null || _thumbTranslation != null)) { GestureListener gestureListener = GestureService.GetGestureListener(_root); gestureListener.DragStarted += DragStartedHandler; gestureListener.DragDelta += DragDeltaHandler; gestureListener.DragCompleted += DragCompletedHandler; _track.SizeChanged += SizeChangedHandler; _thumb.SizeChanged += SizeChangedHandler; } ChangeVisualState(false); }
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(); }
public GestureListenerBehavioursBehaviour(Control element) { var gestureListener = GestureService.GetGestureListener(element); gestureListener.Tap += TapCalled; gestureListener.DoubleTap += DoubleTapCalled; //element.MouseEnter += new MouseEventHandler(MouseIsOverChanged); }
private void _startAll() { LoggingService.Start(); AlertService.Start(); AppService.Start(); RenderingService.Start(); GestureService.Start(this); }
/// <summary> /// Create a new LoopingSelectorItem. /// </summary> public LoopingSelectorItem() { DefaultStyleKey = typeof(LoopingSelectorItem); MouseLeftButtonDown += LoopingSelectorItem_MouseLeftButtonDown; MouseLeftButtonUp += LoopingSelectorItem_MouseLeftButtonUp; LostMouseCapture += LoopingSelectorItem_LostMouseCapture; GestureService.GetGestureListener(this).Tap += new EventHandler <GestureEventArgs>(LoopingSelectorItem_Tap); }
public override void RegisterTypes(IContainerRegistry container) { container.Register <IDataService, DataService>(); container.Register <IJumpListService, JumpListService>(); container.RegisterInstance(new Lazy <IGestureService>(() => GestureService.GetForCurrentView())); container.RegisterForNavigation <MainPage, MainPageViewModel>(nameof(MainPage)); container.RegisterForNavigation <ItemPage, ItemPageViewModel>(nameof(ItemPage)); }
internal static void ForwardWindowCreated(WindowCreatedEventArgs args) { GestureService.SetupWindowListeners(args.Window.CoreWindow); foreach (var item in WindowCreatedCallBacks.ToArray()) { item.Value?.Invoke(args); } _instances.Add(args.Window); }
// Constructor public MainPage() { InitializeComponent(); Loaded += new RoutedEventHandler(MainPage_Loaded); var gl = GestureService.GetGestureListener(LayoutRoot); gl.Flick += new EventHandler <FlickGestureEventArgs>(GestureListener_Flick); gl.DragDelta += new EventHandler <DragDeltaGestureEventArgs>(GestureListener_DragDelta); gl.DoubleTap += new EventHandler <Microsoft.Phone.Controls.GestureEventArgs>(GestureListener_Doubletap); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); _image = GetTemplateChild("ImgZoom") as Image; var gl = GestureService.GetGestureListener(_image); gl.PinchDelta += OnPinchDelta; gl.PinchStarted += OnPinchStarted; gl.DragDelta += OnDragDelta; _image.DoubleTap += OnDoubleTap; }
static void ClearLastUselessEvents(FrameworkElement fe, string eventName) { var lisenter = GestureService.GetGestureListener(fe as FrameworkElement); List <GestureEventRegisterInfo> uselessEventsList_ = new List <GestureEventRegisterInfo>(); foreach (var e in EventsList) { if (e.FE == fe as FrameworkElement) { if (e.EventsName.Equals(eventName)) { if (e.EventsName.Equals("setTapListener") && e.TapGestureEventHandler != null) { fe.Tap -= e.TapGestureEventHandler; uselessEventsList_.Add(e); } else if (e.EventsName.Equals("setDoubleTapListener") && e.TapGestureEventHandler != null) { fe.DoubleTap -= e.TapGestureEventHandler; uselessEventsList_.Add(e); } else if (e.EventsName.Equals("setLongTapListener") && e.GestureEventHandler != null) { lisenter.Hold -= e.GestureEventHandler; uselessEventsList_.Add(e); } else if (e.EventsName.Equals("setSwipeListener") && e.FlickGestureEventHandler != null) { lisenter.Flick -= e.FlickGestureEventHandler; uselessEventsList_.Add(e); } else if (e.EventsName.Equals("setDragListener") && e.DragDeltaGestureEventHandler != null) { fe.ManipulationDelta -= e.DragDeltaGestureEventHandler; uselessEventsList_.Add(e); } else if (e.EventsName.Equals("setRotationListener") && e.RotationDeltaEventHandler != null) { fe.ManipulationDelta -= e.RotationDeltaEventHandler; uselessEventsList_.Add(e); } else if (e.EventsName.Equals("setScaleListener") && e.ScaleDeltaEventHandler != null) { fe.ManipulationDelta -= e.ScaleDeltaEventHandler; uselessEventsList_.Add(e); } } } } foreach (var e in uselessEventsList_) { EventsList.Remove(e); } }
public SwipeContentControl() { this.RenderTransform = new TranslateTransform(); this.DefaultStyleKey = typeof(ContentControl); GestureListener listener = GestureService.GetGestureListener(this); listener.DragStarted += DragStarted; listener.DragDelta += DragDelta; listener.DragCompleted += DragCompleted; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ThemeService.FirstRun(); SetContentView(Resource.Layout.activity_main); this.WireUpControls(); this.SetToolbarWithDrawer(Toolbar, Drawer, 0, 0); Ioc.Resolve <PermissionsService>().SetActivity(this); Ioc.Resolve <FileService>().SetActivity(this); NavigationService = Ioc.Resolve <NavigationService>() .SetFragmentManager(SupportFragmentManager) .SetFragmentContainerId(Resource.Id.FragmentContainerView); GestureService = Ioc.Resolve <GestureService>(); this.WhenActivated((CompositeDisposable disposable) => { Observable.FromEventPattern <GestureEventArgs>( h => GestureService.GoBackRequested += h, h => GestureService.GoBackRequested -= h) .Subscribe(x => { if (!x.EventArgs.Handled && NavigationService.CanGoBack()) { NavigationService.GoBack(); x.EventArgs.Handled = true; } }) .DisposeWith(disposable); Ioc.Resolve <IShellEvents>() .WhenTitleSet() .Throttle(TimeSpan.FromMilliseconds(150)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(title => Toolbar.Title = title) .DisposeWith(disposable); Disposable .Create(() => { }) .DisposeWith(disposable); }); NavigationService.NavigateTo(PageKeys.HomePage); }
public bool HandleTouchDown(Vector3 screenPos) { dragged = null; isDragging = false; touched = null; if (!GestureService.IsOnUI()) { var t = Utils.GetInputTargetOnGrid(screenPos, sceneSystem, cameraService.activeCamera, gridService); if (t != null && !t.hasGrid || (t != null && t.hasGrid && t.grid.cells.Count > 0)) { touched = t; } } return(false); }
private void CreateEventHandlers() { SizeChanged += new SizeChangedEventHandler(LoopingSelector_SizeChanged); GestureListener listener = GestureService.GetGestureListener(this); listener.DragStarted += new EventHandler <DragStartedGestureEventArgs>(listener_DragStarted); listener.DragDelta += new EventHandler <DragDeltaGestureEventArgs>(listener_DragDelta); listener.DragCompleted += new EventHandler <DragCompletedGestureEventArgs>(listener_DragCompleted); listener.Flick += new EventHandler <FlickGestureEventArgs>(listener_Flick); listener.Tap += new EventHandler <GestureEventArgs>(listener_Tap); AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(LoopingSelector_MouseLeftButtonDown), true); AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(LoopingSelector_MouseLeftButtonUp), true); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } //// Create a Frame to act navigation context and navigate to the first page //var rootFrame = new Frame(); //if (!rootFrame.Navigate(typeof(MainPage))) //{ // throw new Exception("Failed to create initial page"); //} LoggingService.Init(AppDatabase.Current); LoggingService.Start(); LoggingService.LogInformation("launching app...", "App.OnLaunched"); AlertService.Init(AppDatabase.Current); AlertService.Start(); LoggingService.LogInformation("initialized alerts...", "App.OnLaunched"); GestureService.Init(); LoggingService.LogInformation("initialized gensture manager...", "App.OnLaunched"); AppDatabase.Current.LoadInstances(); LoggingService.LogInformation("loaded appstate ...", "App.OnLaunched"); AppService.Init(); AppService.Start(); LoggingService.LogInformation("initialized app services ...", "App.OnLaunched"); WindowLayoutService.Init(); LoggingService.LogInformation("initialized window layout services ...", "App.OnLaunched"); // Place the frame in the current Window and ensure that it is active Window.Current.Content = new MasterPage(false); //rootFrame; Window.Current.Activate(); }
public UCPullToRefreshListBox() { Application.Current.Resources.Source = new Uri( "/PullToRefreshListBox;component/Ressources/Ressources.xaml", UriKind.Relative); Style = (Style)Application.Current.Resources["PullToRefreshListBoxStyle2"]; Loaded += OnLoaded; #region GestureListenerConfig var gl = GestureService.GetGestureListener(this); gl.DragDelta += GestureListener_OnDragDelta; gl.DragCompleted += GestureListener_OnDragCompleted; #endregion }
private void AddItem() { Border b = new Border() { Width = 100, Height = 100, Background = new SolidColorBrush(Color.FromArgb(255, (byte)rnd.Next(256), (byte)rnd.Next(256), (byte)rnd.Next(256))), BorderThickness = new Thickness(2), Margin = new Thickness(8) }; b.BorderBrush = (SolidColorBrush)Resources["PhoneForegroundBrush"]; GestureListener listener = GestureService.GetGestureListener(b); listener.Tap += new EventHandler <GestureEventArgs>(WrapPanelSample_Tap); wrapPanel.Children.Add(b); }
protected override void OnAttached() { base.OnAttached(); AssociatedObject.RenderTransform = new CompositeTransform(); _listener = GestureService.GetGestureListener(AssociatedObject); _listener.PinchDelta += OnPinchDelta; _listener.PinchStarted += OnPinchStarted; _listener.DragStarted += OnDragStarted; _listener.DragDelta += OnDragDelta; _listener.DragCompleted += OnDragCompleted; _listener.Flick += OnFlick; _listener.Tap += OnTap; _listener.DoubleTap += OnDoubleTap; // wait for the RootVisual to be initialized //Dispatcher.BeginInvoke(() => // ((PhoneApplicationFrame)Application.Current.RootVisual).OrientationChanged += OrientationChanged); }
private void _cleanUpAll() { SettingsPane.GetForCurrentView().CommandsRequested -= _vm.onCommandsRequested; //SearchPane.GetForCurrentView().QuerySubmitted -= _vm.onQuerySubmitted; RenderingService.Stop(); GestureService.Stop(this); ccDrawingSurfaceBottom.Content = null; ccDrawingSurfaceTop.Content = null; _fvm.ChangeState -= _fvm_ChangeState; DownloadService.Current.DownloadCountChanged -= Current_DownloadCountChanged; Messenger.Default.Unregister <GeneralSystemWideMessage>(this, DoGeneralSystemWideMessageCallback); AppService.NetworkConnectionChanged -= AppService_NetworkConnectionChanged; WindowLayoutService.OnWindowLayoutRaised -= WindowLayoutService_OnWindowLayoutRaised; }
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 ThreadPageSlideView() { InitializeComponent(); this._toggleAppBar = ToggleAppBarDummy; HideTitleOverlay(); VisualStateManager.GoToState(this, "Loading", false); var gestures = GestureService.GetGestureListener(this.LayoutRoot); gestures.DoubleTap += ShowThreadTitle; gestures.PinchStarted += OnLayoutPinchStarted; gestures.PinchDelta += OnLayoutPinchDelta; gestures.PinchCompleted += OnLayoutPinchCompleted; Loaded += OnLoad; Unloaded += OnUnload; }
public bool HandleDragStart(Vector3 screenPos) { if (!GestureService.IsOnUI()) { inertia = false; isDragging = true; currentPos = screenPos; StartDragEntity(); #if UNITY_EDITOR startPos = currentPos; #endif } else { inertia = false; isDragging = false; } return(false); }