Ejemplo n.º 1
0
        /// #NAME#: #DESCRIPTION#
        public void f_d7c92550_523c_4cb7_9223_c8da10a35e3d()
        {
            //INI CODE PRCGUID: d7c92550-523c-4cb7-9223-c8da10a35e3d

            ARQODE_UI.GestorProcesos.CVentanaProcesos CVentanaProcesos = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);
            if (CVentanaProcesos.TV_Processes.SelectedNode != null)
            {
                TreeNode NProcActivo = CVentanaProcesos.TV_Processes.SelectedNode;

                ARQODE_UI.ARQODE_UI.CInputDialog CInputDialog = new ARQODE_UI.ARQODE_UI.CInputDialog(vm);
                CInputDialog.InputDialog.AcceptButton = CInputDialog.BAceptar;
                CInputDialog.InputDialog.CancelButton = CInputDialog.BCancelar;

                CInputDialog.InputDialog.Text = "Renombrar carpeta";
                CInputDialog.Label1.Text      = "Nombre de la carpeta";
                CInputDialog.textBox1.Text    = NProcActivo.Text;

                vm.Cancel_events = false;
                DialogResult dr = CInputDialog.InputDialog.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);

                    String di_antiguo = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, NProcActivo.FullPath);
                    String di_nuevo   = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName,
                                                     NProcActivo.FullPath.Substring(0, NProcActivo.FullPath.LastIndexOf("\\")));

                    if (di_antiguo.EndsWith(".json"))
                    {
                        String nombre_f = (CInputDialog.textBox1.Text.ToLower().EndsWith(".json")) ? CInputDialog.textBox1.Text : CInputDialog.textBox1.Text + ".json";

                        String from_path = NProcActivo.FullPath.Replace(dPROCESS.FOLDER + "\\", "").Replace("\\", ".").Replace(".json", "");
                        String to_path   = from_path.Substring(0, from_path.IndexOf(".") + 1) + nombre_f.Replace(".json", "");

                        CStructModifications csmod = new CStructModifications(sys, App_globals);
                        csmod.MoveProcess_byNamespace(from_path, to_path);

                        di_nuevo = Path.Combine(di_nuevo, nombre_f);
                        File.Move(di_antiguo, di_nuevo);
                        NProcActivo.Text = nombre_f;
                    }
                    else
                    {
                        di_nuevo = Path.Combine(di_nuevo, CInputDialog.textBox1.Text);
                        if (Directory.Exists(di_antiguo))
                        {
                            DirectoryInfo di_ant = new DirectoryInfo(di_antiguo);
                            di_ant.MoveTo(di_nuevo);
                        }
                        else
                        {
                            Directory.CreateDirectory(di_nuevo);
                        }
                        NProcActivo.Text = CInputDialog.textBox1.Text;
                    }
                }
            }

            //END CODE PRCGUID: d7c92550-523c-4cb7-9223-c8da10a35e3d
        }
Ejemplo n.º 2
0
        /// #NAME#: #DESCRIPTION#
        public void f_Nuevo_programa()
        {
            //INI CODE PRCGUID: Nuevo programa
            TextBox tb_nombre_programa = (TextBox)view.getCtrl("tb_nombre_programa");
            TextBox tb_descripcion     = (TextBox)view.getCtrl("tb_descripcion");
            String  Ruta = view.var_str("Ruta");

            if (tb_nombre_programa.Text != "")
            {
                ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
                DirectoryInfo pprog = Globals.AppDataSection(dPATH.PROGRAM);

                FileInfo      f_plantilla = pprog.GetFiles(dGLOBALS.PROGRAM_TEMPLATE)[0];
                DirectoryInfo di          = App_globals.AppDataSection(Path.Combine(dPATH.CODE, Ruta));

                JSonFile jplantilla = new JSonFile(f_plantilla.FullName);
                jplantilla.jActiveObj[dPROGRAM.NAME]        = tb_nombre_programa.Text;
                jplantilla.jActiveObj[dPROGRAM.DESCRIPTION] = tb_descripcion.Text;

                String n_programa = tb_nombre_programa.Text.EndsWith(".json") ? tb_nombre_programa.Text : tb_nombre_programa.Text + ".json";
                if (!File.Exists(Path.Combine(di.FullName, n_programa)))
                {
                    JSonFile jprograma = new JSonFile(Path.Combine(di.FullName, n_programa));
                    jprograma.writeJsonFile(jplantilla.jActiveObj);
                    ((Form)view.mainControl()).Close();
                }
                else
                {
                    MessageBox.Show("Ya existe un programa con este nombre");
                }
            }
            //END CODE PRCGUID: Nuevo programa
        }
Ejemplo n.º 3
0
        /// #NAME#: #DESCRIPTION#
        public void f_54b8eead_551e_428b_98e6_7d3e831d475d()
        {
            //INI CODE PRCGUID: 54b8eead-551e-428b-98e6-7d3e831d475d


            #region Variables

            // Inputs vars
            object I_Namespace_programa_activo = Input("Namespace programa activo", false);
            #endregion

            if (I_Namespace_programa_activo != null)
            {
                ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
                CStructModifications csmod = new CStructModifications(sys, App_globals);
                ArrayList            ar    = csmod.FindProgramReferences(I_Namespace_programa_activo.ToString());
                DataTable            dt    = new DataTable();
                dt.Columns.Add("Path");
                dt.Columns.Add("Program name");
                foreach (string s in ar)
                {
                    String cad = s.Replace(App_globals.AppDataSection(dPATH.CODE).FullName + "\\", "").Replace("\\", ".").Replace(".json", "");
                    dt.Rows.Add(new object[] { cad, cad });
                }

                Outputs("Tabla resultados", dt);
                Outputs("Num columna con path", 0);
            }

            //END CODE PRCGUID: 54b8eead-551e-428b-98e6-7d3e831d475d
        }
Ejemplo n.º 4
0
        /// #NAME#: #DESCRIPTION#
        public void f_87c9e177_3406_4660_8e25_a4eccf856dac()
        {
            //INI CODE PRCGUID: 87c9e177-3406-4660-8e25-a4eccf856dac

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas  = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorProcesos.CFormProcesoActivo CFormProcesoActivo = new ARQODE_UI.GestorProcesos.CFormProcesoActivo(vm);
            if (CFormProcesoActivo.TV_ViewsVars.SelectedNode.Text.EndsWith(".json"))
            {
                ARQODE_UI.ARQODE_UI.CInputDialog CInputDialog = new ARQODE_UI.ARQODE_UI.CInputDialog(vm);
                CInputDialog.InputDialog.AcceptButton = CInputDialog.BAceptar;
                CInputDialog.InputDialog.CancelButton = CInputDialog.BCancelar;

                CInputDialog.InputDialog.Text = "Variables";
                CInputDialog.Label1.Text      = "Nueva variable de vista";
                vm.Cancel_events = false;
                if (CInputDialog.InputDialog.ShowDialog() == DialogResult.OK)
                {
                    if (CInputDialog.textBox1.Text != "")
                    {
                        String view_path = Path.Combine(
                            App_globals.AppDataSection(dPATH.VIEWS).FullName,
                            CFormProcesoActivo.TV_ViewsVars.SelectedNode.FullPath);
                        JSonFile JView = new JSonFile(view_path);
                        (JView.jActiveObj["Variables"] as JArray).Add(CInputDialog.textBox1.Text);
                        CFormProcesoActivo.TV_ViewsVars.SelectedNode.Nodes.Add(CInputDialog.textBox1.Text);
                        JView.Write();
                    }
                }
            }

            //END CODE PRCGUID: 87c9e177-3406-4660-8e25-a4eccf856dac
        }
