public CamView() { if (!base.DesignMode) { var camViewStateTypeQuery = from t in App.GetAvailDualityEditorTypes(typeof(CamViewState)) where !t.IsAbstract select t; foreach (TypeInfo t in camViewStateTypeQuery) { CamViewState state = t.CreateInstanceOf() as CamViewState; state.View = this; this.availStates.Add(t, state); } var camViewLayerTypeQuery = from t in App.GetAvailDualityEditorTypes(typeof(CamViewLayer)) where !t.IsAbstract select t; foreach (TypeInfo t in camViewLayerTypeQuery) { CamViewLayer layer = t.CreateInstanceOf() as CamViewLayer; layer.View = this; this.availLayers.Add(t, layer); } } }
public void SetCurrentState(CamViewState state) { if (this.activeState == state) { return; } if (this.activeState != null) { this.activeState.OnLeaveState(); } this.activeState = state; // If we have a graphics control, we have initialized properly and can enter the state right away. // Otherwise, this is the initial state and we'll need to wait until initialization. Enter the state later. if (this.graphicsControl != null) { if (this.activeState != null) { this.activeState.OnEnterState(); } this.RenderableControl.Invalidate(); } }