private async void ConfirmButtonClick(object sender, EventArgs e)
        {
            try
            {
                // Validate name and access input.
                if (!VersionNameValid(_nameEntry.Text))
                {
                    return;
                }

                if (_protectionSpinner.SelectedItem != null)
                {
                    VersionAccess access = (VersionAccess)Enum.Parse(typeof(VersionAccess), _protectionSpinner.SelectedItem.ToString());

                    // Set the user defined name, access level and description as service version parameters
                    ServiceVersionParameters newVersionParameters = new ServiceVersionParameters();
                    newVersionParameters.Name        = _nameEntry.Text;
                    newVersionParameters.Access      = access;
                    newVersionParameters.Description = _descriptionEntry.Text ?? "";

                    ServiceVersionInfo newVersion = await _serviceGeodatabase.CreateVersionAsync(newVersionParameters);

                    _userCreatedVersionName = newVersion.Name;
                    _ = SwitchVersion();

                    _versionButton.Text = "Switch version";
                }
                else
                {
                    ShowAlert("Please select an access level");
                    return;
                }
            }
            catch (Exception ex)
            {
                ShowAlert(ex.Message, ex.GetType().Name);
            }
            finally
            {
                SwitchView(_defaultView);
            }
        }
        private async void ConfirmButtonClick(object sender, EventArgs e)
        {
            try
            {
                // Validate name and access input.
                if (!VersionNameValid(_nameField.Text))
                {
                    return;
                }

                if (_userVersionAccess is VersionAccess access)
                {
                    // Set the user defined name, access level and description as service version parameters
                    ServiceVersionParameters newVersionParameters = new ServiceVersionParameters();
                    newVersionParameters.Name        = _nameField.Text;
                    newVersionParameters.Access      = access;
                    newVersionParameters.Description = _descriptionField.Text ?? "";

                    ServiceVersionInfo newVersion = await _serviceGeodatabase.CreateVersionAsync(newVersionParameters);

                    _userCreatedVersionName = newVersion.Name;
                    _ = SwitchVersion();

                    _versionButton.SetTitle("Switch version", UIControlState.Normal);
                }
                else
                {
                    ShowAlert("Please select an access level");
                    return;
                }
            }
            catch (Exception ex)
            {
                ShowAlert(ex.Message, ex.GetType().Name);
            }
            finally
            {
                SwitchView(_defaultView);
            }
        }
Пример #3
0
        private async void ConfirmVersionClick(object sender, EventArgs e)
        {
            try
            {
                // Validate name and access input.
                if (!VersionNameValid(NameEntryBox.Text))
                {
                    return;
                }

                if (!(AccessBox.SelectedItem is VersionAccess))
                {
                    ShowAlert("Please select an access level");
                    return;
                }

                // Set the user defined name, access level and description as service version parameters
                ServiceVersionParameters newVersionParameters = new ServiceVersionParameters();
                newVersionParameters.Name        = NameEntryBox.Text;
                newVersionParameters.Access      = (VersionAccess)AccessBox.SelectedItem;
                newVersionParameters.Description = DescriptionBox.Text ?? "";

                ServiceVersionInfo newVersion = await _serviceGeodatabase.CreateVersionAsync(newVersionParameters);

                _userCreatedVersionName = newVersion.Name;
                _ = SwitchVersion();

                CreateVersionButton.Text = "Switch version";
            }
            catch (Exception ex)
            {
                ShowAlert(ex.Message, ex.GetType().Name);
            }
            finally
            {
                SwitchView(DefaultView);
            }
        }