示例#1
0
    /// <summary>
    /// Triggered when the pane list is changed.
    /// </summary>
    private void OnPaneChanged(
        object o,
        EventArgs args)
    {
        // Change the pane
        currentPane = panes[paneList.Active];
        currentPane.Configure(Allocation.Width, Allocation.Height);

        // Trigger a full redraw
        QueueDraw();
    }
示例#2
0
    /// <summary>
    /// This method uses reflection to find all the classes in this
    /// assembly that are a sprite pane demo and loads them into
    /// memory. The order is undefined, but the results are added to
    /// the drop down list and the first one is selected.
    /// </summary>
    private void LoadSpritePanes()
    {
        // Get our assembly
        Assembly assembly = GetType().Assembly;

        foreach (Type type in assembly.GetTypes())
        {
            // Ignore the abstract class
            if (type.IsAbstract)
            {
                continue;
            }

            // Look for the pane
            if (type.BaseType != typeof(DemoSpritePane))
            {
                continue;
            }

            // See if we can find a constructor
            ConstructorInfo ci = type.GetConstructor(new Type[] { });

            if (ci == null)
            {
                continue;
            }

            // Grab the link attribute
            DemoSpritePane dsp = ci.Invoke(new object[] { }) as DemoSpritePane;

            if (dsp == null)
            {
                continue;
            }

            // Register it
            panes.Add(dsp);
            paneList.AppendText(dsp.Name);
        }

        // Check for a change needed
        if (panes.Count > 0)
        {
            paneList.Active = 0;
        }
    }
示例#3
0
    /// <summary>
    /// Triggered when the pane list is changed.
    /// </summary>
    private void OnPaneChanged(
		object o,
		EventArgs args)
    {
        // Change the pane
        currentPane = panes[paneList.Active];
        currentPane.Configure(Allocation.Width, Allocation.Height);

        // Trigger a full redraw
        QueueDraw();
    }