Пример #1
0
        public void Reload()
        {
            foreach (var Item in this.icFileUploadElements.Items)
            {
                FileUploadElement fileUploadElement = WpfUIUtilities.FindVisualChild <FileUploadElement>(Item as DependencyObject);
                if (fileUploadElement == null)
                {
                    fileUploadElement = WpfUIUtilities.FindLogicalChild <FileUploadElement>(Item as DependencyObject);
                }

                fileUploadElement.Reload();
            }
        }
Пример #2
0
        //This method is called when format was changed
        //and sets the format on each of the file upload elements
        private void LstFormats_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            foreach (var Item in this.icFileUploadElements.Items)
            {
                FileUploadElement fileUploadElement = WpfUIUtilities.FindVisualChild <FileUploadElement>(Item as DependencyObject);
                if (fileUploadElement == null)
                {
                    fileUploadElement = WpfUIUtilities.FindLogicalChild <FileUploadElement>(Item as DependencyObject);
                }

                string filter = lstFormats.SelectedValue as string;
                fileUploadElement.Filter = filter;
            }
        }
Пример #3
0
        private void SetControlsToFormat()
        {
            foreach (var Item in this.icFileUploadElements.Items)
            {
                FileUploadElement fileUploadElement = WpfUIUtilities.FindVisualChild <FileUploadElement>(Item as DependencyObject);
                if (fileUploadElement == null)
                {
                    fileUploadElement = WpfUIUtilities.FindLogicalChild <FileUploadElement>(Item as DependencyObject);
                }

                string filter = Format;
                fileUploadElement.Filter = filter;
            }
        }
Пример #4
0
        public List <string> GetItems()
        {
            List <string> lstItems = new List <string>();

            foreach (var Item in this.icFileUploadElements.Items)
            {
                FileUploadElement fueUploader = WpfUIUtilities.FindVisualChild <FileUploadElement>(Item as DependencyObject);
                if (fueUploader != null && !string.IsNullOrEmpty(fueUploader.txbFileName.Text))
                {
                    lstItems.Add(fueUploader.txbFileName.Text);
                }
            }
            return(lstItems);
        }
Пример #5
0
        /// <summary>
        /// This method used to show errors that occur
        /// during validation of formats and contents of uploaded files
        /// </summary>
        /// <param name="errors">Represents dictionary of errors: the key is the type if its error/warning/etc and the value is the message to display</param>

        public void ShowErrors(SortedList <string, string> errors)
        {
            List <string> lstItems = new List <string>();

            foreach (var error in errors)
            {
                foreach (var Item in this.icFileUploadElements.Items)
                {
                    FileUploadElement fueUploader = WpfUIUtilities.FindVisualChild <FileUploadElement>(Item as DependencyObject);
                    if (fueUploader != null && fueUploader.txbFileName.Text == error.Key)
                    {
                        fueUploader.ShowError(error.Value);
                    }
                }
            }
        }
Пример #6
0
        public void FileUpload_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            for (int i = 0; i < NumElements; i++)
            {
                StackPanel        sp  = new StackPanel();
                FileUploadElement fue = new FileUploadElement();
                fue.Uploaded  += Fue_Uploaded;
                sp.Orientation = Orientation.Horizontal;
                sp.Children.Add(fue);

                sp.Margin = new Thickness(15);

                icFileUploadElements.Items.Add(sp);
            }
            spFileUploadContainer.Children.Add(icFileUploadElements);
            this.InitialContent = spFileUploadContainer;
        }