public void InitiateExecution(params object[] obj)
        {
            if (!CanBeExecutedOn(obj))
            {
                throw new InvalidOperationException("Cannot be executed!");
            }

            var tran = _transactionProvider.GetCurrentTransaction();

            tran.CaptureMacroState("CommandAddConversation");

            var conversation = new Conversation();

            tran.Helper.AddItem(_engine.Conversations, conversation);

            tran.Commit();
        }
        public void InitiateExecution(params object[] obj)
        {
            if (!CanBeExecutedOn(obj))
            {
                throw new InvalidOperationException("Cannot be executed!");
            }

            var tran = _transactionProvider.GetCurrentTransaction();

            var propInfo = (PropertyInfo)obj[1];

            tran.CaptureMacroState(string.Format("Edit [{0}]", propInfo.Name));

            tran.Helper.SetValue(obj[0], propInfo, obj[2]);

            tran.Commit();
        }
Exemple #3
0
        public void InitiateExecution(params object[] obj)
        {
            if (!CanBeExecutedOn(obj))
            {
                throw new InvalidOperationException("Cannot be executed!");
            }

            var tran = _transactionProvider.GetCurrentTransaction();

            tran.CaptureMacroState("CommandDeleteMission");

            var missionToDelete = (Mission)obj[0];

            tran.Helper.DeleteItem(_engine.Missions, missionToDelete);

            tran.Commit();
        }
        public void InitiateExecution(params object[] obj)
        {
            if (!CanBeExecutedOn(obj))
            {
                throw new InvalidOperationException("Cannot be executed!");
            }

            var tran = _transactionProvider.GetCurrentTransaction();

            tran.CaptureMacroState("CommandAddTask");

            var mission = (Mission)obj[0];

            var task = new MissionTask();

            tran.Helper.AddItem(mission.Tasks, task);

            tran.Commit();
        }
Exemple #5
0
        public void InitiateExecution(params object[] obj)
        {
            if (!CanBeExecutedOn(obj))
            {
                throw new InvalidOperationException("Cannot be executed!");
            }

            var tran = _transactionProvider.GetCurrentTransaction();

            tran.CaptureMacroState("CommandAddMission");

            string nameForMission = MyInputBox.GetText("Enter mission name", "A mission");
            var    mission        = new Mission();

            //var insert = new McrInsertElementToCollection(_engine.Missions, mission);
            tran.Helper.AddItem(_engine.Missions, mission);
            tran.Helper.SetValue(mission, m => m.Name, nameForMission);

            tran.Commit();
        }