コード例 #1
0
        private void OnPropertyChanged(PropertyChangedEvent @event)
        {
            //NOTE: the scrollbar will update automatically whenever ServerEntity is updated.

            if (@event.PropertyName == "Tiles")
            {
                ServerEntity.Tiles = (Collection <Tile>)@event.Value;
                UpdateTileViews();
                UpdateSize();
                return;
            }

            if (@event.PropertyName == "Selected")
            {
                ServerEntity.Selected = (bool)@event.Value;
                UpdateBorder();
            }
            if (@event.PropertyName == "TopLeftPresentationImageIndex")
            {
                ServerEntity.TopLeftPresentationImageIndex = (int)@event.Value;
            }

            if (@event.PropertyName == "ImageCount")
            {
                var count = (int)@event.Value;
                if (ServerEntity.ImageCount != count)
                {
                    ServerEntity.ImageCount = count;
                    // Note: Because the scrollbar observes PropertyChanged event on the ServerEntity, its visibility will be updated automatically in ImageBoxScrollbarView
                    // When UpdateLayout() is called in UpdateSize(), the size of the TileContainer will be updated accordingly.
                    UpdateSize();
                }
            }
        }
コード例 #2
0
        public void MapPropertyChangedEvent()
        {
            var e = new PropertyChangedEvent
            {
                ChatroomId = 1,
                OperatorId = 2,
                Key        = "Name",
                Value      = "New Chatroom",
            };
            var m = ChatroomEventMapper.Map(e);

            Assert.Equal(new ChatMessage
            {
                TimeUnixMs = e.Time.ToUnixTimeMilliseconds(),
                SenderId   = 0,
                ChatroomId = 1,
                Content    = new Content {
                    SetPeoperty = new Content.Types.SetProperty
                    {
                        Key   = "Name",
                        Value = "New Chatroom"
                    }
                }
            }, m);
        }
コード例 #3
0
 public void Update(PropertyChangedEvent e)
 {
     if (e.PropertyName.Equals("Available"))
     {
         _actionItem.Available = (bool)e.Value;
         Visibility            = _actionItem.DesiredVisiblility;
     }
     else if (e.PropertyName.Equals("Visible"))
     {
         _actionItem.Visible = (bool)e.Value;
         Visibility          = _actionItem.DesiredVisiblility;
     }
     else if (e.PropertyName.Equals("Enabled"))
     {
         _actionItem.Enabled       = (bool)e.Value;
         ButtonComponent.IsEnabled = _actionItem.Enabled;
     }
     else if (e.PropertyName.Equals("IconSet"))
     {
         _actionItem.IconSet = e.Value as WebIconSet;
         SetIcon();
     }
     else if (e.PropertyName.Equals("ToolTip"))
     {
         _actionItem.ToolTip = e.Value as string;
         ToolTipService.SetToolTip(LayoutDropDownButton, _actionItem.ToolTip);
     }
     else if (e.PropertyName.Equals("Label"))
     {
         _actionItem.Label = e.Value as string;
     }
     UpdateLayout();
 }
コード例 #4
0
        /// <summary>
        /// Creates a new <see cref="Subscriber"/> for the specified source object.
        /// </summary>
        /// <typeparam name="T">The type of the source object.</typeparam>
        /// <param name="source">The source object.</param>
        /// <returns>A <see cref="Subscriber"/> for the <paramref name="source"/>.</returns>
        private Subscriber CreateObserve <T>(T source) where T : class, INotifyPropertyChanged
        {
            Subscriber subscriber = Subscriber.Create(source, this);

            PropertyChangedEvent.AddListener(source, subscriber);

            return(subscriber);
        }
コード例 #5
0
        private void BindableObject_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            PropertyChangedEvent changedEvent = new PropertyChangedEvent(
                propertyName: e.PropertyName,
                value: GetPropertyValue(e.PropertyName),
                timestamp: DateTime.UtcNow);

            this.Changes.Add(changedEvent);
        }
