Example #1
0
        public ControllerMain(IMainWindow presentationLevel, BuildInMod.BasicModule basicModule)
        {
            _presentationLevel = presentationLevel;
            _ctx = new AppExecutor(new ScriptingSDK.ModuleBase[] { basicModule });
            _ctx.OnStateChanged += new EventHandler<AppStateChangeEventArgs>(_ctx_OnStateChanged);
            _ctx.OnExecError += new EventHandler<RuntimeErrorEventArg>(_ctx_OnExecError);

            CmdNewFile = new CmdWrapper(NewFile, (object param) =>
            {
                return _ctx.ApplicationState == AppState.Idle;
            });

            CmdLoadFile = new CmdWrapper(LoadFile, (object param) =>
            {
                return _ctx.ApplicationState == AppState.Idle;
            });

            CmdSaveFile = new CmdWrapper(SaveFile, (object param) =>
            {
                return _document.IsChanged &&
                    (_ctx.ApplicationState == AppState.Idle);
            });

            CmdSaveAsFile = new CmdWrapper(SaveFileAs, (object param) =>
            {
                return _ctx.ApplicationState == AppState.Idle;
            });

            CmdPlay = new CmdWrapper(Play, (object param) =>
            {
                switch (_ctx.ApplicationState)
                {
                    case AppState.Idle:
                    case AppState.Pause:
                        return true;
                    default:
                        return false;
                }
            });

            CmdPause = new CmdWrapper(Pause, (object param) =>
            {
                return _ctx.ApplicationState == AppState.Running;
            });

            CmdStop = new CmdWrapper(Stop, (object param) =>
            {
                switch (_ctx.ApplicationState)
                {
                    case AppState.Running:
                    case AppState.Pause:
                        return true;
                    default:
                        return false;
                }
            });
        }
Example #2
0
 public BasicModule(PrintFuncType printFunc,
     BuildInMod.ICsvReport csvFunc)
 {
     _print = printFunc;
     _csvFunc = csvFunc;
 }