Пример #1
0
 public PlayerState()
 {
     m_cash          = new NotifyProperty <int>();
     m_enemiesAlive  = new NotifyProperty <int>();
     m_enemiesKilled = new NotifyProperty <int>();
     m_currentTime   = DEFAULT_TIME;
 }
Пример #2
0
 protected virtual void OnListPositionChanged(object sender, NotifyProperty text)
 {
     toolPosition.Text = text.Value;
     if (list.ListSource != null)
     {
         toolWindow.Label.Text = list.ListSource.Count.ToString() + " совпадений";
     }
 }
Пример #3
0
 public void Set<TValue>(NotifyProperty<TClass, TValue> property, TValue value)
 {
     if (((NotifyProperty<TClass, TValue>.NotifyPropertyValue) _dict.GetOrAdd(property, property.GetValue))
         .Set(value))
     {
         OnPropertyChanged(property.Name);
     }
 }
Пример #4
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public override void Dispose()
 {
     if (_ErrorDictionary != null && _ErrorDictionary.Count > 0)
     {
         _ErrorDictionary.Clear();
     }
     if (NotifyProperty != null)
     {
         NotifyProperty.Dispose();
     }
     base.Dispose();
 }
Пример #5
0
 private void Init()
 {
     playerState   = new PlayerState();
     m_currentExit = new NotifyProperty <GameObject>();
     if (GameObject.Find("AlarmSystem") != null)
     {
         m_alarmLightsController = GameObject.Find("AlarmSystem").GetComponent <AlarmLightsController>();
     }
     if (GameObject.Find("AlarmSystem") != null)
     {
         m_alarmEnemySpawner = GameObject.Find("AlarmSystem").GetComponent <AlarmEnemySpawner>();
     }
 }
Пример #6
0
        public static bool TrySet <T>(this NotifyProperty notify, ref T value, T newValue)
        {
            var change = false;

            if (notify != null)
            {
                if (!value.Equals(newValue))
                {
                    value  = newValue;
                    change = true;
                }
            }

            return(change);
        }
Пример #7
0
        public MainViewModel(ISettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            this.m_settings = settings;


            IsPluggedInProperty = new NotifyProperty <bool>(this, nameof(IsPluggedIn));


            IsAwayModeEnabledProperty    = new NotifyProperty <bool>(this, nameof(IsAwayModeEnabled));
            ToggleAwayModeEnabledCommand = new DelegateCommand(ToggleAwayModeEnabled, CanToggleAwayModeEnabled);


            IsAwayModeSleepOverrideActivatedProperty = new NotifyProperty <bool>(this, nameof(IsAwayModeSleepOverrideActivated), m_settings.IsAwayModeSleepOverrideActivated);
            ToggleAwayModeSleepOverrideCommand       = new DelegateCommand(ToggleAwayModeSleepOverride, CanToggleAwayModeSleepOverride);


            EffectiveIsAwayModeSleepOverrideActivatedProperty = this.CreateDerivedNotifyProperty(nameof(EffectiveIsAwayModeSleepOverrideActivated),
                                                                                                 IsAwayModeEnabledProperty, IsAwayModeSleepOverrideActivatedProperty,
                                                                                                 (enabled, active) => enabled && active);


            KeepDisplayOnProperty      = new NotifyProperty <bool>(this, nameof(KeepDisplayOn), m_settings.KeepDisplayOn);
            ToggleKeepDisplayOnCommand = new DelegateCommand(ToggleKeepDisplayOn, CanToggleKeepDisplayOn);


            IsIdleOverrideActivatedProperty = new NotifyProperty <bool>(this, nameof(IsIdleOverrideActivated), m_settings.IsIdleOverrideActivated);
            ToggleIdleOverrideCommand       = new DelegateCommand(ToggleIdleOverride, CanToggleIdleOverride);


            EffectiveExecutionStateProperty = this.CreateDerivedNotifyProperty(nameof(EffectiveExecutionState),
                                                                               EffectiveIsAwayModeSleepOverrideActivatedProperty, KeepDisplayOnProperty, IsIdleOverrideActivatedProperty,
                                                                               CalculateEffectiveExecutionState);
        }
Пример #8
0
 private void OnNotifyPositionChangedEV(object sender, NotifyProperty text)
 {
     this.lable.Text = text.Value;
 }
Пример #9
0
 public GitRepoInfo()
 {
     Status = new NotifyProperty <IEnumerable <FileStatusInfo> >(this, nameof(Status), Enumerable.Empty <FileStatusInfo>());
 }