コード例 #6
0
ファイル: UISystem.cs プロジェクト: InvertGames/uFrameECSDemo
 protected override void SetScoreLabel(WavesGame data, WavesGame group, PropertyChangedEvent<System.Int32> value)
 {
     var handler = new SetScoreLabel();
     handler.System = this;
     handler.Event = data;
     handler.Group = group;
     handler.OldValue = value.PreviousValue;
     handler.NewValue = value.CurrentValue;
     handler.Execute();
 }
        public CompositePathGetter
        (
            IEnumerable <IBindingPathLink <object> > pathLinks,
            PropertyType defaultValue
        )
        {
            _pathLinks = pathLinks;

            _defaultValue = defaultValue;

            if (pathLinks.IsNullOrEmpty())
            {
                PropGetters.Add(new SimplePropGetter <object>());
                return;
            }

            IObjWithPropGetter <object> previousPropGetter = null;

            foreach (var pathLink in _pathLinks)
            {
                IObjWithPropGetter <object> propGetter = pathLink.CreateGetter();

                PropGetters.Add(propGetter);

                if (previousPropGetter != null)
                {
                    IObjWithPropGetter <object> thePreviousPropGetter = previousPropGetter;
                    previousPropGetter.PropertyChangedEvent += () =>
                    {
                        propGetter.TheObj = thePreviousPropGetter.GetPropValue();
                    };
                }

                previousPropGetter = propGetter;
            }

            previousPropGetter.PropertyChangedEvent += () =>
            {
                if (this.PropertyChangedEvent == null)
                {
                    return;
                }

                if (!LastPropGetter.HasObj)
                {
                    _cachedValue.TheValue = _defaultValue;
                }
                else
                {
                    _cachedValue.TheValue = (PropertyType)LastPropGetter.GetPropValue();
                }

                PropertyChangedEvent?.Invoke();
            };
        }
コード例 #8
0
        protected virtual void SetScoreLabel(WavesGame data, WavesGame group, PropertyChangedEvent <System.Int32> value)
        {
            var handler = new SetScoreLabel();

            handler.System   = this;
            handler.Event    = data;
            handler.Group    = group;
            handler.OldValue = value.PreviousValue;
            handler.NewValue = value.CurrentValue;
            StartCoroutine(handler.Execute());
        }
コード例 #9
0
        protected virtual void UpdateClickCount(ClickCount data, ClickCount group, PropertyChangedEvent <System.Int32> value)
        {
            var handler = new UpdateClickCount();

            handler.System   = this;
            handler.Event    = data;
            handler.Group    = group;
            handler.OldValue = value.PreviousValue;
            handler.NewValue = value.CurrentValue;
            handler.Execute();
        }
コード例 #10
0
        private void OnContentChange(PropertyChangedEvent <IControl> e)
        {
            if (e.OldValue != null)
            {
                e.OldValue.GetWinFormsView().UnsetParent(this);
            }

            var winFormsControlView = e.NewValue.GetWinFormsView();

            winFormsControlView.SetParent(this, _form);
            RecalculateSize();
        }
コード例 #11
0
        public void Addiere(Aufgabe a)
        {
            // Aufgaben.Add(a); böse

            Aufgaben.Add(new Aufgabe
            {
                Text = a.Text,
                ID   = Aufgaben.Count
            });

            PropertyChangedEvent.Invoke(this, EventArgs.Empty);
        }