Ejemplo n.º 5
0
        /// #NAME#: #DESCRIPTION#
        public void f_773923b8_4e21_4dc6_afea_6191de56ef68()
        {
            //INI CODE PRCGUID: 773923b8-4e21-4dc6-afea-6191de56ef68
            ARQODE_UI.GestorProcesos.CVentanaProcesos   CVentanaProcesos  = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);
            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            if ((CVentanaProcesos.LProcess.Items.Count > 0) && (CVentanaProcesos.LProcess.SelectedIndex >= 0))
            {
                CStructModifications csmod = new CStructModifications(sys, App_globals);
                JToken JProc           = ((KeyValuePair <String, JToken>)CVentanaProcesos.LProcess.SelectedItem).Value;
                String prc_active_guid = JProc["Guid"].ToString();

                ArrayList ar = csmod.FindProcessInPrograms(prc_active_guid);

                DataTable dt = new DataTable();
                dt.Columns.Add("Path");
                dt.Columns.Add("Program name");
                foreach (string s in ar)
                {
                    String cad = s.Replace(App_globals.AppDataSection(dPATH.CODE).FullName + "\\", "").Replace("\\", ".").Replace(".json", "");
                    dt.Rows.Add(new object[] { cad, cad });
                }

                Outputs("Tabla resultados", dt);
                Outputs("Num columna con path", 0);
            }

            //END CODE PRCGUID: 773923b8-4e21-4dc6-afea-6191de56ef68
        }
Ejemplo n.º 6
0
        /// #NAME#: #DESCRIPTION#
        public void f_Renombrar_programa()
        {
            //INI CODE PRCGUID: Renombrar programa

            TreeView ArbolProgramas   = (TreeView)view.getCtrl("ArbolProgramas");
            TreeNode N_ProgramaActivo = ArbolProgramas.SelectedNode;

            ARQODE_UI.ARQODE_UI.CInputDialog CInputDialog = new ARQODE_UI.ARQODE_UI.CInputDialog(vm);
            CInputDialog.InputDialog.AcceptButton = CInputDialog.BAceptar;
            CInputDialog.InputDialog.CancelButton = CInputDialog.BCancelar;
            CInputDialog.InputDialog.Text         = "Renombrar carpeta";
            CInputDialog.Label1.Text   = "Nombre de la carpeta";
            CInputDialog.textBox1.Text = N_ProgramaActivo.Text;

            vm.Cancel_events = false;
            DialogResult dr = CInputDialog.InputDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
                CInputDialog.textBox1.Text = CInputDialog.textBox1.Text.Replace("\r\n", "");
                String di_antiguo = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, N_ProgramaActivo.FullPath);
                String di_nuevo   = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName,
                                                 N_ProgramaActivo.FullPath.Substring(0, N_ProgramaActivo.FullPath.LastIndexOf("\\")));

                if (N_ProgramaActivo.Text.EndsWith(".json"))
                {
                    String nombre_f = (CInputDialog.textBox1.Text.ToLower().EndsWith(".json")) ? CInputDialog.textBox1.Text : CInputDialog.textBox1.Text + ".json";
                    di_nuevo = Path.Combine(di_nuevo, nombre_f);

                    CStructModifications csmod = new CStructModifications(sys, App_globals);
                    String from_path           = N_ProgramaActivo.FullPath.Replace(dPROGRAM.FOLDER + "\\", "").Replace("\\", ".").Replace(".json", "");
                    String to_path             = Path.Combine(N_ProgramaActivo.FullPath.Substring(0, N_ProgramaActivo.FullPath.LastIndexOf("\\")), nombre_f).Replace(dPROGRAM.FOLDER + "\\", "").Replace("\\", ".").Replace(".json", "");
                    csmod.MoveProgram(from_path, to_path);

                    File.Move(di_antiguo, di_nuevo);
                    N_ProgramaActivo.Text = nombre_f;
                }
                else
                {
                    di_nuevo = Path.Combine(di_nuevo, CInputDialog.textBox1.Text);
                    if (di_nuevo != di_antiguo)
                    {
                        if (Directory.Exists(di_antiguo))
                        {
                            DirectoryInfo di_ant = new DirectoryInfo(di_antiguo);
                            di_ant.MoveTo(di_nuevo);
                        }
                        else
                        {
                            Directory.CreateDirectory(di_nuevo);
                        }
                        N_ProgramaActivo.Text = CInputDialog.textBox1.Text;
                    }
                }
            }
            //END CODE PRCGUID: Renombrar programa
        }
Ejemplo n.º 7
0
        /// #NAME#: #DESCRIPTION#
        public void f_c1cefd6f_b8ee_4ad4_8f85_a108120db648()
        {
            //INI CODE PRCGUID: c1cefd6f-b8ee-4ad4-8f85-a108120db648

            ARQODE_VISUAL_EDITOR.MapUI Mapui = new ARQODE_VISUAL_EDITOR.MapUI(App_globals.AppDataSection(dPATH.VIEWS).FullName);
            Mapui.Show();

            //END CODE PRCGUID: c1cefd6f-b8ee-4ad4-8f85-a108120db648
        }
Ejemplo n.º 8
0
        /// #NAME#: #DESCRIPTION#
        public void f_61bb9810_2b5a_49d2_9a05_3705c8785181()
        {
            //INI CODE PRCGUID: 61bb9810-2b5a-49d2-9a05-3705c8785181

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            String cadBusqueda = CVentanaProgramas.MenuTop.Items[7].Text;

            CStructModifications csmod             = new CStructModifications(sys, App_globals);
            List <KeyValuePair <JToken, int> > res = csmod.Find_all_in_processes(cadBusqueda);

            DataTable dt = null;

            object I_Datasource = Input("Tabla resultados anterior", false);

            if (I_Datasource != null)
            {
                dt = (DataTable)I_Datasource;
            }
            else
            {
                dt = new DataTable();
                dt.Columns.Add("Path");
                dt.Columns.Add("Ruta");
                dt.Columns.Add("Proceso");
                dt.Columns.Add("Guid");
            }

            int max = 0;

            foreach (KeyValuePair <JToken, int> s in res)
            {
                if (max == 0)
                {
                    max = s.Value;
                }
                if (s.Value > max - 2)
                {
                    String programa  = s.Key["Process"].ToString();
                    String proceso   = s.Key["Process name"].ToString();
                    String proc_guid = s.Key["Process guid"].ToString();
                    String cad       = programa.Replace(App_globals.AppDataSection(dPATH.CODE).FullName + "\\", "").Replace("\\", ".").Replace(".json", "");
                    dt.Rows.Add(new object[] { cad, cad, proceso, proc_guid });
                }
                else
                {
                    break;
                }
            }

            Outputs("Tabla resultados", dt);
            Outputs("Num columna con path", 0);

            //END CODE PRCGUID: 61bb9810-2b5a-49d2-9a05-3705c8785181
        }