Пример #10
0
 /// <summary>
 /// 通知 batchsize,receivetimeout修改
 /// </summary>
 /// <param name="property"></param>
 public void OnNotifyPropertyChange(NotifyProperty property)
 {
     switch (property)
     {
         case NotifyProperty.BatchSize:
             if (_setBatchSize) break;
             setBatchSize(ConfigUtil.Instance.GetBatchSize(ConfigKey));
             break;
         case NotifyProperty.ReceiveTimeout:
             if (_setReceiveTimeout) break;
             setReceiveTimeout(ConfigUtil.Instance.GetReceiveTimeout(ConfigKey));
             break;
         case NotifyProperty.PoolSize:
             var poolSize = ConfigUtil.Instance.GetPoolSize(ConfigKey);
             if (poolSize > 0)
             {
                 _threadPool.ChangeMaxPoolSize(poolSize);
                 ConnectionLimitManager.SetConnection(PullingRequestUri, poolSize);
             }
             break;
         default:
             break;
     }
 }
Пример #11
0
 private void ListOnPositionChanged(object sender, NotifyProperty text)
 {
     toolCount.Text = text.Value;
 }
Пример #12
0
 public TValue Get<TValue>(NotifyProperty<TClass,TValue> property) 
     => ((NotifyProperty<TClass,TValue>.NotifyPropertyValue)_dict.GetOrAdd(property,property.GetValue)).Get();
Пример #13
0
        public CHDB(string applicationPath)
        {
            pathToCHDB   = Path.Combine(applicationPath, CHDBFilename);
            pathToInWork = Path.Combine(applicationPath, InWorkFilename);
            pathToTagDB  = Path.Combine(applicationPath, TagDBFilename);

            CHDBElement   = loadOrCreateXElement(pathToCHDB, XName.Get("CH"));
            InWorkElement = loadOrCreateXElement(pathToInWork, XName.Get("CH"));
            TagDBElement  = loadOrCreateXElement(pathToTagDB, XName.Get("Tags"));

            CurrentFile = pathToCHDB;

            Root = CHDBElement ?? new XElement("CH");

            CHDBElement.Changed   += CHDB_Changed;
            InWorkElement.Changed += InWorkElement_Changed;
            TagDBElement.Changed  += TagDBElement_Changed;

            _roundModeProperty             = NotifyProperty.CreateNotifyProperty(this, () => RoundMode);
            _selectedRoundProperty         = NotifyProperty.CreateNotifyProperty(this, () => SelectedRound);
            _selectedVideoProperty         = DerivedNotifyProperty.CreateDerivedNotifyProperty <XElement, XElement>(this, () => SelectedVideo, _selectedRoundProperty, GetVideoFromRound);
            _currentPlayerPos              = NotifyProperty.CreateNotifyProperty(this, () => CurrentPlayerPosition);
            _breakModeProperty             = NotifyProperty.CreateNotifyProperty(this, () => CurrentBreakMode);
            _onBreakProperty               = NotifyProperty.CreateNotifyProperty(this, () => OnBreak);
            _breakProgressProperty         = NotifyProperty.CreateNotifyProperty(this, () => BreakProgress);
            _breakMinimumProperty          = NotifyProperty.CreateNotifyProperty(this, () => BreakMinimum);
            _breakMaximumProperty          = NotifyProperty.CreateNotifyProperty(this, () => BreakMaximum);
            _breakBetweenMinLengthProperty = NotifyProperty.CreateNotifyProperty(this, () => MinBetweenBreakLength);
            _breakBetweenMaxLengthProperty = NotifyProperty.CreateNotifyProperty(this, () => MaxBetweenBreakLength);
            _breakSetMaxLengthProperty     = NotifyProperty.CreateNotifyProperty(this, () => MaxSetBreakLength);
            _bothFilesExist = NotifyProperty.CreateNotifyProperty(this, () => BothFilesExist);
            _tagTreeViewSyncedToSelectedRound        = NotifyProperty.CreateNotifyProperty(this, () => TagTreeViewSyncedToSelectedRound);
            _treeViewSelectedItemProperty            = NotifyProperty.CreateNotifyProperty(this, () => TreeViewSelectedItem);
            _treeViewSelectedItemTagsDerivedProperty = DerivedNotifyProperty.CreateDerivedNotifyProperty <XElement, List <TokenizedTagItem> >(this, () => TreeViewSelectedTags, _treeViewSelectedItemProperty, GetTagsFromSelectedItem);

            BothFilesExist = File.Exists(pathToCHDB) && File.Exists(pathToInWork);

            TagTreeViewSyncedToSelectedRound = false;

            CurrentBreakMode = BreakMode.Set;
            OnBreak          = false;

            BreakMinimum  = 0;
            BreakMaximum  = 100;
            BreakProgress = 0;

            RoundMode = true;

            timer.Tick    += Timer_Tick;
            timer.Interval = new TimeSpan(0, 0, 0, 0, 100); // 100 milliseconds

            MinBetweenBreakLength = 1;
            MaxBetweenBreakLength = 8;
            MaxSetBreakLength     = 60;

            doStartupCheck();

            if (AllVideos.Count() == 0)  // if at this point we have no videos... die horrific death?
            {
                MessageBox.Show(String.Format("Could not find any videos! Exiting... check your XML files. path used: {0}", applicationPath));
                Environment.Exit(1);
            }

            // cannot access anything that needs "Exists" or "Buried" until after startup check
            SelectedRound = AllRounds.First();
        }