Пример #1
0
        private void HandleRemoveProfile()
        {
            var id = _ui.SelectedProfile;

            if (!_profiles.Contains(id))
            {
                _ui.ShowErrorMessage(_tr._("Selected profile does not exist!"));
                return;
            }

            if (!_ui.ConfirmProfileDeletion(id))
            {
                return;
            }

            try {
                _profiles.Remove(id);
            }
            catch {
                _ui.ShowErrorMessage(_tr._("Failed to delete the profile!"));
                return;
            }

            var profileNames = _profiles.Names;

            _settings.Profile = profileNames.Length > 0 ? profileNames[0] : string.Empty;
            _ui.SetProfiles(_profiles.Names, _settings.Profile);
        }