Пример #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     Filedialogbmp.ShowDialog();
     MessageBox.Show("Esto es el seleccionado" + Filedialogbmp.SafeFileName);
     MessageBox.Show("Esta es la direccion" + Filedialogbmp.FileName);
 }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (listBoxImages.SelectedIndex == -1)
            {
                MessageBox.Show("Seleccione una imagen primero", "Error");
                return;
            }

            var p = new Process();


            p.StartInfo.WorkingDirectory = mainfolder + listbox_filesbase.SelectedItem.ToString() + @"\";
            p.StartInfo.FileName         = gosbp3pk1;

            string image            = listBoxImages.SelectedItem.ToString();
            string fileimage        = Path.Combine(Path.GetDirectoryName(image), Path.GetFileNameWithoutExtension(image));
            string imagenreemplazar = mainfolder + listbox_filesbase.SelectedItem.ToString() + @"\" + fileimage + ".bmp";
            string filepath         = mainfolder + listbox_filesbase.SelectedItem.ToString() + image;
            string selectedfilepath = Filedialogbmp.SafeFileName.ToString();
            string selectedfile     = Filedialogbmp.FileName.ToString();

            p.StartInfo.Arguments = '\u0022' + fileimage + ".bmp" + '\u0022';

            if (Filedialogbmp.ShowDialog() == DialogResult.OK)
            {
                DialogResult reemplazar = MessageBox.Show("Desea reemplazar " + image + " por " + Filedialogbmp.SafeFileName + "?", "Confirmacion", MessageBoxButtons.YesNo);
                if (reemplazar == DialogResult.Yes)
                {
                    try
                    {
                        File.Copy(Filedialogbmp.FileName, imagenreemplazar, overwrite: true);
                        p.Start();
                        var procId = p.Id;
                        id_process_bmp = procId;
                        while (true)
                        {
                            if (IsProcessOpen(id_process_bmp) == false)
                            {
                                DialogResult compilar1 = MessageBox.Show("Desea compilar?", "Confirmacion", MessageBoxButtons.YesNo);
                                if (compilar1 == DialogResult.Yes)
                                {
                                    if (listbox_filesbase.SelectedItem.ToString() == "event")
                                    {
                                        empaquetar("gosflst-event.txt", "event");
                                        break;
                                    }
                                    if (listbox_filesbase.SelectedItem.ToString() == "face")
                                    {
                                        empaquetar("gosflst-face.txt", "FACE");
                                        break;
                                    }
                                    if (listbox_filesbase.SelectedItem.ToString() == "imgfrm")
                                    {
                                        empaquetar("gosflst-img.txt", "imgfrm");
                                        break;
                                    }
                                }
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (reemplazar == DialogResult.No)
                {
                    return;
                }
            }
        }