/// <summary>
        /// Accepts the edited connection by assigning all changes
        /// from the EditItem to the DataItem and persisting the changes.
        /// </summary>
        public void Accept()
        {
            if (ConnectionNames != null && ConnectionNames.Any(x => x == EditItem.Name) && !Runtime.ShowConfirm(
                    "A connection with the same name already exists. Would you like to overwrite the existing connection?",
                    MessageBoxButton.YesNo))
            {
                return;
            }

            // Reset saved SSL protocol
            EditItem.SecurityProtocol = 0;

            // Get selected SSL protocols
            SecurityProtocols
            .Where(x => x.IsEnabled && x.IsSelected)
            .ForEach(x => EditItem.SecurityProtocol |= x.Protocol);

            TestConnection()
            .ContinueWith(x =>
            {
                if (x.Result || Runtime.Invoke(() => Runtime.ShowConfirm("Connection failed.\n\nDo you wish to save the connection settings anyway?", MessageBoxButton.YesNo)))
                {
                    AcceptConnectionChanges();
                }
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Accepts the edited connection by assigning all changes
        /// from the EditItem to the DataItem and persisting the changes.
        /// </summary>
        public void Accept()
        {
            if (ConnectionNames != null && ConnectionNames.Any(x => x == EditItem.Name) && !Runtime.ShowConfirm(
                    "A connection with the same name already exists. Would you like to overwrite the existing connection?",
                    MessageBoxButton.YesNo))
            {
                return;
            }

            TestConnection()
            .ContinueWith(x =>
            {
                if (x.Result || Runtime.Invoke(() => Runtime.ShowConfirm("Connection failed.\n\nDo you wish to save the connection settings anyway?", MessageBoxButton.YesNo)))
                {
                    AcceptConnectionChanges();
                }
            });
        }