From 8c203b26d50818a1b16b2a7ec48eca7b082653f4 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 18 Feb 2019 11:33:30 +0200 Subject: Implemented new Machine Studio Publish CLI and UI. --- .../Tango.MachineStudio.Publisher.UI/App.config | 86 ++++++++++ .../Tango.MachineStudio.Publisher.UI/App.xaml | 9 ++ .../Tango.MachineStudio.Publisher.UI/App.xaml.cs | 17 ++ .../Images/machine-trans.png | Bin 0 -> 45618 bytes .../Images/update.png | Bin 0 -> 5289 bytes .../MainWindow.xaml | 96 +++++++++++ .../MainWindow.xaml.cs | 35 ++++ .../MainWindowVM.cs | 132 +++++++++++++++ .../Properties/AssemblyInfo.cs | 8 + .../Properties/Resources.Designer.cs | 63 ++++++++ .../Properties/Resources.resx | 117 ++++++++++++++ .../Properties/Settings.Designer.cs | 26 +++ .../Properties/Settings.settings | 7 + .../Tango.MachineStudio.Publisher.UI.csproj | 180 +++++++++++++++++++++ .../packages.config | 5 + 15 files changed, 781 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.config create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Images/machine-trans.png create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Images/update.png create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindowVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Resources.resx create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Settings.settings create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Tango.MachineStudio.Publisher.UI.csproj create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/packages.config (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.config new file mode 100644 index 000000000..6818e3328 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.config @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.xaml new file mode 100644 index 000000000..0b87025f5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.xaml.cs new file mode 100644 index 000000000..c4f6f3810 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/App.xaml.cs @@ -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 Tango.MachineStudio.Publisher.UI +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Images/machine-trans.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Images/machine-trans.png new file mode 100644 index 000000000..a7cf65852 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Images/machine-trans.png differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Images/update.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Images/update.png new file mode 100644 index 000000000..a82777414 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Images/update.png differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml new file mode 100644 index 000000000..a263c76a2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + MACHINE STUDIO + + + + + + + + Remote Version: + + + + Local Version: + + + + + + + + Email: + + + + + Password: + + + + Comments + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml.cs new file mode 100644 index 000000000..d43739188 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Publisher.UI +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + + ContentRendered += MainWindow_ContentRendered; + } + + private void MainWindow_ContentRendered(object sender, EventArgs e) + { + DataContext = new MainWindowVM(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindowVM.cs new file mode 100644 index 000000000..f9f2af693 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindowVM.cs @@ -0,0 +1,132 @@ +using FluentFTP; +using Ionic.Zip; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using System.ServiceModel; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using Tango.Core.Commands; +using Tango.Core.Cryptography; +using Tango.Core.Helpers; +using Tango.Core.IO; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Publish; +using Tango.MachineStudio.Common.Update; +using Tango.Settings; +using Tango.SharedUI; +using Tango.Transport.Web; +using Tango.Web; + +namespace Tango.MachineStudio.Publisher.UI +{ + public class MainWindowVM : ViewModel + { + private MachineStudioPublisher _publisher; + + private PublishOptions _options; + public PublishOptions Options + { + get { return _options; } + set { _options = value; RaisePropertyChangedAuto(); } + } + + private String _localVersion; + public String LocalVersion + { + get { return _localVersion; } + set { _localVersion = value; RaisePropertyChangedAuto(); } + } + + private String _remoteVersion; + public String RemoteVersion + { + get { return _remoteVersion; } + set { _remoteVersion = value; RaisePropertyChangedAuto(); } + } + + private PublishProgressEventArgs _publishArgs; + public PublishProgressEventArgs PublishArgs + { + get { return _publishArgs; } + set { _publishArgs = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand PublishCommand { get; set; } + + public MainWindowVM() + { + PublishCommand = new RelayCommand(Publish, () => Options.Email != null && Options.Password != null && Options.Comments != null && LocalVersion != null && RemoteVersion != null && IsFree); + + Options = new PublishOptions(); + _publisher = new MachineStudioPublisher(Options); + _publisher.PublishProgress += _publisher_PublishProgress; + + Options.BasicInfoChanged += (_, __) => + { + InvalidateRelayCommands(); + }; + Options.EnvironmentChanged += (_, __) => UpdateVersions(); + Options.BuidConfigChanged += (_, __) => UpdateVersions(); + + UpdateVersions(); + } + + private void _publisher_PublishProgress(object sender, PublishProgressEventArgs e) + { + PublishArgs = e; + } + + private async void UpdateVersions() + { + IsFree = false; + LocalVersion = _publisher.GetLocalVersion(); + RemoteVersion = await _publisher.GetRemoteVersion(); + InvalidateRelayCommands(); + IsFree = true; + } + + private async void Publish() + { + if (!ShowQuestion("Did you remember to synchronize production database ?")) + { + return; + } + + try + { + IsFree = false; + await _publisher.Publish(); + ShowInfo("Version published successfully."); + } + catch (Exception ex) + { + ShowError(ex.Message); + } + finally + { + IsFree = true; + } + } + + private void ShowError(String error) + { + MessageBox.Show(error, "Machine Studio Publisher", MessageBoxButton.OK, MessageBoxImage.Error); + } + + private void ShowInfo(String message) + { + MessageBox.Show(message, "Machine Studio Publisher", MessageBoxButton.OK, MessageBoxImage.Information); + } + + private bool ShowQuestion(String message) + { + return MessageBox.Show(message, "Machine Studio Publisher", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..1b316d9aa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/AssemblyInfo.cs @@ -0,0 +1,8 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] +[assembly: AssemblyTitle("Tango - Machine Studio Publish Utility")] +[assembly: AssemblyVersion("2.0.5.1647")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Resources.Designer.cs new file mode 100644 index 000000000..927422b6f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.Publisher.UI.UI.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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("Tango.MachineStudio.Publisher.UI.UI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Settings.Designer.cs new file mode 100644 index 000000000..f75064b02 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.Publisher.UI.UI.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.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 { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Tango.MachineStudio.Publisher.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Tango.MachineStudio.Publisher.UI.csproj new file mode 100644 index 000000000..dad050b31 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/Tango.MachineStudio.Publisher.UI.csproj @@ -0,0 +1,180 @@ + + + + + Debug + AnyCPU + {E711CD86-89C1-432C-9C60-BFF30BBBFB3A} + WinExe + Tango.MachineStudio.Publisher.UI + Tango.MachineStudio.Publisher.UI + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + AnyCPU + true + full + false + ..\..\Build\Machine Studio\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + ..\..\Build\Machine Studio\Debug\ + TRACE + prompt + 4 + + + + ..\..\packages\FluentFTP.19.1.2\lib\net45\FluentFTP.dll + + + ..\..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll + + + + + + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + GlobalVersionInfo.cs + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + + + + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {5001990f-977b-48ff-b217-0236a5022ad8} + Tango.Web + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + + False + Microsoft .NET Framework 4.6 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/packages.config new file mode 100644 index 000000000..83ee077e4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file -- cgit v1.3.1