private void InitView() { PropertyView newView = null; if (_component.FunctionParameters.SourceType == SourceType.Equation) { newView = new EquationView(); ((EquationView)newView).Component = _component; } else { newView = new ExpressionView(); ((ExpressionView)newView).Component = _component; } this.panel1.Controls.Add(newView); newView.Dock = DockStyle.Fill; if (_currentView != null) { _currentView.SaveData(); _currentView.Dispose(); _currentView = null; } _currentView = newView; }