Ejemplo n.º 9
0
        /// #NAME#: #DESCRIPTION#
        public void f_0a2c9e12_f50d_4299_802c_0de96791a182()
        {
            //INI CODE PRCGUID: 0a2c9e12-f50d-4299-802c-0de96791a182
            ARQODE_UI.GestorProcesos.CVentanaProcesos   CVentanaProcesos  = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);
            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            if ((CVentanaProcesos.TV_Processes.SelectedNode != null) && (CVentanaProcesos.TV_Processes.SelectedNode.Text.EndsWith(".json")))
            {
                if (MessageBox.Show("¿Desea eliminar el proceso: '" + CVentanaProcesos.TV_Processes.SelectedNode.Text + "'?",
                                    "Confirmar acción",
                                    MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    String prc_namespace                = CVentanaProcesos.TV_Processes.SelectedNode.FullPath.Replace(dPROCESS.FOLDER + "\\", "").Replace("\\", ".").Replace(".json", "");
                    CStructModifications csmod          = new CStructModifications(sys, App_globals);
                    ArrayList            prc_references = csmod.FindProcessFileInPrograms(prc_namespace);

                    if (prc_references.Count <= 0)
                    {
                        String proceso = Path.Combine(
                            App_globals.AppDataSection(dPATH.CODE).FullName,
                            CVentanaProcesos.TV_Processes.SelectedNode.FullPath);
                        File.Delete(proceso);
                        CVentanaProcesos.TV_Processes.SelectedNode.Remove();
                    }
                    else
                    {
                        String        message = "";
                        DirectoryInfo pprog   = App_globals.AppDataSection(dPATH.PROGRAM);
                        foreach (String reference in prc_references)
                        {
                            message += reference.Replace(pprog.FullName + "\\", "") + "\r\n";
                        }
                        MessageBox.Show("Antes de eliminar el fichero de procesos debes eliminar las siguientes referencias en los programas:\r\n" + message);
                    }
                }
            }
            else
            {
                String        dir_path = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, CVentanaProcesos.TV_Processes.SelectedNode.FullPath);
                DirectoryInfo di       = new DirectoryInfo(dir_path);
                if (di.GetFiles().Count() == 0)
                {
                    di.Delete();
                }
                else
                {
                    MessageBox.Show("La carpeta no se puede eliminar mientras no esté vacía");
                }
            }

            //END CODE PRCGUID: 0a2c9e12-f50d-4299-802c-0de96791a182
        }
Ejemplo n.º 10
0
        /// #NAME#: #DESCRIPTION#
        public void f_Cargar_procesos()
        {
            //INI CODE PRCGUID: Cargar procesos

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);

            DirectoryInfo pprocs         = App_globals.AppDataSection(dPATH.PROCESSES);
            DirectoryInfo processes_path = pprocs;

            ARQODE_UI.GestorProcesos.CVentanaProcesos CVentanaProcesos = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);

            if (CVentanaProgramas.PProcesses.Controls.Count == 0)
            {
                CVentanaProcesos.VentanaProcesos.Dock = DockStyle.Fill;
                CVentanaProgramas.PProcesses.Controls.Add(CVentanaProcesos.VentanaProcesos);
            }
            else if (CVentanaProgramas.PProcesses.Controls[0].Controls.Count == 0)
            {
                CVentanaProgramas.PProcesses.Controls.Clear();
                CVentanaProcesos.VentanaProcesos.Dock = DockStyle.Fill;
                CVentanaProgramas.PProcesses.Controls.Add(CVentanaProcesos.VentanaProcesos);
            }

            String SelectedNodePath = "";

            if (CVentanaProcesos.TV_Processes.SelectedNode != null)
            {
                SelectedNodePath = CVentanaProcesos.TV_Processes.SelectedNode.FullPath;
            }

            CVentanaProcesos.TV_Processes.Nodes.Clear();

            TreeNode tn_processes = (TreeNode)CVentanaProgramas.Cargar_arbol_recursivo.Crear_arbol_desde_carpeta(
                processes_path.FullName, "base_process.json");

            CVentanaProcesos.TV_Processes.Nodes.Add(tn_processes);

            if (SelectedNodePath != "")
            {
                TreeNode selNode = CVentanaProcesos.TV_Processes.Nodes[0];
                foreach (String str in SelectedNodePath.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (selNode.Nodes[str] != null)
                    {
                        selNode = selNode.Nodes[str];
                    }
                }
                CVentanaProcesos.TV_Processes.SelectedNode = selNode;
            }
            //END CODE PRCGUID: Cargar procesos
        }
Ejemplo n.º 11
0
        /// #NAME#: #DESCRIPTION#
        public void f_439a02f9_bfb8_467a_8443_6607ca19b912()
        {
            //INI CODE PRCGUID: 439a02f9-bfb8-467a-8443-6607ca19b912

            String I_Fichero_importaciones = Input_str("Fichero importaciones");

            Ionic.Zip.ZipFile zf          = new Ionic.Zip.ZipFile(I_Fichero_importaciones);
            JToken            ImportConvs = null;

            foreach (Ionic.Zip.ZipEntry ze in zf.Entries)
            {
                #region get import convs data
                if (ze.FileName.Contains("ImportConvs.json"))
                {
                    MemoryStream ms = new MemoryStream();
                    ze.Extract(ms);
                    byte[] entry_data   = ms.ToArray();
                    String file_content = System.Text.Encoding.Default.GetString(entry_data);
                    ms.Close();
                    ImportConvs = JArray.Parse(file_content);
                }
                #endregion
                #region Extract progrmas & processes
                else
                {
                    ze.Extract(App_globals.AppDataSection(dPATH.CODE).FullName);
                }
                #endregion
            }

            #region Update imported programs namespaces

            if (ImportConvs != null)
            {
                CStructModifications csmod = new CStructModifications(sys, App_globals);
                foreach (JObject jImp in ImportConvs as JArray)
                {
                    JProperty jprop = (JProperty)jImp.First;
                    csmod.MoveProgram(jprop.Name,
                                      jprop.Value.ToString()
                                      .Replace("\\", ".")
                                      .Replace(dPROGRAM.FOLDER + ".", ""));
                }
            }
            MessageBox.Show("Program imported successfully");

            #endregion

            //END CODE PRCGUID: 439a02f9-bfb8-467a-8443-6607ca19b912
        }
