public void PerformMediaAction(MediaAction mediaAction, float arg = 0) { if (mediaAction == MediaAction.Play) { WebDriverManager.TestWebDriver.LogMessage(LogLevel.Verbose, "Starting to play " + _selfSelector); Interact(elmnt => JavaScriptExecutor.ExecuteScript("arguments[0].play()", elmnt)); } else if (mediaAction == MediaAction.Pause) { WebDriverManager.TestWebDriver.LogMessage(LogLevel.Verbose, "Pausing " + _selfSelector); Interact(elmnt => JavaScriptExecutor.ExecuteScript("arguments[0].pause()", elmnt)); } else if (mediaAction == MediaAction.VolumeChange) { WebDriverManager.TestWebDriver.LogMessage(LogLevel.Verbose, "Setting volume to " + arg + " for " + _selfSelector); SetAttribute("volume", "(float)" + arg); } else if (mediaAction == MediaAction.RateChange) { WebDriverManager.TestWebDriver.LogMessage(LogLevel.Verbose, "Setting playback rate to " + arg + " for " + _selfSelector); SetAttribute("playbackRate", "(float)" + arg); } else if (mediaAction == MediaAction.RateChange) { WebDriverManager.TestWebDriver.LogMessage(LogLevel.Verbose, "Changing the current time to " + arg + " for " + _selfSelector); SetAttribute("currentTime", "(float)" + arg); } }
public IActionResult Action(int dbId, MediaAction actionType) { var mediaItem = Curator.Library.FirstOrDefault(x => x.DbId == dbId); if (mediaItem != null) { switch (actionType) { case MediaAction.RestartDownload: Curator.RestartDownload(mediaItem); break; case MediaAction.CancelDownload: Curator.CancelDownload(mediaItem); break; case MediaAction.Scout: Curator.ForceScout(mediaItem); break; case MediaAction.Remove: Curator.Remove(mediaItem); break; case MediaAction.Restart: Curator.Restart(mediaItem); break; case MediaAction.TryAnotherMagnet: Curator.TryAnotherMagnet(mediaItem); break; case MediaAction.HashCheck: Curator.HashCheck(mediaItem); break; case MediaAction.IgnoreRequirements: Curator.IgnoreRequirement(mediaItem); break; } } return(RedirectToAction("Index")); }
public static MediaAction GetMediaAction(string extension) { MediaAction action = MediaAction.Unknown; RegistryKey extensionKey = Registry.ClassesRoot.OpenSubKey(extension); if (extensionKey != null) { string programValue = (string)extensionKey.GetValue("", null); if (programValue != null) { // find the program associated with it RegistryKey programKey = Registry.ClassesRoot.OpenSubKey(programValue + "\\shell"); string defaultAction = (string)programKey.GetValue("", null); if (defaultAction != null) { RegistryKey actionKey = programKey.OpenSubKey(defaultAction + "\\command"); string command = (string)actionKey.GetValue("", null); if (command != null) { // iTunes in there? if (command.ToLower().IndexOf("itunes.exe") > 0) { action = MediaAction.iTunes; } // WMP in there? if (command.ToLower().IndexOf("wmplayer.exe") > 0) { action = MediaAction.WMP; } } } else { // we might have the Zune software installed if (programKey.ToString().ToLower().IndexOf("zune") > 0) { action = MediaAction.Zune; } } } } return(action); }
public void RequestForJoin(int userId, MediaAction action, int userIdToConnect) { this.Clients.Group(userIdToConnect.ToString()).joinRequested(action, userId); }
public static async Task <MediaFile> GetMedia(MediaAction action = MediaAction.Unknown) { if (_gettingImage) { return(null); } _gettingImage = false; MediaFile res = null; try { if (action == MediaAction.Unknown) { var strAction = await App.Current.MainPage.DisplayActionSheet("Choose action".Localize(), "Cancel".Localize(), null, "Pick Photo".Localize(), "Take Photo".Localize()); await Task.Delay(300); if (strAction == "Pick Photo".Localize()) { action = MediaAction.PickPhotoFromGallery; } else if (strAction == "Take Photo".Localize()) { action = MediaAction.TakePhotoFromCamera; } } if (action == MediaAction.PickPhotoFromGallery) { /*if (Device.RuntimePlatform == Device.Android) * { * p = await DependencyService.Get<IMediaHelper>().CheckGalleryPermissions(); * await Task.Delay(300); * var stream = await DependencyService.Get<IMediaHelper>().PickImage(); * if (stream == null) return; * byte[] image = (stream as MemoryStream)?.ToArray(); * if (image?.Length > 50000) * image = DependencyService.Get<IMediaHelper>().ResizeImage((stream as MemoryStream).ToArray(), 200, 200); * if (image == null) return; * carPhotoArray = image.ToArray(); * imgCar.Source = ImageSource.FromStream(() => new MemoryStream(image.ToArray())); * } * else * p = CrossMedia.Current.IsPickPhotoSupported;*/ if (!CrossMedia.Current.IsPickPhotoSupported) { await App.Current.MainPage.DisplayAlert("Gallery unavailable".Localize(), "You have no permissions for gallery".Localize(), "OK".Localize()); return(null); } res = await CrossMedia.Current.PickPhotoAsync(); if (res == null) { await App.Current.MainPage.DisplayAlert("Failure".Localize(), "Could not pick photo from gallery".Localize(), "OK".Localize()); return(null); } } else if (action == MediaAction.TakePhotoFromCamera) { /*if (Device.RuntimePlatform == Device.Android) * { * p = await DependencyService.Get<IMediaHelper>().CheckCameraPermissions(); * await Task.Delay(300); * /*var stream = await DependencyService.Get<IMediaHelper>().TakePhoto(); * if (stream == null) return; * * carPhotoArray = stream.ToArray(); * imgCar.Source = ImageSource.FromStream(() => new MemoryStream(stream.ToArray())); * } * else * p = CrossMedia.Current.IsTakePhotoSupported;*/ if (!CrossMedia.Current.IsTakePhotoSupported) { await App.Current.MainPage.DisplayAlert("Camera unavailable".Localize(), "You have no permissions for using camera".Localize(), "OK".Localize()); return(null); } res = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions { Directory = "Sample", Name = "Sample.jpg" }); if (res == null) { await App.Current.MainPage.DisplayAlert("Failure".Localize(), "Could not take foto from camera".Localize(), "OK".Localize()); return(res); } } return(res); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error".Localize(), ex.Message, "OK".Localize()); return(null); } finally { _gettingImage = false; } }