private void SetVolumeControl(VolumeState state) { try { XRecyclerView.VolumeStateProvider = state; switch (state) { case VolumeState.Off: XRecyclerView.VolumeStateProvider = VolumeState.Off; XRecyclerView.VideoPlayer.Volume = 0f; AnimateVolumeControl(); break; case VolumeState.On: XRecyclerView.VolumeStateProvider = VolumeState.On; XRecyclerView.VideoPlayer.Volume = 1f; AnimateVolumeControl(); break; default: XRecyclerView.VideoPlayer.Volume = 1f; AnimateVolumeControl(); break; } } catch (Exception e) { Console.WriteLine(e); } }
public DocumentsResult GetDocuments(VolumeState volumeState, int start, int count) { if (start < 0) { throw new ArgumentOutOfRangeException(nameof(start)); } Volume volume = OpenVolume(volumeState); List <Document> documents = new List <Document>(); if (volume.DocumentCount == 0) { return(DocumentsResult.Empty); } int index = 0; volume.Move(start); while (index < count && !volume.IsEOF) { DocIdentity identity = new DocIdentity(volume.VolumeMemberDocId, volume.VolumeId); Document doc = GetDocument(volume, identity); documents.Add(doc); volume.MoveNext(); index++; } return(new DocumentsResult(documents, volume.DocumentCount)); }
public Volume OpenVolume(VolumeState volState) { Volume volume; lock (this._cacheLock) { if (this._volumesCache.TryGetValue(volState, out volume)) { volume.Reopen(); if (!volState.Search.IsNullOrEmpty()) { volume.DoSearch(volState.Search, UnixDates.Min, UnixDates.Max); } return(volume); } volume = this._dictionary.OpenVolume( volState.VolumeName, volState.FilterQuery, volState.SortOrder ); if (!volState.Search.IsNullOrEmpty()) { volume.DoSearch(volState.Search, UnixDates.Min, UnixDates.Max); } this._volumesCache.Set(volState, volume); } return(volume); }
// Update is called once per frame void Update() { switch (state) { case VolumeState.TurnMax: if (!audioSource.isPlaying) { audioSource.Play(); } if (turnTimeToMax != 0f) { audioSource.volume += (MaxVolume / turnTimeToMax) * Time.deltaTime; } else { audioSource.volume = 1f; } if (audioSource.volume > MaxVolume - 0.01) { state = VolumeState.Max; audioSource.volume = MaxVolume; } break; case VolumeState.TurnMute: if (turnTimeToMute != 0) { audioSource.volume -= (MaxVolume / turnTimeToMute) * Time.deltaTime; } else { audioSource.volume = 0f; } if (audioSource.volume < 0f) { audioSource.volume = 0f; state = VolumeState.Mute; } break; case VolumeState.Max: if (!audioSource.isPlaying) { audioSource.Play(); } break; case VolumeState.Mute: if (audioSource.isPlaying) { audioSource.Stop(); } break; } }
public VolumeData() { Volumes = 0; VolumeNo = -1; Path = Name = Description = ""; TotalBytes = AvailableBytes = 0; IsPrimary = IsRemovable = IsEmulated = false; State = VolumeState.MEDIA_UNKNOWN; }
void Awake() { audioSource = GetComponent <AudioSource>(); gameController = GameObject.FindWithTag(Tags.GameController).GetComponent <GameController>(); audioSource.volume = 0f; state = VolumeState.Mute; gameController.SetDelegateSetUpFunc_Rady(TurnVolumeMax); gameController.SetDelegateSetUpFunc_GameOver(TurnVolumeMute); }
/// <summary> /// Executes the specified param. /// </summary> /// <param name="param">The param.</param> /// <param name="result">The result.</param> /// <returns></returns> public OpResult Execute(string param) { OpResult opResult = new OpResult(); try { opResult.StatusCode = OpStatusCode.Success; VolumeState volumeState = new VolumeState(); if (param.Equals("Up", StringComparison.InvariantCultureIgnoreCase)) { AddInHost.Current.MediaCenterEnvironment.AudioMixer.VolumeUp(); } else if (param.Equals("Down", StringComparison.InvariantCultureIgnoreCase)) { AddInHost.Current.MediaCenterEnvironment.AudioMixer.VolumeDown(); } else if (param.Equals("Mute", StringComparison.InvariantCultureIgnoreCase)) { AddInHost.Current.MediaCenterEnvironment.AudioMixer.Mute = true; } else if (param.Equals("UnMute", StringComparison.InvariantCultureIgnoreCase)) { AddInHost.Current.MediaCenterEnvironment.AudioMixer.Mute = false; } else if (!param.Equals("Get", StringComparison.InvariantCultureIgnoreCase)) { int desiredLevel = int.Parse(param); if (desiredLevel > 50 || desiredLevel < 0) { opResult.StatusCode = OpStatusCode.BadRequest; opResult.StatusText = "Volume must be < 50 and > 0!"; } int volume = (int)(AddInHost.Current.MediaCenterEnvironment.AudioMixer.Volume / 1310.7); for (int level = volume; level > desiredLevel; level--) { AddInHost.Current.MediaCenterEnvironment.AudioMixer.VolumeDown(); } for (int level = volume; level < desiredLevel; level++) { AddInHost.Current.MediaCenterEnvironment.AudioMixer.VolumeUp(); } } volumeState.volume = getVolume(); volumeState.is_muted = isMuted(); opResult.ContentObject = volumeState; } catch (Exception ex) { opResult.StatusCode = OpStatusCode.Exception; opResult.StatusText = ex.Message; } return(opResult); }
/// <summary> /// Initializes a new instance of the <see cref="VolumeEnteredErrorStateException"/> with the /// specified volume state. /// </summary> /// <param name="status">The erroneous volume state.</param> /// <exception cref="ArgumentNullException">If <paramref name="status"/> is <see langword="null"/>.</exception> public VolumeEnteredErrorStateException(VolumeState status) : base(string.Format("The volume entered an error state: '{0}'", status)) { if (status == null) throw new ArgumentNullException("status"); _state.Status = status.Name; #if !NET35 SerializeObjectState += (ex, args) => args.AddSerializedState(_state); #endif }
/// <summary> /// Initializes a new instance of the <see cref="VolumeEnteredErrorStateException"/> class with the /// specified volume state. /// </summary> /// <param name="status">The erroneous volume state.</param> /// <exception cref="ArgumentNullException">If <paramref name="status"/> is <see langword="null"/>.</exception> public VolumeEnteredErrorStateException(VolumeState status) : base(string.Format("The volume entered an error state: '{0}'", status)) { if (status == null) { throw new ArgumentNullException("status"); } _state.Status = status.Name; #if !NET35 SerializeObjectState += (ex, args) => args.AddSerializedState(_state); #endif }
public VolumeData(VolumeData vd) { Volumes = vd.Volumes; VolumeNo = vd.VolumeNo; Path = vd.Path; Name = vd.Name; Description = vd.Description; TotalBytes = vd.TotalBytes; AvailableBytes = vd.AvailableBytes; IsPrimary = vd.IsPrimary; IsRemovable = vd.IsRemovable; IsEmulated = vd.IsEmulated; State = vd.State; }
/// <inheritdoc /> public Volume WaitForVolumeState(string volumeId, VolumeState expectedState, VolumeState[] errorStates, int refreshCount = 600, TimeSpan?refreshDelay = null, string region = null, CloudIdentity identity = null) { if (volumeId == null) { throw new ArgumentNullException("volumeId"); } if (expectedState == null) { throw new ArgumentNullException("expectedState"); } if (errorStates == null) { throw new ArgumentNullException("errorStates"); } if (string.IsNullOrEmpty(volumeId)) { throw new ArgumentException("volumeId cannot be empty"); } if (refreshCount < 0) { throw new ArgumentOutOfRangeException("refreshCount"); } if (refreshDelay < TimeSpan.Zero) { throw new ArgumentOutOfRangeException("refreshDelay"); } CheckIdentity(identity); var volumeInfo = ShowVolume(volumeId, region, identity); var count = 0; while (!volumeInfo.Status.Equals(expectedState) && !errorStates.Contains(volumeInfo.Status) && count < refreshCount) { Thread.Sleep(refreshDelay ?? TimeSpan.FromMilliseconds(2400)); volumeInfo = ShowVolume(volumeId, region, identity); count++; } if (errorStates.Contains(volumeInfo.Status)) { throw new VolumeEnteredErrorStateException(volumeInfo.Status); } return(volumeInfo); }
public IActionResult GetDocuments(VolumeQuery volumeQuery, [FromQuery] int?start = 0, [FromQuery] int?count = 50) { if (!TryGetSession(User, out Session session)) { return(Unauthorized()); } if (volumeQuery == null) { return(BadRequest(Resources.ErrorEmptyRequest)); } VolumeState volumeState = new VolumeState( volumeQuery.VolumeName, volumeQuery.FilterQuery, volumeQuery.SortOrder, volumeQuery.Search ); DocumentsResult docsResult = session.GetDocuments(volumeState, start ?? 0, count ?? 50); return(Ok(docsResult)); }
/// <inheritdoc/> public Volume WaitForVolumeState(string volumeId, VolumeState expectedState, VolumeState[] errorStates, int refreshCount = 600, TimeSpan? refreshDelay = null) { return BlockStorageProvider.WaitForVolumeState(volumeId, expectedState, errorStates, refreshCount, refreshDelay, this.DefaultRegion, this.Identity); }
public Volume OpenVolume(VolumeState state) { return(this._volumeRepository.OpenVolume(state)); }
void TurnVolumeMax() { state = VolumeState.TurnMax; }
void TurnVolumeMute() { state = VolumeState.TurnMute; }
public VolumeEnteredErrorStateException(VolumeState status) : base(string.Format("The volume entered an error state: '{0}'", status)) { Status = status; }
public VOL() { Identifier = "VOL"; Volume = new VolumeState(); }
VolumeState GetVolumeState(string strstate) { VolumeState state = VolumeState.MEDIA_UNKNOWN; try { /* * MEDIA_UNKNOWN Unknown storage state, such as when a path isn't backed by known storage media. "unknown" * MEDIA_REMOVED Storage state if the media is not present. "removed" * MEDIA_UNMOUNTED Storage state if the media is present but not mounted. "unmounted" * MEDIA_CHECKING Storage state if the media is present and being disk-checked. "checking" * MEDIA_EJECTING Storage state if the media is in the process of being ejected. "ejecting" * MEDIA_NOFS Storage state if the media is present but is blank or is using an unsupported filesystem. "nofs" * MEDIA_MOUNTED Storage state if the media is present and mounted at its mount point with read/write access. "mounted" * MEDIA_MOUNTED_READ_ONLY Storage state if the media is present and mounted at its mount point with read-only access. "mounted_ro" * MEDIA_SHARED Storage state if the media is present not mounted, and shared via USB mass storage. "shared" * MEDIA_BAD_REMOVAL Storage state if the media was removed before it was unmounted. "bad_removal" * MEDIA_UNMOUNTABLE Storage state if the media is present but cannot be mounted. Typically this happens if the file system on the media is corrupted. "unmountable" */ if (strstate == global::Android.OS.Environment.MediaRemoved) { state = VolumeState.MEDIA_REMOVED; } else if (strstate == global::Android.OS.Environment.MediaUnmounted) { state = VolumeState.MEDIA_UNMOUNTED; } else if (strstate == global::Android.OS.Environment.MediaChecking) { state = VolumeState.MEDIA_CHECKING; } else if (strstate == global::Android.OS.Environment.MediaEjecting) { state = VolumeState.MEDIA_EJECTING; } else if (strstate == global::Android.OS.Environment.MediaNofs) { state = VolumeState.MEDIA_NOFS; } else if (strstate == global::Android.OS.Environment.MediaMounted) { state = VolumeState.MEDIA_MOUNTED; } else if (strstate == global::Android.OS.Environment.MediaMountedReadOnly) { state = VolumeState.MEDIA_MOUNTED_READ_ONLY; } else if (strstate == global::Android.OS.Environment.MediaShared) { state = VolumeState.MEDIA_SHARED; } else if (strstate == global::Android.OS.Environment.MediaBadRemoval) { state = VolumeState.MEDIA_BAD_REMOVAL; } else if (strstate == global::Android.OS.Environment.MediaUnmountable) { state = VolumeState.MEDIA_UNMOUNTABLE; } else { state = VolumeState.MEDIA_UNKNOWN; } } catch { state = VolumeState.MEDIA_UNKNOWN; } return(state); }
/// <inheritdoc/> public Volume WaitForVolumeState(string volumeId, VolumeState expectedState, VolumeState[] errorStates, int refreshCount = 600, TimeSpan?refreshDelay = null) { return(BlockStorageProvider.WaitForVolumeState(volumeId, expectedState, errorStates, refreshCount, refreshDelay, this.DefaultRegion, this.Identity)); }