Ejemplo n.º 12
0
        /// #NAME#: #DESCRIPTION#
        public void f_e0724caf_1ddf_4e3b_82ec_52f91b944f62()
        {
            //INI CODE PRCGUID: e0724caf-1ddf-4e3b-82ec-52f91b944f62

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorProcesos.CVentanaProcesos   CVentanaProcesos  = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);

            String Origin_path = Clipboard.GetText();

            if (Origin_path.StartsWith("{"))
            {
                if (CVentanaProcesos.TV_Processes.SelectedNode.FullPath.EndsWith(".json"))
                {
                    JObject JPrcMove            = JObject.Parse(Origin_path);
                    String  Origin_process_path = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, JPrcMove["Process path"].ToString());
                    String  Origin_process_guid = JPrcMove["Process guid"].ToString();

                    // open orign file
                    JSonFile jOriginFile = new JSonFile(Origin_process_path);
                    JToken   JOriginPrc  = jOriginFile.getNode(String.Format("$.processes[?(@.Guid == '{0}')]", Origin_process_guid));

                    // open target file
                    String   Target_process_namespace = CVentanaProcesos.TV_Processes.SelectedNode.FullPath.Replace(dPROCESS.FOLDER + "\\", "").Replace(".json", "").Replace("\\", ".");
                    String   Target_process_path      = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, CVentanaProcesos.TV_Processes.SelectedNode.FullPath);
                    JSonFile JTargetFile = new JSonFile(Target_process_path);
                    if (JTargetFile.getNode(String.Format("$.processes[?(@.Guid == '{0}')]", Origin_process_guid)) == null)
                    {
                        CStructModifications csmod = new CStructModifications(sys, App_globals);
                        csmod.MoveProcess_byGuid(Origin_process_guid, Target_process_namespace);

                        (JTargetFile.jActiveObj["processes"] as JArray).Add(JOriginPrc);
                        JTargetFile.Write();

                        JOriginPrc.Remove();
                        jOriginFile.Write();
                    }
                    else
                    {
                        MessageBox.Show("Ya existe un proceso con el Guid " + Origin_process_guid + " en el fichero de procesos " + CVentanaProcesos.TV_Processes.SelectedNode.FullPath);
                    }
                }
                else
                {
                    MessageBox.Show("Debes seleccionar un fichero del árbol de procesos donde mover el proceso seleccionado.");
                }
            }

            //END CODE PRCGUID: e0724caf-1ddf-4e3b-82ec-52f91b944f62
        }
Ejemplo n.º 13
0
        /// #NAME#: #DESCRIPTION#
        public void f_Nuevo_proceso()
        {
            //INI CODE PRCGUID: Nuevo proceso

            ARQODE_UI.ARQODE_UI.CInputDialog CInputDialog = new ARQODE_UI.ARQODE_UI.CInputDialog(vm);
            CInputDialog.InputDialog.AcceptButton = CInputDialog.BAceptar;
            CInputDialog.InputDialog.CancelButton = CInputDialog.BCancelar;

            CInputDialog.InputDialog.Text = "Nuevo proceso";
            CInputDialog.Label1.Text      = "Nombre del proceso";

            vm.Cancel_events = false;
            DialogResult dr = CInputDialog.InputDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                if (CInputDialog.textBox1.Text.Trim() != "")
                {
                    ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);

                    TreeView TV_Processes = (TreeView)view.getCtrl("TV_Processes");
                    String   Process_path = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, TV_Processes.SelectedNode.FullPath);

                    // abrir plantilla
                    DirectoryInfo pprocs = Globals.AppDataSection(dPATH.PROCESSES);
                    if (pprocs.GetFiles("base_process.json").Length > 0)
                    {
                        // crear proceso usando la plantilla

                        JSonFile jplantilla_unit_proc = new JSonFile(pprocs.GetFiles("base_unit_process.json")[0].FullName);
                        jplantilla_unit_proc.jActiveObj[dPROCESS.GUID]        = Guid.NewGuid().ToString();
                        jplantilla_unit_proc.jActiveObj[dPROCESS.NAME]        = CInputDialog.textBox1.Text;
                        jplantilla_unit_proc.jActiveObj[dPROCESS.DESCRIPTION] = "";

                        // añadir el proceso a la lista de procesos del fichero
                        JSonFile jProcessFile = new JSonFile(Process_path);
                        (jProcessFile.get("processes") as JArray).Add(jplantilla_unit_proc.jActiveObj);
                        jProcessFile.Write();
                    }
                    else
                    {
                        MessageBox.Show("Plantilla de proceso 'base_process.json' no encontrada en: " + pprocs.FullName);
                    }
                }
            }

            //END CODE PRCGUID: Nuevo proceso
        }
Ejemplo n.º 14
0
        /// #NAME#: #DESCRIPTION#
        public void f_a6099e20_957f_477e_9ff5_92c4fc54e87c()
        {
            //INI CODE PRCGUID: a6099e20-957f-477e-9ff5-92c4fc54e87c

            ARQODE_UI.GestorProgramas.CVentanaProgramas     CVentanaProgramas     = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorControles.CFormControlesEventos CFormControlesEventos = new ARQODE_UI.GestorControles.CFormControlesEventos(vm);
            if ((CFormControlesEventos.TV_Controles.SelectedNode != null) && (CFormControlesEventos.TV_Controles.SelectedNode.Nodes.Count == 0))
            {
                String view_name = CFormControlesEventos.TV_Controles.SelectedNode.Parent.FullPath.Replace("\\", ".").Replace(".json", "");
                String view_file = Path.Combine(
                    App_globals.AppDataSection(dPATH.VIEWS).FullName,
                    CFormControlesEventos.TV_Controles.SelectedNode.Parent.FullPath);
                if (File.Exists(view_file))
                {
                    JSonFile jView    = new JSonFile(view_file);
                    JToken   JControl = jView.jActiveObj.SelectToken(String.Format("$.Controls[?(@.Guid == '{0}')]", CFormControlesEventos.TV_Controles.SelectedNode.Text));

                    if (JControl != null)
                    {
                        JObject JEvents = new JObject();
                        for (int i = 0; i < CFormControlesEventos.DG_EventosControl.RowCount; i++)
                        {
                            if ((CFormControlesEventos.DG_EventosControl[0, i].Value != null) && (CFormControlesEventos.DG_EventosControl[1, i].Value != null))
                            {
                                JProperty JEvent = new JProperty(CFormControlesEventos.DG_EventosControl[0, i].Value.ToString(),
                                                                 CFormControlesEventos.DG_EventosControl[1, i].Value.ToString());
                                JEvents.Add(JEvent);
                            }
                        }

                        if (JControl["Events"] != null)
                        {
                            JControl["Events"].Replace(JEvents);
                        }
                        else
                        {
                            JControl["Events"] = JEvents;
                        }

                        jView.Write();
                    }
                }
            }


            //END CODE PRCGUID: a6099e20-957f-477e-9ff5-92c4fc54e87c
        }
Ejemplo n.º 15
0
        /// #NAME#: #DESCRIPTION#
        public void f_b6e71095_5f94_49c4_a330_9950b390d963()
        {
            //INI CODE PRCGUID: b6e71095-5f94-49c4-a330-9950b390d963

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            String cadBusqueda = CVentanaProgramas.MenuTop.Items[7].Text;

            CStructModifications csmod             = new CStructModifications(sys, App_globals);
            List <KeyValuePair <JToken, int> > res = csmod.Find_all_in_programs(cadBusqueda);

            DataTable dt = new DataTable();

            dt.Columns.Add("Path");
            dt.Columns.Add("Ruta");
            dt.Columns.Add("Proceso");
            dt.Columns.Add("Guid");
            int max = 0;

            foreach (KeyValuePair <JToken, int> s in res)
            {
                if (max == 0)
                {
                    max = s.Value;
                }
                if (s.Value > max - 2)
                {
                    String programa  = s.Key["Program"].ToString();
                    String proceso   = s.Key["Process name"].ToString();
                    String proc_guid = s.Key["Process guid"].ToString();

                    String cad = programa.Replace(App_globals.AppDataSection(dPATH.CODE).FullName + "\\", "").Replace("\\", ".").Replace(".json", "");
                    dt.Rows.Add(new object[] { cad, cad, proceso, proc_guid });
                }
                else
                {
                    break;
                }
            }

            Outputs("Tabla resultados", dt);
            Outputs("Num columna con path", 0);

            //END CODE PRCGUID: b6e71095-5f94-49c4-a330-9950b390d963
        }