コード例 #12
0
        protected override void PropertyChangedHandler(PropertyChangedEvent obj)
        {
            if (View == null)
            {
                return;
            }

            var converter = new ViewModelConverter();

            if (obj is not {
                Value : IViewModel viewModel
            })
コード例 #13
0
        public void T0()
        {
            // Arrange
            var catcher = Catcher.PropertyChanged;

            PropertyChangedEvent += catcher.Catch;
            const string propertyName = nameof(propertyName);

            // Act
            PropertyChangedEvent.Raise(this, propertyName);

            // Assert
            catcher.CaughtPropertyChanged(this, propertyName);
        }
コード例 #14
0
        protected void SetScoreLabelFilter(WavesGame data, PropertyChangedEvent <System.Int32> value)
        {
            var GroupWavesGame = WavesGameManager[data.EntityId];

            if (GroupWavesGame == null)
            {
                return;
            }
            if (!GroupWavesGame.Enabled)
            {
                return;
            }
            this.SetScoreLabel(data, GroupWavesGame, value);
        }
コード例 #15
0
ファイル: ActionDispatcher.cs プロジェクト: hksonngan/Xian
        private void ActionUpdate(object sender, ServerEventArgs e)
        {
            PropertyChangedEvent ev = e.ServerEvent as PropertyChangedEvent;

            if (ev != null)
            {
                IActionUpdate updateObject;

                if (_map.TryGetValue(ev.SenderId, out updateObject))
                {
                    updateObject.Update(ev);
                }
            }
        }
コード例 #16
0
        protected void UpdateClickCountFilter(ClickCount data, PropertyChangedEvent <System.Int32> value)
        {
            var GroupClickCount = ClickCountManager[data.EntityId];

            if (GroupClickCount == null)
            {
                return;
            }
            if (!GroupClickCount.Enabled)
            {
                return;
            }
            this.UpdateClickCount(data, GroupClickCount, value);
        }
コード例 #17
0
ファイル: Notifier.cs プロジェクト: erchiguire/Fuxion
        protected virtual void OnRaisePropertyChanged <T>(string propertyName, T previousValue, T actualValue)
        {
            var action = new Action <string, T, T>((pro, pre, act) => {
                PropertyChangedEvent?.Invoke(this, new PropertyChangedEventArgs(pro));
                PropertyChanged?.Invoke(this as TNotifier, new NotifierPropertyChangedEventArgs <TNotifier>(pro, (TNotifier)(INotifier <TNotifier>) this, pre, act));
            });

            if (UseSynchronizerOnRaisePropertyChanged && Synchronizer != null)
            {
                Synchronizer.Invoke(action, propertyName, previousValue, actualValue).Wait();
            }
            else
            {
                action(propertyName, previousValue, actualValue);
            }
        }
コード例 #18
0
ファイル: Grouping.cs プロジェクト: qube7/qcomposite
            /// <summary>
            /// Initializes a new instance of the <see cref="GroupingCollection"/> class.
            /// </summary>
            /// <param name="enumerable">The input sequence.</param>
            /// <param name="grouping">The underlying grouping.</param>
            internal GroupingCollection(IEnumerable <DependencyObject> enumerable, Grouping grouping) : this(new RecomposableCollection <DependencyObject>(grouping.GroupSort(enumerable)))
            {
                this.grouping = grouping;

                propertyListener = new PropertyChangedListener(this);

                PropertyChangedEvent.AddListener(grouping, propertyListener);

                if (enumerable is INotifyCollectionChanged collection)
                {
                    this.enumerable = enumerable;

                    collectionListener = new CollectionChangedListener(this);

                    CollectionChangedEvent.AddListener(collection, collectionListener);
                }
            }
コード例 #19
0
ファイル: ItemsConverter.cs プロジェクト: qube7/qcomposite
            /// <summary>
            /// Initializes a new instance of the <see cref="ContainerCollection"/> class.
            /// </summary>
            /// <param name="items">The input data objects.</param>
            /// <param name="converter">The underlying converter.</param>
            internal ContainerCollection(IList items, ItemsConverter converter) : this(new ObservableCollection <DependencyObject>(converter.GetContainers(items)))
            {
                this.converter = converter;

                propertyListener = new PropertyChangedListener(this);

                PropertyChangedEvent.AddListener(converter, propertyListener);

                if (items is INotifyCollectionChanged collection)
                {
                    this.items = items;

                    collectionListener = new CollectionChangedListener(this);

                    CollectionChangedEvent.AddListener(collection, collectionListener);
                }
            }
コード例 #20
0
ファイル: Component.cs プロジェクト: kmate95/HomeCenter
        private async Task HandlePropertyChange(PropertyChangedEvent propertyChanged)
        {
            if (_componentState.IsStateProvidingAdapter(propertyChanged.MessageSource, propertyChanged.PropertyChangedName) &&
                _componentState.TryUpdateState(propertyChanged.PropertyChangedName, propertyChanged.NewValue, out var oldValue))
            {
                var translator = _translators.FirstOrDefault(e => e.Type == MessageType.Event && e.From.Equals(propertyChanged));

                if (translator != null)
                {
                    await MessageBroker.PublishWithTranslate(propertyChanged, translator.To, Uid).ConfigureAwait(false);
                }
                else
                {
                    await MessageBroker.Publish(PropertyChangedEvent.Create(Uid, propertyChanged.PropertyChangedName, oldValue, propertyChanged.NewValue), Uid).ConfigureAwait(false);
                }
            }
        }
コード例 #21
0
        private async Task FetchState()
        {
            var stopwatch = Stopwatch.StartNew();

            var newState = await ReadFromBus();

            stopwatch.Stop();

            if (!_driver.TrySaveState(newState, out var oldState))
            {
                return;
            }

            var oldStateBits = new BitArray(oldState);
            var newStateBits = new BitArray(newState);

            Logger.LogTrace($"[{Uid}] fetched different state ({oldState.ToBinaryString()}->{newState.ToBinaryString()})");

            for (int pinNumber = 0; pinNumber < oldStateBits.Length; pinNumber++)
            {
                var  oldPinState    = oldStateBits.Get(pinNumber);
                var  newPinState    = newStateBits.Get(pinNumber);
                bool pinInWriteMode = IsPinInWriteMode(pinNumber);

                // When state is the same or change is in port that are set to WRITE we skip event generation
                if (oldPinState == newPinState || pinInWriteMode)
                {
                    continue;
                }

                var properyChangeEvent = PropertyChangedEvent.Create(Uid, PowerState.StateName, oldPinState, newPinState, new Dictionary <string, string>()
                {
                    [MessageProperties.PinNumber] = pinNumber.ToString()
                });

                await MessageBroker.Publish(properyChangeEvent, Uid);

                Logger.LogTrace($"[{Uid}] Pin [{pinNumber}] state changed {oldPinState}->{newPinState}");
            }

            if (stopwatch.ElapsedMilliseconds > _poolDurationWarning)
            {
                Logger.LogWarning($"Polling device '{Uid}' took {stopwatch.ElapsedMilliseconds}ms.");
            }
        }
コード例 #22
0
        /// <summary>
        /// Removes from the <see cref="PropertyObserver"/> subscriptions associated with the specified source object.
        /// </summary>
        /// <typeparam name="T">The type of the source object.</typeparam>
        /// <param name="source">The source object to unobserve.</param>
        public void Unobserve <T>(T source) where T : class, INotifyPropertyChanged
        {
            Requires.NotNull(source, nameof(source));

            CheckDisposed();

            lock (table)
            {
                if (table.TryGetValue(source, out Subscriber subscriber))
                {
                    subscriber.Dispose();

                    PropertyChangedEvent.RemoveListener(source, subscriber);

                    table.Remove(source);
                }
            }
        }
コード例 #23
0
        /// <summary>
        /// Releases resources used by the <see cref="PropertyObserver"/>.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing && ValueSafe.Increment0(ref disposed))
            {
                lock (table)
                {
                    foreach (KeyValuePair <INotifyPropertyChanged, Subscriber> pair in table)
                    {
                        Subscriber subscriber = pair.Value;

                        subscriber.Dispose();

                        PropertyChangedEvent.RemoveListener(pair.Key, subscriber);
                    }

                    table.Clear();
                }
            }
        }
