C# Add custom Windows context menu for just this programContext menuAdd menu item to windows context menu only for specific filetypeWindows Explorer Context Menu Integration, get file that was right clicked onC# Windows 'Open With >' Context menu behaviourAdding a menu item to Windows Explorer right click context menu in C#Add a custom menu item to the Context Menu in Windows FormsHow to add a “open git-bash here…” context menu to the windows explorer?Add Java program to Windows' context menuAdding “Open Anaconda Prompt here” to context menu (Windows)Add a custom option in context menu in windows explorer background

What could a Medieval society do with excess animal blood?

Are the plates of a battery really charged?

"Best practices" for formulating MIPs

Why will we fail creating a self sustaining off world colony?

Why should I allow multiple IP addresses on a website for a single session?

What do you call the fear of forgetting (specifically something one cherishes a lot)?

Can you help me, to widen the page. Thank you

Why did the Middle Kingdom stop building pyramid tombs?

Which high-degree derivatives play an essential role?

Existence of infinite set of positive integers s.t sum of reciprocals is rational and set of primes dividing an element is infinite

How can I change my buffer system for protein purification?

Is my background sufficient to start Quantum Computing

ShellExView vs ShellMenuView

How to extract coefficients of a generating function like this one, using a computer?

German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)

Bootstrap paradox with a time machine in iron

What is the meaning of "it" in "as luck would have it"?

Are there advantages in writing by hand over typing out a story?

What is this white film on slides from late 1950s?

What happened to the Apollo 1 rocket?

Why are examinees often not allowed to leave during the start and end of an exam?

Turing Machines: What is the difference between recognizing, deciding, total, accepting, rejecting?

My players like to search everything. What do they find?

How can I get a file's size in C++ in 2019 with C++ 17?



C# Add custom Windows context menu for just this program


Context menuAdd menu item to windows context menu only for specific filetypeWindows Explorer Context Menu Integration, get file that was right clicked onC# Windows 'Open With >' Context menu behaviourAdding a menu item to Windows Explorer right click context menu in C#Add a custom menu item to the Context Menu in Windows FormsHow to add a “open git-bash here…” context menu to the windows explorer?Add Java program to Windows' context menuAdding “Open Anaconda Prompt here” to context menu (Windows)Add a custom option in context menu in windows explorer background













1















My question is: How do I add a windows context menu item for a specific application, not globally?



Quick Brief:
We use Access (groan) for our CRM system. We use a basic 'copy to local' process for multi-access. I have written a C# 'launcher' of which handles this much better than a .bat file (they click the launcher, the launcher downloads the db, launches the db and quits). I also currently use a C# console application to handle development, automating stuff like incrementing version number, moving files around etc.




My Question/Goal:
I want to combine the two programs into one but I don't want to hinder the launcher from it's main purpose by jarring the user asking if they want to develop or not. I use this launcher too as I am primarily an estimator, hence wanting to combine the two. I have read that you can add context menu items to Windows as a whole, but I want to be able to add a launch option into the context menu just for this application. i.e. right click on program, normal menu options but with the addition of "Development Mode", this opens the program with arguments that I can use to open the development window/console instead.




Things to note:



  • I have played around with holding a key on start but it can be vague when to press the key. Too early - you will end up typing "r" several times into the active window, too late - and it will miss the capture point.

  • I have also looked at having a button on the launcher that gives you the option to go into dev mode, but the launcher is only open for around a second so its really easy to miss.

Thanks in advance



EDIT: The launcher is made and run as a click-once app.










share|improve this question
























  • @Anas I have amended the first line of the question to be more precise. thanks

    – Simon Curtis
    Oct 24 '18 at 13:17











  • Thanks @stuartd that's a good shout! I will give it a go.

    – Simon Curtis
    Oct 24 '18 at 13:38















1















My question is: How do I add a windows context menu item for a specific application, not globally?



Quick Brief:
We use Access (groan) for our CRM system. We use a basic 'copy to local' process for multi-access. I have written a C# 'launcher' of which handles this much better than a .bat file (they click the launcher, the launcher downloads the db, launches the db and quits). I also currently use a C# console application to handle development, automating stuff like incrementing version number, moving files around etc.




My Question/Goal:
I want to combine the two programs into one but I don't want to hinder the launcher from it's main purpose by jarring the user asking if they want to develop or not. I use this launcher too as I am primarily an estimator, hence wanting to combine the two. I have read that you can add context menu items to Windows as a whole, but I want to be able to add a launch option into the context menu just for this application. i.e. right click on program, normal menu options but with the addition of "Development Mode", this opens the program with arguments that I can use to open the development window/console instead.




