コード例 #1
0
 private void DestroyUnsupportedView()
 {
     if (unsupported_view != null)
     {
         unsupported_view.Refresh -= OnRebuildDatabaseRefresh;
         unsupported_view.Destroy();
         unsupported_view = null;
     }
 }
コード例 #2
0
        private void LoadIpod()
        {
            database_supported = false;

            try {
                if (File.Exists(ipod_device.TrackDatabasePath))
                {
                    ipod_device.LoadTrackDatabase(false);
                }
                else
                {
                    int count = CountMusicFiles();
                    Log.DebugFormat("Found {0} files in /iPod_Control/Music", count);
                    if (CountMusicFiles() > 5)
                    {
                        throw new DatabaseReadException("No database, but found a lot of music files");
                    }
                }
                database_supported = true;
                ThreadAssist.ProxyToMain(DestroyUnsupportedView);
            } catch (DatabaseReadException e) {
                Log.Exception("Could not read iPod database", e);
                ipod_device.LoadTrackDatabase(true);

                ThreadAssist.ProxyToMain(delegate {
                    DestroyUnsupportedView();
                    unsupported_view          = new UnsupportedDatabaseView(this);
                    unsupported_view.Refresh += OnRebuildDatabaseRefresh;
                    Properties.Set <Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", unsupported_view);
                });
            } catch (Exception e) {
                Log.Exception(e);
            }

            database_loaded = true;

            Name = GetDeviceName();
        }
コード例 #3
0
 private void DestroyUnsupportedView ()
 {
     if (unsupported_view != null) {
         unsupported_view.Refresh -= OnRebuildDatabaseRefresh;
         unsupported_view.Destroy ();
         unsupported_view = null;
     }
 }
コード例 #4
0
        private void LoadIpod ()
        {
            database_supported = false;

            try {
                if (File.Exists (ipod_device.TrackDatabasePath)) {
                    ipod_device.LoadTrackDatabase (false);
                } else {
                    int count = CountMusicFiles ();
                    Log.DebugFormat ("Found {0} files in /iPod_Control/Music", count);
                    if (CountMusicFiles () > 5) {
                        throw new DatabaseReadException ("No database, but found a lot of music files");
                    }
                }
                database_supported = true;
                ThreadAssist.ProxyToMain (DestroyUnsupportedView);
            } catch (DatabaseReadException e) {
                Log.Exception ("Could not read iPod database", e);
                ipod_device.LoadTrackDatabase (true);

                ThreadAssist.ProxyToMain (delegate {
                    DestroyUnsupportedView ();
                    unsupported_view = new UnsupportedDatabaseView (this);
                    unsupported_view.Refresh += OnRebuildDatabaseRefresh;
                    Properties.Set<Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", unsupported_view);
                });
            } catch (Exception e) {
                Log.Exception (e);
            }

            database_loaded = true;

            Name = GetDeviceName ();
        }