示例#1
0
        public async Task <bool> ConnectCamera(Lumix camera)
        {
            try
            {
                var connectResult = await camera.Connect(LiveViewPort, lang);

                if (connectResult)
                {
                    ipToLumix[camera.CameraHost]  = camera;
                    usnToLumix[camera.Device.Usn] = camera;
                    Debug.WriteLine("Add listener: " + camera.CameraHost, "UDP");
                }

                return(connectResult);
            }
            catch (Exception ex)
            {
                Log.Error(new Exception("Connection failed", ex));
                return(false);
            }
        }
示例#2
0
        public void StartConnectCamera(Lumix camera, Action <bool> onConnect)
        {
            camera.Disconnected += Camera_Disconnected;

            Task.Run(async() =>
            {
                try
                {
                    var connectResult = await camera.Connect(LiveViewPort, lang);
                    if (connectResult)
                    {
                        ipToLumix[camera.CameraHost]  = camera;
                        usnToLumix[camera.Device.Usn] = camera;
                        Debug.WriteLine("Add listener: " + camera.CameraHost, "UDP");
                    }

                    onConnect(connectResult);
                }
                catch (Exception ex)
                {
                    Log.Error(new Exception("Connection failed", ex));
                }
            });
        }