Example #1
0
        /// <summary>
        /// event is fired when Ignore Folders List Box _ Key Down
        /// </summary>
        private void IgnoreFoldersListBox_KeyDown(object sender, KeyEventArgs e)
        {
            // if the delete key was pressed
            if ((e.KeyCode == Keys.Delete) && (this.HasIgnoreExceptions) && (this.IgnoreFoldersListBox.SelectedItem != null))
            {
                // cast the SelectedItem as an IgnoreFolderException
                IgnoreFolderException exception = this.IgnoreFoldersListBox.SelectedItem as IgnoreFolderException;

                // If the exception object exists
                if (NullHelper.Exists(exception))
                {
                    // attempt to find the index of the selected exception
                    int index = this.IgnoreExceptions.IndexOf(exception);

                    // if the index was found
                    if (index >= 0)
                    {
                        // remove this exception
                        this.IgnoreExceptions.RemoveAt(index);

                        // Display the exceptions
                        this.DisplayExceptions(null);
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// This event is fired AFTER the ignoreFolderException is parsed.
        /// </summary>
        /// <param name="xmlNode"></param>
        /// <param name="ignoreFolderException"></param>
        /// <returns>True if cancelled else false if not.</returns>
        public bool Parsed(XmlNode xmlNode, ref IgnoreFolderException ignoreFolderException)
        {
            // initial value
            bool cancel = false;

            // Add any post processing code here. Set cancel to true to abort adding this object.

            // return value
            return(cancel);
        }
        /// <summary>
        /// This method is used to parse IgnoreFolderException objects.
        /// </summary>
        public IgnoreFolderException ParseIgnoreFolderException(ref IgnoreFolderException ignoreFolderException, XmlNode xmlNode)
        {
            // if the ignoreFolderException object exists and the xmlNode exists
            if ((ignoreFolderException != null) && (xmlNode != null))
            {
                // get the full name of this node
                string fullName = xmlNode.GetFullName();

                // Check the name of this node to see if it is mapped to a property
                switch (fullName)
                {
                case "Shipment.Options.DoNotCopyContentFolders.Folder.Exceptions.Exception.ExceptionType":

                    // Set the value for ignoreFolderException.ExceptionTypeValue
                    ignoreFolderException.ExceptionTypeValue = NumericHelper.ParseInteger(xmlNode.FormattedNodeValue, 0, -1);

                    // required
                    break;

                case "Shipment.Options.DoNotCopyContentFolders.Folder.Exceptions.Exception.Name":

                    // Set the value for ignoreFolderException.Name
                    ignoreFolderException.Name = xmlNode.FormattedNodeValue;

                    // required
                    break;

                case "Shipment.Options.DoNotCopyContentFolders.Folder.Exceptions.Exception.Text":

                    // Set the value for ignoreFolderException.Text
                    ignoreFolderException.Text = xmlNode.FormattedNodeValue;

                    // required
                    break;
                }

                // if there are ChildNodes
                if (xmlNode.HasChildNodes)
                {
                    // iterate the child nodes
                    foreach (XmlNode childNode in xmlNode.ChildNodes)
                    {
                        // append to this IgnoreFolderException
                        ignoreFolderException = ParseIgnoreFolderException(ref ignoreFolderException, childNode);
                    }
                }
            }

            // return value
            return(ignoreFolderException);
        }
Example #4
0
        /// <summary>
        /// This method Display Exceptions
        /// </summary>
        public void DisplayExceptions(IgnoreFolderException selectedException = null)
        {
            // Clear the ListBox
            this.IgnoreFoldersListBox.Items.Clear();

            // locals
            int index         = -1;
            int selectedIndex = -1;

            // If the IgnoreExceptions object exists
            if (this.HasIgnoreExceptions)
            {
                // iterate the exceptions
                foreach (IgnoreFolderException exception in this.IgnoreExceptions)
                {
                    // Increment the value for index
                    index++;

                    // if the selected exception exists
                    if (NullHelper.Exists(selectedException))
                    {
                        // if this is the selected item
                        if (exception.Name == selectedException.Name)
                        {
                            // set the selectedIndex
                            selectedIndex = index;

                            // Set the SelectedIgnoreFolderException
                            this.SelectedIgnoreFolderException = exception;
                        }
                    }

                    // Add this object
                    this.IgnoreFoldersListBox.Items.Add(exception);
                }

                // set the selected index
                this.IgnoreFoldersListBox.SelectedIndex = selectedIndex;

                // Display the Exception
                this.DisplayException(this.SelectedIgnoreFolderException);
            }
        }
Example #5
0
        /// <summary>
        /// event is fired when the 'AddIgnoreExceptionButton' is clicked.
        /// </summary>
        private void AddIgnoreExceptionButton_Click(object sender, EventArgs e)
        {
            // If the IgnoreExceptions object exists
            if (this.HasIgnoreExceptions)
            {
                // Create a new instance of an 'IgnoreFolderException' object.
                IgnoreFolderException exception = new IgnoreFolderException();

                // Add the name that must be changed
                exception.Name = "New Exception";

                // Add this exception
                this.IgnoreExceptions.Add(exception);

                // Display the exceptions
                this.DisplayExceptions(exception);

                // Set Focus to the Textbox
                this.ExceptionNameControl.SetFocusToTextBox();
            }
        }
Example #6
0
        /// <summary>
        /// This method Display Exception
        /// </summary>
        public void DisplayException(IgnoreFolderException exception)
        {
            // locals
            string name          = "";
            int    selectedIndex = -1;
            string text          = "";

            // If the exception object exists
            if (NullHelper.Exists(exception))
            {
                // set the values
                name          = exception.Name;
                selectedIndex = this.IgnoreExceptionType.FindItemIndexByValue(exception.IgnoreExceptionType.ToString());
                text          = exception.Text;
            }

            // Display the values
            this.ExceptionNameControl.Text         = name;
            this.IgnoreExceptionType.SelectedIndex = selectedIndex;
            this.ExceptionTextControl.Text         = text;
        }
        /// <summary>
        /// This method is used to parse a list of 'IgnoreFolderException' objects.
        /// </summary>
        /// <param name="XmlNode">The XmlNode to be parsed.</param>
        /// <returns>A list of 'IgnoreFolderException' objects.</returns>
        public List <IgnoreFolderException> ParseIgnoreFolderExceptions(XmlNode xmlNode, List <IgnoreFolderException> ignoreFolderExceptions = null)
        {
            // locals
            IgnoreFolderException ignoreFolderException = null;
            bool cancel = false;

            // if the xmlNode exists
            if (xmlNode != null)
            {
                // get the full name for this node
                string fullName = xmlNode.GetFullName();

                // if this is the new collection line
                if (fullName == "Shipment.Options.DoNotCopyContentFolders.Folder.Exceptions")
                {
                    // Raise event Parsing is starting.
                    cancel = Parsing(xmlNode);

                    // If not cancelled
                    if (!cancel)
                    {
                        // create the return collection
                        ignoreFolderExceptions = new List <IgnoreFolderException>();
                    }
                }
                // if this is the new object line and the return collection exists
                else if ((fullName == "Shipment.Options.DoNotCopyContentFolders.Folder.Exceptions.Exception") && (ignoreFolderExceptions != null))
                {
                    // Create a new object
                    ignoreFolderException = new IgnoreFolderException();

                    // Perform pre parse operations
                    cancel = Parsing(xmlNode, ref ignoreFolderException);

                    // If not cancelled
                    if (!cancel)
                    {
                        // parse this object
                        ignoreFolderException = ParseIgnoreFolderException(ref ignoreFolderException, xmlNode);
                    }

                    // Perform post parse operations
                    cancel = Parsed(xmlNode, ref ignoreFolderException);

                    // If not cancelled
                    if (!cancel)
                    {
                        // Add this object to the return value
                        ignoreFolderExceptions.Add(ignoreFolderException);
                    }
                }

                // if there are ChildNodes
                if (xmlNode.HasChildNodes)
                {
                    // iterate the child nodes
                    foreach (XmlNode childNode in xmlNode.ChildNodes)
                    {
                        // self call this method for each childNode
                        ignoreFolderExceptions = ParseIgnoreFolderExceptions(childNode, ignoreFolderExceptions);
                    }
                }
            }

            // return value
            return(ignoreFolderExceptions);
        }