Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19599 |

    Hi

    i am trying to create zip file, if my user want to cancel operation copyto how can i do it??

    please help me

    Imported from legacy forums. Posted by dcave (had 7446 views)

    Xceed Support
    Member
    Post count: 5658

    Hi dcave,

    here’s a blog post from Martin Plante explaining how to achieve this.

    http://blogs.xceedsoft.com/plantem/PermaLink.aspx?guid=cff8fc14-76a1-4fde-a4f0-a49ab582a21a

    Have a good day!

    Imported from legacy forums. Posted by Jacques [Xceed] (had 413 views)

    User (Old forums)
    Member
    Post count: 23064

    The sample code from the blog is generating an unhandled exception error at following line of code:
    private void CheckAbort_ByteProgression(object sender, ByteProgressionEventArgs e)
    {
    if (m_abort)
    throw new ApplicationException(“The user aborted the operation.”); //this is where the unhandled exception occurs.
    Application.DoEvents();
    }

    Imported from legacy forums. Posted by jnavarro (had 400 views)

    Xceed Support
    Member
    Post count: 5658

    This is probably because you don’t have a try..catch around the CopyTo or MoveTo method in your code.

    The abort is done in 2 steps.

    1. Raise an exception in the ByteProgression event as follow:

    private void CheckAbort_ByteProgression(object sender, ByteProgressionEventArgs e)
    {
    if( m_abort )
    throw new ApplicationException( “The user aborted the operation.” );

    Application.DoEvents();
    }

    2. You must trap this exception on the CopyTo or MoveTo method as follow


    try
    {
    source.CopyTo( events, null, zip, true );
    }
    catch( System.Reflection.TargetInvocationException except )
    {
    MessageBox.Show( except.InnerException.Message, “Abort” );
    }

    Hope this help,

    Imported from legacy forums. Posted by Jacques [Xceed] (had 306 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve done that already. The code eventually ends up in the catch block for the System.Reflection.TargetInvocationException but not before the unhandled exception error is triggered in the CheckByte_Progression event. I copied the code from the blog verbatim and still get the error. Are you actually able to run the code with no error?

    Imported from legacy forums. Posted by jnavarro (had 247 views)

    Xceed Support
    Member
    Post count: 5658

    I just tested it and it works fine here.

    From where to where are you coying/moving the file? (which product are you using?)

    Imported from legacy forums. Posted by Jacques [Xceed] (had 408 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve e-mailed you a copy of the complete source code I’m using.

    Imported from legacy forums. Posted by jnavarro (had 273 views)

    Xceed Support
    Member
    Post count: 5658

    Hi jnavarro,

    our webmaster just transmitted me the files you sent. BTW, if you want to send files regarding an issue in the future, please send them to support@xceedsoft.com. It will be treated faster this way. 🙂

    Back to our issue, I just tested your project and indeed, I have the same behavior as yours. I’ve done some more testing with it and this only happens when using release version of our components (it’s obvioustly your case :)) and we running inside the debugger of VS.NET 2005. If you run your project with CTRL-F5 (basically not using the debugger), the process will go as it should. It will be also ok when you will be running your release version of your application.

    The behavior have changed with Visual Studio 2005 regarding the way it handles exceptions. I don’t have the details of those changes and I wasn’t expecting this procedure to react this way.

    Imported from legacy forums. Posted by Jacques [Xceed] (had 316 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Jaques,

    I am new to C# and .NET. I am trying to use Xceed Zip v3.4 with Mono on Linux for a GUI application project. Do you know if the aforementioned approach works with Mono?

    Thanks in advance

    Jiangbin

    Imported from legacy forums. Posted by jzhao (had 344 views)

    User (Old forums)
    Member
    Post count: 23064

    It should work, except that TargetInvocationException is not implemented under Mono, so that you need to use System.Reflection.TargetException instead of System.Reflection.TargetInvocationException.

    Imported from legacy forums. Posted by André (had 7189 views)

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.