Exemple #1
0
        public bool AddTransaction(T type, long value)
        {
            if (value == 0)
            {
                return(true);
            }

            if (!_repository.ContainsKey(type))
            {
                if (value < 0)
                {
                    return(false);
                }
                RegisterType(type);
            }

            var result = _repository[type] + value;

            if (result < 0)
            {
                return(false);
            }

            _repository[type] = result;
            OnRepositoryChanged?.Invoke(this, null);
            return(true);
        }
Exemple #2
0
        private void OnRepositoryUpdatedHandler()
        {
            Logger.Trace("Starting OnRepositoryUpdatedHandler");

            var task = GitClient.Status()
                       .Finally((success, ex, data) =>
            {
                if (success && data.HasValue)
                {
                    OnRepositoryChanged?.Invoke(data.Value);
                }
                Logger.Trace("Ending OnRepositoryUpdatedHandler");
            });

            HookupHandlers(task).Start();
        }
 private void RepositoryManager_OnRepositoryChanged(GitStatus status)
 {
     CurrentStatus = status;
     //Logger.Debug("Got STATUS 2 {0} {1}", OnRepositoryChanged, status);
     OnRepositoryChanged?.Invoke(CurrentStatus);
 }