Things to note:



  • I have played around with holding a key on start but it can be vague when to press the key. Too early - you will end up typing "r" several times into the active window, too late - and it will miss the capture point.

  • I have also looked at having a button on the launcher that gives you the option to go into dev mode, but the launcher is only open for around a second so its really easy to miss.

Thanks in advance



EDIT: The launcher is made and run as a click-once app.










share|improve this question
























  • @Anas I have amended the first line of the question to be more precise. thanks

    – Simon Curtis
    Oct 24 '18 at 13:17











  • Thanks @stuartd that's a good shout! I will give it a go.

    – Simon Curtis
    Oct 24 '18 at 13:38













1












1








1


1






My question is: How do I add a windows context menu item for a specific application, not globally?



Quick Brief:
We use Access (groan) for our CRM system. We use a basic 'copy to local' process for multi-access. I have written a C# 'launcher' of which handles this much better than a .bat file (they click the launcher, the launcher downloads the db, launches the db and quits). I also currently use a C# console application to handle development, automating stuff like incrementing version number, moving files around etc.




My Question/Goal:
I want to combine the two programs into one but I don't want to hinder the launcher from it's main purpose by jarring the user asking if they want to develop or not. I use this launcher too as I am primarily an estimator, hence wanting to combine the two. I have read that you can add context menu items to Windows as a whole, but I want to be able to add a launch option into the context menu just for this application. i.e. right click on program, normal menu options but with the addition of "Development Mode", this opens the program with arguments that I can use to open the development window/console instead.




Things to note:



  • I have played around with holding a key on start but it can be vague when to press the key. Too early - you will end up typing "r" several times into the active window, too late - and it will miss the capture point.

  • I have also looked at having a button on the launcher that gives you the option to go into dev mode, but the launcher is only open for around a second so its really easy to miss.

Thanks in advance



EDIT: The launcher is made and run as a click-once app.










share|improve this question
















My question is: How do I add a windows context menu item for a specific application, not globally?



Quick Brief:
We use Access (groan) for our CRM system. We use a basic 'copy to local' process for multi-access. I have written a C# 'launcher' of which handles this much better than a .bat file (they click the launcher, the launcher downloads the db, launches the db and quits). I also currently use a C# console application to handle development, automating stuff like incrementing version number, moving files around etc.




My Question/Goal:
I want to combine the two programs into one but I don't want to hinder the launcher from it's main purpose by jarring the user asking if they want to develop or not. I use this launcher too as I am primarily an estimator, hence wanting to combine the two. I have read that you can add context menu items to Windows as a whole, but I want to be able to add a launch option into the context menu just for this application. i.e. right click on program, normal menu options but with the addition of "Development Mode", this opens the program with arguments that I can use to open the development window/console instead.




Things to note:



  • I have played around with holding a key on start but it can be vague when to press the key. Too early - you will end up typing "r" several times into the active window, too late - and it will miss the capture point.

  • I have also looked at having a button on the launcher that gives you the option to go into dev mode, but the launcher is only open for around a second so its really easy to miss.

Thanks in advance



EDIT: The launcher is made and run as a click-once app.







c# windows contextmenu






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 24 '18 at 13:21







Simon Curtis

















asked Oct 24 '18 at 13:03









Simon CurtisSimon Curtis

545 bronze badges




545 bronze badges












  • @Anas I have amended the first line of the question to be more precise. thanks

    – Simon Curtis
    Oct 24 '18 at 13:17











  • Thanks @stuartd that's a good shout! I will give it a go.

    – Simon Curtis
    Oct 24 '18 at 13:38

















  • @Anas I have amended the first line of the question to be more precise. thanks

    – Simon Curtis
    Oct 24 '18 at 13:17











  • Thanks @stuartd that's a good shout! I will give it a go.

    – Simon Curtis
    Oct 24 '18 at 13:38
















@Anas I have amended the first line of the question to be more precise. thanks

– Simon Curtis
Oct 24 '18 at 13:17





@Anas I have amended the first line of the question to be more precise. thanks

– Simon Curtis
Oct 24 '18 at 13:17













Thanks @stuartd that's a good shout! I will give it a go.

– Simon Curtis
Oct 24 '18 at 13:38





