Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 6b08374e authored by Harald Martini's avatar Harald Martini
Browse files

Select File in Folder

parent b638f6f0
No related branches found
No related tags found
No related merge requests found
......@@ -219,3 +219,4 @@ Documentation/VehiclesReleaseComparisonDeclarationMode/tmp/
/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/tests.xml
/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/finalGroup41.VIF_Report_4.xml
/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/output
/Vecto3GUI2020Test/TestData/output
......@@ -593,14 +593,14 @@ namespace VECTO3GUI2020.ViewModel.Implementation
{
get
{
return _cancelSimulationCommand ?? new RelayCommand(() => {
return _cancelSimulationCommand ?? (_cancelSimulationCommand = new RelayCommand(() => {
_outputViewModel.AddMessage(new MessageEntry() {
Message="Canceling Simulation",
Type=MessageType.StatusMessage,
});
cancellationTokenSource.Cancel();
},
() => SimulationRunning);
() => SimulationRunning));
}
}
......
......@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Input;
using Microsoft.Toolkit.Mvvm.Input;
......@@ -65,10 +67,12 @@ namespace VECTO3GUI2020.ViewModel
#region Commands
// ReSharper disable once UnusedMember.Global
public ICommand OpenFolderCommand =>
_openFolderCommand ?? (_openFolderCommand = new RelayCommand<string>(
OpenFolderExecute));
// ReSharper disable once UnusedMember.Global
public ICommand OpenFileCommand =>
_openFileCommand ?? (_openFileCommand = new RelayCommand<string>(
OpenFileExecute));
......@@ -79,10 +83,17 @@ namespace VECTO3GUI2020.ViewModel
return;
}
link = Path.GetFullPath(link);
var directoryPath = Path.GetDirectoryName(link);
var explorerCommandStrBuilder = new StringBuilder();
explorerCommandStrBuilder.Append("explorer.exe");
explorerCommandStrBuilder.Append(" /select ");
explorerCommandStrBuilder.Append(link);
StartProcess(directoryPath);
//var directoryPath = Path.GetDirectoryName(link);
//StartProcess(directoryPath);
StartProcess("explorer.exe", ("/select," + link));
}
private void OpenFileExecute(string link){
......@@ -95,11 +106,26 @@ namespace VECTO3GUI2020.ViewModel
}
private void StartProcess(string command)
private void StartProcess(string command, params string[]arguments)
{
string argumentsString = "";
if (arguments != null) {
var argumentsStrBuilder = new StringBuilder();
foreach (var argument in arguments) {
argumentsStrBuilder.Append(argument);
if(argument != arguments.Last()) {
argumentsStrBuilder.Append(" ");
}
}
argumentsString = argumentsStrBuilder.ToString();
Debug.WriteLine(argumentsString);
}
try
{
Process.Start(command);
Process.Start(command, argumentsString );
}
catch (Exception e)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment