Automatically open my program C # [closed]

1

Good,

I created a program to convert some file formats. Now on windows, I put it by default, that whenever I click 2x in the * .csr file open my program. How do I programmatically whenever the user opens a * .csr file, open my program, and automatically put the path of that file in OpenFileDialog? Thank you.

At this moment I have a button to open file: CSR or CNF. Then the code I have is this:

 private void button2_Click(object sender, EventArgs e)
    {
        string arquivoCNF = VariaveisGlobais.cnf;
        string arquivoCSR = VariaveisGlobais.csr;


        ExecutarComandoSSL(arquivoCNF, arquivoCSR);

        textBox3.Text = ("");
        button2.Enabled = false;
        button3.Enabled = false;
        button4.Enabled = false;
        return;
    }

 //Variáveis
    public static class VariaveisGlobais
    {
        public static string CNF { get; set; }
        public static string CSR { get; set; }
        public static string cnf { get; set; }
        public static string csr { get; set; }
    } 

What I'm asking is: If the user DOES NOT OPEN the program but directly opens a CSR or CNF, it runs that code.

    
asked by anonymous 07.09.2015 / 15:49

1 answer

0

In Visual Studio:

Project Properties > Publish > Options > File Associations

You will see the following interface:

Enter the desired extension and associated program.

Using the ClickOnce publication, the installer will create the link between the extension and the program automatically.

    
07.09.2015 / 16:17