Beispiel #1
0
        private void LoadProfiles()
        {
            var profilesResult = _profileLoader.LoadProfiles();

            if (profilesResult.IsSuccess)
            {
                _profiles = profilesResult.Value;
                return;
            }

            _logger.Debug($"Profiles.json not found. Creating default profiles.");
            var defaultProfile = new Profile
            {
                Name         = "Local",
                HostName     = "localhost",
                HostPort     = 9050,
                UserName     = "******",
                UserPassword = "******"
            };

            _profiles = new List <Profile>
            {
                defaultProfile
            };
            _profileSaver.SaveProfiles(_profiles.ToList());
        }
Beispiel #2
0
        private async Task LoadProfiles()
        {
            var oldProfiles = Profiles.ToDictionary(x => x.ProfilePath, x => x.ProcessInfos);
            var profiles    = await _profileLoader.LoadProfiles(Constants.ProfilesPath);

            // Migrate old process infos
            foreach (var profile in profiles)
            {
                if (!oldProfiles.TryGetValue(profile.ProfilePath, out var oldProcessInfos))
                {
                    continue;
                }

                foreach (var processInfo in oldProcessInfos)
                {
                    profile.AddProcessInfo(processInfo);
                }
            }

            Profiles.Clear();

            foreach (var profile in profiles)
            {
                Profiles.Add(profile);
            }

            NotifyOfPropertyChange(nameof(Profiles));
        }
        private async Task LoadProfiles()
        {
            var profiles = await _profileLoader.LoadProfiles(Constants.ProfilesPath);

            Profiles.Clear();

            foreach (var profile in profiles)
            {
                Profiles.Add(profile);
            }

            NotifyOfPropertyChange(nameof(Profiles));
        }