using System; using System.Data; using Chernobyl.Collections.Generic.Event; using Chernobyl.Dependency; using Chernobyl.Graphics; using Chernobyl.Plugin; using Chernobyl.StateMachine; namespace Chernobyl.Sandbox { /// /// The core class of the Chernobyl Sandbox project. /// public class Main : IPlugin { /// /// Initializes a new instance of the class. /// /// The instance that gives out services for use /// by this type and takes services from this type for use by other systems. public Main(IEventCollection services) { Services = services; Services.Inject
(this); } /// /// The that represents the configuration or /// initialization state of the application. /// [Inject] public IConfigurationState ConfigurationState { set { value.Left += ConfigurationEnded; } } /// /// An event handler that is invoked when the state of the application /// has left the configuration state. /// /// The sender of the event. /// The instance /// containing the event data. void ConfigurationEnded(object sender, EventArgs e) { EnumerableListView listView = new EnumerableListView(Services, new[] { "Grass", "Water", "Dirt", "Really Long String!!!!!!!!!!", "Something Else"}); listView.Translate(200, 200); // we don't need this refresh since it is automatically called by the // constructor of the type, we are just fixing a bug that happens when // refresh is called twice in a row. Remove when finished. listView.Refresh(); GC.Collect(); } /// /// The main used for rendering content in /// [Inject] public Scene TheScene { get; set; } /// /// The instance that gives out services for use by this type and takes /// services from this type for use by other systems. /// IEventCollection Services { get; set; } } }