コード例 #24
0
        protected async Task <T> UpdateState <T>(string stateName, T oldValue, T newValue, IDictionary <string, string> additionalProperties = null)
        {
            if (newValue == null || EqualityComparer <T> .Default.Equals(oldValue, newValue))
            {
                return(oldValue);
            }

            if (_requierdProperties.Count > 0)
            {
                if (additionalProperties == null || additionalProperties.Count != _requierdProperties.Count || !_requierdProperties.SequenceEqual(additionalProperties.Keys))
                {
                    throw new ArgumentException($"Update state on component {Uid} should be invoked with required properties: {string.Join(",", _requierdProperties)}");
                }
            }

            await MessageBroker.Publish(PropertyChangedEvent.Create(Uid, stateName, oldValue?.ToString(), newValue.ToString(), additionalProperties), Uid);

            return(newValue);
        }
コード例 #25
0
        /// <summary>
        /// Unsubscribes the specified delegate from the change notification of any property of the specified source object.
        /// </summary>
        /// <typeparam name="T">The type of the source object.</typeparam>
        /// <param name="source">The source object to unsubscribe from.</param>
        /// <param name="callback">The delegate to unsubscribe.</param>
        private void Unsubscribe <T>(T source, Action callback) where T : class, INotifyPropertyChanged
        {
            CheckDisposed();

            lock (table)
            {
                if (table.TryGetValue(source, out Subscriber subscriber))
                {
                    subscriber.Unsubscribe <T>(callback);

                    if (subscriber.IsEmpty)
                    {
                        subscriber.Dispose();

                        PropertyChangedEvent.RemoveListener(source, subscriber);

                        table.Remove(source);
                    }
                }
            }
        }
