コード例 #1
0
ファイル: DapService.cs プロジェクト: thoja21/banshee-1
        private DapSource FindDeviceSource(IDevice device)
        {
            foreach (TypeExtensionNode node in supported_dap_types)
            {
                try {
                    DapSource source = (DapSource)node.CreateInstance();
                    source.DeviceInitialize(device, false);
                    source.LoadDeviceContents();
                    source.AddinId = node.Addin.Id;
                    return(source);
                } catch (InvalidDeviceStateException) {
                    Log.WarningFormat(
                        "Dap.DapService: invalid state, mapping potential source for {0}",
                        device.Name
                        );
                    DapSource source = new PotentialSource(this, node, device);
                    return(source);
                } catch (InvalidDeviceException) {
                } catch (InvalidCastException e) {
                    Log.Warning("Extension is not a DapSource as required", e);
                } catch (Exception e) {
                    Log.Error(e);
                }
            }

            return(null);
        }
コード例 #2
0
ファイル: DapService.cs プロジェクト: thoja21/banshee-1
        private void OnHardwareDeviceChanged(object o, DeviceChangedEventArgs args)
        {
            DapSource source;

            if (!sources.TryGetValue(args.Device.Uuid, out source))
            {
                MapDevice(args.Device);
                return;
            }

            PotentialSource potential = source as PotentialSource;

            if (potential != null)
            {
                potential.TryInitialize();
            }
        }
コード例 #3
0
ファイル: DapService.cs プロジェクト: knocte/banshee
        private DapSource FindDeviceSource(IDevice device)
        {
            foreach (TypeExtensionNode node in supported_dap_types) {
                try {
                    DapSource source = (DapSource)node.CreateInstance ();
                    source.DeviceInitialize (device, false);
                    source.LoadDeviceContents ();
                    source.AddinId = node.Addin.Id;
                    return source;
                } catch (InvalidDeviceStateException) {
                    Log.WarningFormat (
                        "Dap.DapService: invalid state, mapping potential source for {0}",
                        device.Name
                    );
                    DapSource source = new PotentialSource (this, node, device);
                    return source;
                } catch (InvalidDeviceException) {
                } catch (InvalidCastException e) {
                    Log.Warning ("Extension is not a DapSource as required", e);
                } catch (Exception e) {
                    Log.Error (e);
                }
            }

            return null;
        }