Пример #1
0
        /// <summary>
        /// Invoked when the canvas is being painted.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event data</param>
        private void Canvas_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            if (!loaded)
            {
                return;
            }

            if (!canvas.Context.IsCurrent)
            {
                canvas.MakeCurrent();
            }

            Plugins.Plugin p = PluginManager.Get(SettingsManager.CurrentVisualizer);
            if (p == null)
            {
                return;
            }

            Plugins.Visualizer vis = p as Plugins.Visualizer;
            if (vis == null)
            {
                return;
            }

            vis.Refresh();
            canvas.SwapBuffers();
        }
Пример #2
0
 /// <summary>
 /// Refreshes the name, description according to the current visualizer
 /// or hides the canvas if no visualizer is active.
 /// </summary>
 public void RefreshMeta()
 {
     Plugins.Visualizer plugin = null;
     if (SettingsManager.CurrentVisualizer != null &&
         SettingsManager.CurrentVisualizer != "" &&
         (plugin = PluginManager.Get(SettingsManager.CurrentVisualizer) as Plugins.Visualizer) != null)
     {
         VisualizerVisible = true;
         Title             = plugin.T("Name");
         Description       = plugin.T("Description");
     }
     else
     {
         VisualizerVisible = false;
         Title             = U.T("NavigationVisualizerTitle");
         Description       = U.T("NavigationVisualizerDescription");
     }
 }
Пример #3
0
        /// <summary>
        /// Called by the periodic timer for refreshing active plugins.
        /// </summary>
        /// <param name="state">The state (not used)</param>
        private static void Tick(object state)
        {
            if (activePlugins.Count == 0)
            {
                if (ticker != null)
                {
                    ticker.Dispose();
                }
                ticker = null;
            }
            else
            {
                try
                {
                    foreach (Plugin p in activePlugins)
                    {
                        switch (p.Type)
                        {
                        case PluginType.Visualizer:
                            Plugins.Visualizer v = p as Plugins.Visualizer;
                            MediaManager.FFTData.CopyTo(v.FFTData, 0);
                            DispatchRefresh(v);
                            break;

                        case PluginType.Filter:
                            p.Refresh();
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    U.L(LogLevel.Warning, "PLUGIN", "Could not refresh plugins: " + e.Message);
                }
            }
        }