コード例 #1
0
        public bool Update()
        {
            IsInitializing = true;
            _logger.Info("Updating vMix state.");
            var _temp = Create();

            if (_temp == null)
            {
                _logger.Info("vMix is offline");
                _logger.Info("Firing \"updated\" event.");

                if (OnStateUpdated != null)
                {
                    OnStateUpdated(this, new StateUpdatedEventArgs()
                    {
                        Successfully = false
                    });
                }
                IsInitializing = false;
                return(false);
            }

            _logger.Info("Calculating difference.");
            Diff(this, _temp);

            _logger.Info("Updating inputs.");

            Inputs.Clear();
            foreach (var item in _temp.Inputs)
            {
                Inputs.Add(item);
            }
            Overlays.Clear();
            foreach (var item in _temp.Overlays)
            {
                Overlays.Add(item);
            }


            UpdateChangedInputs(_currentStateText, _temp._currentStateText);
            if (_currentStateText != _temp._currentStateText)
            {
                _currentStateText = _temp._currentStateText;
            }

            _logger.Info("Firing \"updated\" event.");

            OnStateUpdated?.Invoke(this, new StateUpdatedEventArgs()
            {
                Successfully = true, OldInputs = null, NewInputs = null
            });
            IsInitializing = false;
            return(true);
        }
コード例 #2
0
 private void NotifyStateUpdated(IDictionary <string, object> extraData)
 {
     OnStateUpdated?.Invoke(this, new StateUpdateEventArgs <T>(_state, extraData));
 }
コード例 #3
0
 private void OnObjectiveProgressUpdated(QuestObjectiveState objectiveState)
 {
     OnStateUpdated?.Invoke();
 }