public static PassGate GetPassGate(Passageway passageway, VolumetricBody body) { switch (body.GetType().ToString()) { case "Wardrobe": return(new WardrobeThroughTheDoor(passageway as Door, body as Wardrobe)); case "Bullet": return(new BulletThoughTheDoor(passageway as Door, body as Bullet)); case "Tub": return(new TubThoughTheDoor(passageway as Door, body as Tub)); default: return(new PassGate(passageway, body)); } }
public void SetBodyOrGate(StackPanel stackPanel, ComboBox comboBox) { Dictionary <string, double> keyValuePairs = new Dictionary <string, double>(); foreach (VariablesBlock variablesBlock in stackPanel.Children) { keyValuePairs.Add(variablesBlock.NameValue, variablesBlock.Value); } if (FormatterServices.GetUninitializedObject((comboBox.SelectedItem as MyType).ValueType) is Passageway) { passageway = FormatterServices.GetUninitializedObject((comboBox.SelectedItem as MyType).ValueType) as Passageway; passageway.SetParamValue(keyValuePairs); } else if (FormatterServices.GetUninitializedObject((comboBox.SelectedItem as MyType).ValueType) is VolumetricBody) { volumetricBody = FormatterServices.GetUninitializedObject((comboBox.SelectedItem as MyType).ValueType) as VolumetricBody; volumetricBody.SetParamValue(keyValuePairs); } }
public PassGate(Passageway passageway, VolumetricBody volumetricBody) { Gate = passageway; VBody = volumetricBody; }