/[cits3200i]/trunk/UWAPlugins/PlaybackPlugin/Source/PlaybackControl.cs


UCC Code Repository

Contents of /trunk/UWAPlugins/PlaybackPlugin/Source/PlaybackControl.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 20 - (show annotations) (download)
Sun Sep 12 08:23:38 2010 UTC (11 years, 2 months ago) by rvvs89
File size: 2213 byte(s)
Disable buttons if the playback state is Disabled.
Change playButton icon to PauseIcon if playback state is not disabled, stopped or paused.
1 using PlaybackPlugin.Properties;
2 using System;
3 using System.Collections.Generic;
4 using System.ComponentModel;
5 using System.Drawing;
6 using System.Data;
7 using System.Text;
8 using System.Timers;
9 using System.Windows.Forms;
10 using ZoneFiveSoftware.Common.Data.Fitness;
11
12 namespace PlaybackPlugin.Source
13 {
14 public partial class PlaybackControl : UserControl
15 {
16 private PlaybackState state = PlaybackState.Disabled;
17 private IActivity activity = null;
18
19 public PlaybackControl()
20 {
21 InitializeComponent();
22 UpdateUI();
23 }
24
25 public PlaybackControl(IActivity activity) : this()
26 {
27 this.activity = activity;
28 }
29
30 public IActivity Activity
31 {
32 get { return activity; }
33 set { activity = value; }
34 }
35
36 public PlaybackState State
37 {
38 get { return state; }
39 }
40
41 private void UpdateUI()
42 {
43 rewindButton.Enabled = State != PlaybackState.Disabled && State != PlaybackState.Stopped;
44 fastForwardButton.Enabled = State != PlaybackState.Disabled && State != PlaybackState.Stopped;
45 playButton.Enabled = State != PlaybackState.Disabled;
46 playButton.Image = State == PlaybackState.Playing || State == PlaybackState.FastForwarding || State == PlaybackState.Rewinding ? Resources.PauseIcon : Resources.PlayIcon;
47 loopButton.Enabled = State != PlaybackState.Disabled;
48 speedLabel.Enabled = State != PlaybackState.Disabled;
49 speedSpinner.Enabled = State != PlaybackState.Disabled;
50 statusStrip.Enabled = State != PlaybackState.Disabled;
51 playbackBar.Enabled = State != PlaybackState.Disabled;
52 statusLabel.Enabled = State != PlaybackState.Disabled;
53 }
54
55 public enum PlaybackState
56 {
57 Disabled,
58 Stopped,
59 Paused,
60 Playing,
61 FastForwarding,
62 Rewinding
63 }
64
65 private void statusStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
66 {
67
68 }
69 }
70 }

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26