Ejemplo n.º 16
0
        /// #NAME#: #DESCRIPTION#
        public void f_Eliminar_programa()
        {
            //INI CODE PRCGUID: Eliminar programa
            TreeView ArbolProgramas = (TreeView)view.getCtrl("ArbolProgramas");

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            if (ArbolProgramas.SelectedNode.FullPath.EndsWith(".json"))
            {
                CStructModifications csmod          = new CStructModifications(sys, App_globals);
                ArrayList            listaProgramas = csmod.SearchProgramCalls_IOC(ArbolProgramas.SelectedNode.FullPath.Replace(dPROGRAM.FOLDER + "\\", "").Replace("\\", ".").Replace(".json", ""));
                if (listaProgramas.Count <= 0)
                {
                    DirectoryInfo di = App_globals.AppDataSection(dPATH.CODE);

                    File.Delete(Path.Combine(di.FullName, ArbolProgramas.SelectedNode.FullPath));
                }
                else
                {
                    String        mensaje = "";
                    DirectoryInfo pprog   = App_globals.AppDataSection(dPATH.PROGRAM);
                    foreach (String programa in listaProgramas)
                    {
                        mensaje += programa.Replace(pprog.FullName + "\\", "") + "\r\n";
                    }
                    MessageBox.Show("No se puede eliminar el programa hasta que no se eliminen las siguientes referencias: \r\n" + mensaje);
                }
            }
            else
            {
                String        di_path = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, ArbolProgramas.SelectedNode.FullPath);
                DirectoryInfo di      = new DirectoryInfo(di_path);
                if (di.GetFiles().Count() <= 0)
                {
                    di.Delete();
                    ArbolProgramas.SelectedNode.Remove();
                }
                else
                {
                    MessageBox.Show("El directorio debe estar vacío para poder ser eliminado");
                }
            }
            //END CODE PRCGUID: Eliminar programa
        }
Ejemplo n.º 17
0
        /// #NAME#: #DESCRIPTION#
        public void f_781150d3_d1ed_4245_8fe9_9fe26a594e2f()
        {
            //INI CODE PRCGUID: 781150d3-d1ed-4245-8fe9-9fe26a594e2f

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);

            String nombre_programa = Clipboard.GetText();

            if (nombre_programa != "")
            {
                // montamos el proceso destino:
                JObject JNewProc_2_program = new JObject();
                JNewProc_2_program.Add("Namespace", "System.Call");
                JNewProc_2_program.Add("Guid", "Call");
                JNewProc_2_program.Add("Name", "Call " + nombre_programa);
                JNewProc_2_program.Add("Description", "");

                JObject JConf = new JObject();
                JConf.Add("program", nombre_programa);
                JNewProc_2_program.Add("Configuration", JConf);


                JObject JIn = new JObject();
                JNewProc_2_program.Add("Inputs", JIn);

                JObject JOut = new JObject();
                JNewProc_2_program.Add("Outputs", JOut);

                // obtienes el programa
                String rutaPrograma = Path.Combine(
                    App_globals.AppDataSection(dPATH.CODE).FullName,
                    CVentanaProgramas.ArbolProgramas.SelectedNode.FullPath);

                JSonFile jprograma = new JSonFile(rutaPrograma);
                (jprograma.jActiveObj["Logic"] as JArray).Add(JNewProc_2_program);
                jprograma.Write();
            }


            //END CODE PRCGUID: 781150d3-d1ed-4245-8fe9-9fe26a594e2f
        }
Ejemplo n.º 18
0
        /// #NAME#: #DESCRIPTION#
        public void f_e0ac24cc_d14e_4e0c_bb6b_da7a4942a916()
        {
            //INI CODE PRCGUID: e0ac24cc-d14e-4e0c-bb6b-da7a4942a916

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorProcesos.CVentanaProcesos   CVentanaProcesos  = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);

            String Origin_path = Clipboard.GetText();

            if ((!Origin_path.StartsWith("{")) && (CVentanaProcesos.TV_Processes.SelectedNode.FullPath.Contains(dPROCESS.FOLDER + "\\")))
            {
                DirectoryInfo pprocs           = App_globals.AppDataSection(dPATH.PROCESSES);
                String        Origin_full_path = Path.Combine(pprocs.FullName, Origin_path.Replace(".", "\\") + ".json");

                if (File.Exists(Origin_full_path))
                {
                    FileInfo fi = new FileInfo(Origin_full_path);
                    String   Target_full_path = Path.Combine(Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, CVentanaProcesos.TV_Processes.SelectedNode.FullPath), fi.Name);
                    String   Target_path      = (CVentanaProcesos.TV_Processes.SelectedNode.FullPath.Replace(dPROCESS.FOLDER + "\\", "") + "." + fi.Name).Replace(".json", "").Replace("\\", ".");

                    // Replace old program path ocurrencies
                    CStructModifications csmod = new CStructModifications(sys, App_globals);
                    csmod.MoveProcess_byNamespace(Origin_path, Target_path);

                    // File move
                    File.Move(Origin_full_path, Target_full_path);

                    CVentanaProcesos.contextMenu_Procesos.Items[2].Enabled = false;
                }
                else
                {
                    MessageBox.Show("Debe cortar un programa del árbol de programas antes de pegarlo");
                }
            }
            else
            {
                MessageBox.Show("Debe pegar el programa dentro del árbol de programas");
            }

            //END CODE PRCGUID: e0ac24cc-d14e-4e0c-bb6b-da7a4942a916
        }
Ejemplo n.º 19
0
        /// #NAME#: #DESCRIPTION#
        public void f_c3697a76_651b_43ca_b89e_a035993a9d23()
        {
            //INI CODE PRCGUID: c3697a76-651b-43ca-b89e-a035993a9d23

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas  = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorProcesos.CFormProcesoActivo CFormProcesoActivo = new ARQODE_UI.GestorProcesos.CFormProcesoActivo(vm);
            if ((CFormProcesoActivo.TV_ViewsVars.SelectedNode != null) &&
                (CFormProcesoActivo.TV_ViewsVars.SelectedNode.Nodes.Count == 0))
            {
                JSonFile jView = new JSonFile(Path.Combine(
                                                  App_globals.AppDataSection(dPATH.VIEWS).FullName,
                                                  CFormProcesoActivo.TV_ViewsVars.SelectedNode.Parent.FullPath));
                JToken Jnode = jView.jActiveObj["Variables"].FirstOrDefault(x => x.ToString() == CFormProcesoActivo.TV_ViewsVars.SelectedNode.Text);
                Jnode.Remove();
                jView.Write();

                CFormProcesoActivo.TV_ViewsVars.SelectedNode.Remove();
            }

            //END CODE PRCGUID: c3697a76-651b-43ca-b89e-a035993a9d23
        }
