private static EntryDefinition BuildUsernameDefinition(int order)
        {
            var entryDefinition = new EntryDefinition
            {
                InputType    = InputType.Text,
                IsRequired   = false,
                Label        = ConnectionPropertyLabels.Username,
                PropertyName = ConnectionPropertyKeys.Username,
                Order        = order,
            };

            return(entryDefinition);
        }
        private static EntryDefinition BuildPasswordDefinition(int order)
        {
            var entryDefinition = new EntryDefinition
            {
                InputType    = InputType.Password,
                IsRequired   = false,
                Label        = ConnectionPropertyLabels.Password,
                PropertyName = ConnectionPropertyKeys.Password,
                Order        = order,
            };

            return(entryDefinition);
        }
Пример #3
0
        private static EntryDefinition BuildUrlDefinition(int order)
        {
            var entryDefinition = new EntryDefinition
            {
                InputType    = InputType.Text,
                IsRequired   = true,
                Label        = ConnectionPropertyLabels.BaseUrl,
                PropertyName = ConnectionPropertyKeys.BaseUrl,
                Order        = order,
            };

            return(entryDefinition);
        }
        /// <summary>
        /// Construct an XML serialized form that will define the input properties that will be displayed in the UI and 
        /// used to pass back into the connection using the connect method the connection method
        /// </summary>
        /// <returns></returns>
        private string BuildUiFormDefinition()
        {
            FormDefinition formDefinition = new FormDefinition();
            //Add your company name here, this is a required field 
            formDefinition.CompanyName = "Scribe Software Corporation © 1996-2011 All rights reserved.";
            //declare the key used for transfering of sensative data
            //this is a required 
            formDefinition.CryptoKey = CryptoKey;

            //decalare a help uri, this is not required and will not be display if it is not declared
            formDefinition.HelpUri = new Uri("http://www.scribesoft.com");

            //for each input item on the screen a new entry definition will need to be created and 
            //added to the form definition in order to be serialized and passed up to the ui.
            //this first entry will define a combo box
            EntryDefinition entry = new EntryDefinition();

            //set the input type to plain text
            entry.InputType = InputType.Text;
            entry.IsRequired = true;

            //set the Label that is displayed to the user and the identifying property name
            //note: the label and the property name may be different
            entry.Label = "Provider";
            entry.PropertyName = "Provider";

            //set the position in which the control will be displayed
            entry.Order = 1;

            //the options will hold the list of values to be placed in the combo box
            //The first value is what will be displayed to the user
            //The second value is the actual value that will be passed back to the connector
            entry.Options.Add("SQL Server 2012", "SQLNCLI11");
            entry.Options.Add("SQL Server 2008", "SQLNCLI10");
            entry.Options.Add("SQL Server 2005", "SQLNCLI");
            //finally add the entry definition representing the combobox to the form definition
            formDefinition.Add(entry);

            //create and entry for a standard text box
            formDefinition.Add(new EntryDefinition { InputType = InputType.Text, PropertyName = "Server", Label = "Server", Order = 2, IsRequired = true });
            formDefinition.Add(new EntryDefinition { InputType = InputType.Text, PropertyName = "Database", Label = "Database", Order = 3, IsRequired = true });
            formDefinition.Add(new EntryDefinition { InputType = InputType.Text, PropertyName = "UserName", Label = "UserName", Order = 4, IsRequired = true });

            //Finally create a password field
            formDefinition.Add(new EntryDefinition { InputType = InputType.Password, PropertyName = "Password", Label = "Password", Order = 5, IsRequired = true });

            //serialize the formDefinition so that it can be sent back to the UI
            return formDefinition.Serialize();
        }
