Beispiel #1
0
        /*
         * Properties
         */

        /*
         * Member Methods
         */

        protected void createButtonsFromState()
        {
            if (_playState == null)
            {
                return;
            }

            _playState.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(_playState_ValueChangedEvent);

            Hashtable   labels = _playState.Type.ValueLabels;
            IEnumerator keys   = labels.Keys.GetEnumerator();

            while (keys.MoveNext())
            {
                object           value     = keys.Current;
                LabelDictionary  labelDict = (LabelDictionary)labels[value];
                MediaStateAction m;

                if (labelDict.Contains(PLAY_LABEL))
                {
                    _valueToTypeMap[PLAY_LABEL] = value;
                    m = new MediaStateAction(_playState, value);
                    ((PhoneMediaControls)GetControl()).Play += new EventHandler(m.Activate);
                }
                else if (labelDict.Contains(STOP_LABEL))
                {
                    _valueToTypeMap[STOP_LABEL] = value;
                    m = new MediaStateAction(_playState, value);
                    ((PhoneMediaControls)GetControl()).Stop += new EventHandler(m.Activate);
                }
                else if (labelDict.Contains(PAUSE_LABEL))
                {
                    _valueToTypeMap[PAUSE_LABEL] = value;
                    m = new MediaStateAction(_playState, value);
                    ((PhoneMediaControls)GetControl()).Pause += new EventHandler(m.Activate);
                }
            }
        }
Beispiel #2
0
        protected void createButtonsFromState()
        {
            if (_playState == null)
            {
                return;
            }

            doNotRenderObject(_playState);

            Hashtable   labels = _playState.Type.ValueLabels;
            IEnumerator keys   = labels.Keys.GetEnumerator();

            while (keys.MoveNext())
            {
                object          value     = keys.Current;
                LabelDictionary labelDict = (LabelDictionary)labels[value];

                if (labelDict.Contains(PLAY_LABEL))
                {
                    _playBtn = createImageButton(PLAY_IMG_NAME);
                    _mediaActions.Add(new MediaStateValueAction(_playBtn, _playState, value, PLAY_LABEL));
                }
                else if (labelDict.Contains(STOP_LABEL))
                {
                    _stopBtn = createImageButton(STOP_IMG_NAME);
                    _mediaActions.Add(new MediaStateValueAction(_stopBtn, _playState, value, STOP_LABEL));
                }
                else if (labelDict.Contains(PAUSE_LABEL))
                {
                    _pauseBtn = createImageButton(PAUSE_IMG_NAME);
                    _mediaActions.Add(new MediaStateValueAction(_pauseBtn, _playState, value, PAUSE_LABEL));
                }
                else if (labelDict.Contains(REWIND_LABEL))
                {
                    _rewindBtn = createImageButton(REWIND_IMG_NAME);
                    _mediaActions.Add(new MediaStateValueAction(_rewindBtn, _playState, value, REWIND_LABEL));
                }
                else if (labelDict.Contains(FFWD_LABEL))
                {
                    _fastFwdBtn = createImageButton(FFWD_IMG_NAME);
                    _mediaActions.Add(new MediaStateValueAction(_fastFwdBtn, _playState, value, FFWD_LABEL));
                }
                else if (labelDict.Contains(RECORD_LABEL))
                {
                    _recordBtn = createImageButton(RECORD_IMG_NAME);
                    _mediaActions.Add(new MediaStateValueAction(_recordBtn, _playState, value, RECORD_LABEL));
                }
            }
        }