Ejemplo n.º 20
0
        /// #NAME#: #DESCRIPTION#
        public void f_1ff83da1_817c_4c05_bf34_579e43091bb0()
        {
            //INI CODE PRCGUID: 1ff83da1-817c-4c05-bf34-579e43091bb0

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);

            if (CVentanaProgramas.ArbolProgramas.SelectedNode.FullPath.Contains(dPROGRAM.FOLDER + "\\"))
            {
                String        Origin_path      = Clipboard.GetText();
                DirectoryInfo pprog            = App_globals.AppDataSection(dPATH.PROGRAM);
                String        Origin_full_path = Path.Combine(pprog.FullName, Origin_path.Replace(".", "\\") + ".json");

                if (File.Exists(Origin_full_path))
                {
                    FileInfo fi = new FileInfo(Origin_full_path);
                    String   Target_full_path = Path.Combine(Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, CVentanaProgramas.ArbolProgramas.SelectedNode.FullPath), fi.Name);
                    String   Target_path      = (CVentanaProgramas.ArbolProgramas.SelectedNode.FullPath.Replace(dPROGRAM.FOLDER + "\\", "") + "." + fi.Name).Replace(".json", "").Replace("\\", ".");

                    // Replace old program path ocurrencies
                    CStructModifications csmod = new CStructModifications(sys, App_globals);
                    csmod.MoveProgram(Origin_path, Target_path);

                    // File move
                    File.Move(Origin_full_path, Target_full_path);

                    CVentanaProgramas.contextMenu_Programas.Items[2].Enabled = false;
                }
                else
                {
                    MessageBox.Show("Debe cortar un programa del árbol de programas antes de pegarlo");
                }
            }
            else
            {
                MessageBox.Show("Debe pegar el programa dentro del árbol de programas");
            }


            //END CODE PRCGUID: 1ff83da1-817c-4c05-bf34-579e43091bb0
        }
Ejemplo n.º 21
0
        /// #NAME#: #DESCRIPTION#
        public void f_7f1c5983_51c4_4d71_9647_041bf4366321()
        {
            //INI CODE PRCGUID: 7f1c5983-51c4-4d71-9647-041bf4366321

            ARQODE_UI.ARQODE_UI.CInputDialog CInputDialog = new ARQODE_UI.ARQODE_UI.CInputDialog(vm);
            CInputDialog.InputDialog.AcceptButton = CInputDialog.BAceptar;
            CInputDialog.InputDialog.CancelButton = CInputDialog.BCancelar;

            CInputDialog.InputDialog.Text = "Fichero de procesos";
            CInputDialog.Label1.Text      = "Nombre del fichero";

            vm.Cancel_events = false;
            DialogResult dr = CInputDialog.InputDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                ARQODE_UI.GestorProcesos.CVentanaProcesos CVentanaProcesos = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);
                if (CVentanaProcesos.TV_Processes.SelectedNode != null)
                {
                    String Ruta = CVentanaProcesos.TV_Processes.SelectedNode.FullPath;
                    ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
                    DirectoryInfo pprocs      = Globals.AppDataSection(dPATH.PROCESSES);
                    FileInfo      f_plantilla = pprocs.GetFiles(dGLOBALS.PROCESS_TEMPLATE)[0];
                    DirectoryInfo di          = App_globals.AppDataSection(Path.Combine(dPATH.CODE, Ruta));

                    JSonFile JPrc_plantilla = new JSonFile(f_plantilla.FullName);
                    JPrc_plantilla.jActiveObj["description"] = CInputDialog.textBox1.Text;

                    String   n_prc        = CInputDialog.textBox1.Text.EndsWith(".json") ? CInputDialog.textBox1.Text : CInputDialog.textBox1.Text + ".json";
                    JSonFile JNew_process = new JSonFile(Path.Combine(di.FullName, n_prc));
                    JNew_process.writeJsonFile(JPrc_plantilla.jActiveObj);
                }
            }
            CInputDialog.InputDialog.Close();


            //END CODE PRCGUID: 7f1c5983-51c4-4d71-9647-041bf4366321
        }
Ejemplo n.º 22
0
        /// #NAME#: #DESCRIPTION#
        public void f_246c3776_b78e_4702_b593_78ce31b6fef7()
        {
            //INI CODE PRCGUID: 246c3776-b78e-4702-b593-78ce31b6fef7

            ARQODE_UI.GestorProcesos.CVentanaProcesos CVentanaProcesos = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);

            JToken JProc = ((KeyValuePair <String, JToken>)CVentanaProcesos.LProcess.SelectedItem).Value;

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            CStructModifications csmod = new CStructModifications(sys, App_globals);
            String    prc_guid         = JProc["Guid"].ToString();
            ArrayList program_refs     = csmod.FindProcessInPrograms(prc_guid);

            if (program_refs.Count <= 0)
            {
                // Remove process
                String   prc_path = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, CVentanaProcesos.TV_Processes.SelectedNode.FullPath);
                JSonFile jProcess = new JSonFile(prc_path);
                JToken   jPrc     = jProcess.getNode(String.Format("$.processes[?(@.Guid == '{0}')]", prc_guid));
                if (jPrc != null)
                {
                    jPrc.Remove();
                    jProcess.Write();
                }
            }
            else
            {
                //String message = "";
                //DirectoryInfo pprog = App_globals.DataSection(dPATH.PROGRAM);
                //foreach (String program in program_refs) { message += program.Replace(pprog.FullName + "\\", "") + "\r\n"; }
                //MessageBox.Show("Antes de eliminar este proceso debe eliminar las siguientes referencias en programas: \r\n" + message);

                String call_buscar_referencias = Config_str("Call a buscar referencias");
                vm.CallProgram(event_desc, call_buscar_referencias);
            }

            //END CODE PRCGUID: 246c3776-b78e-4702-b593-78ce31b6fef7
        }
