Exemple #1
0
        /// <summary>
        /// Align the configuration State of this Action accordingly to the Data.
        /// </summary>
        private void ValidateData()
        {
            bool pathOk     = !String.IsNullOrEmpty(this.FilePath);
            bool filenameOk = !String.IsNullOrEmpty(this.Filename) && !GenericAction.ContainsIllegalCharacters(this.txtBxFilename.Text) && GenericAction.IsValidFileOrFolderName(this.txtBxFilename.Text);

            this.txtBxFilePath.BackColor = pathOk ? SystemColors.Window : Color.Orange;
            this.txtBxFilename.BackColor = filenameOk ? SystemColors.Window : Color.Orange;
            this.ConfigurationState      = (pathOk && filenameOk) ? ConfigurationStates.Configured : ConfigurationStates.Misconfigured;
        }
Exemple #2
0
        /// <summary>
        /// Align the configuration State of this Action accordingly to the Data.
        /// </summary>
        private void ValidateData()
        {
            bool pathOK    = !String.IsNullOrEmpty(this.FullPath) && !this.FullPath.EndsWith(@"\");
            bool newNameOK = !String.IsNullOrEmpty(this.NewName) && GenericAction.IsValidFileOrFolderName(this.NewName) && !GenericAction.ContainsIllegalCharacters(this.NewName);

            this.txtBxFullPath.BackColor = pathOK ? SystemColors.Window : Color.Orange;
            this.txtBxNewName.BackColor  = newNameOK ? SystemColors.Window : Color.Orange;

            this.ConfigurationState = (pathOK && newNameOK) ? ConfigurationStates.Configured : ConfigurationStates.Misconfigured;
        }
Exemple #3
0
        private void tlpCustomActions_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(typeof(CustomActions.DragDropInfo)))
            {
                CustomActions.DragDropInfo dragDropInfo = (CustomActions.DragDropInfo)e.Data.GetData(typeof(CustomActions.DragDropInfo));
                CustomActions.GenericAction controlToMove = dragDropInfo.EmbededControl;
                Point mousePoint = tlpCustomActions.PointToClient(new Point(e.X, e.Y));
                CustomActions.GenericAction destinationControl = (CustomActions.GenericAction)tlpCustomActions.GetChildAtPoint(mousePoint);

                this._customUpdate.MoveAction(controlToMove, destinationControl);
                this.IsUnsaved = true;
                RefreshDisplay();
            }
        }
        /// <summary>
        /// Align the configuration State of this Action accordingly to the Data.
        /// </summary>
        public void ValidateData()
        {
            bool folderPathOK = !String.IsNullOrEmpty(this.FolderPath) && !this.FolderPath.EndsWith(@"\");
            bool newNameOK    = !String.IsNullOrEmpty(this.NewName) && !GenericAction.ContainsIllegalCharacters(this.NewName);

            this.txtBxFolderPath.BackColor = folderPathOK ? SystemColors.Window : Color.Orange;
            this.txtBxNewName.BackColor    = newNameOK ? SystemColors.Window : Color.Orange;

            if (folderPathOK && newNameOK)
            {
                this.ConfigurationState = ConfigurationStates.Configured;
            }
            else
            {
                this.ConfigurationState = ConfigurationStates.Misconfigured;
            }
        }
        /// <summary>
        /// Initialize properties of this Action with values contains in the dictionary.
        /// </summary>
        /// <param name="properties">A dictionary where keys are propertie name, and values are propertie value.</param>
        public void InitializeProperties(System.Collections.Generic.Dictionary <string, string> properties)
        {
            System.Reflection.PropertyInfo[] thisProperties = this.GetType().GetProperties();

            foreach (System.Collections.Generic.KeyValuePair <string, string> property in properties)
            {
                string propertyName  = property.Key;
                string propertyValue = property.Value;
                bool   found         = false;

                for (int i = 0; i < thisProperties.Length; i++)
                {
                    if (thisProperties[i].Name.ToLower() == propertyName.ToLower())
                    {
                        found = true;

                        if (thisProperties[i].PropertyType.BaseType == typeof(System.Enum))
                        {
                            if (thisProperties[i].PropertyType == typeof(CustomActions.RegistryHelper.ValueType))
                            {
                                thisProperties[i].SetValue(this, GenericAction.ConvertToEnum <CustomActions.RegistryHelper.ValueType>(propertyValue), null);
                            }
                            if (thisProperties[i].PropertyType == typeof(CustomActions.RegistryHelper.RegistryHive))
                            {
                                thisProperties[i].SetValue(this, GenericAction.ConvertToEnum <CustomActions.RegistryHelper.RegistryHive>(propertyValue), null);
                            }
                        }
                        else
                        {
                            thisProperties[i].SetValue(this, Convert.ChangeType(propertyValue, thisProperties[i].PropertyType), null);
                        }

                        break;
                    }
                }
                if (!found)
                {
                    throw new Exception(String.Format(this.GetLocalizedString("TheXmlElementHasNotBeenMatchWithProperty"), propertyName, this.GetType()));
                }
            }
        }
 public DragDropInfo(GenericAction control)
 {
     this.EmbededControl = control;
 }