Exemple #1
0
        private void DisposeAdapter()
        {
            if (adapter != null)
            {
                try {
                    adapter.Dispose();
                } catch (Exception e) {
                    Log.Exception("IFullscreenAdapter failed to dispose", e);
                }

                adapter = null;
            }
        }
        private void DisposeAdapter()
        {
            if (adapter != null)
            {
                try {
                    adapter.SuggestUnfullscreen -= OnSuggestUnfullscreen;
                    adapter.Dispose();
                } catch (Exception e) {
                    Log.Error("IFullscreenAdapter failed to dispose", e);
                }

                adapter = null;
            }
        }
        public void Fullscreen(Window window, bool fullscreen)
        {
            if (!first_fullscreen && !fullscreen)
            {
                return;
            }
            else if (fullscreen)
            {
                first_fullscreen = true;
            }

            if (adapter != null)
            {
                try {
                    adapter.Fullscreen(window, fullscreen);
                } catch (Exception e) {
                    Log.Error("IFullscreenAdapter extension failed, so disabling", e);
                    DisposeAdapter();
                }

                return;
            }
            else if (probed)
            {
                DefaultFullscreen(window, fullscreen);
                return;
            }

            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Banshee/NowPlaying/FullscreenAdapter"))
            {
                try {
                    adapter = (IFullscreenAdapter)node.CreateInstance(typeof(IFullscreenAdapter));
                    adapter.SuggestUnfullscreen += OnSuggestUnfullscreen;
                    Log.DebugFormat("Loaded IFullscreenAdapter: {0}", adapter.GetType().FullName);
                    break;
                } catch (Exception e) {
                    Log.Error("IFullscreenAdapter extension failed to load", e);
                }
            }

            probed = true;
            Fullscreen(window, fullscreen);
        }
        public void Fullscreen (Window window, bool fullscreen)
        {
            if (!first_fullscreen && !fullscreen) {
                return;
            } else if (fullscreen) {
                first_fullscreen = true;
            }

            if (adapter != null) {
                try {
                    adapter.Fullscreen (window, fullscreen);
                } catch (Exception e) {
                    Log.Exception ("IFullscreenAdapter extension failed, so disabling", e);
                    DisposeAdapter ();
                }

                return;
            } else if (probed) {
                DefaultFullscreen (window, fullscreen);
                return;
            }

            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes ("/Banshee/NowPlaying/FullscreenAdapter")) {
                try {
                    adapter = (IFullscreenAdapter)node.CreateInstance (typeof (IFullscreenAdapter));
                    adapter.SuggestUnfullscreen += OnSuggestUnfullscreen;
                    Log.DebugFormat ("Loaded IFullscreenAdapter: {0}", adapter.GetType ().FullName);
                    break;
                } catch (Exception e) {
                    Log.Exception ("IFullscreenAdapter extension failed to load", e);
                }
            }

            probed = true;
            Fullscreen (window, fullscreen);
        }
        private void DisposeAdapter ()
        {
            if (adapter != null) {
                try {
                    adapter.SuggestUnfullscreen -= OnSuggestUnfullscreen;
                    adapter.Dispose ();
                } catch (Exception e) {
                    Log.Exception ("IFullscreenAdapter failed to dispose", e);
                }

                adapter = null;
            }
        }