Ejemplo n.º 23
0
        /// #NAME#: #DESCRIPTION#
        public void f_fd7bbb95_2c3f_4e41_869f_5dca33016355()
        {
            //INI CODE PRCGUID: fd7bbb95-2c3f-4e41-869f-5dca33016355

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            if (CVentanaProgramas.ArbolProgramas.SelectedNode != null)
            {
                Clipboard.SetText(CVentanaProgramas.ArbolProgramas.SelectedNode.FullPath.Replace(dPROGRAM.FOLDER + "\\", "").Replace("\\", ".").Replace(".json", ""));
            }

            ARQODE_UI.GestorControles.CFormControlesEventos CFormControlesEventos = new ARQODE_UI.GestorControles.CFormControlesEventos(vm);

            // Cargar árbol de controles
            DirectoryInfo program_path = App_globals.AppDataSection(dPATH.VIEWS);

            if (CFormControlesEventos.TV_Controles.Nodes.Count == 0)
            {
                CFormControlesEventos.TV_Controles.Nodes.Clear();
                TreeNode tn_vistas = (TreeNode)CVentanaProgramas.Cargar_arbol_recursivo.Crear_arbol_desde_carpeta(
                    program_path.FullName, "base_control.json");

                foreach (TreeNode tnchild in tn_vistas.Nodes)
                {
                    CFormControlesEventos.TV_Controles.Nodes.Add(tnchild);
                }
                // Añadir controles al árbol de vistas
                List <TreeNode> Nodos_vista = (List <TreeNode>)CVentanaProgramas.Cargar_arbol_recursivo.Crear_lista_de_nodos_hoja_del_arbol(tn_vistas);
                foreach (TreeNode nodo_vista in Nodos_vista)
                {
                    String nombre_vista = nodo_vista.FullPath.Replace("\\", ".").Replace(".json", "");

                    try
                    {
                        CView VTemp = new CView(App_globals, nombre_vista);
                        if (VTemp != null)
                        {
                            foreach (CView.CtrlStruct cstr in VTemp.getAllControls())
                            {
                                TreeNode tn = null;
                                if (nombre_vista == cstr.control_name)
                                {
                                    tn = new TreeNode(cstr.control_name.Substring(cstr.control_name.IndexOf(".") + 1));
                                }
                                else
                                {
                                    tn = new TreeNode(cstr.control_name);
                                }
                                nodo_vista.Nodes.Add(tn);
                            }
                        }
                    }
                    catch (Exception exc)
                    {
                        errors.warning = exc.Message;
                    }
                }
            }

            // Enlazar opciones de menú con programas
            String C_Programa_filtrar_busqueda = Config_str("Programa filtrar busqueda");

            CFormControlesEventos.view.Set_event_handler(
                CFormControlesEventos.toolStrip1.Items[1],
                CFormControlesEventos.toolStrip1.Items[1].Name,
                "Click",
                C_Programa_filtrar_busqueda);

            CFormControlesEventos.view.Set_event_handler(
                CFormControlesEventos.toolStrip1.Items[0],
                CFormControlesEventos.toolStrip1.Items[0].Name,
                "TextChanged",
                C_Programa_filtrar_busqueda);


            CFormControlesEventos.FormControlesEventos.Show();


            //END CODE PRCGUID: fd7bbb95-2c3f-4e41-869f-5dca33016355
        }
Ejemplo n.º 24
0
        /// #NAME#: #DESCRIPTION#
        public void f_Cargar_proceso_activo()
        {
            //INI CODE PRCGUID: Cargar proceso activo

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas  = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorProcesos.CFormProcesoActivo CFormProcesoActivo = new ARQODE_UI.GestorProcesos.CFormProcesoActivo(vm);
            if ((CVentanaProgramas.Namespace_programa_activo != null) && (CVentanaProgramas.ListaProcesos.Rows.Count > 0))
            {
                ARQODE_UI.GestorProcesos.CVentanaProcesos CVentanaProcesos = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);
                if (CVentanaProcesos.PProcessPanel.Controls.Count == 0)
                {
                    CVentanaProcesos.PProcessPanel.Controls.Add(CFormProcesoActivo.FormProcesoActivo);
                }
                CFormProcesoActivo.FormProcesoActivo.Dock = DockStyle.Fill;
                // Variables de vistas
                CFormProcesoActivo.TV_ViewsVars.Nodes.Clear();
                TreeNode        tn_views  = (TreeNode)CVentanaProgramas.Cargar_arbol_recursivo.Crear_arbol_desde_carpeta(App_globals.AppDataSection(dPATH.VIEWS).FullName, "base_control.json");
                List <TreeNode> NodosHoja = (List <TreeNode>)CVentanaProgramas.Cargar_arbol_recursivo.Crear_lista_de_nodos_hoja_del_arbol(tn_views);

                foreach (TreeNode node in tn_views.Nodes)
                {
                    CFormProcesoActivo.TV_ViewsVars.Nodes.Add(node);
                }

                foreach (TreeNode nodo in NodosHoja)
                {
                    JSonFile JView = new JSonFile(Path.Combine(
                                                      App_globals.AppDataSection(dPATH.VIEWS).FullName,
                                                      nodo.FullPath));
                    if (JView.jActiveObj["Variables"] != null)
                    {
                        foreach (JValue var in JView.jActiveObj["Variables"] as JArray)
                        {
                            nodo.Nodes.Add(var.Value.ToString());
                        }
                    }
                }

                // Variables de programa
                CFormProcesoActivo.LB_ProgramVars.Items.Clear();

                CProgram Curr_prog = new CProgram(sys, App_globals, CVentanaProgramas.Namespace_programa_activo.ToString());
                foreach (String var in Curr_prog.vars.Keys)
                {
                    CFormProcesoActivo.LB_ProgramVars.Items.Add(var);
                }

                // Variables globals
                CFormProcesoActivo.TV_GlobalsVars.Nodes.Clear();
                foreach (JToken JGlob in App_globals.Globals)
                {
                    TreeNode tn = new TreeNode(((JProperty)JGlob).Name);

                    if (((JProperty)JGlob).Value is JObject)
                    {
                        JObject JChildGlobs = (JObject)((JProperty)JGlob).Value;

                        foreach (JProperty JChildGlob in JChildGlobs.Properties())
                        {
                            TreeNode tn1 = new TreeNode(JChildGlob.Name);
                            tn.Nodes.Add(tn1);
                        }
                    }

                    CFormProcesoActivo.TV_GlobalsVars.Nodes.Add(tn);
                }

                // Datos del proceso
                JToken JProgram_logic = (JToken)CVentanaProgramas.Procesos_programa_activo;
                if (JProgram_logic != null)
                {
                    if ((CVentanaProgramas.ListaProcesos.SelectedCells.Count > 0) ||
                        (CVentanaProgramas.ListaProcesos.Rows.Count > 0))
                    {
                        int rowIndex = (CVentanaProgramas.ListaProcesos.SelectedCells.Count > 0) ?
                                       CVentanaProgramas.ListaProcesos.SelectedCells[0].RowIndex :
                                       0;

                        String PGuid = CVentanaProgramas.ListaProcesos[1, rowIndex].Value.ToString();
                        JToken JProc = (JProgram_logic as JArray)[rowIndex];
                        // Eliminar el proceso si está vacío
                        if (JProc.Count() == 0)
                        {
                            JProc.Remove();
                            JProc = (JProgram_logic as JArray)[rowIndex];
                        }

                        // Guardar proceso activo
                        Outputs("Proceso de programa activo", JProc);

                        CFormProcesoActivo.Fila_activa = rowIndex;

                        CFormProcesoActivo.Active_process            = JProc;
                        CFormProcesoActivo.Namespace_programa_activo = CVentanaProgramas.Namespace_programa_activo;

                        CFormProcesoActivo.LName.Text         = (JProc["Name"] != null) ? JProc["Name"].ToString() : JProc["Guid"].ToString();
                        CFormProcesoActivo.TBDescription.Text = (JProc["Description"] != null) ? JProc["Description"].ToString() : "";

                        // inputs
                        System.Data.DataTable dti = new System.Data.DataTable();

                        dti.Columns.Add("Input");
                        dti.Columns.Add("Value");
                        foreach (JProperty JInput in JProc["Inputs"])
                        {
                            dti.Rows.Add(new String[] { JInput.Name, JInput.Value.ToString() });
                        }
                        CFormProcesoActivo.LInputs.DataSource = dti;

                        // Outputs
                        System.Data.DataTable dto = new System.Data.DataTable();

                        dto.Columns.Add("Output");
                        dto.Columns.Add("Value");
                        foreach (JProperty JOutputs in JProc["Outputs"])
                        {
                            dto.Rows.Add(new String[] { JOutputs.Name, JOutputs.Value.ToString() });
                        }
                        CFormProcesoActivo.LOutputs.DataSource = dto;

                        // Configuration
                        if (JProc["Configuration"] != null)
                        {
                            System.Data.DataTable dtc = new System.Data.DataTable();

                            dtc.Columns.Add("Configuration");
                            dtc.Columns.Add("Value");
                            foreach (JProperty JConfig in JProc["Configuration"])
                            {
                                dtc.Rows.Add(new String[] { JConfig.Name, JConfig.Value.ToString() });
                            }
                            CFormProcesoActivo.LConfig.DataSource = dtc;
                        }
                    }
                    else
                    {
                        CFormProcesoActivo.Active_process      = null;
                        CFormProcesoActivo.LName.Text          = "";
                        CFormProcesoActivo.TBDescription.Text  = "";
                        CFormProcesoActivo.LInputs.DataSource  = null;
                        CFormProcesoActivo.LOutputs.DataSource = null;
                        CFormProcesoActivo.LConfig.DataSource  = null;
                        Outputs("Proceso de programa activo", null);
                    }
                }

                CVentanaProcesos.tabProcesos.SelectedIndex = 1;
            }
            else
            {
                CFormProcesoActivo.Active_process      = null;
                CFormProcesoActivo.LName.Text          = "";
                CFormProcesoActivo.TBDescription.Text  = "";
                CFormProcesoActivo.LInputs.DataSource  = null;
                CFormProcesoActivo.LOutputs.DataSource = null;
                CFormProcesoActivo.LConfig.DataSource  = null;
                Outputs("Proceso de programa activo", null);
            }
            //END CODE PRCGUID: Cargar proceso activo
        }
