/// <summary> /// Method triggered whenever the user changes the type of block /// </summary> private void BlockTypeBox_SelectedIndexChanged(object sender, EventArgs e) { // Delete the old data _current = null; // Ensure that the type is a Data Filter var type = _typeMapping[(string)BlockTypeBox.SelectedItem]; if (type == null || !typeof(DataFilter).IsAssignableFrom(type)) { throw new Exception("Invalid object type! Not a DataFilter!"); } // Start creating the skeleton, and display it _current = (DataFilter)Activator.CreateInstance(type, _core); _current.Name = _current.InternalName; BlockViewer.SetViewingComponent(_current); }
/// <summary> /// Determines which block viewer should be shown for the user /// </summary> private void DetermineViewingComponent(object owner, IConnectable c) { var dc = c as DataConnection; if (dc != null) { // Treat as Data Connection BlockViewer.SetViewingComponent(null); IOBlockViewer.SetViewingComponent(dc); IOBlockViewer.UpdateAllComponents(); BlockViewer.Hide(); IOBlockViewer.Show(); } else { // Treat as generic block BlockViewer.SetViewingComponent(c); IOBlockViewer.SetViewingComponent(null); BlockViewer.Show(); IOBlockViewer.Hide(); } }