コード例 #26
0
ファイル: Component.cs プロジェクト: dominikjeske/HomeCenter
        private async Task HandlePropertyChange(PropertyChangedEvent propertyChanged)
        {
            if (_componentState.IsStateProvidingAdapter(propertyChanged.MessageSource, propertyChanged.PropertyChangedName) &&
                _componentState.TryUpdateState(propertyChanged.PropertyChangedName, propertyChanged.NewValue, out var oldValue))
            {
                var translator = _translators.FirstOrDefault(e => e.Type == MessageType.Event && e.From.Equals(propertyChanged));

                if (translator != null)
                {
                    var eventPublished = await MessageBroker.PublishWithTranslate(propertyChanged, translator.To, Uid);

                    Logger.Log(LogLevel.Information, $"<@{Uid}> {eventPublished}");
                }
                else if (RelayNotTranslatedEvents)
                {
                    var eventPublished = PropertyChangedEvent.Create(Uid, propertyChanged.PropertyChangedName, oldValue, propertyChanged.NewValue);
                    await MessageBroker.Publish(eventPublished, Uid);

                    Logger.Log(LogLevel.Information, $"<@{Uid}> {eventPublished}");
                }
            }
        }
コード例 #27
0
 public void Update(PropertyChangedEvent e)
 {
     if (e.PropertyName.Equals("Available"))
     {
         _actionItem.Available = (bool)e.Value;
         Item.Visibility       = _actionItem.DesiredVisiblility;
     }
     else if (e.PropertyName.Equals("Visible"))
     {
         _actionItem.Visible = (bool)e.Value;
         Item.Visibility     = _actionItem.DesiredVisiblility;
     }
     else if (e.PropertyName.Equals("Enabled"))
     {
         _actionItem.Enabled = (bool)e.Value;
         Item.IsEnabled      = _actionItem.Enabled;
     }
     else if (e.PropertyName.Equals("IconSet"))
     {
         _actionItem.IconSet = e.Value as WebIconSet;
         SetIcon();
     }
     else if (e.PropertyName.Equals("Tooltip"))
     {
         _actionItem.ToolTip = e.Value as string;
     }
     else if (e.PropertyName.Equals("Label"))
     {
         _actionItem.Label = e.Value as string;
         SetLabel(_actionItem.Label);
     }
     else if (e.PropertyName.Equals("Checked"))
     {
         WebClickAction action = _actionItem as WebClickAction;
         action.Checked = (bool)e.Value;
         Item.IsChecked = action.Checked;
     }
 }
コード例 #28
0
        protected async Task Handle(PropertyChangedEvent propertyChangedEvent)
        {
            if (!_Minimum.HasValue || !_Range.HasValue)
            {
                return;
            }

            var value = propertyChangedEvent.AsDouble(MessageProperties.NewValue);

            if (value < _Minimum)
            {
                value = 0;
            }

            _PreviousCurrentValue = _CurrentValue;
            _CurrentValue         = value;

            var newLevel = GetPowerLevel(value);

            Logger.LogInformation($"NEW: {newLevel}, MAX: {_Maximum}, MIN: {_Minimum}");

            _PowerLevel = await UpdateState(PowerLevelState.StateName, _PowerLevel, newLevel);
        }
コード例 #29
0
 public void TriggerPropertyChanged()
 {
     PropertyChangedEvent?.Invoke();
 }
コード例 #30
0
 protected void UpdateClickCountFilter(ClickCount data, PropertyChangedEvent<System.Int32> value) {
     var GroupClickCount = ClickCountManager[data.EntityId];
     if (GroupClickCount == null) {
         return;
     }
     if (!GroupClickCount.Enabled) {
         return;
     }
     this.UpdateClickCount(data, GroupClickCount, value);
 }
コード例 #31
0
 protected virtual void UpdateClickCount(ClickCount data, ClickCount group, PropertyChangedEvent<System.Int32> value) {
     var handler = new UpdateClickCount();
     handler.System = this;
     handler.Event = data;
     handler.Group = group;
     handler.OldValue = value.PreviousValue;
     handler.NewValue = value.CurrentValue;
     handler.Execute();
 }