Ejemplo n.º 25
0
        /// #NAME#: #DESCRIPTION#
        public void f_Asignar_proceso()
        {
            //INI CODE PRCGUID: Asignar proceso
            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);

            if ((CVentanaProgramas.ArbolProgramas.SelectedNode != null) && (CVentanaProgramas.ArbolProgramas.SelectedNode.Text.EndsWith(".json")))
            {
                // obtenemos el proceso a incluir
                ListBox LProcess = (ListBox)view.getCtrl("LProcess");
                JToken  JProc    = ((KeyValuePair <String, JToken>)LProcess.SelectedItem).Value;

                // obtenemos la ruta del proceso
                TreeView TV_Processes = (TreeView)view.getCtrl("TV_Processes");
                if (TV_Processes.SelectedNode != null)
                {
                    String prc_namespace = TV_Processes.SelectedNode.FullPath.Replace(dPROCESS.FOLDER + "\\", "").Replace("\\", ".").Replace(".json", "");

                    // montamos el proceso destino:
                    JObject JNewProc_2_program = new JObject();
                    JNewProc_2_program.Add("Namespace", prc_namespace);
                    JNewProc_2_program.Add("Guid", JProc["Guid"].ToString());
                    JNewProc_2_program.Add("Name", JProc["Name"].ToString());
                    JNewProc_2_program.Add("Description", JProc["Description"].ToString());

                    JObject JConf = new JObject();
                    if (JProc["Configuration"].Count() > 0)
                    {
                        foreach (JToken jitem in (JArray)JProc["Configuration"])
                        {
                            JConf.Add(jitem.ToString(), "");
                        }
                    }
                    JNewProc_2_program.Add("Configuration", JConf);
                    JObject JIn = new JObject();
                    if (JProc["Inputs"].Count() > 0)
                    {
                        foreach (JToken jitem in (JArray)JProc["Inputs"])
                        {
                            JIn.Add(jitem.ToString(), "");
                        }
                    }
                    JNewProc_2_program.Add("Inputs", JIn);
                    JObject JOut = new JObject();
                    if (JProc["Outputs"].Count() > 0)
                    {
                        foreach (JToken jitem in (JArray)JProc["Outputs"])
                        {
                            JOut.Add(jitem.ToString(), "");
                        }
                    }
                    JNewProc_2_program.Add("Outputs", JOut);

                    // obtienes el programa
                    String rutaPrograma = Path.Combine(
                        App_globals.AppDataSection(dPATH.CODE).FullName,
                        CVentanaProgramas.ArbolProgramas.SelectedNode.FullPath);

                    JSonFile jprograma = new JSonFile(rutaPrograma);
                    (jprograma.jActiveObj["Logic"] as JArray).Add(JNewProc_2_program);
                    jprograma.Write();
                }
            }


            //END CODE PRCGUID: Asignar proceso
        }
Ejemplo n.º 26
0
        /// #NAME#: #DESCRIPTION#
        public void f_Cargar_subprocesos()
        {
            //INI CODE PRCGUID: Cargar subprocesos

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorProcesos.CVentanaProcesos   CVentanaProcesos  = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);

            CVentanaProcesos.LProcess.Items.Clear();
            if (CVentanaProcesos.TV_Processes.SelectedNode != null)
            {
                String pathProcesses = CVentanaProcesos.TV_Processes.SelectedNode.FullPath;
                if (pathProcesses.EndsWith(".json"))
                {
                    JSonFile processes_file = new JSonFile(Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, pathProcesses), true);

                    // Guardar fichero activo
                    ARQODE_UI.GestorProcesos.CFormProceso CFormProceso = new ARQODE_UI.GestorProcesos.CFormProceso(vm);
                    CFormProceso.FicheroProceso = processes_file.file_path;

                    if (!processes_file.hasErrors())
                    {
                        if (processes_file.jActiveObj["processes"].Count() > 0)
                        {
                            foreach (JToken jProc in (JArray)processes_file.jActiveObj["processes"])
                            {
                                String Name = (jProc["Name"] != null) ? jProc["Name"].ToString() : jProc["Guid"].ToString();
                                KeyValuePair <String, JToken> kprocess = new KeyValuePair <string, JToken>(Name, jProc);

                                CVentanaProcesos.LProcess.Items.Add(kprocess);
                                CVentanaProcesos.LProcess.ValueMember   = "Value";
                                CVentanaProcesos.LProcess.DisplayMember = "Key";
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Errors in json file: " + processes_file.jErrors.ToString());
                    }
                }
                else
                {
                    DirectoryInfo processes_path = new DirectoryInfo(Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, pathProcesses));

                    foreach (TreeNode child_node in CVentanaProcesos.TV_Processes.SelectedNode.Nodes)
                    {
                        if ((child_node.Nodes.Count == 0) && (!child_node.Text.EndsWith(".json")))
                        {
                            foreach (DirectoryInfo subProcesses_folder in processes_path.GetDirectories(child_node.Text)[0].GetDirectories())
                            {
                                child_node.Nodes.Add(subProcesses_folder.FullName, subProcesses_folder.Name);
                                child_node.Nodes[child_node.Nodes.Count - 1].Name = subProcesses_folder.Name;
                            }

                            foreach (FileInfo subProcesses_files in processes_path.GetDirectories(child_node.Text)[0].GetFiles())
                            {
                                child_node.Nodes.Add(subProcesses_files.FullName, subProcesses_files.Name);
                                child_node.Nodes[child_node.Nodes.Count - 1].Name = subProcesses_files.Name;
                            }
                        }
                    }
                }
            }

            //END CODE PRCGUID: Cargar subprocesos
        }