How do you feel about modal code????

Post Reply
BStrauss3
Posts: 36
Joined: Sun Jun 12, 2016 11:12 pm

How do you feel about modal code????

Post by BStrauss3 » Mon Aug 08, 2016 5:37 am

The exception when the Canon EDSDK.dll file is missing is getting swallowed up and there's no indication other than in the log about the problem.

I would like to catch this and put it front & center under the user's nose.

The 'simplest' fix is to put some code in InitCanon, but that is run by both the GUI and the CameraControlCmd programs (also CameraControlRemoteCmd). So in CameraDeviceManager.cs's InitCanon() I would need to do a Console.WriteLine() for one case and some kind of message box for the other...

So what's the feeling about adding using System.Window and this:

Code: Select all

            catch (Exception exception)
            {
                Log.Error("Unable init canon driver", exception);
                /* Give specific guidance if the error is a missing DLL */
                if ((exception.InnerException != null) && (exception.InnerException.Message != null) && (exception.InnerException.Message.Contains("EDSDK.dll")))
                {
                    /* one or the other */
                    if (Process.GetCurrentProcess().ProcessName.Equals("CameraControl"))
                    {
                        MessageBoxResult result = MessageBox.Show("Canon EOS camera library, EDSDK.dll is missing\nInstall it after downloading from Canon's site\n\nDo you want to close this application?\n\n(You can try to continue, but it probably will not not work)", "Critical Error", MessageBoxButton.YesNo, MessageBoxImage.Question);
                        if (result == MessageBoxResult.Yes)
                        {
                            Application.Current.Shutdown();
                        }
                    } else
                    {
                        Console.WriteLine("\n**CRITICAL ERROR**\n\nCanon EOS camera library, EDSDK.dll is missing\nInstall it after downloading from Canon's site\n");
                    }

                }
            }

How do you feel about modal code????

Advertisment
 

Duka Istvan
Posts: 684
Joined: Sat Oct 03, 2015 7:57 pm

Re: How do you feel about modal code????

Post by Duka Istvan » Mon Aug 08, 2016 1:19 pm

I want to use less reference as possible for CameraControl.Devices. This error happen only for developers not for the final user, maybe some debug info which can be observed easily can be better
In mean time i fixed the example project the EDSDK.dll is included in the project

BStrauss3
Posts: 36
Joined: Sun Jun 12, 2016 11:12 pm

Re: How do you feel about modal code????

Post by BStrauss3 » Mon Aug 08, 2016 3:34 pm

I've re-read the Canon SDK license and there are some requirements that must be met to include EDSDK.dll in the .msi file.

From "SDK License Agreement, Created By: Admin 07/01/2004 12:09 PM":

I am not a lawyer, but as I read it, "Software" is the SDK (includes the dll) and "Developer Software" is digiCamControl
2. SUBLICENSES: If you distribute Developer Software, you will sublicense said Software under an End-User License Agreement which contains the same conditions and restrictions contained in this Agreement. Without limiting the foregoing, your End-User License Agreement shall specifically disclaim any warranty by, or liability of, Canon, its parent, subsidiaries and affiliates and shall limit the customer to use of the Developer Software with the Product. You agree to abide by the terms of this Agreement, to inform your customers of them, to require your customers to comply with them and to actively pursue correction of known breaches by your customers. Willful violation of this Agreement will be grounds for immediate termination of this Agreement or any sublicense granted hereunder. You acknowledge that damages at law may be an inadequate remedy and agree that Canon may enforce its rights under this Agreement by injunction by any court of competent jurisdiction.
The rest of the license says you can't use Canon trademarks and Canon isn't responsible for the Developer Software.


I think it would be sufficient to include a copy of the Canon SDK license with the statement "the EDSDK.dll file is the property of Canon, Inc. redistributed under license only for use with digiCamControl. Cannon, its parent, subsidiaries and affiliates make no warranty and have no liability for digiCamControl.".

BStrauss3
Posts: 36
Joined: Sun Jun 12, 2016 11:12 pm

Re: How do you feel about modal code????

Post by BStrauss3 » Tue Aug 09, 2016 4:36 am

OK, I'll just rethrow the exception and catch it in CameraControlCmd.cs

That shouldn't bother the GUI and between your adding the DLL and the code change, the Cmd program with handle the critical error better.

Duka Istvan
Posts: 684
Joined: Sat Oct 03, 2015 7:57 pm

Re: How do you feel about modal code????

Post by Duka Istvan » Tue Aug 09, 2016 12:01 pm

Thanks, you done a really good job
I hope i will have more free time in this weekend and i will test cmd with a Nikon camera if everything working right

Post Reply