Ejemplo n.º 1
0
        public CoinKernelProfileViewModel GetOrCreateCoinKernelProfileVm(Guid coinKernelId)
        {
            if (_coinKernelProfileDicById.ContainsKey(coinKernelId))
            {
                return(_coinKernelProfileDicById[coinKernelId]);
            }
            CoinKernelProfileViewModel coinKernelProfileViewModel = new CoinKernelProfileViewModel(NTMinerRoot.Current.CoinKernelProfileSet.GetCoinKernelProfile(coinKernelId));

            _coinKernelProfileDicById.Add(coinKernelId, coinKernelProfileViewModel);
            return(coinKernelProfileViewModel);
        }
Ejemplo n.º 2
0
        public CoinKernelProfileViewModel GetOrCreateCoinKernelProfileVm(Guid coinKernelId)
        {
            CoinKernelProfileViewModel coinKernelProfileVm;

            if (!_coinKernelProfileDicById.TryGetValue(coinKernelId, out coinKernelProfileVm))
            {
                lock (_coinKernelProfileLocker) {
                    if (!_coinKernelProfileDicById.TryGetValue(coinKernelId, out coinKernelProfileVm))
                    {
                        coinKernelProfileVm = new CoinKernelProfileViewModel(NTMinerRoot.Current.MinerProfile.GetCoinKernelProfile(coinKernelId));
                        _coinKernelProfileDicById.Add(coinKernelId, coinKernelProfileVm);
                    }
                }
            }

            return(coinKernelProfileVm);
        }