Aggiungere i file di progetto.

This commit is contained in:
Kalarumeth
2022-03-08 13:34:26 +01:00
parent 9b122d97f4
commit 5ba09cc7c0
9 changed files with 244 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32002.185
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wpf_ax_utility", "wpf_ax_utility\wpf_ax_utility.csproj", "{19D34C84-1A58-42AF-BACB-73E1F3592748}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19D34C84-1A58-42AF-BACB-73E1F3592748}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19D34C84-1A58-42AF-BACB-73E1F3592748}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19D34C84-1A58-42AF-BACB-73E1F3592748}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19D34C84-1A58-42AF-BACB-73E1F3592748}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FD2EC41D-E3AA-4E6B-8AEE-9E2BD696452A}
EndGlobalSection
EndGlobal
+9
View File
@@ -0,0 +1,9 @@
<Application x:Class="wpf_ax_utility.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:wpf_ax_utility"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace wpf_ax_utility
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
+10
View File
@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
+72
View File
@@ -0,0 +1,72 @@
<Window x:Class="wpf_ax_utility.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Height="250" Width="400"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Title="PAL Ax Utility"
Icon="/axlogo.png">
<Window.Resources>
<Style TargetType="Button" x:Key="TabButton">
<Setter Property="Background" Value="White"/>
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
<Style.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="3"/>
</Style>
</Style.Resources>
</Style>
</Window.Resources>
<Grid>
<GroupBox Margin="15,0,15,0"
VerticalAlignment="Top"
BorderBrush="LightGray"
BorderThickness="1"
Header="Ambienti">
<StackPanel Name="LayoutRoot"
VerticalAlignment="Center"
Margin="5,5,5,5">
<Button Style="{StaticResource TabButton}"
x:Name="LIVE"
Click="ButtonClicked"
Height="115" Width="320"
Content="LIVE"
FontSize="36"/>
<DockPanel HorizontalAlignment="Center"
Margin="0,10,0,0">
<Button Style="{StaticResource TabButton}"
x:Name="DEV"
Click="ButtonClicked"
Height="45" Width="100"
Margin="0,0,5,0"
Content="DEV"
FontSize="18"
FontWeight="DemiBold"
Background="Chartreuse"/>
<Button Style="{StaticResource TabButton}"
x:Name="TEST"
Click="ButtonClicked"
Height="45" Width="100"
Margin="5,0,5,0"
Content="TEST"
FontSize="18"
FontWeight="DemiBold"
Background="LightCoral"/>
<Button Style="{StaticResource TabButton}"
x:Name="STAGING"
Click="ButtonClicked"
Height="45" Width="100"
Margin="5,0,0,0"
Content="STAGING"
FontSize="18"
FontWeight="DemiBold"
Background="Yellow"/>
</DockPanel>
</StackPanel>
</GroupBox>
</Grid>
</Window>
+92
View File
@@ -0,0 +1,92 @@
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
namespace wpf_ax_utility
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void ButtonClicked(object sender, RoutedEventArgs e)
{
AucCleaner();
string AxClient = @"C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe";
string AxArguments = string.Empty;
switch (((Button)sender).Name)
{
case "LIVE":
AxArguments = @"-regConfig=L:\Link\PAL_LIVE_02_USR.axc";
break;
case "DEV":
AxArguments = @"-regConfig=L:\Link\PAL_DEVELOP_USR.axc";
break ;
case "TEST":
AxArguments = @"-regConfig=L:\Link\PAL_TEST_USR.axc";
break;
case "STAGING":
AxArguments = @"-regConfig=L:\Link\PAL_STAGING_USR.axc";
break; ;
}
AxExecution(AxClient, AxArguments);
}
public static void AxExecution(string AxClient, string AxArgs)
{
if (System.IO.File.Exists(AxClient))
{
var p = new System.Diagnostics.Process();
p.StartInfo.FileName = AxClient;
p.StartInfo.Arguments = AxArgs;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.Start();
}
else
{
MessageBox.Show("Microsoft Dynamics Ax 2012 non è installato.", "Informazioni PAL Ax Utility", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
public static void AucCleaner()
{
string sourceDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string aucFile = ".auc";
DirectoryInfo directory = new DirectoryInfo(sourceDir);
FileInfo[] files = directory.GetFiles();
bool fileFound = false;
foreach (FileInfo file in files)
{
if (String.Compare(file.Extension, aucFile) == 0)
{
fileFound = true;
}
}
if (!fileFound)
{
MessageBox.Show("Non sono presenti file .AUC",
"Informazioni PAL Ax Utility", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
string[] aucList = Directory.GetFiles(sourceDir, "*.auc");
foreach (string f in aucList)
{
File.Delete(f);
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

+19
View File
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<None Remove="axlogo.png" />
<None Remove="rdrect1197.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="axlogo.png" />
</ItemGroup>
</Project>