diff --git a/wpf_ax_utility/MainWindow.xaml.cs b/wpf_ax_utility/MainWindow.xaml.cs index 58ee8d5..4852ee4 100644 --- a/wpf_ax_utility/MainWindow.xaml.cs +++ b/wpf_ax_utility/MainWindow.xaml.cs @@ -28,27 +28,40 @@ namespace wpf_ax_utility { Utility.AucCleaner(); - string AxArgs = string.Empty; - + string AxcFilePath = ""; + switch (((Button)sender).Name) { case "LIVE": - AxArgs = @"-regConfig=axc\PAL_LIVE_USR.axc"; + AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.LIVE_axc_filename; + if(!File.Exists(AxcFilePath)) + AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.LIVE_axc_filename; break; case "LIVE02": - AxArgs = @"-regConfig=axc\PAL_LIVE_02_USR.axc"; + AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.LIVE02_axc_filename; + if (!File.Exists(AxcFilePath)) + AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.LIVE02_axc_filename; break; case "DEV": - AxArgs = @"-regConfig=axc\PAL_DEVELOP_USR.axc"; + AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.DEV_axc_filename; + if (!File.Exists(AxcFilePath)) + AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.DEV_axc_filename; break; case "TEST": - AxArgs = @"-regConfig=axc\PAL_TEST_USR.axc"; + AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.TEST_axc_filename; + if (!File.Exists(AxcFilePath)) + AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.TEST_axc_filename; break; case "STAGING": - AxArgs = @"-regConfig=axc\PAL_STAGING_USR.axc"; - break; ; + AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.STAGING_axc_filename; + if (!File.Exists(AxcFilePath)) + AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.STAGING_axc_filename; + break; } + + var AxArgs = @"-regConfig=" + AxcFilePath; + Utility.AxExecution(AxArgs); Log.Logger.Information("Running AX client with this parameter: " + AxArgs); diff --git a/wpf_ax_utility/Properties/Resources.Designer.cs b/wpf_ax_utility/Properties/Resources.Designer.cs new file mode 100644 index 0000000..a73bc7a --- /dev/null +++ b/wpf_ax_utility/Properties/Resources.Designer.cs @@ -0,0 +1,135 @@ +//------------------------------------------------------------------------------ +// +// Il codice è stato generato da uno strumento. +// Versione runtime:4.0.30319.42000 +// +// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace wpf_ax_utility.Properties { + using System; + + + /// + /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. + /// + // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder. + // tramite uno strumento quale ResGen o Visual Studio. + // Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen + // con l'opzione /str oppure ricompilare il progetto VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("wpf_ax_utility.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le + /// ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Cerca una stringa localizzata simile a C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe. + /// + internal static string Ax32_exe_filepath { + get { + return ResourceManager.GetString("Ax32_exe_filepath", resourceCulture); + } + } + + /// + /// Cerca una stringa localizzata simile a PAL_DEVELOP_USR.axc. + /// + internal static string DEV_axc_filename { + get { + return ResourceManager.GetString("DEV_axc_filename", resourceCulture); + } + } + + /// + /// Cerca una stringa localizzata simile a PAL_LIVE_USR.axc. + /// + internal static string LIVE_axc_filename { + get { + return ResourceManager.GetString("LIVE_axc_filename", resourceCulture); + } + } + + /// + /// Cerca una stringa localizzata simile a PAL_LIVE_02_USR.axc. + /// + internal static string LIVE02_axc_filename { + get { + return ResourceManager.GetString("LIVE02_axc_filename", resourceCulture); + } + } + + /// + /// Cerca una stringa localizzata simile a axc\. + /// + internal static string local_axc_path { + get { + return ResourceManager.GetString("local_axc_path", resourceCulture); + } + } + + /// + /// Cerca una stringa localizzata simile a \\palaxaos01\XVOL11\Link\. + /// + internal static string network_axc_path { + get { + return ResourceManager.GetString("network_axc_path", resourceCulture); + } + } + + /// + /// Cerca una stringa localizzata simile a PAL_STAGING_USR.axc. + /// + internal static string STAGING_axc_filename { + get { + return ResourceManager.GetString("STAGING_axc_filename", resourceCulture); + } + } + + /// + /// Cerca una stringa localizzata simile a PAL_TEST_USR.axc. + /// + internal static string TEST_axc_filename { + get { + return ResourceManager.GetString("TEST_axc_filename", resourceCulture); + } + } + } +} diff --git a/wpf_ax_utility/Properties/Resources.resx b/wpf_ax_utility/Properties/Resources.resx new file mode 100644 index 0000000..2b4a0fa --- /dev/null +++ b/wpf_ax_utility/Properties/Resources.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe + + + PAL_DEVELOP_USR.axc + + + PAL_LIVE_02_USR.axc + + + PAL_LIVE_USR.axc + + + axc\ + + + \\palaxaos01\XVOL11\Link\ + + + PAL_STAGING_USR.axc + + + PAL_TEST_USR.axc + + \ No newline at end of file diff --git a/wpf_ax_utility/Utility.cs b/wpf_ax_utility/Utility.cs index aabcd8b..38151bf 100644 --- a/wpf_ax_utility/Utility.cs +++ b/wpf_ax_utility/Utility.cs @@ -20,12 +20,10 @@ namespace wpf_ax_utility { try { - string AxClient = @"C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe"; - - if (System.IO.File.Exists(AxClient)) + if (System.IO.File.Exists(Properties.Resources.Ax32_exe_filepath)) { var p = new System.Diagnostics.Process(); - p.StartInfo.FileName = AxClient; + p.StartInfo.FileName = Properties.Resources.Ax32_exe_filepath; p.StartInfo.Arguments = AxArgs; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; diff --git a/wpf_ax_utility/wpf_ax_utility.csproj b/wpf_ax_utility/wpf_ax_utility.csproj index f3e152c..b14286c 100644 --- a/wpf_ax_utility/wpf_ax_utility.csproj +++ b/wpf_ax_utility/wpf_ax_utility.csproj @@ -35,6 +35,21 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + Always