Setup project added and tool updated to include an installer and better handling of user settings.
This commit is contained in:
parent
8ec484fc17
commit
6353066423
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30907.101
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Metadata Translator", "Metadata Translator\Metadata Translator.csproj", "{CB7D493C-B67E-4438-B304-EFE5D418ADDF}"
|
||||
EndProject
|
||||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Metadata Translator Setup", "Metadata Translator Setup\Metadata Translator Setup.vdproj", "{FC353DA7-B669-4EDF-B465-CB9827C7F035}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -15,6 +17,8 @@ Global
|
||||
{CB7D493C-B67E-4438-B304-EFE5D418ADDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CB7D493C-B67E-4438-B304-EFE5D418ADDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CB7D493C-B67E-4438-B304-EFE5D418ADDF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FC353DA7-B669-4EDF-B465-CB9827C7F035}.Debug|Any CPU.ActiveCfg = Debug
|
||||
{FC353DA7-B669-4EDF-B465-CB9827C7F035}.Release|Any CPU.ActiveCfg = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,13 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="SubscriptionKey" value="" />
|
||||
<add key="TranslatorEndpoint" value="https://api.cognitive.microsofttranslator.com/" />
|
||||
<add key="TranslatorLocation" value="" />
|
||||
<add key="OverwriteTranslation" value="false" />
|
||||
<add key="LastUsedExportFolder" value="" />
|
||||
</appSettings>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="Metadata_Translator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<Metadata_Translator.Properties.Settings>
|
||||
<setting name="SubscriptionKey" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="TranslatorEndpoint" serializeAs="String">
|
||||
<value>https://api.cognitive.microsofttranslator.com/</value>
|
||||
</setting>
|
||||
<setting name="TranslatorLocation" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="OverwriteTranslation" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="LastUsedExportFolder" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</Metadata_Translator.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
37
MetadataTranslator/Metadata Translator/Installer1.Designer.cs
generated
Normal file
37
MetadataTranslator/Metadata Translator/Installer1.Designer.cs
generated
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
namespace Metadata_Translator
|
||||
{
|
||||
partial class Installer1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
59
MetadataTranslator/Metadata Translator/Installer1.cs
Normal file
59
MetadataTranslator/Metadata Translator/Installer1.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration.Install;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Permissions;
|
||||
using System.Windows;
|
||||
using System.IO;
|
||||
|
||||
namespace Metadata_Translator
|
||||
{
|
||||
[RunInstaller(true)]
|
||||
public partial class Installer1 : System.Configuration.Install.Installer
|
||||
{
|
||||
public Installer1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
[SecurityPermission(SecurityAction.Demand)]
|
||||
public override void Commit(System.Collections.IDictionary savedState)
|
||||
{
|
||||
base.Commit(savedState);
|
||||
MessageBox.Show("Commit");
|
||||
}
|
||||
|
||||
[SecurityPermission(SecurityAction.Demand)]
|
||||
public override void Install(System.Collections.IDictionary stateSaver)
|
||||
{
|
||||
base.Install(stateSaver);
|
||||
|
||||
string exeName = Context.Parameters["assemblypath"];
|
||||
string appDir = Path.GetDirectoryName(exeName);
|
||||
string pbiSharedDir = Environment.ExpandEnvironmentVariables(@"%CommonProgramFiles%\microsoft shared\Power BI Desktop\External Tools\");
|
||||
string pbiToolsJsonTemplate = $"{appDir}\\metadata-translator.pbitool.json";
|
||||
if (File.Exists(pbiToolsJsonTemplate))
|
||||
{
|
||||
string pbiToolsJson = File.ReadAllText(pbiToolsJsonTemplate).Replace("<METADATA_TRANSLATOR_PATH>", exeName.Replace("\\", "\\\\"));
|
||||
File.WriteAllText($"{pbiSharedDir}\\metadata-translator.pbitool.json", pbiToolsJson);
|
||||
}
|
||||
}
|
||||
|
||||
[SecurityPermission(SecurityAction.Demand)]
|
||||
public override void Uninstall(System.Collections.IDictionary savedState)
|
||||
{
|
||||
base.Uninstall(savedState);
|
||||
|
||||
string pbiSharedDir = Environment.ExpandEnvironmentVariables(@"%CommonProgramFiles%\microsoft shared\Power BI Desktop\External Tools\");
|
||||
string pbiToolFile = $"{pbiSharedDir}\\metadata-translator.pbitool.json";
|
||||
if (File.Exists(pbiToolFile))
|
||||
{
|
||||
File.Delete(pbiToolFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,21 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -33,33 +48,42 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>MetadataTranslator.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AnalysisServices, Version=19.16.3.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3\lib\net45\Microsoft.AnalysisServices.dll</HintPath>
|
||||
<Reference Include="Microsoft.AnalysisServices, Version=19.16.3.4, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3.4\lib\net45\Microsoft.AnalysisServices.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AnalysisServices.AdomdClient, Version=19.16.3.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.AdomdClient.retail.amd64.19.16.3\lib\net45\Microsoft.AnalysisServices.AdomdClient.dll</HintPath>
|
||||
<Reference Include="Microsoft.AnalysisServices.AdomdClient, Version=19.16.3.4, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.AdomdClient.retail.amd64.19.16.3.4\lib\net45\Microsoft.AnalysisServices.AdomdClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AnalysisServices.Core, Version=19.16.3.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3\lib\net45\Microsoft.AnalysisServices.Core.dll</HintPath>
|
||||
<Reference Include="Microsoft.AnalysisServices.Core, Version=19.16.3.4, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3.4\lib\net45\Microsoft.AnalysisServices.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AnalysisServices.SPClient.Interfaces, Version=19.16.3.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3\lib\net45\Microsoft.AnalysisServices.SPClient.Interfaces.dll</HintPath>
|
||||
<Reference Include="Microsoft.AnalysisServices.SPClient.Interfaces, Version=19.16.3.4, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3.4\lib\net45\Microsoft.AnalysisServices.SPClient.Interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AnalysisServices.Tabular, Version=19.16.3.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3\lib\net45\Microsoft.AnalysisServices.Tabular.dll</HintPath>
|
||||
<Reference Include="Microsoft.AnalysisServices.Tabular, Version=19.16.3.4, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3.4\lib\net45\Microsoft.AnalysisServices.Tabular.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AnalysisServices.Tabular.Json, Version=19.16.3.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3\lib\net45\Microsoft.AnalysisServices.Tabular.Json.dll</HintPath>
|
||||
<Reference Include="Microsoft.AnalysisServices.Tabular.Json, Version=19.16.3.4, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AnalysisServices.retail.amd64.19.16.3.4\lib\net45\Microsoft.AnalysisServices.Tabular.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
@ -89,6 +113,12 @@
|
||||
<Compile Include="Helpers\Hourglass.cs" />
|
||||
<Compile Include="Helpers\ListExtensions.cs" />
|
||||
<Compile Include="Helpers\ObservableCollectionExtensions.cs" />
|
||||
<Compile Include="Installer1.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Installer1.Designer.cs">
|
||||
<DependentUpon>Installer1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\ImportExportPanel.xaml.cs">
|
||||
<DependentUpon>ImportExportPanel.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -161,7 +191,10 @@
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="metadata-translator.pbitool.json" />
|
||||
<None Include="metadata-translator.pbitool.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="MetadataTranslator.snk" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
@ -175,7 +208,21 @@
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="icon.ico" />
|
||||
<Resource Include="icon.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
BIN
MetadataTranslator/Metadata Translator/MetadataTranslator.snk
Normal file
BIN
MetadataTranslator/Metadata Translator/MetadataTranslator.snk
Normal file
Binary file not shown.
@ -8,9 +8,9 @@ using System.Windows;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Metadata Translator")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyDescription("Metadata Translator can translate the names and descriptions of the metadata objects in your semantic model by using Azure Cognitive Services.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyCompany("Microsoft Corporation")]
|
||||
[assembly: AssemblyProduct("Metadata Translator")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
|
@ -8,22 +8,79 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Metadata_Translator.Properties {
|
||||
|
||||
|
||||
namespace Metadata_Translator.Properties
|
||||
{
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string SubscriptionKey {
|
||||
get {
|
||||
return ((string)(this["SubscriptionKey"]));
|
||||
}
|
||||
set {
|
||||
this["SubscriptionKey"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://api.cognitive.microsofttranslator.com/")]
|
||||
public string TranslatorEndpoint {
|
||||
get {
|
||||
return ((string)(this["TranslatorEndpoint"]));
|
||||
}
|
||||
set {
|
||||
this["TranslatorEndpoint"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string TranslatorLocation {
|
||||
get {
|
||||
return ((string)(this["TranslatorLocation"]));
|
||||
}
|
||||
set {
|
||||
this["TranslatorLocation"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool OverwriteTranslation {
|
||||
get {
|
||||
return ((bool)(this["OverwriteTranslation"]));
|
||||
}
|
||||
set {
|
||||
this["OverwriteTranslation"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string LastUsedExportFolder {
|
||||
get {
|
||||
return ((string)(this["LastUsedExportFolder"]));
|
||||
}
|
||||
set {
|
||||
this["LastUsedExportFolder"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,21 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Metadata_Translator.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="SubscriptionKey" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="TranslatorEndpoint" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">https://api.cognitive.microsofttranslator.com/</Value>
|
||||
</Setting>
|
||||
<Setting Name="TranslatorLocation" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="OverwriteTranslation" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastUsedExportFolder" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
@ -6,7 +6,8 @@
|
||||
xmlns:local="clr-namespace:Metadata_Translator"
|
||||
mc:Ignorable="d"
|
||||
x:Name="main"
|
||||
Title="Metadata Translator" Height="450" Width="800">
|
||||
Title="Metadata Translator" Height="450" Width="800"
|
||||
Closing="OnMainWindow_Closing">
|
||||
<Window.Resources>
|
||||
<local:TrueFalseVisibilityConverter x:Key="TrueFalseVisibilityConverter" />
|
||||
<local:FalseTrueVisibilityConverter x:Key="FalseTrueVisibilityConverter" />
|
||||
|
@ -32,13 +32,10 @@ namespace Metadata_Translator
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
Configuration AppConfig { get; set; }
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AppConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
|
||||
SetDependencyProperty("SubscriptionKey");
|
||||
SetDependencyProperty("TranslatorEndpoint");
|
||||
SetDependencyProperty("TranslatorLocation");
|
||||
@ -102,20 +99,19 @@ namespace Metadata_Translator
|
||||
switch (parameterName)
|
||||
{
|
||||
case "SubscriptionKey":
|
||||
SubscriptionKey = AppConfig.AppSettings.Settings[parameterName].Value;
|
||||
SubscriptionKey = Properties.Settings.Default.SubscriptionKey;
|
||||
break;
|
||||
case "TranslatorEndpoint":
|
||||
TranslatorEndpoint = AppConfig.AppSettings.Settings[parameterName].Value;
|
||||
TranslatorEndpoint = Properties.Settings.Default.TranslatorEndpoint;
|
||||
break;
|
||||
case "TranslatorLocation":
|
||||
TranslatorLocation = AppConfig.AppSettings.Settings[parameterName].Value;
|
||||
TranslatorLocation = Properties.Settings.Default.TranslatorLocation;
|
||||
break;
|
||||
case "OverwriteTranslation":
|
||||
string configSetting = AppConfig.AppSettings.Settings[parameterName].Value;
|
||||
OverwriteTranslation = bool.TryParse(configSetting, out bool value) && value;
|
||||
OverwriteTranslation = Properties.Settings.Default.OverwriteTranslation;
|
||||
break;
|
||||
case "LastUsedExportFolder":
|
||||
LastUsedExportFolder = AppConfig.AppSettings.Settings[parameterName].Value;
|
||||
LastUsedExportFolder = Properties.Settings.Default.LastUsedExportFolder;
|
||||
break;
|
||||
case "Languages":
|
||||
Languages = new ObservableCollection<Language>();
|
||||
@ -245,18 +241,6 @@ namespace Metadata_Translator
|
||||
return GetMainWindow(parentObject);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save app settings to the application config file.
|
||||
/// </summary>
|
||||
/// <param name="settingName"></param>
|
||||
/// <param name="newValue"></param>
|
||||
private void OnAppSettingChanged(string settingName, string newValue)
|
||||
{
|
||||
AppConfig.AppSettings.Settings[settingName].Value = newValue;
|
||||
AppConfig.Save(ConfigurationSaveMode.Modified);
|
||||
ConfigurationManager.RefreshSection("appSettings");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Dependency Properties
|
||||
@ -390,8 +374,7 @@ namespace Metadata_Translator
|
||||
|
||||
private static void OnSubscriptionKeyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
(d as MainWindow)?.OnAppSettingChanged("SubscriptionKey", (string)e.NewValue);
|
||||
|
||||
Properties.Settings.Default.SubscriptionKey = (string)e.NewValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -409,8 +392,7 @@ namespace Metadata_Translator
|
||||
|
||||
private static void OnTranslatorEndpointChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
(d as MainWindow)?.OnAppSettingChanged("TranslatorEndpoint", (string)e.NewValue);
|
||||
|
||||
Properties.Settings.Default.TranslatorEndpoint = (string)e.NewValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -428,8 +410,7 @@ namespace Metadata_Translator
|
||||
|
||||
private static void OnTranslatorLocationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
(d as MainWindow)?.OnAppSettingChanged("TranslatorLocation", (string)e.NewValue);
|
||||
|
||||
Properties.Settings.Default.TranslatorLocation = (string)e.NewValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -447,8 +428,7 @@ namespace Metadata_Translator
|
||||
|
||||
private static void OnOverwriteTranslationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
(d as MainWindow)?.OnAppSettingChanged("OverwriteTranslation", e.NewValue.ToString());
|
||||
|
||||
Properties.Settings.Default.OverwriteTranslation = (bool)e.NewValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -466,8 +446,7 @@ namespace Metadata_Translator
|
||||
|
||||
private static void OnLastUsedExportFolderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
(d as MainWindow)?.OnAppSettingChanged("LastUsedExportFolder", (string)e.NewValue);
|
||||
|
||||
Properties.Settings.Default.LastUsedExportFolder = (string)e.NewValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -633,6 +612,16 @@ namespace Metadata_Translator
|
||||
{
|
||||
DataModel.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves modified user settings.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnMainWindow_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.AnalysisServices.AdomdClient.retail.amd64" version="19.16.3" targetFramework="net472" />
|
||||
<package id="Microsoft.AnalysisServices.retail.amd64" version="19.16.3" targetFramework="net472" />
|
||||
<package id="Microsoft.AnalysisServices.AdomdClient.retail.amd64" version="19.16.3.4" targetFramework="net472" />
|
||||
<package id="Microsoft.AnalysisServices.retail.amd64" version="19.16.3.4" targetFramework="net472" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user