-1

I have an WPF application, i using caliburn micro library for MVVM.

public class AppBootstrapper : BootstrapperBase{
  protected override void OnStartup(object sender, StartupEventArgs eventArgs)
  {
     LoadUserConfigData();

     if (eventArgs.Args.Count() != 0)
     {
       MessageBox.Show(eventArgs.Args[0]);
     }
     else
     {
       MessageBox.Show("no");
     }
     StartProgram();
  }
}

here is my xaml

<Application x:Class="Mat.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:Mat">
  <Application.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary>
          <local:AppBootstrapper x:Key="bootstrapper" />
        </ResourceDictionary>

        <ResourceDictionary Source="/UIStyle;component/UIStyle.xaml"/>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </Application.Resources>
</Application>

I using NSIS for creating installer exe file, and i register file associate by NSIS script. but when i double click on file nothing happen excepted the cursor is loading.

many thanks for your suggest.

Erics Nguyen
  • 370
  • 4
  • 16
  • It seems, that you question is about NSIS mostly. Please, you the correct tags and add your script to the question – Pavel Anikhouski Apr 20 '20 at 11:24
  • i don't think the prolem is NSIS, because if i uninstall my program, and click to (file), open with, and i select the exe in the bin/debug folder. it didn't work. – Erics Nguyen Apr 20 '20 at 14:02
  • @EricsNguyen: What happens when you debug your code in Visual Studio? Where does it fail? – mm8 Apr 20 '20 at 14:11
  • @mm8 how can i debug in VS when open from file associate. When i click `run` button on VS, it run throught my code above and pop the message box: `no` – Erics Nguyen Apr 20 '20 at 14:38
  • @EricsNguyen: You can specify the arguments under Project->Properties->Debug->Application Arguments. You should also add logging to your code to be able to determine what actually happens when it fails. – mm8 Apr 20 '20 at 14:43
  • @mm8 thank you, i have set the arguments for it, and when debug, it catch the arguments value. So i think i need to set some log for tracking when i click on file – Erics Nguyen Apr 20 '20 at 14:48
  • @mm8 i add a log to `OnStartup` function, but when i open by (file) log is not written anything. so when open by file, the program seem doesn't trigger for starting by windows OS – Erics Nguyen Apr 20 '20 at 14:54
  • @EricsNguyen: Well, your code cannot do anything until it's actually called, can it? So what is your question? How to associate a file extension with a specific app or what? – mm8 Apr 20 '20 at 14:55
  • How to associate a file extension with a specific app => i associate a file extension by manually: right click on file => click on `open with` => look for another application on this PC => select to /bin/debug/MyApp.exe. So may i wrong with this step? and if it 's right. so the problem is with this step, i click on (file) and my application is not launched. sorry if my thinking is unclear – Erics Nguyen Apr 20 '20 at 15:00
  • 1
    are you sure that when you click on the file the arguments look like you they look? You can [wait for debugger](https://stackoverflow.com/questions/361077/how-to-wait-until-remote-net-debugger-attached) in entry point in your code, then attach to process with Visual Studio to check the parameters. Also, some kind of logging in entry point could be very usefull – Krzysztof Skowronek Apr 20 '20 at 15:13
  • are you sure that when you click on the file the arguments look like you they look?=> i clicked and nothing happened. i added a log on first line of `OnStartup` method. and after clicking, i check the log, and nothing was pushed in. – Erics Nguyen Apr 20 '20 at 15:18
  • If you don't believe the problem is with NSIS and there is no NSIS code in your question, what is the point of the NSIS tag? – Anders Apr 20 '20 at 19:49
  • sorry, my post was edited, and i forgot to remove the this tag – Erics Nguyen Apr 21 '20 at 02:51

1 Answers1

0

i follow @krzysztof skowronek direction, i attach my app process to Visual studio, and debug. the reason it doesn't launch is it got exception that wasn't handled (logged).

Erics Nguyen
  • 370
  • 4
  • 16