Thanks @stuartd that's a good shout! I will give it a go.

– Simon Curtis
Oct 24 '18 at 13:38










3 Answers
3






active

oldest

votes


















1














I dont really know about whether its possible to have a custom context for a specific program, as far as i know the context works with the extension. That being said, i think there are better ways to handle your problem. Have a look at this



 static void Main(string[] args)

/* here normal flow of the launcher*/

if (args[0] == "-dev")

/*here de developer mode*/
Console.WriteLine("Developer mode activated");




The way to use it is simple, you make a shorcut, and where it says the shorcut target you will have something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" and you should change it to something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" -dev






share|improve this answer























  • Thanks for your suggestion, the only issue here is that I would have to have two shortcuts for the same thing. Therefore I might as well just stick with the two applications.

    – Simon Curtis
    Oct 24 '18 at 13:19











  • I see what you mean. What if after you finish the flow of your launcher you await a number of seconds and if there is an input (any input or a specific letter perhaps) you enter the developer mode

    – nalnpir
    Oct 24 '18 at 13:24











  • Unfortunately the process flow of the launcher itself is to open a copy of the database. This means if I wait until the end then I will end up opening the database and going into the developer mode too. I have just had a thought of making myself a service that runs in the background, as I know that I can add a context menu to that

    – Simon Curtis
    Oct 24 '18 at 13:28












  • if you are interested... I worked out the answer to this stackoverflow.com/a/55341608/7985048

    – Simon Curtis
    Mar 25 at 17:38



















0














As per a suggestion in a comment, that has gone for some reason. I am going to revert to keypress but use shift instead or "R".



Failing this, or if it causes problems it will look at creating a global context menu item for all programs, and just won't click it when I don't need to






