Пример #1
0
        public CProgram(CSystem csystem, Programs ePrograms, String program)
        {
            sys = csystem;
            // Remove program queued flag
            program_name = (program.StartsWith("&")) ? program.Substring(1) : program;
            // Read program
            progInfo = new JSonFile(ePrograms.getProgram(program));

            if (!progInfo.hasErrors())
            {
                // Init csystem.ProgramErrors and debug for program execution
                csystem.NewProgram(program_name);
                debug = csystem.ProgramDebug;

                csystem.ProgramErrors.Name        = Name;
                csystem.ProgramErrors.Description = Description;
                debug.Name        = Name;
                debug.Description = Description;

                // Init vars
                vars = new Dictionary <string, object>();
                foreach (JValue var in Variables)
                {
                    if (!vars.ContainsKey(var.Value.ToString()))
                    {
                        vars.Add(var.Value.ToString(), null);
                    }
                }
            }
            else
            {
                csystem.ProgramErrors.invalidJSON = progInfo.jErrors;
            }
        }
Пример #2
0
        public event RunProcess ExecuteProcess;             // Execute process event

        public CProgram(CSystem csystem, String program)
        {
            sys = csystem;
            // Remove program queued flag
            program = (program.StartsWith("&")) ? program.Substring(1) : program;

            // Read program
            progInfo = new JSonFile(csystem.Globals.debug, csystem.Globals.AppData_path(dPATH.PROGRAM), program, true);

            if (!progInfo.hasErrors())
            {
                // Init csystem.ProgramErrors and debug for program execution
                csystem.NewProgram(program);
                csystem.ProgramErrors.Error = "";
                debug = csystem.ProgramDebug;

                csystem.ProgramErrors.Name        = Name;
                csystem.ProgramErrors.Description = Description;
                debug.Name        = Name;
                debug.Description = Description;

                // Init vars
                vars = new Dictionary <string, object>();
            }
            else
            {
                csystem.ProgramErrors.addError(progInfo.jErrors);
            }
        }
Пример #3
0
        public CProgram(CSystem csystem, CGlobals Globals, String program, object program_vars = null)
        {
            sys = csystem;
            // Remove program queued flag
            program_name = (program.StartsWith("&")) ? program.Substring(1) : program;
            // Read program
            progInfo = new JSonFile(Globals.AppDataSection(dPATH.PROGRAM), program_name, true);

            if (!progInfo.hasErrors())
            {
                // Init csystem.ProgramErrors and debug for program execution
                csystem.ProgramErrors = new TErrors(Globals, program);
                csystem.ProgramDebug  = new TDebug(Globals, program);
                debug = csystem.ProgramDebug;

                csystem.ProgramErrors.Name        = Name;
                csystem.ProgramErrors.Description = Description;
                debug.Name        = Name;
                debug.Description = Description;

                // Init vars
                if (program_vars == null)
                {
                    vars = new Dictionary <string, object>();
                }
                else
                {
                    vars = (Dictionary <string, object>)program_vars;
                }
                foreach (JValue var in Variables)
                {
                    if (!vars.ContainsKey(var.Value.ToString()))
                    {
                        vars.Add(var.Value.ToString(), null);
                    }
                }
            }
            else
            {
                csystem.ProgramErrors             = new TErrors(Globals, program);
                csystem.ProgramErrors.invalidJSON = progInfo.jErrors;
            }
        }
Пример #4
0
        CView.CtrlStruct fireCtrl_str; // Controls struct who fire the event
        #endregion

        #region initialize

        /// <summary>
        /// Load all information from UI to work with
        /// </summary>
        /// <param name="viewManager"></param>
        /// <param name="eventDesc"></param>
        public CLogic(CSystem csystem, CViewsManager views_manager, CEventDesc eventDesc)
        {
            sys        = csystem;
            vm         = views_manager;
            Globals    = sys.Globals;
            errors     = sys.ProgramErrors;
            debug      = sys.ProgramDebug;
            event_desc = eventDesc;
            if (event_desc != null)
            {
                view = (event_desc.View_Guid != "") ? vm.getFirstView_byGuid(event_desc.View_Guid) : null;
                if (view != null)
                {
                    mainCtrl     = view.mainControl();
                    fireCtrl_str = view.getCtrlStruct(eventDesc.Control_Name);
                }
                fireCtrl = (Control)event_desc.fireCtrl;
                args     = event_desc.args;
            }
            MainView = ((view != null) && (Globals.get_str(dGLOBALS.MAIN_VIEW) == view.Name)) ? view : vm.getFirstView(Globals.get_str(dGLOBALS.MAIN_VIEW));
        }