コード例 #32
0
 /// <include file='doc\DataGridTable.uex' path='docs/doc[@for="DataGridTableStyle.OnColumnChanged"]/*' />
 /// <devdoc>
 ///      The DataColumnCollection class actually wires up this
 ///      event handler to the PropertyChanged events of
 ///      a DataGridTable's columns.
 /// </devdoc>
 internal void OnColumnChanged(object sender, PropertyChangedEvent event) {
     if (event.PropertyName.Equals("Visible"))
コード例 #33
0
 public void Update(PropertyChangedEvent e)
 {
     if (e.PropertyName.Equals("Available"))
     {
         _actionItem.Visible = (bool)e.Value;
         Visibility          = _actionItem.DesiredVisiblility;
     }
     else if (e.PropertyName.Equals("Visible"))
     {
         _actionItem.Visible = (bool)e.Value;
         Visibility          = _actionItem.DesiredVisiblility;
     }
     else if (e.PropertyName.Equals("Enabled"))
     {
         _actionItem.Enabled           = (bool)e.Value;
         ButtonComponent.IsEnabled     = _actionItem.Enabled;
         DropButtonComponent.IsEnabled = _actionItem.Enabled;
         if (_actionItem.Checked && !_actionItem.Enabled)
         {
             CheckedIndicator.Opacity = 0.25;
             if (_actionItem.IconSet.HasOverlay)
             {
                 OverlayCheckedIndicator.Opacity = 0.25;
             }
         }
         else if (_actionItem.Checked)
         {
             CheckedIndicator.Opacity = 1;
             if (_actionItem.IconSet.HasOverlay)
             {
                 OverlayCheckedIndicator.Opacity = 1;
             }
         }
         else
         {
             IndicateChecked(false);
         }
     }
     else if (e.PropertyName.Equals("IconSet"))
     {
         _actionItem.IconSet = e.Value as WebIconSet;
         SetIcon();
     }
     else if (e.PropertyName.Equals("ToolTip"))
     {
         _actionItem.ToolTip = e.Value as string;
         ToolTipService.SetToolTip(StackPanelVerticalComponent, _actionItem.ToolTip);
     }
     else if (e.PropertyName.Equals("Label"))
     {
         _actionItem.Label = e.Value as string;
     }
     else if (e.PropertyName.Equals("Checked"))
     {
         _actionItem.Checked = (bool)e.Value;
         IndicateChecked(_actionItem.Checked);
     }
     else if (e.PropertyName.Equals("DropDownActions"))
     {
         _actionItem.DropDownActions = e.Value as Collection <WebActionNode>;
         _dropMenu.Dispose();
         _dropMenu = MenuBuilder.BuildContextMenu(_actionItem, _actionDispatcher);
     }
     UpdateLayout();
 }
コード例 #34
0
ファイル: MenuBuilder.cs プロジェクト: nhannd/Xian
		public void Update(PropertyChangedEvent e)
        {
            if (e.PropertyName.Equals("Available"))
            {
                _actionItem.Available = (bool)e.Value;
                Item.Visibility = _actionItem.DesiredVisiblility;
            }
            else if (e.PropertyName.Equals("Visible"))
            {
				_actionItem.Visible = (bool)e.Value;
                Item.Visibility = _actionItem.DesiredVisiblility;
            }
            else if (e.PropertyName.Equals("Enabled"))
            {
				_actionItem.Enabled = (bool)e.Value;
                Item.IsEnabled = _actionItem.Enabled;
            }
            else if (e.PropertyName.Equals("IconSet"))
            {
				_actionItem.IconSet = e.Value as WebIconSet;
                SetIcon();
            }
            else if (e.PropertyName.Equals("Tooltip"))
            {
				_actionItem.ToolTip = e.Value as string;
            }
            else if (e.PropertyName.Equals("Label"))
            {
				_actionItem.Label = e.Value as string;
                SetLabel(_actionItem.Label);
            }
            else if (e.PropertyName.Equals("Checked"))
            {
				WebClickAction action = _actionItem as WebClickAction;
				action.Checked = (bool)e.Value;
				Item.IsChecked = action.Checked;
            }
        }
コード例 #35
0
ファイル: StandardButton.xaml.cs プロジェクト: nhannd/Xian
		public void Update(PropertyChangedEvent e)
		{
            if (e.PropertyName.Equals("Available"))
            {
                _actionItem.Available = (bool)e.Value;
                Visibility = _actionItem.DesiredVisiblility;
            }
            else if (e.PropertyName.Equals("Visible"))
			{
				_actionItem.Visible = (bool)e.Value;

                Visibility = _actionItem.DesiredVisiblility;
			}
			else if (e.PropertyName.Equals("Enabled"))
			{
				_actionItem.Enabled = (bool)e.Value;
				ButtonComponent.IsEnabled = _actionItem.Enabled;
                if (_actionItem.Checked && !_actionItem.Enabled)
                {
                    CheckedIndicator.Opacity = 0.25;
                    if(_actionItem.IconSet.HasOverlay) OverlayCheckedIndicator.Opacity = 0.25;
                }
                else if (_actionItem.Checked)
                {
                    CheckedIndicator.Opacity = 1;
                    if (_actionItem.IconSet.HasOverlay) OverlayCheckedIndicator.Opacity = 1;
                }
                else IndicateChecked(false);
			}
			else if (e.PropertyName.Equals("IconSet"))
			{
				_actionItem.IconSet = e.Value as WebIconSet;

				SetIcon();
			}
			else if (e.PropertyName.Equals("ToolTip"))
			{
				_actionItem.ToolTip = e.Value as string;
				ToolTipService.SetToolTip(ButtonComponent, _actionItem.ToolTip);
			}
			else if (e.PropertyName.Equals("Label"))
			{
				_actionItem.Label = e.Value as string;
			}
			else if (e.PropertyName.Equals("Checked"))
			{
				_actionItem.Checked = (bool)e.Value;

                IndicateChecked(_actionItem.Checked);
			}

			UpdateLayout();
		}
コード例 #36
0
        public override async Task RunTask(int taskId)
        {
            if (!pinNumber.HasValue)
            {
                ConsoleEx.WriteWarning("Write PIN number:");
                pinNumber = int.Parse(Console.ReadLine());
            }

            Command cmd = null;

            switch (taskId)
            {
            case 0:
                cmd = new TurnOnCommand();
                break;

            case 1:
                cmd = new TurnOffCommand();
                break;

            case 2:
                cmd          = new RefreshCommand();
                cmd.LogLevel = nameof(Microsoft.Extensions.Logging.LogLevel.Information);
                break;

            case 3:
                cmd = new SwitchPowerStateCommand();
                break;

            case 4:
                var inputUid           = "HSPE16InputOnly_2";
                var properyChangeEvent = PropertyChangedEvent.Create(inputUid, PowerState.StateName, false, true, new Dictionary <string, string>()
                {
                    [MessageProperties.PinNumber] = 0.ToString()
                });

                await MessageBroker.Publish(properyChangeEvent, inputUid);

                return;

            case 5:
                var inputUid2           = "HSPE16InputOnly_2";
                var properyChangeEvent2 = PropertyChangedEvent.Create(inputUid2, PowerState.StateName, true, false, new Dictionary <string, string>()
                {
                    [MessageProperties.PinNumber] = 0.ToString()
                });

                await MessageBroker.Publish(properyChangeEvent2, inputUid2);

                return;
            }

            if (pinNumber.HasValue && pinNumber.Value < 10)
            {
                cmd.SetProperty(MessageProperties.PinNumber, pinNumber.Value);
            }

            MessageBroker.Send(cmd, Uid);

            //return Task.CompletedTask;
        }
コード例 #37
0
ファイル: ImageBoxView.xaml.cs プロジェクト: nhannd/Xian
		private void OnPropertyChanged(PropertyChangedEvent @event)
		{
            //NOTE: the scrollbar will update automatically whenever ServerEntity is updated.

			if (@event.PropertyName == "Tiles")
			{
                ServerEntity.Tiles = (Collection<Tile>)@event.Value;
                UpdateTileViews();
                UpdateSize();
				return;
			}

			if (@event.PropertyName == "Selected")
			{
				ServerEntity.Selected = (bool)@event.Value;
				UpdateBorder();
			}
            if (@event.PropertyName == "TopLeftPresentationImageIndex")
            {
                ServerEntity.TopLeftPresentationImageIndex = (int)@event.Value;     
            }

            if (@event.PropertyName == "ImageCount")
            {
                var count = (int)@event.Value;
                if (ServerEntity.ImageCount!=count)
                {
                    ServerEntity.ImageCount = count;
                    // Note: Because the scrollbar observes PropertyChanged event on the ServerEntity, its visibility will be updated automatically in ImageBoxScrollbarView
                    // When UpdateLayout() is called in UpdateSize(), the size of the TileContainer will be updated accordingly.
                    UpdateSize();
                }
            }
		}
コード例 #38
0
ファイル: DropDownButton.xaml.cs プロジェクト: nhannd/Xian
		public void Update(PropertyChangedEvent e)
		{
            if (e.PropertyName.Equals("Available"))
            {
                _actionItem.Visible = (bool)e.Value;
                Visibility = _actionItem.DesiredVisiblility;
            }
            else if (e.PropertyName.Equals("Visible"))
			{
				_actionItem.Visible = (bool)e.Value;
                Visibility = _actionItem.DesiredVisiblility;
			}
			else if (e.PropertyName.Equals("Enabled"))
			{
				_actionItem.Enabled = (bool)e.Value;
				ButtonComponent.IsEnabled = _actionItem.Enabled;
			    DropButtonComponent.IsEnabled = _actionItem.Enabled;
                if (_actionItem.Checked && !_actionItem.Enabled)
                {
                    CheckedIndicator.Opacity = 0.25;
                    if (_actionItem.IconSet.HasOverlay) OverlayCheckedIndicator.Opacity = 0.25;
                }
                else if (_actionItem.Checked)
                {
                    CheckedIndicator.Opacity = 1;
                    if (_actionItem.IconSet.HasOverlay) OverlayCheckedIndicator.Opacity = 1;
                }
                else IndicateChecked(false);
			}
			else if (e.PropertyName.Equals("IconSet"))
			{
				_actionItem.IconSet = e.Value as WebIconSet;
			    SetIcon();
			}
			else if (e.PropertyName.Equals("ToolTip"))
			{
				_actionItem.ToolTip = e.Value as string;
                ToolTipService.SetToolTip(StackPanelVerticalComponent, _actionItem.ToolTip);
			}
			else if (e.PropertyName.Equals("Label"))
			{
				_actionItem.Label = e.Value as string;
			}
			else if (e.PropertyName.Equals("Checked"))
			{
				_actionItem.Checked = (bool)e.Value;
                IndicateChecked(_actionItem.Checked);
			}
			else if (e.PropertyName.Equals("DropDownActions"))
            {
				_actionItem.DropDownActions = e.Value as Collection<WebActionNode>;
                _dropMenu.Dispose();
                _dropMenu = MenuBuilder.BuildContextMenu(_actionItem, _actionDispatcher);
            }
			UpdateLayout();
		}
コード例 #39
0
 protected void SetScoreLabelFilter(WavesGame data, PropertyChangedEvent<System.Int32> value)
 {
     var GroupWavesGame = WavesGameManager[data.EntityId];
     if (GroupWavesGame == null) {
         return;
     }
     if (!GroupWavesGame.Enabled) {
         return;
     }
     this.SetScoreLabel(data, GroupWavesGame, value);
 }
コード例 #40
0
		public void Update(PropertyChangedEvent e)
		{
            if (e.PropertyName.Equals("Available"))
            {
                _actionItem.Available = (bool)e.Value;
                Visibility = _actionItem.DesiredVisiblility;
            }
			else if (e.PropertyName.Equals("Visible"))
			{
				_actionItem.Visible = (bool)e.Value;
                Visibility = _actionItem.DesiredVisiblility;
			}
			else if (e.PropertyName.Equals("Enabled"))
			{
				_actionItem.Enabled = (bool)e.Value;
				ButtonComponent.IsEnabled = _actionItem.Enabled;
			}
			else if (e.PropertyName.Equals("IconSet"))
			{
				_actionItem.IconSet = e.Value as WebIconSet;
			    SetIcon();
			}
			else if (e.PropertyName.Equals("ToolTip"))
			{
				_actionItem.ToolTip = e.Value as string;
                ToolTipService.SetToolTip(LayoutDropDownButton, _actionItem.ToolTip);
			}
			else if (e.PropertyName.Equals("Label"))
			{
				_actionItem.Label = e.Value as string;
			}
            UpdateLayout();
		}