Click here to Skip to main content
15,889,462 members
Home / Discussions / WPF
   

WPF

 
Questionwpf gridview does not have a row selected event Pin
Stephen Holdorf9-Aug-16 4:26
Stephen Holdorf9-Aug-16 4:26 
AnswerRe: wpf gridview does not have a row selected event Pin
Richard Deeming9-Aug-16 5:10
mveRichard Deeming9-Aug-16 5:10 
GeneralRe: wpf gridview does not have a row selected event Pin
Stephen Holdorf9-Aug-16 9:57
Stephen Holdorf9-Aug-16 9:57 
GeneralRe: wpf gridview does not have a row selected event Pin
Richard Deeming9-Aug-16 10:09
mveRichard Deeming9-Aug-16 10:09 
GeneralRe: wpf gridview does not have a row selected event Pin
Stephen Holdorf10-Aug-16 2:24
Stephen Holdorf10-Aug-16 2:24 
QuestionCopy directory with progress bar in WPF Pin
Dadou557-Aug-16 20:12
Dadou557-Aug-16 20:12 
AnswerRe: Copy directory with progress bar in WPF Pin
Richard MacCutchan7-Aug-16 21:14
mveRichard MacCutchan7-Aug-16 21:14 
GeneralRe: Copy directory with progress bar in WPF Pin
Dadou557-Aug-16 21:50
Dadou557-Aug-16 21:50 
i found this code (thanks for your link):

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace copynestedfolderformapplication
{
    public partial class Form1 : Form
    {
         int maxbytes = 0;
         int copied = 0;
         int total=0;
       
        public Form1()
        {
            InitializeComponent();
        }

        private void copybtn_Click(object sender, EventArgs e)
        {
            Copy1(@"F:\Posts", @"G:\copydata");
          
            MessageBox.Show("Done");
        }
       
        public void Copy1(string sourceDirectory, string targetDirectory)
        {
         
            DirectoryInfo diSource = new DirectoryInfo(sourceDirectory);
            DirectoryInfo diTarget = new DirectoryInfo(targetDirectory);
          //Gets size of all files present in source folder.
            GetSize(diSource, diTarget);
            maxbytes = maxbytes / 1024;
           
            progressBar1.Maximum = maxbytes;
            CopyAll(diSource, diTarget);
        }
        public void CopyAll(DirectoryInfo source, DirectoryInfo target)
        {
           
            if (Directory.Exists(target.FullName) == false)
            {
                Directory.CreateDirectory(target.FullName);
            }
            foreach (FileInfo fi in source.GetFiles())
            {
               
                fi.CopyTo(Path.Combine(target.ToString(), fi.Name), true);

                total += (int)fi.Length;
               
                copied += (int)fi.Length;
                copied /= 1024;
                progressBar1.Step =copied;
                            
                progressBar1.PerformStep();
                label1.Text = (total/1048576).ToString() + "MB of " + (maxbytes/1024).ToString() + "MB copied";
               
               
              
                label1.Refresh();
            }
            foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
            {
               
              
              
                DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
                CopyAll(diSourceSubDir, nextTargetSubDir);
            }
        }

        public  void GetSize(DirectoryInfo source, DirectoryInfo target)
        {

        
            if (Directory.Exists(target.FullName) == false)
            {
                Directory.CreateDirectory(target.FullName);
            }
            foreach (FileInfo fi in source.GetFiles())
            {
                maxbytes += (int)fi.Length;//Size of File
             
              
            }
            foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
            {
                DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
                GetSize(diSourceSubDir, nextTargetSubDir);
             
            }
           
        }
    }
}


where do i need to include the Backgroundworker in this code?
GeneralRe: Copy directory with progress bar in WPF Pin
Pete O'Hanlon7-Aug-16 22:06
mvePete O'Hanlon7-Aug-16 22:06 
GeneralRe: Copy directory with progress bar in WPF Pin
Dadou557-Aug-16 22:38
Dadou557-Aug-16 22:38 
GeneralRe: Copy directory with progress bar in WPF Pin
Pete O'Hanlon7-Aug-16 22:46
mvePete O'Hanlon7-Aug-16 22:46 
QuestionExecuting a WPF .exe program from an email link Pin
Stephen Holdorf5-Aug-16 8:07
Stephen Holdorf5-Aug-16 8:07 
AnswerRe: Executing a WPF .exe program from an email link Pin
Richard Deeming5-Aug-16 8:26
mveRichard Deeming5-Aug-16 8:26 
AnswerRe: Executing a WPF .exe program from an email link Pin
Stephen Holdorf5-Aug-16 9:40
Stephen Holdorf5-Aug-16 9:40 
GeneralRe: Executing a WPF .exe program from an email link Pin
Dave Kreskowiak5-Aug-16 9:45
mveDave Kreskowiak5-Aug-16 9:45 
AnswerRe: Executing a WPF .exe program from an email link Pin
Richard MacCutchan5-Aug-16 20:42
mveRichard MacCutchan5-Aug-16 20:42 
AnswerRe: Executing a WPF .exe program from an email link Pin
Gerry Schmitz6-Aug-16 7:07
mveGerry Schmitz6-Aug-16 7:07 
GeneralRe: Executing a WPF .exe program from an email link Pin
Stephen Holdorf7-Aug-16 11:26
Stephen Holdorf7-Aug-16 11:26 
GeneralRe: Executing a WPF .exe program from an email link Pin
Gerry Schmitz7-Aug-16 12:16
mveGerry Schmitz7-Aug-16 12:16 
QuestionResourceDictionary swapped at run-time only applies to MainWindow Pin
Imagiv5-Aug-16 6:51
Imagiv5-Aug-16 6:51 
AnswerRe: ResourceDictionary swapped at run-time only applies to MainWindow Pin
Richard Deeming5-Aug-16 7:02
mveRichard Deeming5-Aug-16 7:02 
GeneralRe: ResourceDictionary swapped at run-time only applies to MainWindow Pin
Imagiv5-Aug-16 7:18
Imagiv5-Aug-16 7:18 
QuestionKeepTextBoxDisplaySynchronizedWithTextProperty Pin
Kevin Marois28-Jul-16 7:18
professionalKevin Marois28-Jul-16 7:18 
AnswerRe: KeepTextBoxDisplaySynchronizedWithTextProperty Pin
Matt T Heffron28-Jul-16 7:33
professionalMatt T Heffron28-Jul-16 7:33 
GeneralRe: KeepTextBoxDisplaySynchronizedWithTextProperty Pin
Kevin Marois28-Jul-16 7:39
professionalKevin Marois28-Jul-16 7:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.