public MainWindow() { InitializeComponent(); string exeDir = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Directory.SetCurrentDirectory(exeDir); Model = new MainWindowModel(); var args = Environment.GetCommandLineArgs(); if (args.Length >= 2) { if (File.Exists(args[1]) && Path.GetExtension(args[1]).Equals(".tft", StringComparison.InvariantCultureIgnoreCase)) { Model.PickedFile = args[1]; Model.ShowFileList = Visibility.Hidden; } } this.DataContext = Model; }