Exemplo n.º 1
0
    private void btnSync_Click(object sender, EventArgs e)
    {
        string Overwrite;

        if (rbOverwrite.Checked)
        {
            Overwrite = "Overwrite";
        }
        else if (rbPrompt.Checked)
        {
            Overwrite = "Prompt";
        }
        else
        {
            Overwrite = "Skip";
        }
        if (cbSource.Text != cbDest.Text)
        {
            string[] Destinations = new string[cbDest.CheckedItems.Count];

            SyncVar.Progress = pbProgress; //Pass progress bar to class so it can be updated.

            cbDest.CheckedItems.CopyTo(Destinations, 0);

            SyncVar.SyncVariants(cbSource.Text, Destinations, Overwrite, cbForce.Checked);
            this.Close();
        }
        else
        {
            MessageBox.Show("From and To are the same. Please select different locations.");
        }
    }