0
FileSystem.CopyFile(fSource, fTarget, UIOption.AllDialogs, UICancelOption.DoNothing);
                                            foreach (ListViewItem checkItem in listView_left.Items)
                                            {

                                                if (checkItem.Text == lItem.Text)
                                                {
                                                    listView_left.Items.Remove(checkItem);
                                                }
                                            }
                                            listView_left.Items.Add((ListViewItem)lItem.Clone());
                                            reload(lItem, fSource);

how can i return the UIOption.AllDialogs value so if it's cancel it doesnt do the code after the first line?

Edited by darkseid: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by mcriscolo
0

Perhaps this:

try
{
    FileSystem.CopyFile(fSource, fTarget, UIOption.AllDialogs, UICancelOption.ThrowException);  // Throw exception if user cancels
    foreach (ListViewItem checkItem in listView_left.Items)
    {
        if (checkItem.Text == lItem.Text)
        {
            listView_left.Items.Remove(checkItem);
        }
    }
    listView_left.Items.Add((ListViewItem)lItem.Clone());
    reload(lItem, fSource);
}
catch (OperationCanceledException ocex)
{
    // The user canceled
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.