private async void OnAddToPlaylistClick(object sender, RoutedEventArgs e) { if (!(e.OriginalSource is MenuItem item)) { return; } switch (item.Tag) { case IPlaylist playlist: { if (playlist.Contains(CurrentRightClick)) { ContentDialogResult result = await NebulaMessageBox.ShowYesNo("MediaAlreadyExists", "MediaAlreadyExistsMsg", CurrentRightClick.Title); if (result == ContentDialogResult.Primary) { playlist.AddMedia(CurrentRightClick); } } else { playlist.AddMedia(CurrentRightClick); } } break; case "CREATE_PLAYLIST": { PlaylistCreationDialog dialog = new PlaylistCreationDialog(); ContentDialogResult result = await dialog.ShowDialogAsync(); if (result == ContentDialogResult.Primary) { dialog.CreatedPlaylist?.AddMedia(CurrentRightClick); } } break; } }
public static async Task CheckForUpdate(bool silentIfUpToDate) { UpdateCheckResult checkResult = await Updater.CheckForUpdate(); switch (checkResult) { case UpdateCheckResult.Failed when !silentIfUpToDate: await NebulaMessageBox.ShowOk("UpdateCheckFailed", "UpdateCheckFailedMsg"); break; case UpdateCheckResult.UpdateAvailable: { ContentDialogResult result = await NebulaMessageBox.ShowYesNo("UpdateCheckAvailable", "UpdateCheckAvailableMsg"); if (result == ContentDialogResult.Primary) { Updater.DownloadUpdate(); Navigate(typeof(SettingsPage), "ABOUT"); } } break; case UpdateCheckResult.UpToDate when !silentIfUpToDate: { ContentDialogResult result = await NebulaMessageBox.ShowYesNo("UpdateCheckUpToDate", "UpdateCheckUpToDateMsg"); if (result == ContentDialogResult.Primary) { Updater.DownloadUpdate(); Navigate(typeof(SettingsPage), "ABOUT"); } } break; } }
private void OnReceiveSharedSessionJoinResponse(SharedSessionJoinResponse response, NebulaNetClient net) { NebulaClient.BeginInvoke(async() => { switch (response.ResponseCode) { case 0: SetSession(response.Session, response.Users); break; case 10: await NebulaMessageBox.ShowOk("SharedSessionCantJoin", "Session does not exists"); break; case 11: break; case 12: await NebulaMessageBox.ShowOk("SharedSessionCantJoin", "SharedSessionWrongPassword"); break; } }); }