public void AddState(int itemindex, int keyindex, bool iskey) { try { var be = canvasDock.EffectManager.Effects[itemindex] as BaseEffect; var name = Path.GetFileNameWithoutExtension(be.Filename); var asc = new AddStateCommand(canvasDock.EffectManager, (iskey ? key : "") + insertstate + name, iskey, itemindex, keyindex); asc.Execute(); historyDock.CommandManager.AddCommand(asc); RefreshState(); } catch (Exception e) { MessageBox.Show(e.Message); } }
/// <summary> /// Adds a new State with the given position to the graph /// </summary> /// <param name="graph"></param> /// <param name="position">The position of the state</param> /// <returns></returns> public static void AddState(this StateMachine stateMachine, Vector2 position) { ICommand command = new AddStateCommand(stateMachine, position); command.Execute(); }