Exemplo n.º 1
0
        private void tratarFile(object file)
        {
            // ahora tratamos cada archivo en una nueva tarea...
            try
            {

                string archivito = "";
                archivito = file.ToString();

                //   AsyncWriteLine("Procesando " + archivito);

                char tabCaracter = '\u0009';
                try
                {

                    String plantilla = util.loadFile(archivito);

                    // sacamos las variables de la plantilla
                    variablesTemplate var = new variablesTemplate();
                    var = util.getVariablesFromTemplate(plantilla);

                    // vamos a sacar unas variables que luego nos serviran...
                    string nombreArchivo = "";
                    nombreArchivo = util.ExtractFilename(archivito);

                    // si no tiene variables de configuracion es que no es un template...
                    if (var.description == null && var.extensionFile == null)
                    // no es una plantilla...
                    {
                        // no es una plantilla... no hacemos nada

                    }

                    else
                    // es una plantilla...
                    {

                        userControlLinktemplate uc = new userControlLinktemplate();
                        uc.pathTemplate = archivito;
                        uc.nameFile = nombreArchivo;
                        uc.linkLabel1.Text = var.description;
                        uc.parent = this;
                        // panel1.Controls.Add(uc);
                        AsyncAddControl(uc);
                        //uc = null;

                    }

                }
                catch (Exception ex)
                {
                    AsyncWriteLine(ex.Message);
                }

            }
            catch (Exception ex)
            {
                AsyncWriteLine("Error " + ex.Message);
                //throw;
            }
        }
Exemplo n.º 2
0
        public void AsyncAddControl(userControlLinktemplate uc)
        {
            try
            {
                flowLayoutPanel1.BeginInvoke(new MethodInvoker(delegate
                {
                    flowLayoutPanel1.Controls.Add(uc);
                    //flowLayoutPanel1.Refresh();
                }));

            }
            catch (Exception exx)
            {
                //  AsyncWriteLine("Error: " + exx.Message.ToString() + "\n");
            }
        }