public Membrane CreateInnerMembrane() { Membrane inner = new Membrane(SemanticTypeSystem, ApplicationController); Membranes.Add(inner); inner.ParentMembrane = this; NewMembrane.Fire(this, new MembraneEventArgs(inner)); return(inner); }
// TODO: Maintain a flat list to avoid this recursion. /// <summary> /// Recurse through membranes to find the membrane containing the desired receptor. /// </summary> public Membrane GetMembraneContaining(IReceptor searchFor) { Membrane ret = null; if (Receptors.Contains((Receptor)searchFor)) { ret = this; } else { foreach (Membrane childMembrane in Membranes) { ret = childMembrane.GetMembraneContaining(searchFor); if (ret != null) { break; } } } return(ret); }
public Membrane CreateInnerMembrane() { Membrane inner = new Membrane(SemanticTypeSystem, ApplicationController); Membranes.Add(inner); inner.ParentMembrane = this; NewMembrane.Fire(this, new MembraneEventArgs(inner)); return inner; }
static void Main() { Application.AddMessageFilter(new MouseWheelMessageFilter()); try { SemanticTypeSystem = new STS(); Skin = new Membrane(SemanticTypeSystem, null); Skin.Name = "Skin"; // Receptors = new ReceptorsContainer(); // Receptors.SemanticTypeSystem = SemanticTypeSystem; DropReceptor = new DropReceptor(Skin.ReceptorSystem); // Program.Skin.RegisterReceptor("DropReceptor", dr); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AppState = new StatePersistence(); AppState.ReadState("appState.xml"); // Load the last application state. MainForm = MycroParser.InstantiateFromFile<Form>("mainform.xml", null); Application.Run(MainForm); AppState.WriteState("appState.xml"); // Save the application state. } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debugger.Break(); } }