/// <summary> /// 抛竿动作(包括以小钓大) /// </summary> public void Cast() { StartTime = DateTime.Now; State = FishingState.Casting; Color = Properties.Settings.Default.TimerColor; _tug = TugType.None; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Color")); }
/// <summary> /// 抛竿动作(包括以小钓大) /// </summary> internal void Bite(TugType tug) { State = FishingState.Holding; _tug = tug; if (tug == TugType.None) { return; } var soundPlayer = new SoundPlayer(); switch (tug) { case TugType.Light: Color = Properties.Settings.Default.LTugColor; soundPlayer.SoundLocation = "轻杆.wav"; break; case TugType.Medium: Color = Properties.Settings.Default.MTugColor; soundPlayer.SoundLocation = "中杆.wav"; break; case TugType.Heavy: Color = Properties.Settings.Default.HTugColor; soundPlayer.SoundLocation = "鱼王杆.wav"; break; case TugType.None: break; default: throw new ArgumentOutOfRangeException(nameof(tug), tug, null); } //提杆或放杆后,界面保持显示最后状态。因此最后一次更新显示。 PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Color")); Update(); if (File.Exists(soundPlayer.SoundLocation)) { //m_mediaPlayer.Play(); soundPlayer.LoadAsync(); soundPlayer.Play(); } }