private void Iniciar_Click(object sender, RoutedEventArgs e) { // NavInfoText.Text = "Vuelvo al juego"; //Va al juego cuando esté completa la pagina this.Frame.Navigate(typeof(Sel_Dron)); ElementSoundPlayer.Play(ElementSoundKind.Invoke); }
private void BGRadioButton_Checked(object sender, RoutedEventArgs e) { RadioButton rb = sender as RadioButton; ElementSoundPlayer.Play(ElementSoundKind.MoveNext); if (rb != null) { string choice = rb.Tag.ToString(); Enum.TryParse(choice, out _yourChoice); switch (_yourChoice) { case Choice.Rock: ImagePath = @"ms-appx:///Assets/rock.png"; break; case Choice.Paper: ImagePath = @"ms-appx:///Assets/paper.png"; break; case Choice.Scissors: ImagePath = @"ms-appx:///Assets/scissors.png"; break; case Choice.Moo: ImagePath = @"ms-appx:///Assets/moo.png"; break; } } }
private void HideTransportGrid() { transportGridAnimating = true; Storyboard storyboard = ((Storyboard)TransportControlGrid.Resources["ExitStoryboard"]); EventHandler <object> handler = null; handler = new EventHandler <object>((x, y) => { storyboard.Completed -= handler; transportGridAnimating = false; transportGridVisible = false; TransportControlGrid.IsHitTestVisible = false; //TransportControlGrid.Visibility = Visibility.Collapsed; InlineFrame.IsEnabled = true; InlineFrame.Focus(FocusState.Programmatic); ElementSoundPlayer.Play(ElementSoundKind.Hide); if (InlineFrame.Content is IXboxInputPage) { ((IXboxInputPage)InlineFrame.Content).RestoreFocus(); } }); storyboard.Completed += handler; storyboard.Begin(); }
private void ShowTransportGrid() { InlineFrame.IsEnabled = false; if (InlineFrame.Content is IXboxInputPage) { ((IXboxInputPage)InlineFrame.Content).PreserveFocus(); } //TransportControlGrid.Visibility = Visibility.Visible; transportGridAnimating = true; Storyboard storyboard = ((Storyboard)TransportControlGrid.Resources["EnterStoryboard"]); EventHandler <object> handler = null; handler = new EventHandler <object>((x, y) => { storyboard.Completed -= handler; transportGridAnimating = false; transportGridVisible = true; TransportControlGrid.IsHitTestVisible = true; PlayButton.Focus(FocusState.Keyboard); ElementSoundPlayer.Play(ElementSoundKind.Show); }); storyboard.Completed += handler; storyboard.Begin(); }
public async Task RecordSpeechFromMicrophoneAsync(string command) { string recognizedText = string.Empty; if (this.mute == false) { ElementSoundPlayer.State = ElementSoundPlayerState.On; ElementSoundPlayer.Volume = 0.5; ElementSoundPlayer.Play(ElementSoundKind.Invoke); //BackgroundMediaPlayer.Current.SetUriSource(new Uri("ms-winsoundevent:Notification.Mail")); } BackgroundMediaPlayer.Current.Play(); Helper.MessageBoxLongAsync(command, "Voice"); using (SpeechRecognizer recognizer = new Windows.Media.SpeechRecognition.SpeechRecognizer()) { await recognizer.CompileConstraintsAsync(); SpeechRecognitionResult result = await recognizer.RecognizeAsync(); if (result.Status == SpeechRecognitionResultStatus.Success) { recognizedText = result.Text; } } VoiceResult = (recognizedText); }
private void EnterGamepadEngagementMode() { double currentValue = Value; m_shouldDiscardValue = true; if (currentValue == c_noValueSetSentinel) { Value = InitialSetValue; // Notify that the Value has changed ValueChanged?.Invoke(this, null); currentValue = InitialSetValue; m_preEngagementValue = -1; } else { currentValue = Value; m_preEngagementValue = currentValue; } if (SharedHelpers.IsRS1OrHigher()) { ElementSoundPlayer.Play(ElementSoundKind.Invoke); } if (SharedHelpers.IsAnimationsEnabled()) { double focalPoint = CalculateStarCenter((int)(currentValue - 1.0)); m_sharedPointerPropertySet.InsertScalar("starsScaleFocalPoint", (float)(focalPoint)); } }
private void GotoAbout() { if (squaresCentered && !importing) { ElementSoundPlayer.Play(ElementSoundKind.Invoke); Frame.Navigate(typeof(AboutPage)); } }
private void Rating_FocusEngaged(Control sender, FocusEngagedEventArgs args) { if (actualUserRating == Score.NotSet) { actualUserRating = PlaceholderValue.ToScore(); } ElementSoundPlayer.Play(ElementSoundKind.Invoke); draw(); }
private void ExitGamepadEngagementMode() { if (SharedHelpers.IsRS1OrHigher()) { ElementSoundPlayer.Play(ElementSoundKind.GoBack); } m_sharedPointerPropertySet.InsertScalar("starsScaleFocalPoint", c_noPointerOverMagicNumber); m_disengagedWithA = false; }
private void GotoCreation() { if (squaresCentered && !importing) { ElementSoundPlayer.Play(ElementSoundKind.Invoke); var currentSquare = presentedSquareIndex; userIsAwayFromThisPlace = true; Frame.Navigate(typeof(WorkoutEditor)); } }
private void Timer_Tick(object sender, object e) { remainingSeconds--; progressBar.Value = totalSeconds - remainingSeconds; if (remainingSeconds == 0) { timerFinished(); UpdateSecondsLabel(); return; } ElementSoundPlayer.Play(ElementSoundKind.Hide); UpdateSecondsLabel(); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; ElementSoundPlayer.State = ElementSoundPlayerState.On; ElementSoundPlayer.Play(ElementSoundKind.Focus); ElementSoundPlayer.Play(ElementSoundKind.Invoke); ElementSoundPlayer.Play(ElementSoundKind.Show); ElementSoundPlayer.Play(ElementSoundKind.Hide); ElementSoundPlayer.Play(ElementSoundKind.MoveNext); ElementSoundPlayer.Play(ElementSoundKind.MovePrevious); ElementSoundPlayer.Play(ElementSoundKind.GoBack); }
private async void Exit_Button_Click(object sender, RoutedEventArgs e) { var json = Newtonsoft.Json.JsonConvert.SerializeObject(MainPage.User); using var data = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync($"{MainPage.endpoint}/api/search/leavelobby?lobbyId={OnlineSearch.Lobby.Id}", data); OnlineSearch.Lobby = null; ElementSoundPlayer.Play(ElementSoundKind.GoBack); this.Frame.Navigate(typeof(MainPage)); }
private void grd_checkpoint_Tapped(object sender, TappedRoutedEventArgs e) { StopAlarm(); ElementSoundPlayer.Play(ElementSoundKind.Focus); if (timerTask != null) { UpdateCheckpointAdd(); UpdateCheckpointSymbolSync(); CheckpointTimeCheckerSync(); counting = false; UpdatePageButtonTextSync(); } }
private void element_PointerEntered(object sender, PointerRoutedEventArgs e) { // Scale up to 1.5 Canvas.SetZIndex(this, 10); ElementSoundPlayer.Play(ElementSoundKind.Focus); CreateOrUpdateSpringAnimation(1.5f); try { (sender as UIElement).StartAnimation(_springAnimation); } catch (Exception) { } }
private void NvSample_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) { Frame rootFrame = Window.Current.Content as Frame; if (!contentFrame.CanGoBack) { rootFrame.GoBack(); } else { contentFrame.GoBack(); } ElementSoundPlayer.Play(ElementSoundKind.GoBack); }
private async void GotoExport() { if (!squaresCentered && !exporting) { exporting = true; var exportWorkout = WorkoutManager.Workouts[presentedSquareIndex]; setButtonsEnabled(false); var savePicker = new FileSavePicker(); savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; savePicker.FileTypeChoices.Add("Keep with it Workout File", new List <string>() { ".kwiw" }); savePicker.SuggestedFileName = WorkoutManager.Workouts[presentedSquareIndex].Name; StorageFile file = await savePicker.PickSaveFileAsync(); if (file != null) { CachedFileManager.DeferUpdates(file); var exportPassed = await WorkoutManager.ExportWorkout(file, exportWorkout, false); var status = FileUpdateStatus.Incomplete; if (exportPassed) { status = await CachedFileManager.CompleteUpdatesAsync(file); } if (status != FileUpdateStatus.Complete) { MessageDialog messageDialog = new MessageDialog("Workout couldn't be exported! SAD SAD SAD SAADDDDD SAD") { DefaultCommandIndex = 0, CancelCommandIndex = 0 }; messageDialog.Commands.Add(new UICommand("Okay :(")); await messageDialog.ShowAsync(); } } else { ElementSoundPlayer.Play(ElementSoundKind.Hide); } setButtonsEnabled(true); exporting = false; } }
private void timerFinished() { ElementSoundPlayer.Play(ElementSoundKind.Show); if (runTimerTwice) { runTimerTwice = false; remainingSeconds = totalSeconds; progressBar.Value = 0; return; } rightButton.IsEnabled = true; rightButton.Focus(FocusState.Programmatic); highestIndex++; timer.Stop(); addCompletionTimeIfApplicable(); }
async void CheckLogic() { maxValue += 1; BadGoodBar.Maximum = maxValue; if (RuWord.Text == JsonWords.RWArray[currentEngWord]) { IfTrue(); positiveBtClick += 1; if (TrainerModel.timesAmount == positiveBtClick && TrainerModel.trainEnabled == true) { positiveBtClick = 0; Frame.Navigate(typeof(PickFromFour)); } WordPic.Opacity = 0.0; EngWord.Opacity = 0.0; Windows.Storage.StorageFolder folder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync(@"Assets"); Windows.Storage.StorageFile file = await folder.GetFileAsync("Windows Balloon.wav"); player.AutoPlay = false; player.Source = MediaSource.CreateFromStorageFile(file); player.Play(); ShowOpacityButton(); ElementSoundPlayer.Play(ElementSoundKind.MoveNext); currentEngWord = random.Next(0, JsonWords.EWArray.Length); EngWord.Text = JsonWords.EWArray[currentEngWord]; bitmapImage.UriSource = new Uri(WordPic.BaseUri, $"ArrayPics/{JsonWords.EWArray[currentEngWord]}.jpg"); WordPic.Source = bitmapImage; ShowOpacityPic(); ShowOpacityEngWord(); RuWord.Text = ""; ratingBar += 1; // MainProBar.MainProBarLocal.Value++; BadGoodBar.Value = ratingBar; } else { IfFalse(); badRatingBar += 1; } MaxOfBar.Text = $"{Convert.ToString(BadGoodBar.Maximum)}"; TrueBar.Text = $"{Convert.ToString(BadGoodBar.Value)}"; FalseBar.Text = $"{badRatingBar}"; }
private void pointerBasedGridSelect(object sender, PointerRoutedEventArgs e) { var senderGrid = sender as Grid; if (senderGrid == selectedGrid) { return; } if (selectedIndex != -1) { removeSelectionAttributes(selectedGrid); } selectedGrid = senderGrid; selectedIndex = squaresGrid.Children.IndexOf(selectedGrid); lastSelectedIndex = selectedIndex; addSelectionAttributes(selectedGrid); ElementSoundPlayer.Play(ElementSoundKind.Focus); }
public void ClearPresentSquare(bool playSound) { if (presentedSquare != null) { TopGrid.Children.Remove(presentedSquare); } presentedSquare = null; presentedSquareIndex = -1; UnsubscribeBackButton(); setButtonsEnabled(false); CentralizeSquares(); if (playSound) { ElementSoundPlayer.Play(ElementSoundKind.MovePrevious); } }
private void pauseButton_Click(object sender, RoutedEventArgs e) { isTimerPasued = !isTimerPasued; if (totalSeconds != -1) { if (isTimerPasued) { timer.Stop(); } else { if (remainingSeconds > 0) { timer.Start(); ElementSoundPlayer.Play(ElementSoundKind.MoveNext); } } } UpdateSecondsLabel(); }
public MainPage() { this.InitializeComponent(); violet = new User(); ApplicationView.PreferredLaunchViewSize = new Size(1280, 720); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize; ElementSoundPlayer.State = ElementSoundPlayerState.On; myFrame.Navigate(typeof(HomePage), violet); ElementSoundPlayer.Play(ElementSoundKind.GoBack); ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; titleBar.BackgroundColor = Color.FromArgb(0, 63, 63, 63); titleBar.ForegroundColor = Colors.White; titleBar.ButtonBackgroundColor = Color.FromArgb(0, 63, 63, 63); titleBar.ButtonForegroundColor = Colors.White; }
private void respuesta_Tapped(object sender, TappedRoutedEventArgs e) { //ElementSoundPlayer.State = ElementSoundPlayerState.On; //ElementSoundPlayer.Volume = 1; ElementSoundPlayer.Play(ElementSoundKind.Invoke); Border border = (Border)sender; TextBlock answer = (TextBlock)border.Child; if (answer.Text != "") { border.BorderThickness = new Thickness(6); //answer.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0)); vm.comprobarPregunta(answer.Text); esperandoQueContesteElRival.Visibility = Visibility.Visible; //framePartida.Visibility = Visibility.Collapsed; } }
private async void GotoImport() { if (squaresCentered && !importing) { importing = true; ElementSoundPlayer.Play(ElementSoundKind.Invoke); var picker = new FileOpenPicker(); picker.ViewMode = PickerViewMode.Thumbnail; picker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; picker.FileTypeFilter.Add(".kwiw"); var file = await picker.PickSingleFileAsync(); if (file != null) { var fileResult = await WorkoutManager.AddWorkout(file); if (fileResult == false) { MessageDialog messageDialog = new MessageDialog("Workout couldn't be imported! SAD SAD SAD SAADDDDD SAD") { DefaultCommandIndex = 0, CancelCommandIndex = 0 }; messageDialog.Commands.Add(new UICommand("Okay :(")); await messageDialog.ShowAsync(); } else { var newWorkout = WorkoutManager.Workouts.Last(); AddedANewDamnWorkoutToTheMix(newWorkout); PostImportSelect(newWorkout, true); } } else { ElementSoundPlayer.Play(ElementSoundKind.Hide); } importing = false; } }
private void StartWorkout() { segmentTitleBlock.Visibility = Visibility.Visible; repInfoBlock.Visibility = Visibility.Visible; progressBar.Visibility = Visibility.Visible; pauseButton.Visibility = Visibility.Visible; if (totalSeconds != 0) { timer.Start(); ElementSoundPlayer.Play(ElementSoundKind.MoveNext); } else { rightButton.IsEnabled = true; if (FocusManager.GetFocusedElement() == null) { rightButton.Focus(FocusState.Programmatic); } addCompletionTimeIfApplicable(); } }
void setDR(bool isOn) { checkBox.IsChecked = isOn; if (isOn) { _dr.RequestActive(); tbkLog.Text = $"{DateTime.Now:HH:mm:ss}\r\n"; ElementSoundPlayer.Play(ElementSoundKind.Show); } else { _dr.RequestRelease(); ElementSoundPlayer.Play(ElementSoundKind.Hide); } tbkBig.Text = isOn ? $"On {(_since = DateTime.Now):HH:mm} ÷ {_till}:00" : $"Was On for {(DateTime.Now - _since):hh\\:mm}"; ApplicationView.GetForCurrentView().Title = isOn ? $"{(_since = DateTime.Now):HH:mm}···" : $"Off"; //buttonStart.Visibility = v ? Visibility.Collapsed : Visibility.Visible; //buttonStop.Visibility = !v ? Visibility.Collapsed : Visibility.Visible; }
private void Timeline_KeyUp(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e) { if (TimelinePanel == null) { return; } switch (e.Key) { case Windows.System.VirtualKey.Down: case Windows.System.VirtualKey.GamepadDPadDown: case Windows.System.VirtualKey.GamepadLeftThumbstickDown: TimelinePanel.TopItemIndex++; e.Handled = true; break; case Windows.System.VirtualKey.Up: case Windows.System.VirtualKey.GamepadDPadUp: case Windows.System.VirtualKey.GamepadLeftThumbstickUp: TimelinePanel.TopItemIndex--; e.Handled = true; break; case Windows.System.VirtualKey.Space: case Windows.System.VirtualKey.Enter: case Windows.System.VirtualKey.GamepadA: var item = TimelinePanel.GetTopItem(); if (item == null || !item.IsActionable) { break; } item.Scale(duration: 200, centerX: (float)item.DesiredSize.Width / 2, centerY: (float)item.DesiredSize.Height / 2, scaleX: 1f, scaleY: 1f).StartAsync(); ElementSoundPlayer.Play(ElementSoundKind.Invoke); ItemInvoked?.Invoke(this, new Controls.TimelineItemInvokedEventArgs() { Item = item }); break; } }
private void OnPointerReleasedBackgroundStackPanel(object sender, PointerRoutedEventArgs args) { if (!IsReadOnly) { var point = args.GetCurrentPoint(m_backgroundStackPanel); var xPosition = point.Position.X; double mousePercentage = xPosition / CalculateActualRatingWidth(); SetRatingTo(Math.Ceiling(mousePercentage * MaxRating), true); if (SharedHelpers.IsRS1OrHigher()) { ElementSoundPlayer.Play(ElementSoundKind.Invoke); } } if (m_isPointerDown) { m_isPointerDown = false; UpdateRatingItemsAppearance(); } }
private void focusUp() { var focusedItem = FocusManager.GetFocusedElement(); if (focusedItem == nameBox) { if (listView.Items.Count != 0) { listViewIndex = listView.Items.Count; FocusManager.TryMoveFocus(FocusNavigationDirection.Previous); ElementSoundPlayer.Play(ElementSoundKind.Focus); } else { addButton.Focus(FocusState.Programmatic); ElementSoundPlayer.Play(ElementSoundKind.Focus); } } else if (focusedItem == addButton) { nameBox.Focus(FocusState.Programmatic); ElementSoundPlayer.Play(ElementSoundKind.Focus); } else if (focusedItem == null || focusedItem is ScrollViewer) { nameBox.Focus(FocusState.Programmatic); ElementSoundPlayer.Play(ElementSoundKind.Focus); } else { listViewIndex--; if (listViewIndex < 1) { addButton.Focus(FocusState.Programmatic); ElementSoundPlayer.Play(ElementSoundKind.Focus); listViewIndex = 1; } } }