コード例 #1
0
        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));
        }