Пример #1
0
        public IntensityState(Intensity _intensity, TagEntity _parent)
        {
            Intensity   = _intensity;
            Description = _intensity.ToString();

            var bytes = BitConverter.GetBytes((int)_intensity);

            Background = new SolidColorBrush(Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]));

            ChangeState = new Command(new Action(() => {
                _parent.Background.Value = Background;
                _parent.Intensity        = Intensity;
                _parent.NotifyPropertyChanged("Intensity");
            }));
        }
Пример #2
0
        public NewTagEntity(TagPresenter _tagPresenter)
        {
            Text = new Observable <string>();
            AutoCompleteCollection = _tagPresenter.AvailableTags;

            IsFocused = new Observable <bool>();

            TakeFocusByForce = new Command(new Action(() => { IsFocused.Value = true; }));

            Submit = new Command(new Action(() => {
                _tagPresenter.Entities.Remove(this);
                var newTag = new TagEntity(Text.Value, _tagPresenter.Entities);
                _tagPresenter.Entities.Insert(_tagPresenter.Entities.Count - 1, newTag);
                newTag.NotifyPropertyChanged("Added"); //Have to call PropertyChanged after it's added to collection to route event to ListChanged with ItemChanged type
            }));

            Cancel = new Command(new Action(() => {
                _tagPresenter.Entities.Remove(this);
            }));
        }