Made the language restart actually restart the app.
This commit is contained in:
parent
2c391b8780
commit
50ead93c1e
10 changed files with 279 additions and 39 deletions
|
|
@ -117,15 +117,11 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
Button restartButton;
|
||||
Dictionary<string, string> languageDict;
|
||||
|
||||
private void AddLanguageControls(FlowLayoutWidget controlsTopToBottomLayout)
|
||||
{
|
||||
CreateLanguageDict();
|
||||
|
||||
DisableableWidget container = new DisableableWidget();
|
||||
|
||||
|
||||
GroupBox languageControlsGroupBox = new GroupBox(LocalizedString.Get("Language Settings"));
|
||||
languageControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
languageControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
|
@ -137,22 +133,7 @@ namespace MatterHackers.MatterControl
|
|||
FlowLayoutWidget controlsContainer = new FlowLayoutWidget();
|
||||
controlsContainer.HAnchor = HAnchor.ParentLeftRight;
|
||||
|
||||
string languageCode = UserSettings.Instance.get("Language");
|
||||
string languageVerbose = "Default";
|
||||
|
||||
foreach(KeyValuePair<string, string> entry in languageDict)
|
||||
{
|
||||
if (languageCode == entry.Value)
|
||||
{
|
||||
languageVerbose = entry.Key;
|
||||
}
|
||||
}
|
||||
|
||||
LanguageSelector languageSelector = new LanguageSelector(languageVerbose);
|
||||
foreach (KeyValuePair<string, string> entry in languageDict)
|
||||
{
|
||||
languageSelector.AddItem(entry.Key,entry.Value);
|
||||
}
|
||||
LanguageSelector languageSelector = new LanguageSelector();
|
||||
|
||||
languageSelector.Margin = new BorderDouble(0);
|
||||
languageSelector.SelectionChanged += new EventHandler(LanguageDropList_SelectionChanged);
|
||||
|
|
@ -182,22 +163,17 @@ namespace MatterHackers.MatterControl
|
|||
UiThread.RunOnIdle((state) =>
|
||||
{
|
||||
//horrible hack - to be replaced
|
||||
MatterControlApplication app = (MatterControlApplication)this.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent;
|
||||
GuiWidget parent = this;
|
||||
while (parent as MatterControlApplication == null)
|
||||
{
|
||||
parent = parent.Parent;
|
||||
}
|
||||
MatterControlApplication app = parent as MatterControlApplication;
|
||||
app.RestartOnClose = true;
|
||||
app.Close();
|
||||
});
|
||||
}
|
||||
|
||||
private void CreateLanguageDict()
|
||||
{
|
||||
languageDict = new Dictionary<string, string>();
|
||||
languageDict["Default"] = "EN";
|
||||
languageDict["English"] = "EN";
|
||||
languageDict["Español"] = "ES";
|
||||
languageDict["Français"] = "FR";
|
||||
languageDict["Deutsch"] = "DE";
|
||||
}
|
||||
|
||||
private void LanguageDropList_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
string languageCode = ((DropDownList)sender).SelectedLabel;
|
||||
|
|
|
|||
|
|
@ -10,17 +10,15 @@ using MatterHackers.VectorMath;
|
|||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class LanguageSelector : StyledDropDownList
|
||||
{
|
||||
{
|
||||
Dictionary<string, string> languageDict;
|
||||
|
||||
public LanguageSelector(string selection)
|
||||
: base(selection)
|
||||
public LanguageSelector()
|
||||
: base("Default")
|
||||
{
|
||||
|
||||
|
||||
//string pathToModels = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "PrinterSettings", manufacturer);
|
||||
//if (Directory.Exists(pathToModels))
|
||||
//{
|
||||
|
|
@ -32,7 +30,34 @@ namespace MatterHackers.MatterControl
|
|||
//}
|
||||
|
||||
this.MinimumSize = new Vector2(this.LocalBounds.Width, this.LocalBounds.Height);
|
||||
|
||||
CreateLanguageDict();
|
||||
|
||||
string languageCode = UserSettings.Instance.get("Language");
|
||||
|
||||
foreach (KeyValuePair<string, string> entry in languageDict)
|
||||
{
|
||||
AddItem(entry.Key, entry.Value);
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, string> entry in languageDict)
|
||||
{
|
||||
if (languageCode == entry.Value)
|
||||
{
|
||||
SelectedLabel = entry.Key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateLanguageDict()
|
||||
{
|
||||
languageDict = new Dictionary<string, string>();
|
||||
languageDict["Default"] = "EN";
|
||||
languageDict["English"] = "EN";
|
||||
languageDict["Español"] = "ES";
|
||||
languageDict["Français"] = "FR";
|
||||
languageDict["Deutsch"] = "DE";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
38
Launcher/Launcher.cs
Normal file
38
Launcher/Launcher.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MatterHackers.MatterControl.Launcher
|
||||
{
|
||||
public class LauncherApp
|
||||
{
|
||||
public LauncherApp()
|
||||
{
|
||||
}
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
if (args.Length == 2 && File.Exists(args[0]))
|
||||
{
|
||||
ProcessStartInfo runAppLauncherStartInfo = new ProcessStartInfo();
|
||||
runAppLauncherStartInfo.FileName = args[0];
|
||||
|
||||
int timeToWait = 0;
|
||||
int.TryParse(args[1], out timeToWait);
|
||||
|
||||
Stopwatch waitTime = new Stopwatch();
|
||||
waitTime.Start();
|
||||
while (waitTime.ElapsedMilliseconds < timeToWait)
|
||||
{
|
||||
}
|
||||
|
||||
Process.Start(runAppLauncherStartInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Launcher/Launcher.csproj
Normal file
50
Launcher/Launcher.csproj
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputType>Exe</OutputType>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MatterHackers.MatterControl.Launcher</RootNamespace>
|
||||
<AssemblyName>Launcher</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<ReleaseVersion>0.8.2</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Launcher.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
|
|
@ -316,6 +316,10 @@
|
|||
<Project>{AE37DE1F-22F7-49EE-8732-FC6BC8DC58D9}</Project>
|
||||
<Name>Tesselate</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="Launcher\Launcher.csproj">
|
||||
<Project>{3DF4CB3D-9A03-4256-9A81-70523AAD828B}</Project>
|
||||
<Name>Launcher</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="PrinterDriverInstaller\InfInstaller.csproj">
|
||||
<Project>{990A9AD3-B6A4-407B-9DFC-9C722AF7C9B9}</Project>
|
||||
<Name>InfInstaller</Name>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OutlineCreator", "..\Matter
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterSlice", "..\MatterSlice\MatterSlice.csproj", "{C46CA728-DD2F-4DD1-971A-AAA89D9DFF95}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher\Launcher.csproj", "{3DF4CB3D-9A03-4256-9A81-70523AAD828B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -224,6 +226,12 @@ Global
|
|||
{C46CA728-DD2F-4DD1-971A-AAA89D9DFF95}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C46CA728-DD2F-4DD1-971A-AAA89D9DFF95}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C46CA728-DD2F-4DD1-971A-AAA89D9DFF95}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
|
|
@ -322,6 +322,19 @@ namespace MatterHackers.MatterControl
|
|||
Datastore.Instance.Exit();
|
||||
PrinterCommunication.Instance.HaltConnectionThread();
|
||||
SlicingQueue.Instance.ShutDownSlicingThread();
|
||||
if (RestartOnClose)
|
||||
{
|
||||
string appPathAndFile = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
||||
string pathToAppFolder = Path.GetDirectoryName(appPathAndFile);
|
||||
|
||||
ProcessStartInfo runAppLauncherStartInfo = new ProcessStartInfo();
|
||||
runAppLauncherStartInfo.Arguments = "\"{0}\" \"{1}\"".FormatWith(appPathAndFile, 1000);
|
||||
runAppLauncherStartInfo.FileName = Path.Combine(pathToAppFolder, "Launcher.exe");
|
||||
runAppLauncherStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
runAppLauncherStartInfo.CreateNoWindow = true;
|
||||
|
||||
Process.Start(runAppLauncherStartInfo);
|
||||
}
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1932,3 +1932,6 @@ Translated:You cannot move any lower. This position on your bed is too low for t
|
|||
English:Edit Preset
|
||||
Translated:Edit Preset
|
||||
|
||||
English:Slice-Engine
|
||||
Translated:Slice-Engine
|
||||
|
||||
|
|
|
|||
|
|
@ -1816,3 +1816,123 @@ Translated:MatterContol
|
|||
English:Saving to Parts Sheet
|
||||
Translated:Saving to Parts Sheet
|
||||
|
||||
English:The default temperature to set the bed to. Can sometimes be overriden on the first layer. Set to 0 to eliminate bed temperature commands.
|
||||
Translated:The default temperature to set the bed to. Can sometimes be overriden on the first layer. Set to 0 to eliminate bed temperature commands.
|
||||
|
||||
English:The default temperature to set the extruder to. Can sometimes be overriden on the first layer.
|
||||
Translated:The default temperature to set the extruder to. Can sometimes be overriden on the first layer.
|
||||
|
||||
English:Macro Editor
|
||||
Translated:Macro Editor
|
||||
|
||||
English:Macro Presets
|
||||
Translated:Macro Presets
|
||||
|
||||
English:Edit Macro
|
||||
Translated:Edit Macro
|
||||
|
||||
English:Macro Name
|
||||
Translated:Macro Name
|
||||
|
||||
English:Give your macro a name
|
||||
Translated:Give your macro a name
|
||||
|
||||
English:Macro Commands
|
||||
Translated:Macro Commands
|
||||
|
||||
English:This should be in 'Gcode'
|
||||
Translated:This should be in 'Gcode'
|
||||
|
||||
English:3D Printer Setup
|
||||
Translated:3D Printer Setup
|
||||
|
||||
English:Give your printer a name.
|
||||
Translated:Give your printer a name.
|
||||
|
||||
English:Select Make
|
||||
Translated:Select Make
|
||||
|
||||
English:Select the printer manufacturer
|
||||
Translated:Select the printer manufacturer
|
||||
|
||||
English:Select the printer model
|
||||
Translated:Select the printer model
|
||||
|
||||
English:Save & Continue
|
||||
Translated:Save & Continue
|
||||
|
||||
English:MatterControl will now attempt to auto-detect printer.
|
||||
Translated:MatterControl will now attempt to auto-detect printer.
|
||||
|
||||
English:Disconnect printer
|
||||
Translated:Disconnect printer
|
||||
|
||||
English:if currently connected
|
||||
Translated:if currently connected
|
||||
|
||||
English:Press
|
||||
Translated:Press
|
||||
|
||||
English:Continue
|
||||
Translated:Continue
|
||||
|
||||
English:Manual Configuration
|
||||
Translated:Manual Configuration
|
||||
|
||||
English:Setup Manual Configuration
|
||||
Translated:Setup Manual Configuration
|
||||
|
||||
English:or
|
||||
Translated:or
|
||||
|
||||
English:Skip Printer Connection
|
||||
Translated:Skip Printer Connection
|
||||
|
||||
English:You can either
|
||||
Translated:You can either
|
||||
|
||||
English:You can also
|
||||
Translated:You can also
|
||||
|
||||
English:Extruder Temperature Settings
|
||||
Translated:Extruder Temperature Settings
|
||||
|
||||
English:Temperature Shortcut Presets
|
||||
Translated:Temperature Shortcut Presets
|
||||
|
||||
English:Label
|
||||
Translated:Label
|
||||
|
||||
English:Preset
|
||||
Translated:Preset
|
||||
|
||||
English:Max Temp.
|
||||
Translated:Max Temp.
|
||||
|
||||
English:Bed Temperature Settings
|
||||
Translated:Bed Temperature Settings
|
||||
|
||||
English:Movement Speeds
|
||||
Translated:Movement Speeds
|
||||
|
||||
English:Extruder
|
||||
Translated:Extruder
|
||||
|
||||
English:Power on and connect printer
|
||||
Translated:Power on and connect printer
|
||||
|
||||
English:Attempting to connect
|
||||
Translated:Attempting to connect
|
||||
|
||||
English:Connection succeeded
|
||||
Translated:Connection succeeded
|
||||
|
||||
English:You cannot move any lower. This position on your bed is too low for the extruder to reach. You need to raise your bed, or adjust your limits to allow the extruder to go lower.
|
||||
Translated:You cannot move any lower. This position on your bed is too low for the extruder to reach. You need to raise your bed, or adjust your limits to allow the extruder to go lower.
|
||||
|
||||
English:Edit Preset
|
||||
Translated:Edit Preset
|
||||
|
||||
English:Slice-Engine
|
||||
Translated:Slice-Engine
|
||||
|
||||
|
|
|
|||
|
|
@ -5,4 +5,7 @@ should appear at the bottom of that file.
|
|||
|
||||
There is a folder for each langage. The names of these folders
|
||||
match the ISO 639 standard which can be found at:
|
||||
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||
|
||||
Special thanks to:
|
||||
Filip Bartoszek - original German Translation
|
||||
Loading…
Add table
Add a link
Reference in a new issue