Пример #5
0
        /// <summary>
        /// Registers a new entry with the given ID, name and parameters.
        /// </summary>
        /// <exception cref="ArgumentNullException">If the given ID or name is null or empty.</exception>
        /// <exception cref="ArgumentException">If an entry with this ID has already been added.</exception>
        public VisualEntryConfigurator Add(string id, string name, Action <VisualEntryParameterConfigurator> parameters)
        {
            if (entries.ContainsKey(id))
            {
                throw new ArgumentException($"An entry with this ID ('{id}') has already been registered.", nameof(id));
            }

            var paramConfig = new VisualEntryParameterConfigurator();

            parameters(paramConfig);
            var ed = new EntryDefinition(id, name, paramConfig.parameters);

            entries.Add(id, ed);
            return(this);
        }
        private static EntryDefinition BuildRunAsDefinition(int order)
        {
            var entryDefinition = new EntryDefinition
            {
                InputType    = InputType.Text,
                IsRequired   = true,
                Label        = ConnectionPropertyLabels.RunAs,
                PropertyName = ConnectionPropertyKeys.RunAs,
                Order        = order,
            };

            entryDefinition.Options.Add(RunAsTypeLabels.User, RunAsTypes.User);
            entryDefinition.Options.Add(RunAsTypeLabels.Agent, RunAsTypes.Agent);

            return(entryDefinition);
        }
Пример #7
0
        private static EntryDefinition BuildHMACDefinition(int order)
        {
            var entryDefinition = new EntryDefinition
            {
                InputType    = InputType.Text,
                IsRequired   = true,
                Label        = ConnectionPropertyLabels.HMAC,
                PropertyName = ConnectionPropertyKeys.HMAC,
                Order        = order,
            };

            entryDefinition.Options.Add("Enabled", "Enabled");
            entryDefinition.Options.Add("Disabled", "Disabled");

            return(entryDefinition);
        }
 public VisualNodeViewModel CreateNode(EntryDefinition entryDefinition) => CreateNode(model.Nodes.Create(entryDefinition));
Пример #9
0
        /// <summary>
        /// Construct an XML serialized form that will define the input properties that will be displayed in the UI and 
        /// used to pass back into the connection using the connect method the connection method
        /// </summary>
        /// <returns></returns>
        private string BuildUiFormDefinition()
        {
            FormDefinition formDefinition = new FormDefinition();
            //Add your company name here, this is a required field
            formDefinition.CompanyName = "Scribe Software Corporation © 1996-2011 All rights reserved.";
            //declare the key used for transfering of sensative data
            //this is a required
            formDefinition.CryptoKey = CryptoKey;

            //decalare a help uri, this is not required and will not be display if it is not declared
            formDefinition.HelpUri = new Uri("http://www.scribesoft.com");

            //for each input item on the screen a new entry definition will need to be created and
            //added to the form definition in order to be serialized and passed up to the ui.
            //this first entry will define a combo box
            EntryDefinition entry = new EntryDefinition();

            //set the input type to plain text
            entry.InputType = InputType.Text;
            entry.IsRequired = true;

            //set the Label that is displayed to the user and the identifying property name
            //note: the label and the property name may be different
            entry.Label = "Provider";
            entry.PropertyName = "Provider";

            //set the position in which the control will be displayed
            entry.Order = 1;

            //the options will hold the list of values to be placed in the combo box
            //The first value is what will be displayed to the user
            //The second value is the actual value that will be passed back to the connector
            entry.Options.Add("SQL Server 2012", "SQLNCLI11");
            entry.Options.Add("SQL Server 2008", "SQLNCLI10");
            entry.Options.Add("SQL Server 2005", "SQLNCLI");
            //finally add the entry definition representing the combobox to the form definition
            formDefinition.Add(entry);

            //create and entry for a standard text box
            formDefinition.Add(new EntryDefinition { InputType = InputType.Text, PropertyName = "Server", Label = "Server", Order = 2, IsRequired = true });
            formDefinition.Add(new EntryDefinition { InputType = InputType.Text, PropertyName = "Database", Label = "Database", Order = 3, IsRequired = true });
            formDefinition.Add(new EntryDefinition { InputType = InputType.Text, PropertyName = "UserName", Label = "UserName", Order = 4, IsRequired = true });

            //Finally create a password field
            formDefinition.Add(new EntryDefinition { InputType = InputType.Password, PropertyName = "Password", Label = "Password", Order = 5, IsRequired = true });

            //serialize the formDefinition so that it can be sent back to the UI
            return formDefinition.Serialize();
        }