public static void Init() { if (keyboardHelper == null) { keyboardHelper = DependencyService.Get <IKeyboardHelper>(); } }
/// <summary> /// Invoked when the add new post button is clicked. /// </summary> /// <param name="obj">The Object</param> private void AddNewPost(object obj) { if (string.IsNullOrEmpty(NewPostText)) { MainPage.DisplayAlert("Alert", "Please add a message.", "OK"); return; } Post post = new Post(this) { ID = postId, Owner = LoggedInUser }; MessagePostViewModel.AddNewPost(ref post, LoggedInUser, NewPostText); Posts.Insert(0, post); NewPostText = string.Empty; IKeyboardHelper dependencyService = DependencyService.Get <IKeyboardHelper>(); dependencyService?.HideKeyboard(); }
public InfiniteListView(ListViewCachingStrategy cachingStrategy) : base(cachingStrategy) { _keyboardHelper = FreshIOC.Container.Resolve <IKeyboardHelper>(); _gestureDismiss = new TapGestureRecognizer { Command = new Command(() => _keyboardHelper.HideKeyboard()) }; }
private void AddComment(object selectedItem) { if (!string.IsNullOrEmpty(NewCommentText)) { this.Comments.Add(new PostComment(ViewModel.LoggedInUser, NewCommentText, DateTime.Now)); NewCommentText = string.Empty; IKeyboardHelper dependencyService = DependencyService.Get <IKeyboardHelper>(); dependencyService?.HideKeyboard(); } }
public PostFeedDetailPageViewModel(IServiceMapper serviceMapper, IAppUser appUser, IPostFeedManager postFeedManager, INavigationService navigationService, INavigationStackService navigationStackService, PostFeedDetailsPageValidator validator) : base(serviceMapper, appUser) { _postFeedManager = postFeedManager; _navigationService = navigationService; _navigationStackService = navigationStackService; _validator = validator; _keyboardHelper = AppUnityContainer.InstanceDependencyService.Get <IKeyboardHelper>(); _keyValueCacheUtility = AppUnityContainer.InstanceDependencyService.Get <IKeyValueCacheUtility>(); Title = AppStrings.TitleComments; }
internal InputManager(IKeyboardHelper keyboardHelper, IMouseHelper mouseHelper, IGamePadHelper gamePadHelper) { if(keyboardHelper == null) throw new ArgumentNullException("keyboardHelper"); if (mouseHelper == null) throw new ArgumentNullException("mouseHelper"); if (gamePadHelper == null) throw new ArgumentNullException("gamePadHelper"); Keyboard = keyboardHelper; Mouse = mouseHelper; GamePads = gamePadHelper; }
public AlptuluptaGame(IShapeFactory shapeFactory, IKeyboardHelper keyboardHelper, IMouseHelper mouseHelper) { this.shapeFactory = shapeFactory; this.keyboardHelper = keyboardHelper; this.mouseHelper = mouseHelper; graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; IsMouseVisible = true; updateables.Add(keyboardHelper); updateables.Add(mouseHelper); }
public static void Init() { if (keyboardHelper == null) { keyboardHelper = DependencyService.Get<IKeyboardHelper>(); } }
public MainViewModel(IAppProperties properties, INotificationManager notificationManager, IKeyboardHelper keyboardHelper) { _properties = properties; _notificationManager = notificationManager; _memories = new List <Memory>(); MessagingCenter.Subscribe <ThemeService, bool>(this, ThemeService.TOOLS_SHOULD_BE_BLACK_CHANGED, SetToolbarIcons); AddMemoryCommand = new Command(() => { if (string.IsNullOrWhiteSpace(MemoryInput)) { return; } var newMemory = new Memory { Description = MemoryInput }; newMemory.Occurrences.Add(SystemTime.Now()); _memories.Add(newMemory); RaisePropertyChanged(nameof(Memories)); MemoryInput = null; notificationManager.SetMemories(_memories); CringeFlashTrigger = !CringeFlashTrigger; }); AddOccurrenceCommand = new Command(arg => { var memory = (Memory)arg; memory.Occurrences.Insert(0, SystemTime.Now()); MemoryInput = ""; keyboardHelper.HideKeyboard(); CringeFlashTrigger = !CringeFlashTrigger; }); ViewDetailsCommand = new Command(async args => { var memory = (Memory)((ItemTappedEventArgs)args).Item; await ViewDetails(memory); }); ViewGraphCommand = new Command(async args => { await ViewGraph(_memories); }); ViewHelpCommand = new Command(async args => { await ViewHelp(); }); ViewSettingsCommand = new Command(async args => { await ViewSettings(); }); PropertyChanged += (sender, args) => { if (args.PropertyName != nameof(Simulate)) { return; } if (Simulate) { notificationManager.StartNotifications(_memories, _settings); ShowSimulationExplanation(); } else { notificationManager.StopNotifications(); } }; }
public static void HideKeyboard() { IKeyboardHelper k = DependencyService.Get<IKeyboardHelper>(); k.HideKeyboard(); }