コード例 #1
0
        private void SavePools(PoolSettingsXml ps)
        {
            if (ps != null)
            {
                if (ps.IsMain)
                {
                    var mainPool = Pools.Where(x => x.IsMain).FirstOrDefault();
                    if (mainPool != null)
                    {
                        mainPool.IsMain = false;
                    }
                }

                SelectedPool.CoinType         = ps.CoinType;
                SelectedPool.URL              = ps.URL.Trim();
                SelectedPool.FailOverPriority = ps.FailOverPriority;
                SelectedPool.IsCPUPool        = ps.IsCPUPool;
                SelectedPool.IsFailOver       = ps.IsFailOver;
                SelectedPool.IsGPUPool        = ps.IsGPUPool;
                SelectedPool.IsMain           = ps.IsMain;
                SelectedPool.Password         = String.IsNullOrEmpty(ps.Password)?String.Empty:ps.Password.Trim();
                SelectedPool.Port             = ps.Port;
                SelectedPool.Username         = ps.Username.Trim();
                SelectedPool.Algorithm        = ps.Algorithm;
                SelectedPool.Name             = ps.Name;
                SelectedPool.Website          = ps.Website;
            }

            var poolzToSave = Pools.ToList();

            PoolHandler.SavePools(poolzToSave);
            Pools = Pools.OrderByDescending(x => x.IsMain).ThenByDescending(x => x.IsFailOver).ThenBy(x => x.FailOverPriority).ToList();
            RaisePropertyChanged(nameof(Pools));
            RefreshPools?.Invoke();
        }
コード例 #2
0
        private void SavePools(PoolSettingsXml ps)
        {
            if (ps != null)
            {
                if (ps.IsMain)
                {
                    var mainPool = Pools.Where(x => x.IsMain).FirstOrDefault();
                    if (mainPool != null)
                    {
                        mainPool.IsMain = false;
                    }
                }

                SelectedPool.CoinType         = ps.CoinType;
                SelectedPool.URL              = ps.URL.Trim();
                SelectedPool.FailOverPriority = ps.FailOverPriority;
                SelectedPool.IsCPUPool        = ps.IsCPUPool;
                SelectedPool.IsFailOver       = ps.IsFailOver;
                SelectedPool.IsGPUPool        = ps.IsGPUPool;
                SelectedPool.IsMain           = ps.IsMain;
                SelectedPool.Password         = string.IsNullOrEmpty(ps.Password) ? string.Empty : ps.Password.Trim();
                SelectedPool.Port             = ps.Port;
                SelectedPool.Username         = ps.Username.Trim();
                SelectedPool.Algorithm        = ps.Algorithm;
                SelectedPool.Name             = ps.Name;
                SelectedPool.Website          = ps.Website;
            }

            List <PoolSettingsXml> poolzToSave = new List <PoolSettingsXml>();

            Pools.ForEach(x => poolzToSave.Add(new PoolSettingsXml()
            {
                Algorithm        = Utils.MigrateAlgorithm(x.Algorithm).ToString(),
                CoinType         = x.CoinType,
                FailOverPriority = x.FailOverPriority,
                ID             = x.ID,
                IsCPUPool      = x.IsCPUPool,
                IsGPUPool      = x.IsGPUPool,
                IsFailOver     = x.IsFailOver,
                IsMain         = x.IsMain,
                IsRemoveable   = x.IsRemoveable,
                Name           = x.Name,
                Password       = x.Password,
                Port           = x.Port,
                StatsAvailable = x.StatsAvailable,
                StatUrl        = x.StatUrl,
                URL            = x.URL,
                Username       = x.Username,
                Website        = x.Website
            }));
            PoolHandler.SavePools(poolzToSave);
            Pools = Pools.OrderByDescending(x => x.IsMain).ThenByDescending(x => x.IsFailOver).ThenBy(x => x.FailOverPriority).ToList();
            RaisePropertyChanged(nameof(Pools));
            RefreshPools?.Invoke();
        }