private void UploadFile(object param)
        {
            ItemsControl        itemsControl    = (ItemsControl)param;
            FileUploaderControl uploaderControl = new FileUploaderControl(119, SelectedFile, GetUploadMethod());

            itemsControl.Items.Add(uploaderControl);
            SelectedFile = "Click Here To Browse";
        }
        public void CheckPendingUploads(ItemsControl itemsControl)
        {
            PendingUploadsResponse pendingUploadsResponse = fileUploaderWindowModel.GetPendingUploads(_userId);

            foreach (var pUpload in pendingUploadsResponse.PendingUploads)
            {
                FileUploaderControl uploaderControl = new FileUploaderControl(pUpload.UserId, pUpload.ClientFilePath, pUpload.UploadMethod);
                itemsControl.Items.Add(uploaderControl);
                SelectedFile = "Click Here To Browse";
            }
        }
Exemplo n.º 3
0
        private void Application_Exit(object sender, EventArgs e)
        {
            FileUploaderControl fileUploader = ((Page)this.RootVisual).fileUploader;

            if (fileUploader != null && fileUploader.Files != null)
            {
                // clear the file list when the application exits, which will dispose the file streams
                // for any files that were not uploaded.
                // Any other threads that could be accessing the file should be robust to the file stream being abandoned
                // when the application exits, and shut down gracefully.
                fileUploader.Files.Clear();
            }
        }