void Close(bool okPressed)
        {
            if (okPressed)
            {
                if (ProfileTypes.Count(p => p.IsSelected) != 1)
                {
                    _uiService.ShowErrorDialog("Please select exactly one option.", ComponentContainer.MessageBoxTitle);
                    return;
                }

                SelectedProfile = ProfileTypes.Single(p => p.IsSelected).ProfileType;
            }

            CloseRequested?.Invoke(this, new CloseEventArgs(okPressed));
        }
예제 #2
0
        public bool Validate()
        {
            IOptionsViewModel firstViewModelWithError;
            string            errorMessage;

            if (!Validate(out errorMessage, out firstViewModelWithError))
            {
                _uiService.ShowErrorDialog(errorMessage, Strings.Get($"Some options contain invalid values"));
                if (firstViewModelWithError != null)
                {
                    firstViewModelWithError.IsSelected = true;
                }
                return(false);
            }

            return(true);
        }
예제 #3
0
        private void Close(bool shouldSaveNewOptions)
        {
            if (shouldSaveNewOptions)
            {
                IOptionsViewModel firstViewModelWithError;
                string            errorMessage;
                if (!Validate(out errorMessage, out firstViewModelWithError))
                {
                    _uiService.ShowErrorDialog(errorMessage, "Some Options contain invalid Values");
                    if (firstViewModelWithError != null)
                    {
                        firstViewModelWithError.IsSelected = true;
                    }
                    return;
                }
            }

            CloseRequested?.Invoke(this, new CloseEventArgs(shouldSaveNewOptions));
        }
예제 #4
0
        void Close(bool okPressed)
        {
            if (okPressed)
            {
                if (ProfileTypes.Count(p => p.IsSelected) != 1)
                {
                    _uiService.ShowErrorDialog(Strings.Get($"Please select exactly one option."), ComponentContainer.MessageBoxTitle);
                    return;
                }

                if (StringComparer.InvariantCultureIgnoreCase.Equals(ProfileTypes.Single(p => p.IsSelected).ProfileType.Name, "Open-Xchange"))
                {
                    _uiService.ShowOXInfoDialog();
                    return;
                }

                SelectedProfile = ProfileTypes.Single(p => p.IsSelected).ProfileType;
            }

            CloseRequested?.Invoke(this, new CloseEventArgs(okPressed));
        }