/// <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 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); } }
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 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(); }
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; } }
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 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(); } }
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; } } }
public void PresentSquare(Grid square, bool playSound) { var currentView = SystemNavigationManager.GetForCurrentView(); currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; currentView.BackRequested += CurrentView_BackRequested; calendar.SelectedDates.Clear(); foreach (var date in WorkoutManager.Workouts[presentedSquareIndex].Dates) { calendar.SelectedDates.Add(date); } calendar.SetDisplayDate(DateTime.Today - TimeSpan.FromDays(14)); if (presentedSquare != null) { TopGrid.Children.Remove(presentedSquare); } setButtonsEnabled(true); if (WorkoutManager.Workouts[presentedSquareIndex].Segments.Count < 1) { StartButton.IsEnabled = false; ExportButton.IsEnabled = false; } presentedSquare = square; PushSquaresLeft(); TopGrid.Children.Add(square); if (playSound) { ElementSoundPlayer.Play(ElementSoundKind.MoveNext); } }
private async Task setMotChoisiSelected(LImageMotReadMatching motChoisi) { if (isEvaluating == false) { isEvaluating = true; gameCount++; motChoisi.setSelected(); if (!motChoisi.isCorrect) { ElementSoundPlayer.State = ElementSoundPlayerState.On; ElementSoundPlayer.Play(ElementSoundKind.GoBack); NotifyPropertyChanged("GameProgress"); NotifyPropertyChanged("ScoreActuel"); await letterPlayer_m.speachAsync(motChoisi.word); await Task.Delay(500); ElementSoundPlayer.State = ElementSoundPlayerState.Off; motChoisi.setUnSelected(); } else { score++; NotifyPropertyChanged("ScoreActuel"); NotifyPropertyChanged("GameProgress"); await playApplauseAsync(); await Task.Delay(1000); selectOneImage(); } isEvaluating = false; } }
private async void rightButton_Click(object sender, RoutedEventArgs e) { if (++segmentIndex == currentWorkout.Segments.Count) { ExitWorkout(); MessageDialog messageDialog = new MessageDialog( "Workout completed! Congratulations!" ) { DefaultCommandIndex = 0, CancelCommandIndex = 0 }; messageDialog.Commands.Add(new UICommand("Yay! I share this enthusiasm!")); ElementSoundPlayer.Play(ElementSoundKind.Show); await messageDialog.ShowAsync(); ElementSoundPlayer.Play(ElementSoundKind.Hide); } else { changeSegment(segmentIndex); } }
private async void Capture_Click(object sender, RoutedEventArgs e) { ElementSoundPlayer.Play(ElementSoundKind.Invoke); CameraCaptureUI captureUI = new CameraCaptureUI(); captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg; captureUI.PhotoSettings.AllowCropping = false; StorageFile photo = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo); StorageFile fileCopy = await photo.CopyAsync(Windows.Storage.ApplicationData.Current.LocalFolder); if (photo == null) { return; } if (TemporaryFile != null) { await TemporaryFile.DeleteAsync(); } TemporaryFile = photo; var camImage = new Images { Temp = photo, }; var camImageFile = camImage.Temp; camImage.Name = camImageFile.Name; camImage.ID = ++camlastImageID; BitmapImage bitmapImage = new BitmapImage(); FileRandomAccessStream stream = (FileRandomAccessStream)await TemporaryFile.OpenAsync(FileAccessMode.Read); bitmapImage.SetSource(stream); image.Source = bitmapImage; FileHelper.WriteImagesToFileAsync(camImage, FILE_NAME); }
private async void NavView_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args) { if (args.IsSettingsInvoked) { UpdateNavigationMenuOnOpenSettings(); this.UiNotificationService.NotifyExitCalled(); ChangeDialog(new Settings(this.UiNotificationService)); ElementSoundPlayer.Play(ElementSoundKind.Invoke); return; } if (args.InvokedItemContainer.Tag == null) { return; } if (args.InvokedItemContainer.Tag is SettingsMenuItem settingsMenuItem) { Start(); return; } MenuItem menuItem = (MenuItem)args.InvokedItemContainer.Tag; await UiNotificationService.ToPreviousStep(UiNotificationService.CreateRequestForBackup(), menuItem.Stage); }
private async void OpenImagePrompt() { if (openingOrProcessingImage || imageLoading) { return; } setPictureLabelText("Selecting image"); openingOrProcessingImage = true; FileOpenPicker fileOpenPicker = new FileOpenPicker(); fileOpenPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; fileOpenPicker.FileTypeFilter.Add(".jpg"); fileOpenPicker.FileTypeFilter.Add(".png"); fileOpenPicker.FileTypeFilter.Add(".jpeg"); fileOpenPicker.FileTypeFilter.Add(".gif"); fileOpenPicker.ViewMode = PickerViewMode.Thumbnail; ElementSoundPlayer.Play(ElementSoundKind.Show); var file = await fileOpenPicker.PickSingleFileAsync(); if (file == null) { if (stillOnThePage) { UpdatePicture(); openingOrProcessingImage = false; } return; } setPictureLabelText("Loading new image"); SoftwareBitmap softwareBitmap; try { softwareBitmap = await WorkoutManager.GetBitMapFromFile(file); } catch { softwareBitmap = null; } if (softwareBitmap != null) { setPictureLabelText("Processing new image"); segment.PropertyChanged += Segment_PropertyChanged; segment.SetImage(softwareBitmap); imageLoading = true; } else { ElementSoundPlayer.Play(ElementSoundKind.Show); MessageDialog messageDialog = new MessageDialog("Error opening new image. You know what sucks?") { DefaultCommandIndex = 0, CancelCommandIndex = 0 }; messageDialog.Commands.Add(new UICommand("Well, this sucks?")); await messageDialog.ShowAsync(); } ElementSoundPlayer.Play(ElementSoundKind.Hide); if (stillOnThePage) { openingOrProcessingImage = false; UpdatePicture(); } }
void onExit(object s, RoutedEventArgs e) => ElementSoundPlayer.Play(ElementSoundKind.Hide);
void onMove(object s, RoutedEventArgs e) => ElementSoundPlayer.Play(ElementSoundKind.Show);
public static void RequestInteractionSoundForElement(ElementSoundKind soundToPlay, DependencyObject element) { ElementSoundPlayer.RequestInteractionSoundForElement(soundToPlay, element); }
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: if (Orientation == Orientation.Vertical) { TimelinePanel.ItemIndex++; e.Handled = true; } break; case Windows.System.VirtualKey.Up: case Windows.System.VirtualKey.GamepadDPadUp: case Windows.System.VirtualKey.GamepadLeftThumbstickUp: if (Orientation == Orientation.Vertical) { TimelinePanel.ItemIndex--; e.Handled = true; } break; case Windows.System.VirtualKey.Left: case Windows.System.VirtualKey.GamepadDPadLeft: case Windows.System.VirtualKey.GamepadLeftThumbstickLeft: if (Orientation == Orientation.Horizontal) { TimelinePanel.ItemIndex--; e.Handled = true; } break; case Windows.System.VirtualKey.Right: case Windows.System.VirtualKey.GamepadDPadRight: case Windows.System.VirtualKey.GamepadLeftThumbstickRight: if (Orientation == Orientation.Horizontal) { TimelinePanel.ItemIndex++; 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: 0.5f, centerY: 0.5f, scaleX: 1f, scaleY: 1f).StartAsync(); ElementSoundPlayer.Play(ElementSoundKind.Invoke); ItemInvoked?.Invoke(this, new Controls.TimelineItemInvokedEventArgs() { Container = item }); break; } }
private void End_Click(object sender, RoutedEventArgs e) { ElementSoundPlayer.Play(ElementSoundKind.Invoke); Application.Current.Exit(); }
private void Opciones_Click(object sender, RoutedEventArgs e) { this.Frame.Navigate(typeof(Options)); ElementSoundPlayer.Play(ElementSoundKind.Invoke); }
private void Exit_Button_Click(object sender, RoutedEventArgs e) { ElementSoundPlayer.Play(ElementSoundKind.GoBack); this.Frame.Navigate(typeof(MainPage)); }