share|improve this answer






























    0














    Further to this I stumbled upon some code to make this work. Hopefully this will help someone in the future. I am doing this in WPF, but I am sure you could probably adapt this code to work elsewhere.



    1) App.xaml - Adding the JumpList action



    After (not inside) the Application.Resources property add the following and change to your liking (There are a lot of properties I haven't used for development sake, check out the link to learn more):



    <Application.Resources>
    ...
    </Application.Resources>
    <JumpList.JumpList>
    <JumpList ShowRecentCategory="False"
    ShowFrequentCategory="False">
    <JumpTask Title="Open Dev Mode"
    Description="Use this to enter dev mode (admins only)"
    Arguments="DevMode:true"/>
    </JumpList>
    </JumpList.JumpList>


    This will create a "Task" in the jump list:



    enter image description here



    2) Create Global static class - this will allow you to store the variable for later use in other forms.



    public static class Global

    public static Boolean DevMode = false;



    3) App.xaml.cs - Adding OnStartup handler



    Inside the App class create an override method for OnStartup



    public partial class App : Application

    protected override void OnStartup(StartupEventArgs e)

    Global.DevMode = Boolean.Parse(e.Args.FirstOrDefault().ToString().Split(':')[1]);




    4) Read the variable in your form using Global.DevMode



    private void Window_ContentRendered(object sender, EventArgs e)

    if (Global.DevMode) RunYourDevScript();






    share|improve this answer



























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52969764%2fc-sharp-add-custom-windows-context-menu-for-just-this-program%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      I dont really know about whether its possible to have a custom context for a specific program, as far as i know the context works with the extension. That being said, i think there are better ways to handle your problem. Have a look at this



       static void Main(string[] args)

      /* here normal flow of the launcher*/

      if (args[0] == "-dev")

      /*here de developer mode*/
      Console.WriteLine("Developer mode activated");




      The way to use it is simple, you make a shorcut, and where it says the shorcut target you will have something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" and you should change it to something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" -dev






      share|improve this answer























      • Thanks for your suggestion, the only issue here is that I would have to have two shortcuts for the same thing. Therefore I might as well just stick with the two applications.

        – Simon Curtis
        Oct 24 '18 at 13:19











      • I see what you mean. What if after you finish the flow of your launcher you await a number of seconds and if there is an input (any input or a specific letter perhaps) you enter the developer mode

        – nalnpir
        Oct 24 '18 at 13:24











      • Unfortunately the process flow of the launcher itself is to open a copy of the database. This means if I wait until the end then I will end up opening the database and going into the developer mode too. I have just had a thought of making myself a service that runs in the background, as I know that I can add a context menu to that

        – Simon Curtis
        Oct 24 '18 at 13:28












      • if you are interested... I worked out the answer to this stackoverflow.com/a/55341608/7985048

        – Simon Curtis
        Mar 25 at 17:38
















      1














      I dont really know about whether its possible to have a custom context for a specific program, as far as i know the context works with the extension. That being said, i think there are better ways to handle your problem. Have a look at this



       static void Main(string[] args)

      /* here normal flow of the launcher*/

      if (args[0] == "-dev")

      /*here de developer mode*/
      Console.WriteLine("Developer mode activated");




      The way to use it is simple, you make a shorcut, and where it says the shorcut target you will have something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" and you should change it to something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" -dev






      share|improve this answer























      • Thanks for your suggestion, the only issue here is that I would have to have two shortcuts for the same thing. Therefore I might as well just stick with the two applications.

        – Simon Curtis
        Oct 24 '18 at 13:19











      • I see what you mean. What if after you finish the flow of your launcher you await a number of seconds and if there is an input (any input or a specific letter perhaps) you enter the developer mode

        – nalnpir
        Oct 24 '18 at 13:24











      • Unfortunately the process flow of the launcher itself is to open a copy of the database. This means if I wait until the end then I will end up opening the database and going into the developer mode too. I have just had a thought of making myself a service that runs in the background, as I know that I can add a context menu to that

        – Simon Curtis
        Oct 24 '18 at 13:28












      • if you are interested... I worked out the answer to this stackoverflow.com/a/55341608/7985048

        – Simon Curtis
        Mar 25 at 17:38














      1












      1








      1







      I dont really know about whether its possible to have a custom context for a specific program, as far as i know the context works with the extension. That being said, i think there are better ways to handle your problem. Have a look at this



       static void Main(string[] args)

      /* here normal flow of the launcher*/

      if (args[0] == "-dev")

      /*here de developer mode*/
      Console.WriteLine("Developer mode activated");




      The way to use it is simple, you make a shorcut, and where it says the shorcut target you will have something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" and you should change it to something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" -dev






      share|improve this answer













      I dont really know about whether its possible to have a custom context for a specific program, as far as i know the context works with the extension. That being said, i think there are better ways to handle your problem. Have a look at this



       static void Main(string[] args)

      /* here normal flow of the launcher*/

      if (args[0] == "-dev")

      /*here de developer mode*/
      Console.WriteLine("Developer mode activated");




      The way to use it is simple, you make a shorcut, and where it says the shorcut target you will have something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" and you should change it to something like this "C:Users****Documentsvisual studio 2017ProjectsTestTestbinDebugTest.exe" -dev







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Oct 24 '18 at 13:16









      nalnpirnalnpir

      71014 bronze badges




      71014 bronze badges












      • Thanks for your suggestion, the only issue here is that I would have to have two shortcuts for the same thing. Therefore I might as well just stick with the two applications.

        – Simon Curtis
        Oct 24 '18 at 13:19











      • I see what you mean. What if after you finish the flow of your launcher you await a number of seconds and if there is an input (any input or a specific letter perhaps) you enter the developer mode

        – nalnpir
        Oct 24 '18 at 13:24











      • Unfortunately the process flow of the launcher itself is to open a copy of the database. This means if I wait until the end then I will end up opening the database and going into the developer mode too. I have just had a thought of making myself a service that runs in the background, as I know that I can add a context menu to that

        – Simon Curtis
        Oct 24 '18 at 13:28












      • if you are interested... I worked out the answer to this stackoverflow.com/a/55341608/7985048

        – Simon Curtis
        Mar 25 at 17:38


















      • Thanks for your suggestion, the only issue here is that I would have to have two shortcuts for the same thing. Therefore I might as well just stick with the two applications.

        – Simon Curtis
        Oct 24 '18 at 13:19











      • I see what you mean. What if after you finish the flow of your launcher you await a number of seconds and if there is an input (any input or a specific letter perhaps) you enter the developer mode

        – nalnpir
        Oct 24 '18 at 13:24











      • Unfortunately the process flow of the launcher itself is to open a copy of the database. This means if I wait until the end then I will end up opening the database and going into the developer mode too. I have just had a thought of making myself a service that runs in the background, as I know that I can add a context menu to that

        – Simon Curtis
        Oct 24 '18 at 13:28












      • if you are interested... I worked out the answer to this stackoverflow.com/a/55341608/7985048

        – Simon Curtis
        Mar 25 at 17:38

















      Thanks for your suggestion, the only issue here is that I would have to have two shortcuts for the same thing. Therefore I might as well just stick with the two applications.

      – Simon Curtis
      Oct 24 '18 at 13:19





      Thanks for your suggestion, the only issue here is that I would have to have two shortcuts for the same thing. Therefore I might as well just stick with the two applications.

      – Simon Curtis
      Oct 24 '18 at 13:19













      I see what you mean. What if after you finish the flow of your launcher you await a number of seconds and if there is an input (any input or a specific letter perhaps) you enter the developer mode

      – nalnpir
      Oct 24 '18 at 13:24





      I see what you mean. What if after you finish the flow of your launcher you await a number of seconds and if there is an input (any input or a specific letter perhaps) you enter the developer mode

      – nalnpir
      Oct 24 '18 at 13:24













      Unfortunately the process flow of the launcher itself is to open a copy of the database. This means if I wait until the end then I will end up opening the database and going into the developer mode too. I have just had a thought of making myself a service that runs in the background, as I know that I can add a context menu to that

      – Simon Curtis
      Oct 24 '18 at 13:28






      Unfortunately the process flow of the launcher itself is to open a copy of the database. This means if I wait until the end then I will end up opening the database and going into the developer mode too. I have just had a thought of making myself a service that runs in the background, as I know that I can add a context menu to that

      – Simon Curtis
      Oct 24 '18 at 13:28














      if you are interested... I worked out the answer to this stackoverflow.com/a/55341608/7985048

      – Simon Curtis
      Mar 25 at 17:38






      if you are interested... I worked out the answer to this stackoverflow.com/a/55341608/7985048

      – Simon Curtis
      Mar 25 at 17:38












      0














      As per a suggestion in a comment, that has gone for some reason. I am going to revert to keypress but use shift instead or "R".



      Failing this, or if it causes problems it will look at creating a global context menu item for all programs, and just won't click it when I don't need to






      share|improve this answer



























        0














        As per a suggestion in a comment, that has gone for some reason. I am going to revert to keypress but use shift instead or "R".



        Failing this, or if it causes problems it will look at creating a global context menu item for all programs, and just won't click it when I don't need to






        share|improve this answer

























          0












          0








          0







          As per a suggestion in a comment, that has gone for some reason. I am going to revert to keypress but use shift instead or "R".



          Failing this, or if it causes problems it will look at creating a global context menu item for all programs, and just won't click it when I don't need to






          share|improve this answer













          As per a suggestion in a comment, that has gone for some reason. I am going to revert to keypress but use shift instead or "R".



          Failing this, or if it causes problems it will look at creating a global context menu item for all programs, and just won't click it when I don't need to







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 24 '18 at 13:43









          Simon CurtisSimon Curtis

          545 bronze badges




          545 bronze badges





















              0














              Further to this I stumbled upon some code to make this work. Hopefully this will help someone in the future. I am doing this in WPF, but I am sure you could probably adapt this code to work elsewhere.



              1) App.xaml - Adding the JumpList action



              After (not inside) the Application.Resources property add the following and change to your liking (There are a lot of properties I haven't used for development sake, check out the link to learn more):



              <Application.Resources>
              ...
              </Application.Resources>
              <JumpList.JumpList>
              <JumpList ShowRecentCategory="False"
              ShowFrequentCategory="False">
              <JumpTask Title="Open Dev Mode"
              Description="Use this to enter dev mode (admins only)"
              Arguments="DevMode:true"/>
              </JumpList>
              </JumpList.JumpList>


              This will create a "Task" in the jump list:



              enter image description here



              2) Create Global static class - this will allow you to store the variable for later use in other forms.



              public static class Global

              public static Boolean DevMode = false;



              3) App.xaml.cs - Adding OnStartup handler



              Inside the App class create an override method for OnStartup



              public partial class App : Application

              protected override void OnStartup(StartupEventArgs e)

              Global.DevMode = Boolean.Parse(e.Args.FirstOrDefault().ToString().Split(':')[1]);




              4) Read the variable in your form using Global.DevMode



              private void Window_ContentRendered(object sender, EventArgs e)

              if (Global.DevMode) RunYourDevScript();






              share|improve this answer





























                0














                Further to this I stumbled upon some code to make this work. Hopefully this will help someone in the future. I am doing this in WPF, but I am sure you could probably adapt this code to work elsewhere.



                1) App.xaml - Adding the JumpList action



                After (not inside) the Application.Resources property add the following and change to your liking (There are a lot of properties I haven't used for development sake, check out the link to learn more):



                <Application.Resources>
                ...
                </Application.Resources>
                <JumpList.JumpList>
                <JumpList ShowRecentCategory="False"
                ShowFrequentCategory="False">
                <JumpTask Title="Open Dev Mode"
                Description="Use this to enter dev mode (admins only)"
                Arguments="DevMode:true"/>
                </JumpList>
                </JumpList.JumpList>


                This will create a "Task" in the jump list:



                enter image description here



                2) Create Global static class - this will allow you to store the variable for later use in other forms.



                public static class Global

                public static Boolean DevMode = false;



                3) App.xaml.cs - Adding OnStartup handler



                Inside the App class create an override method for OnStartup



                public partial class App : Application

                protected override void OnStartup(StartupEventArgs e)

                Global.DevMode = Boolean.Parse(e.Args.FirstOrDefault().ToString().Split(':')[1]);




                4) Read the variable in your form using Global.DevMode



                private void Window_ContentRendered(object sender, EventArgs e)

                if (Global.DevMode) RunYourDevScript();






                share|improve this answer



























                  0












                  0








                  0







                  Further to this I stumbled upon some code to make this work. Hopefully this will help someone in the future. I am doing this in WPF, but I am sure you could probably adapt this code to work elsewhere.



                  1) App.xaml - Adding the JumpList action



                  After (not inside) the Application.Resources property add the following and change to your liking (There are a lot of properties I haven't used for development sake, check out the link to learn more):



                  <Application.Resources>
                  ...
                  </Application.Resources>
                  <JumpList.JumpList>
                  <JumpList ShowRecentCategory="False"
                  ShowFrequentCategory="False">
                  <JumpTask Title="Open Dev Mode"
                  Description="Use this to enter dev mode (admins only)"
                  Arguments="DevMode:true"/>
                  </JumpList>
                  </JumpList.JumpList>


                  This will create a "Task" in the jump list:



                  enter image description here



                  2) Create Global static class - this will allow you to store the variable for later use in other forms.



                  public static class Global

                  public static Boolean DevMode = false;



                  3) App.xaml.cs - Adding OnStartup handler



                  Inside the App class create an override method for OnStartup



                  public partial class App : Application

                  protected override void OnStartup(StartupEventArgs e)

                  Global.DevMode = Boolean.Parse(e.Args.FirstOrDefault().ToString().Split(':')[1]);




                  4) Read the variable in your form using Global.DevMode



                  private void Window_ContentRendered(object sender, EventArgs e)

                  if (Global.DevMode) RunYourDevScript();






                  share|improve this answer















                  Further to this I stumbled upon some code to make this work. Hopefully this will help someone in the future. I am doing this in WPF, but I am sure you could probably adapt this code to work elsewhere.



                  1) App.xaml - Adding the JumpList action



                  After (not inside) the Application.Resources property add the following and change to your liking (There are a lot of properties I haven't used for development sake, check out the link to learn more):



                  <Application.Resources>
                  ...
                  </Application.Resources>
                  <JumpList.JumpList>
                  <JumpList ShowRecentCategory="False"
                  ShowFrequentCategory="False">
                  <JumpTask Title="Open Dev Mode"
                  Description="Use this to enter dev mode (admins only)"
                  Arguments="DevMode:true"/>
                  </JumpList>
                  </JumpList.JumpList>


                  This will create a "Task" in the jump list:



                  enter image description here



                  2) Create Global static class - this will allow you to store the variable for later use in other forms.



                  public static class Global

                  public static Boolean DevMode = false;



                  3) App.xaml.cs - Adding OnStartup handler



                  Inside the App class create an override method for OnStartup



                  public partial class App : Application

                  protected override void OnStartup(StartupEventArgs e)

                  Global.DevMode = Boolean.Parse(e.Args.FirstOrDefault().ToString().Split(':')[1]);




                  4) Read the variable in your form using Global.DevMode



                  private void Window_ContentRendered(object sender, EventArgs e)

                  if (Global.DevMode) RunYourDevScript();







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 25 at 17:34

























                  answered Mar 25 at 15:48









                  Simon CurtisSimon Curtis

                  545 bronze badges




                  545 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52969764%2fc-sharp-add-custom-windows-context-menu-for-just-this-program%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript