diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner')
20 files changed, 100 insertions, 1253 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index 69cc75461..d80060831 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -89,20 +89,14 @@ <Compile Include="ViewModels\ColorCalibrationViewVM.cs" /> <Compile Include="ViewModels\HardwareConfigurationViewVM.cs" /> <Compile Include="ViewModels\MachineCreationDialogVM.cs" /> - <Compile Include="ViewModels\MachineUpdateDetailsDialogVM.cs" /> - <Compile Include="ViewModels\MachineUpdatesViewVM.cs" /> <Compile Include="ViewModels\MachineVersionDialogVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> - <Compile Include="ViewModels\TupViewVM.cs" /> <Compile Include="Views\ColorCalibrationView.xaml.cs"> <DependentUpon>ColorCalibrationView.xaml</DependentUpon> </Compile> <Compile Include="Views\HardwareConfigurationView.xaml.cs"> <DependentUpon>HardwareConfigurationView.xaml</DependentUpon> </Compile> - <Compile Include="Views\MachineUpdateDetailsDialog.xaml.cs"> - <DependentUpon>MachineUpdateDetailsDialog.xaml</DependentUpon> - </Compile> <Compile Include="Views\MachineCreationDialog.xaml.cs"> <DependentUpon>MachineCreationDialog.xaml</DependentUpon> </Compile> @@ -128,12 +122,6 @@ <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> - <Compile Include="Views\MachineUpdatesView.xaml.cs"> - <DependentUpon>MachineUpdatesView.xaml</DependentUpon> - </Compile> - <Compile Include="Views\TupView.xaml.cs"> - <DependentUpon>TupView.xaml</DependentUpon> - </Compile> <Compile Include="Views\SpoolsView.xaml.cs"> <DependentUpon>SpoolsView.xaml</DependentUpon> </Compile> @@ -149,10 +137,6 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Views\MachineUpdateDetailsDialog.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> <Page Include="Views\MachineCreationDialog.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -185,14 +169,6 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Views\MachineUpdatesView.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> - <Page Include="Views\TupView.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> <Page Include="Views\SpoolsView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -332,7 +308,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/ColorCalibrationViewVM.cs index d37fe1aaa..b75fe7e03 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/ColorCalibrationViewVM.cs @@ -180,16 +180,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public void Save() { - //Remove cats with deleted RMLS. (Can only happen when creating new machine from prototype) - foreach (var cat in Machine.Cats.ToList()) - { - if (!Rmls.Any(x => x.Guid == cat.RmlGuid)) - { - Machine.Cats.Remove(cat); - _dbContext.Cats.Remove(cat); - } - } - foreach (var calDataVM in ColorConversionViewVM.LiquidsCalibrationData) { var cat = calDataVM.IdsPack.LiquidType.Cats.FirstOrDefault(x => x.Machine == Machine && x.Rml == SelectedRML); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs index e29ba3b6f..f7ae88f68 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs @@ -92,19 +92,16 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { HardwareVersion hardwareVersion = configuration.HardwareVersion; - if (hardwareVersion != null) - { - _hwConfig = configuration.GetHardwareConfiguration(); + _hwConfig = configuration.GetHardwareConfiguration(); - Collections.Clear(); - Collections.Add(CreateMotorsCollection(hardwareVersion)); - Collections.Add(CreateDancerCollection(hardwareVersion)); - Collections.Add(CreatePidCollection(hardwareVersion)); - Collections.Add(CreateWindersCollection(hardwareVersion)); - Collections.Add(CreateSpeedSensorsCollection(hardwareVersion)); - Collections.Add(CreateBlowersCollection(hardwareVersion)); - Collections.Add(CreateBreakSensorCollection(hardwareVersion)); - } + Collections.Clear(); + Collections.Add(CreateMotorsCollection(hardwareVersion)); + Collections.Add(CreateDancerCollection(hardwareVersion)); + Collections.Add(CreatePidCollection(hardwareVersion)); + Collections.Add(CreateWindersCollection(hardwareVersion)); + Collections.Add(CreateSpeedSensorsCollection(hardwareVersion)); + Collections.Add(CreateBlowersCollection(hardwareVersion)); + Collections.Add(CreateBreakSensorCollection(hardwareVersion)); } private HardwareCollection CreateMotorsCollection(HardwareVersion hardwareVersion) @@ -127,7 +124,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels collection.Components.Add(componentResult); } } - collection.Components = collection.Components.OrderByAlphaNumeric(x => x.Description).ToSynchronizedObservableCollection(); return collection; } private HardwareCollection CreateDancerCollection(HardwareVersion hardwareVersion) @@ -150,7 +146,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels collection.Components.Add(componentResult); } } - collection.Components = collection.Components.OrderByAlphaNumeric(x => x.Description).ToSynchronizedObservableCollection(); return collection; } private HardwareCollection CreatePidCollection(HardwareVersion hardwareVersion) @@ -173,7 +168,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels collection.Components.Add(componentResult); } } - collection.Components = collection.Components.OrderByAlphaNumeric(x => x.Description).ToSynchronizedObservableCollection(); return collection; } private HardwareCollection CreateWindersCollection(HardwareVersion hardwareVersion) @@ -196,7 +190,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels collection.Components.Add(componentResult); } } - collection.Components = collection.Components.OrderByAlphaNumeric(x => x.Description).ToSynchronizedObservableCollection(); return collection; } private HardwareCollection CreateSpeedSensorsCollection(HardwareVersion hardwareVersion) @@ -219,7 +212,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels collection.Components.Add(componentResult); } } - collection.Components = collection.Components.OrderByAlphaNumeric(x => x.Description).ToSynchronizedObservableCollection(); return collection; } private HardwareCollection CreateBlowersCollection(HardwareVersion hardwareVersion) @@ -242,7 +234,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels collection.Components.Add(componentResult); } } - collection.Components= collection.Components.OrderByAlphaNumeric(x => x.Description).ToSynchronizedObservableCollection(); return collection; } private HardwareCollection CreateBreakSensorCollection(HardwareVersion hardwareVersion) @@ -265,7 +256,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels collection.Components.Add(componentResult); } } - collection.Components = collection.Components.OrderByAlphaNumeric(x => x.Description).ToSynchronizedObservableCollection(); return collection; } private HardwareComponent CreateComponent(String name, String description, List<PropertyInfo> properties, Object component) @@ -275,7 +265,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels Description = description, ComponentName = name }; - + foreach (var prop in properties) { var hProp = new HardwareParameter(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs index 4584d3508..0f6ab3314 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs @@ -13,50 +13,5 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public List<MachineVersion> MachineVersions { get; set; } public MachineVersion SelectedMachineVersion { get; set; } - - private bool _isNewMachine; - public bool IsNewMachine - { - get { return _isNewMachine; } - set { _isNewMachine = value; RaisePropertyChangedAuto(); } - } - - private String _serialNumber; - public String SerialNumber - { - get { return _serialNumber; } - set { _serialNumber = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } - } - - private String _name; - public String Name - { - get { return _name; } - set { _name = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } - } - - private bool _generateDispensers; - public bool GenerateDispensers - { - get { return _generateDispensers; } - set { _generateDispensers = value; RaisePropertyChangedAuto(); } - } - - private double _dispenserFactor; - public double DispenserFactor - { - get { return _dispenserFactor; } - set { _dispenserFactor = value; RaisePropertyChangedAuto(); } - } - - public MachineCreationDialogVM() : base() - { - DispenserFactor = 2.34; - } - - protected override bool CanOK() - { - return base.CanOK() && !String.IsNullOrWhiteSpace(SerialNumber) && !String.IsNullOrWhiteSpace(Name); - } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdateDetailsDialogVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdateDetailsDialogVM.cs deleted file mode 100644 index 49d410cdf..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdateDetailsDialogVM.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL.Entities; -using Tango.SharedUI; - -namespace Tango.MachineStudio.MachineDesigner.ViewModels -{ - public class MachineUpdateDetailsDialogVM : DialogViewVM - { - private TangoUpdate _update; - public TangoUpdate Update - { - get { return _update; } - set { _update = value; RaisePropertyChangedAuto(); } - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs deleted file mode 100644 index 6004dbe6e..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs +++ /dev/null @@ -1,198 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Data; -using Tango.BL; -using Tango.BL.Builders; -using Tango.BL.Entities; -using Tango.Core.Commands; -using Tango.MachineStudio.Common.Notifications; -using Tango.MachineStudio.MachineDesigner.Views; -using Tango.SharedUI; - -namespace Tango.MachineStudio.MachineDesigner.ViewModels -{ - public class MachineUpdatesViewVM : ViewModel - { - private INotificationProvider _notification; - private ObservablesContext _context; - private const int MAX_UPDATE_ITEMS = 200; - - #region Properties - - private Machine _machine; - public Machine Machine - { - get { return _machine; } - set { _machine = value; RaisePropertyChangedAuto(); } - } - - private List<TangoUpdate> _updates; - public List<TangoUpdate> Updates - { - get { return _updates; } - set { _updates = value; RaisePropertyChangedAuto(); } - } - - private ICollectionView _updatesView; - public ICollectionView UpdatesView - { - get { return _updatesView; } - set { _updatesView = value; RaisePropertyChangedAuto(); } - } - - - private TangoUpdate _selectedUpdate; - public TangoUpdate SelectedUpdate - { - get { return _selectedUpdate; } - set { _selectedUpdate = value; RaisePropertyChangedAuto(); OnSelectedUpdateChanged(); } - } - - private bool _displayMachineSetups; - public bool DisplayMachineSetups - { - get { return _displayMachineSetups; } - set { _displayMachineSetups = value; RaisePropertyChangedAuto(); OnFilterChanged(); } - } - - private bool _displayApplicationUpdates; - public bool DisplayApplicationUpdates - { - get { return _displayApplicationUpdates; } - set { _displayApplicationUpdates = value; RaisePropertyChangedAuto(); OnFilterChanged(); } - } - - private bool _displayDatabaseUpdates; - public bool DisplayDatabaseUpdates - { - get { return _displayDatabaseUpdates; } - set { _displayDatabaseUpdates = value; RaisePropertyChangedAuto(); OnFilterChanged(); } - } - - private bool _displaySynchronizations; - public bool DisplaySynchronizations - { - get { return _displaySynchronizations; } - set { _displaySynchronizations = value; RaisePropertyChangedAuto(); OnFilterChanged(); } - } - - private bool _displayOfflineUpdates; - public bool DisplayOfflineUpdates - { - get { return _displayOfflineUpdates; } - set { _displayOfflineUpdates = value; RaisePropertyChangedAuto(); OnFilterChanged(); } - } - - private bool _displayFirmwareUpgrades; - public bool DisplayFirmwareUpgrades - { - get { return _displayFirmwareUpgrades; } - set { _displayFirmwareUpgrades = value; RaisePropertyChangedAuto(); OnFilterChanged(); } - } - - #endregion - - #region Commands - - public RelayCommand RefreshCommand { get; set; } - - #endregion - - #region Constructors - - public MachineUpdatesViewVM() - { - DisplayApplicationUpdates = true; - DisplayMachineSetups = true; - DisplayDatabaseUpdates = true; - DisplaySynchronizations = true; - DisplayOfflineUpdates = true; - DisplayFirmwareUpgrades = true; - - RefreshCommand = new RelayCommand(Refresh, () => IsFree); - } - - public MachineUpdatesViewVM(INotificationProvider notificationProvider) : this() - { - _notification = notificationProvider; - } - - #endregion - - #region Public Methods - - public async Task Init(Machine machine, ObservablesContext context) - { - try - { - _context = context; - Machine = machine; - Updates = (await new TangoUpdatesCollectionBuilder(context).Set(x => x.MachineGuid == machine.Guid).Query(x => x.OrderByDescending(y => y.StartDate).Take(MAX_UPDATE_ITEMS)).BuildAsync()).ToList(); - UpdatesView = CollectionViewSource.GetDefaultView(Updates); - UpdatesView.Filter = UpdatesFilter; - OnFilterChanged(); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error loading machine updates."); - _notification.ShowError($"An error occurred while loading the history of machine updates.\n{ex.FlattenMessage()}"); - } - } - - #endregion - - #region Private Methods - - private async void Refresh() - { - IsFree = false; - using (_notification.PushTaskItem("Refreshing machine updates...")) - { - await Init(Machine, _context); - } - IsFree = true; - } - - private void OnFilterChanged() - { - if (UpdatesView != null) - { - UpdatesView.Refresh(); - } - } - - private bool UpdatesFilter(object obj) - { - TangoUpdate update = obj as TangoUpdate; - if (update != null) - { - if (!DisplayMachineSetups && update.IsSetup) return false; - if (!DisplayApplicationUpdates && update.IsUpdate) return false; - if (!DisplayDatabaseUpdates && update.IsDataBase) return false; - if (!DisplaySynchronizations && update.IsSynchronization) return false; - if (!DisplayOfflineUpdates && update.IsOfflineUpdate) return false; - if (!DisplayFirmwareUpgrades && update.IsOfflineFirmwareUpgrade) return false; - return true; - } - else - { - return false; - } - } - - private void OnSelectedUpdateChanged() - { - if (SelectedUpdate != null && SelectedUpdate.ApplicationVersion != "Fake") - { - _notification.ShowModalDialog<MachineUpdateDetailsDialogVM, MachineUpdateDetailsDialog>(new MachineUpdateDetailsDialogVM() { Update = SelectedUpdate }, (vm) => { }, () => { }); - SelectedUpdate = new TangoUpdate() { ApplicationVersion = "Fake"}; - } - } - - #endregion - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 0f439c83d..5f2dcd00d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -25,32 +25,17 @@ using Tango.Core.Threading; using Tango.MachineStudio.RML.ViewModels; using Tango.Settings; using Tango.MachineStudio.RML.Models; -using Tango.BL.ActionLogs; -using Tango.MachineStudio.Common.Authentication; -using Tango.BL.DTO; -using Tango.Core.Cryptography; namespace Tango.MachineStudio.MachineDesigner.ViewModels { public class MainViewVM : StudioViewModel<IMainView> { private INotificationProvider _notification; - private IActionLogManager _actionLogManager; - private IAuthenticationProvider _authentication; private ActionTimer _machines_action_timer; private ActionTimer _dispensers_action_timer; - private MachineDTO _machineBeforeSave; - private List<Site> _all_sites; #region Properties - private bool _isNewMachine; - public bool IsNewMachine - { - get { return _isNewMachine; } - set { _isNewMachine = value; RaisePropertyChangedAuto(); } - } - private ObservablesStaticCollections _machinesAdapter; public ObservablesStaticCollections MachinesAdapter { @@ -130,21 +115,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels set { _selectedSpool = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } - private Site _selectedSite; - public Site SelectedSite - { - get { return _selectedSite; } - set { _selectedSite = value; RaisePropertyChangedAuto(); } - } - - private List<Site> _sites; - public List<Site> Sites - { - get { return _sites; } - set { _sites = value; RaisePropertyChangedAuto(); } - } - - private ColorCalibrationViewVM _colorCalibrationViewVM; public ColorCalibrationViewVM ColorCalibrationViewVM { @@ -153,6 +123,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } private HardwareConfigurationViewVM _hardwareConfigurationViewVM; + public HardwareConfigurationViewVM HardwareConfigurationViewVM { get { return _hardwareConfigurationViewVM; } @@ -163,19 +134,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } } - private MachineUpdatesViewVM _machineUpdatesViewVM; - public MachineUpdatesViewVM MachineUpdatesViewVM - { - get { return _machineUpdatesViewVM; } - set { _machineUpdatesViewVM = value; RaisePropertyChangedAuto(); } - } - - private TupViewVM _tupViewVM; - public TupViewVM TupViewVM - { - get { return _tupViewVM; } - set { _tupViewVM = value; RaisePropertyChangedAuto(); } - } #endregion @@ -230,17 +188,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// Gets or sets the clone machine command. /// </summary> public RelayCommand CloneMachineCommand { get; set; } - - /// <summary> - /// Gets or sets the reset device registration command. - /// </summary> - public RelayCommand ResetDeviceRegistrationCommand { get; set; } - - /// <summary> - /// Gets or sets the make prototype command. - /// </summary> - public RelayCommand MakePrototypeCommand { get; set; } - #endregion #region Constructors @@ -253,12 +200,10 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <summary> /// Initializes a new instance of the <see cref="MainViewVM"/> class. /// </summary> - public MainViewVM(INotificationProvider notification, IAuthenticationProvider authentication, IActionLogManager actionLogManager) + public MainViewVM(INotificationProvider notification) { MachinesAdapter = new ObservablesStaticCollections(ObservablesContext.CreateDefault()); _notification = notification; - _authentication = authentication; - _actionLogManager = actionLogManager; _machines_action_timer = new ActionTimer(TimeSpan.FromMilliseconds(200)); _dispensers_action_timer = new ActionTimer(TimeSpan.FromMilliseconds(200)); @@ -273,13 +218,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels AddSpoolCommand = new RelayCommand(AddNewSpool); RemoveSpoolCommand = new RelayCommand(RemoveSpool, () => SelectedSpool != null); CloneMachineCommand = new RelayCommand(CloneMachine, () => SelectedMachine != null); - ResetDeviceRegistrationCommand = new RelayCommand(ResetDeviceRegistration); - MakePrototypeCommand = new RelayCommand(MakePrototype); - - MachineUpdatesViewVM = new MachineUpdatesViewVM(_notification); - TupViewVM = new TupViewVM(_notification); } - #endregion #region Application Ready @@ -300,7 +239,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { Task.Factory.StartNew(() => { - ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection(); + ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).ToSynchronizedObservableCollection(); }); }); } @@ -449,10 +388,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels InvalidateRelayCommands(); } - private async void LoadSelectedMachine(bool newMachine = false, bool clone = false, MachineCreationDialogVM machineCreationDialogVM = null) + private async void LoadSelectedMachine(bool newMachine = false, bool clone = false, MachineVersion selectedVersion = null) { - IsNewMachine = false; - using (_notification.PushTaskItem("Loading machine details...")) { try @@ -476,7 +413,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachineAdapter.ApplicationOsVersions = (await ActiveMachineAdapter.Context.ApplicationOsVersions.ToListAsync()).ToObservableCollection(); ActiveMachineAdapter.EmbeddedFirmwareVersions = (await ActiveMachineAdapter.Context.EmbeddedFirmwareVersions.ToListAsync()).ToObservableCollection(); ActiveMachineAdapter.DispenserTypes = (await ActiveMachineAdapter.Context.DispenserTypes.ToListAsync()).ToObservableCollection(); - ActiveMachineAdapter.LiquidTypes = (await ActiveMachineAdapter.Context.LiquidTypes.ToListAsync()).OrderBy(x => x.PreferredIndex).ToObservableCollection(); + ActiveMachineAdapter.LiquidTypes = (await ActiveMachineAdapter.Context.LiquidTypes.ToListAsync()).ToObservableCollection(); ActiveMachineAdapter.MidTankTypes = (await ActiveMachineAdapter.Context.MidTankTypes.ToListAsync()).ToObservableCollection(); ActiveMachineAdapter.CartridgeTypes = (await ActiveMachineAdapter.Context.CartridgeTypes.ToListAsync()).ToObservableCollection(); ActiveMachineAdapter.IdsPackFormulas = (await ActiveMachineAdapter.Context.IdsPackFormulas.ToListAsync()).ToObservableCollection(); @@ -484,144 +421,32 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachineAdapter.MachineVersions = (await ActiveMachineAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection(); ActiveMachineAdapter.Organizations = (await ActiveMachineAdapter.Context.Organizations.ToListAsync()).ToObservableCollection(); - bool initHwConfig = true; - - Configuration machineConfigBeforeClone = null; - if (!newMachine) { ActiveMachine = (await new MachineBuilder(ActiveMachineAdapter.Context).Set(SelectedMachine.Guid).WithOrganization().WithConfiguration().WithSpools().BuildAsync()); - _machineBeforeSave = MachineDTO.FromObservable(ActiveMachine); - if (clone) { - machineConfigBeforeClone = ActiveMachine.Configuration; - - IsNewMachine = true; ActiveMachine = ActiveMachine.Clone(); - ActiveMachine.Name = machineCreationDialogVM.Name; - ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber; - ActiveMachine.IsDeviceRegistered = false; - ActiveMachine.DeviceId = null; - ActiveMachine.DeviceName = null; - ActiveMachine.ActivationKey = null; + ActiveMachine.Name = ""; + ActiveMachine.SerialNumber = ""; ActiveMachineAdapter.Context.Machines.Add(ActiveMachine); } } else { - IsNewMachine = true; - - if (machineCreationDialogVM.SelectedMachineVersion == null) + if (selectedVersion == null) { ActiveMachine = new Machine(); ActiveMachine.Configuration = new Configuration(); - ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber; - ActiveMachine.Name = machineCreationDialogVM.Name; ActiveMachineAdapter.Context.Machines.Add(ActiveMachine); } else { - try - { - initHwConfig = false; - ActiveMachine = await machineCreationDialogVM.SelectedMachineVersion.CreatePrototypeMachine(ActiveMachineAdapter.Context); - ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber; - ActiveMachine.Name = machineCreationDialogVM.Name; - ActiveMachineAdapter.Context.Machines.Add(ActiveMachine); - - HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification); - var version = await new HardwareVersionBuilder(ActiveMachineAdapter.Context).Set(ActiveMachine.Configuration.HardwareVersionGuid).WithHardwareComponents().BuildAsync(); - HardwareConfigurationViewVM.Init(ActiveMachine.Configuration); - } - catch (Exception ex) - { - _notification.ShowError($"Invalid machine version prototype.\n{ex.FlattenMessage()}"); - View.NavigateTo(MachineDesignerNavigationView.MachinesView); - return; - } - } - } - - if ((newMachine || clone) && machineCreationDialogVM.GenerateDispensers) - { - for (int i = 0; i < 8; i++) - { - var serial = machineCreationDialogVM.SerialNumber + "-" + (i + 1); - - var existingDispenser = await ActiveMachineAdapter.Context.Dispensers.Include(x => x.IdsPacks).SingleOrDefaultAsync(x => x.SerialNumber == serial); - - if (existingDispenser != null) - { - if (existingDispenser.IsInstalled) - { - _notification.ShowError($"Dispenser '{serial}' already exists. Cannot create machine."); - return; - } - else - { - if (!_notification.ShowErrorQuestion($"Dispenser '{serial}' already exists and is not installed. Do you wish to assign the existing dispenser to this machine?")) - { - return; - } - } - } - - Dispenser dispenser = new Dispenser(); - - if (existingDispenser == null) - { - dispenser.SerialNumber = serial; - - if (newMachine) - { - dispenser.NlPerPulse = machineCreationDialogVM.DispenserFactor; - dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.First().Guid; - } - else - { - var packBefore = machineConfigBeforeClone.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i); - - if (packBefore != null) - { - dispenser.NlPerPulse = packBefore.Dispenser.NlPerPulse; - dispenser.DispenserTypeGuid = packBefore.Dispenser.DispenserType.Guid; - } - else - { - continue; - } - } - - dispenser.ProductionDate = DateTime.UtcNow; - - ActiveMachineAdapter.Context.Dispensers.Add(dispenser); - } - else - { - dispenser = existingDispenser; - } - - var idsPack = ActiveMachine.Configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i); - - if (idsPack != null) - { - idsPack.Dispenser = dispenser; - idsPack.DispenserGuid = dispenser.Guid; - } + ActiveMachine = selectedVersion.CreatePrototypeMachine(ActiveMachineAdapter.Context); + ActiveMachineAdapter.Context.Machines.Add(ActiveMachine); } } - ActiveMachine.OrganizationChanged -= ActiveMachine_OrganizationChanged; - ActiveMachine.OrganizationChanged += ActiveMachine_OrganizationChanged; - - _all_sites = await ActiveMachineAdapter.Context.Sites.ToListAsync(); - - var sites = ActiveMachine.Organization != null ? _all_sites.Where(x => x.OrganizationGuid == ActiveMachine.OrganizationGuid).ToList() : new List<Site>(); - sites.Insert(0, new Site() { Name = "NONE", ID = -1 }); - Sites = sites; - - SelectedSite = Sites.SingleOrDefault(x => x.Guid == ActiveMachine.SiteGuid); ColorCalibrationViewVM = new ColorCalibrationViewVM(_notification, ActiveMachine, _activeMachineAdapter.Context) { @@ -630,31 +455,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels SelectedRML = ActiveMachineAdapter.Rmls.FirstOrDefault(), }; - if (initHwConfig) - { - HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification); - HardwareConfigurationViewVM.Init(ActiveMachine.Configuration); - } - - if (!IsNewMachine) - { - await MachineUpdatesViewVM.Init(ActiveMachine, ActiveMachineAdapter.Context); - TupViewVM.Init(ActiveMachine); - } + HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification); + HardwareConfigurationViewVM.Init(ActiveMachine.Configuration); ActiveMachine.Configuration.HardwareVersionChanged += Configuration_HardwareVersionChanged; - while (ActiveMachine.ActivationKey == null) //Generate a random password and make sure no machine matches it. - { - ActiveMachine.ActivationKey = PasswordGenerator.Generate(8, PasswordGenerator.PasswordType.Alpha, PasswordGenerator.PasswordCasing.Upper); - if (await ActiveMachineAdapter.Context.Machines.Where(x => x.ActivationKey == ActiveMachine.ActivationKey).CountAsync() == 0) - { - break; - } - - ActiveMachine.ActivationKey = null; - } - View.NavigateTo(MachineDesignerNavigationView.MachineDetailsView); } catch (Exception ex) @@ -680,11 +485,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { try { - if (HardwareConfigurationViewVM == null) - { - HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification); - } - version = await new HardwareVersionBuilder(ActiveMachineAdapter.Context).Set(version.Guid).WithHardwareComponents().BuildAsync(); HardwareConfigurationViewVM.Init(ActiveMachine.Configuration); } @@ -820,24 +620,14 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachine.ConfigurationGuid = ActiveMachine.Configuration.Guid; ActiveMachine.LastUpdated = DateTime.UtcNow; - ActiveMachine.SiteGuid = SelectedSite == null ? null : (SelectedSite.ID == -1 ? null : SelectedSite.Guid); + ActiveMachine.ProductionDate = DateTime.UtcNow; ColorCalibrationViewVM.Save(); var hwConfig = HardwareConfigurationViewVM.GetResultingHardwareConfiguration(); ActiveMachine.Configuration.SetHardwareConfiguration(hwConfig); - await ActiveMachineAdapter.Context.SaveChangesAsync(); - if (IsNewMachine) - { - _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineCreated, _authentication.CurrentUser, ActiveMachine.Name, ActiveMachine, "New machine created using Machine Studio."); - } - else - { - var machineAfterDTO = MachineDTO.FromObservable(ActiveMachine); - _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineSaved, _authentication.CurrentUser, _machineBeforeSave.Name, _machineBeforeSave, machineAfterDTO, "Machine saved using Machine Studio."); - _machineBeforeSave = machineAfterDTO; - } + await ActiveMachineAdapter.Context.SaveChangesAsync(); if (SelectedMachine != null) { @@ -862,23 +652,16 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels private void AddNewMachine() { MachineCreationDialogVM vm = new MachineCreationDialogVM(); - vm.IsNewMachine = true; vm.MachineVersions = MachinesAdapter.MachineVersions.ToList(); _notification.ShowModalDialog<MachineCreationDialogVM, Views.MachineCreationDialog>(vm, (x) => { - if (MachinesAdapter.Context.Machines.Any(y => y.SerialNumber == vm.SerialNumber || y.Name.ToLower() == vm.Name.ToLower())) - { - _notification.ShowError("Machine serial number or name already exists."); - return; - } - if (vm.SelectedMachineVersion != null && String.IsNullOrWhiteSpace(vm.SelectedMachineVersion.PrototypeMachineData)) { _notification.ShowError("The selected version does not contain any prototype machine data."); return; } - LoadSelectedMachine(true, false, vm); + LoadSelectedMachine(true, false, vm.SelectedMachineVersion); }, () => { }); } @@ -892,9 +675,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { IsFree = false; await SelectedMachine.DeleteCascadeAsync(MachinesAdapter.Context); - _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineDeleted, _authentication.CurrentUser, SelectedMachine.Name, SelectedMachine, "Machine deleted using Machine Studio."); MachinesAdapter.Context.Machines.Remove(SelectedMachine); - MachinesAdapter.Machines.Remove(SelectedMachine); } catch (Exception ex) { @@ -909,68 +690,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } } - private void ResetDeviceRegistration() - { - if (_notification.ShowQuestion("Are you sure you wish to reset this machine device registration?")) - { - ActiveMachine.IsDeviceRegistered = false; - ActiveMachine.DeviceId = null; - ActiveMachine.DeviceName = null; - } - } - - private async void MakePrototype() - { - if (ActiveMachine.MachineVersion == null) - { - _notification.ShowError("Machine version must be selected in order to make a prototype."); - return; - } - - if (_notification.ShowQuestion($"Are you sure you wish to make this machine configuration as a prototype for version '{ActiveMachine.MachineVersion.Name}' ?")) - { - using (_notification.PushTaskItem($"Making prototype machine for '{ActiveMachine.MachineVersion.Name}'...")) - { - try - { - IsFree = false; - - using (var db = ObservablesContext.CreateDefault()) - { - var machineVersion = await db.MachineVersions.SingleOrDefaultAsync(x => x.Guid == ActiveMachine.MachineVersionGuid); - await machineVersion.ApplyPrototypeMachine(ActiveMachine, db); - await db.SaveChangesAsync(); - } - } - catch (Exception ex) - { - _notification.ShowError($"Error making machine version prototype\n{ex.FlattenMessage()}"); - } - finally - { - IsFree = true; - } - } - } - } - #endregion private void CloneMachine() { - MachineCreationDialogVM vm = new MachineCreationDialogVM(); - vm.IsNewMachine = false; - vm.MachineVersions = MachinesAdapter.MachineVersions.ToList(); - _notification.ShowModalDialog<MachineCreationDialogVM, Views.MachineCreationDialog>(vm, (x) => - { - if (MachinesAdapter.Context.Machines.Any(y => y.SerialNumber == vm.SerialNumber || y.Name.ToLower() == vm.Name.ToLower())) - { - _notification.ShowError("Machine serial number or name already exists."); - return; - } - - LoadSelectedMachine(false, true, vm); - }, () => { }); + LoadSelectedMachine(false, true); } private void AddNewSpool() @@ -1001,7 +725,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels try { IsFree = false; - MachinesAdapter.Machines = MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection(); + MachinesAdapter.Machines = MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).ToSynchronizedObservableCollection(); } catch { @@ -1015,14 +739,5 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels }); } } - - private void ActiveMachine_OrganizationChanged(object sender, Organization e) - { - var sites = ActiveMachine.Organization != null ? _all_sites.Where(x => x.OrganizationGuid == ActiveMachine.OrganizationGuid).ToList() : new List<Site>(); - sites.Insert(0, new Site() { Name = "NONE", ID = -1 }); - Sites = sites; - - SelectedSite = Sites.SingleOrDefault(x => x.Guid == ActiveMachine.SiteGuid); - } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/TupViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/TupViewVM.cs deleted file mode 100644 index 5d1703dc3..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/TupViewVM.cs +++ /dev/null @@ -1,129 +0,0 @@ -using Microsoft.Win32; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL.Entities; -using Tango.Core.Commands; -using Tango.MachineStudio.Common.Notifications; -using Tango.MachineStudio.Common.Tup; -using Tango.SharedUI; - -namespace Tango.MachineStudio.MachineDesigner.ViewModels -{ - public class TupViewVM : ViewModel - { - private INotificationProvider _notification; - - private String _latestVersion; - public String LatestVersion - { - get { return _latestVersion; } - set { _latestVersion = value; RaisePropertyChangedAuto(); } - } - - private Machine _machine; - public Machine Machine - { - get { return _machine; } - set { _machine = value; RaisePropertyChangedAuto(); } - } - - private String _filePath; - public String FilePath - { - get { return _filePath; } - set { _filePath = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } - } - - private TupFileBuilderProgressEventArgs _progress; - public TupFileBuilderProgressEventArgs Progress - { - get { return _progress; } - set { _progress = value; RaisePropertyChangedAuto(); } - } - - public RelayCommand CreateTupFileCommand { get; set; } - - public RelayCommand SelectFileCommand { get; set; } - - public TupViewVM() - { - - } - - public TupViewVM(INotificationProvider notification) : this() - { - _notification = notification; - CreateTupFileCommand = new RelayCommand(CreateTupFile, () => FilePath != null && IsFree); - SelectFileCommand = new RelayCommand(SelectFile); - } - - public void Init(Machine machine) - { - Machine = machine; - DisplayLatestPPCVersion(); - } - - private async void DisplayLatestPPCVersion() - { - TupFileBuilder builder = new TupFileBuilder(); - - try - { - LatestVersion = await builder.GetLatestPPCVersion(Machine.SerialNumber); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error retrieving latest PPC version."); - await Task.Delay(5000); - DisplayLatestPPCVersion(); - } - } - - private void SelectFile() - { - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Title = "Select package location"; - dlg.Filter = "Tango Update Package Files|*.tup"; - dlg.DefaultExt = ".tup"; - dlg.FileName = LatestVersion == null ? $"{Machine.SerialNumber}_Update_{DateTime.Now.Date.ToFileName()}.tup" : $"{Machine.SerialNumber}_Update_{DateTime.Now.Date.ToFileName()}_v{LatestVersion}.tup"; - - if (dlg.ShowDialog().Value) - { - FilePath = dlg.FileName; - } - } - - private async void CreateTupFile() - { - try - { - LogManager.Log($"Generating TUP file to '{FilePath}'..."); - - IsFree = false; - TupFileBuilder builder = new TupFileBuilder(); - builder.Progress += Builder_Progress; - await builder.Build(Machine.SerialNumber, FilePath); - - LogManager.Log("TUP file generated successfully."); - _notification.ShowInfo("Tango update package created successfuly."); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error generating tup file."); - _notification.ShowError($"An error occurred while generating the .tup file.\n{ex.FlattenMessage()}"); - } - finally - { - IsFree = true; - } - } - - private void Builder_Progress(object sender, TupFileBuilderProgressEventArgs e) - { - Progress = e; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml index 0640b846e..e3ba1bff4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml @@ -6,15 +6,9 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" - xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" mc:Ignorable="d" - d:DesignHeight="400" d:DesignWidth="700" Height="460" Width="750" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:MachineCreationDialogVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource Dialog.Foreground}"> - - <UserControl.Resources> - <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converters:BooleanToVisibilityConverter> - </UserControl.Resources> - + d:DesignHeight="400" d:DesignWidth="700" Height="400" Width="700" Background="White" d:DataContext="{d:DesignInstance Type=vm:MachineCreationDialogVM, IsDesignTimeCreatable=False}"> <Grid Margin="10"> <DockPanel> <Grid DockPanel.Dock="Top"> @@ -23,18 +17,7 @@ <Image Source="../Images/machine-full-fx.png" Width="120" RenderOptions.BitmapScalingMode="Fant"></Image> <materialDesign:PackIcon HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -10 -10" Kind="PlusCircle" Foreground="#15C315" Width="42" Height="42" /> </Grid> - <TextBlock Margin="30 0 0 0" VerticalAlignment="Bottom" FontSize="22"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Text" Value="CLONE MACHINE"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsNewMachine}" Value="True"> - <Setter Property="Text" Value="NEW MACHINE"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> + <TextBlock Margin="30 0 0 0" VerticalAlignment="Bottom" FontSize="22">NEW MACHINE</TextBlock> </StackPanel> </Grid> @@ -50,30 +33,12 @@ </Grid> <Grid> - <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20 20 0 0" Width="400"> - <TextBlock TextWrapping="Wrap" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}"> - <Run>Please specify the machine version in order to prototype the new machine with default machine settings and configuration.</Run> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="400"> + <TextBlock TextWrapping="Wrap" TextAlignment="Center"> + <Run>Please specify the machine version in order to prototype the new machine with default machine settings and configuartion.</Run> </TextBlock> - <ComboBox Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}" ItemsSource="{Binding MachineVersions}" SelectedItem="{Binding SelectedMachineVersion}" DisplayMemberPath="Name" Margin="0 10 0 0" FontSize="16" materialDesign:HintAssist.Hint="NONE"></ComboBox> - - <TextBlock Margin="0 20 0 0" FontSize="10">Serial Number</TextBlock> - <TextBox Margin="0 2 0 0" Text="{Binding SerialNumber,UpdateSourceTrigger=PropertyChanged}"></TextBox> - - <TextBlock Margin="0 20 0 0" FontSize="10">Name</TextBlock> - <TextBox Margin="0 2 0 0" Text="{Binding Name,UpdateSourceTrigger=PropertyChanged}"></TextBox> - - <CheckBox Margin="0 30 0 0" IsChecked="{Binding GenerateDispensers}"> - <TextBlock> - <Run>Automatically generate 8 dispensers for this machine</Run> - <Run>(</Run><Run Foreground="{StaticResource GrayBrush}" FontSize="10" Text="{Binding SerialNumber}"></Run><Run Foreground="{StaticResource GrayBrush}" FontSize="10">-1-8</Run><Run>)</Run> - </TextBlock> - </CheckBox> - - <StackPanel Margin="20 10 0 0" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}"> - <TextBlock FontSize="10">Dispenser max nl/cm</TextBlock> - <mahapps:NumericUpDown Minimum="0" StringFormat="0.00" Maximum="10" InterceptMouseWheel="True" Value="{Binding DispenserFactor,Mode=TwoWay}" HorizontalContentAlignment="Left" Width="95" HorizontalAlignment="Left" BorderThickness="0 0 0 1" Margin="0 2 0 0" HideUpDownButtons="True" HasDecimals="True" Background="Transparent"></mahapps:NumericUpDown> - </StackPanel> + <ComboBox ItemsSource="{Binding MachineVersions}" SelectedItem="{Binding SelectedMachineVersion}" DisplayMemberPath="Name" Margin="0 10 0 0" FontSize="16" materialDesign:HintAssist.Hint="NONE"></ComboBox> </StackPanel> </Grid> </DockPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml index b2b770698..1f748fe9f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml @@ -5,17 +5,11 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - <UserControl.Resources> - <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> - </UserControl.Resources> - <Grid Margin="20"> <DockPanel> <Grid DockPanel.Dock="Top"> @@ -29,7 +23,7 @@ </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 20 0"> - <Button Width="170" Height="45" VerticalAlignment="Center" Command="{Binding SaveCommand}"> + <Button Width="170" Height="45" VerticalAlignment="Center" Command="{Binding SaveCommand}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="ContentSaveAll" Width="24" Height="24" /> <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock> @@ -67,12 +61,6 @@ <TabItem Header="HW CONFIGURATION"> <local:HardwareConfigurationView/> </TabItem> - <TabItem Header="UPDATES" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <local:MachineUpdatesView/> - </TabItem> - <TabItem Header="TUP" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <local:TupView/> - </TabItem> </TabControl> </Grid> </DockPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml index 76517ec37..40ce9ea08 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml @@ -6,7 +6,6 @@ xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" - xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" @@ -14,11 +13,6 @@ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - <UserControl.Resources> - <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter"/> - </UserControl.Resources> - <Grid Margin="20"> <DockPanel> <Grid DockPanel.Dock="Bottom"> @@ -33,106 +27,84 @@ <local:MachineView DataContext="{Binding ActiveMachine}" IsHitTestVisible="False" /> - <StackPanel Grid.Column="1" Margin="100 30"> - <Border CornerRadius="5" Background="{StaticResource TransparentBackgroundBrush600}" Padding="10" BorderBrush="{StaticResource borderBrush}" BorderThickness="1"> - <Grid TextElement.Foreground="{StaticResource GrayBrush280}"> - <Grid.ColumnDefinitions> - <ColumnDefinition/> - <ColumnDefinition Width="Auto" /> - <ColumnDefinition/> - </Grid.ColumnDefinitions> - - <StackPanel> - <controls:TableGrid RowHeight="50" Margin="10"> - <TextBlock FontWeight="SemiBold">Serial Number</TextBlock> - <TextBox Text="{Binding ActiveMachine.SerialNumber}"></TextBox> - - <TextBlock FontWeight="SemiBold">Name</TextBlock> - <TextBox Text="{Binding ActiveMachine.Name}"></TextBox> + <Border Grid.Column="1" Margin="100 70" CornerRadius="5" Background="{StaticResource TransparentBackgroundBrush600}" Padding="10" BorderBrush="{StaticResource borderBrush}" BorderThickness="1"> + <Grid TextElement.Foreground="{StaticResource GrayBrush280}"> + <Grid.ColumnDefinitions> + <ColumnDefinition/> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition/> + </Grid.ColumnDefinitions> + <controls:TableGrid RowHeight="50" Margin="10"> + <TextBlock FontWeight="SemiBold">Serial Number</TextBlock> + <TextBox Text="{Binding ActiveMachine.SerialNumber}"></TextBox> - <TextBlock FontWeight="SemiBold">Head Type</TextBlock> - <ComboBox ItemsSource="{Binding Source={x:Type enumerations:HeadTypes},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ActiveMachine.MachineHeadType}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> + <TextBlock FontWeight="SemiBold">Name</TextBlock> + <TextBox Text="{Binding ActiveMachine.Name}"></TextBox> - <TextBlock FontWeight="SemiBold">Machine Version</TextBlock> - <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.MachineVersions}" SelectedItem="{Binding ActiveMachine.MachineVersion}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}" ></ComboBox> + <TextBlock FontWeight="SemiBold">Machine Version</TextBlock> + <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.MachineVersions}" SelectedItem="{Binding ActiveMachine.MachineVersion}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> - <TextBlock FontWeight="SemiBold">Organization</TextBlock> - <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.Organizations}" SelectedItem="{Binding ActiveMachine.Organization}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> + <TextBlock FontWeight="SemiBold">Organization</TextBlock> + <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.Organizations}" SelectedItem="{Binding ActiveMachine.Organization}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> - <TextBlock FontWeight="SemiBold">Site</TextBlock> - <ComboBox Background="Transparent" ItemsSource="{Binding Sites}" SelectedItem="{Binding SelectedSite}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> + <TextBlock FontWeight="SemiBold">Default RML</TextBlock> + <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.Rmls}" SelectedItem="{Binding ActiveMachine.DefaultRml}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> - <TextBlock FontWeight="SemiBold">OS Key</TextBlock> - <TextBox Text="{Binding ActiveMachine.OsKey}"></TextBox> + <TextBlock FontWeight="SemiBold">Loaded RML</TextBlock> + <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.Rmls}" SelectedValue="{Binding ActiveMachine.LoadedRmlGuid}" SelectedValuePath="Guid" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> - <TextBlock FontWeight="SemiBold">Device COM Port</TextBlock> - <TextBox Text="{Binding ActiveMachine.DeviceComPort}"></TextBox> - </controls:TableGrid> + <TextBlock FontWeight="SemiBold">Default Color Space</TextBlock> + <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.ColorSpaces}" SelectedItem="{Binding ActiveMachine.DefaultColorSpace}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> - <Button Margin="0 20 0 0" Background="{StaticResource RedBrush300}" ToolTip="Make this machine configuration as a prototype for the selected machine version" BorderBrush="{StaticResource RedBrush300}" Width="200" Height="45" VerticalAlignment="Bottom" Command="{Binding MakePrototypeCommand}"> - <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon Kind="Copyright" Width="24" Height="24" /> - <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">MAKE PROTOTYPE</TextBlock> - </StackPanel> - </Button> - </StackPanel> + <TextBlock FontWeight="SemiBold">Default Segment Length</TextBlock> + <mahapps:NumericUpDown HideUpDownButtons="True" BorderThickness="0 0 0 1" Background="Transparent" Minimum="0" Maximum="1000" Value="{Binding ActiveMachine.DefaultSegmentLength}" HasDecimals="False"></mahapps:NumericUpDown> - <Rectangle Grid.Column="1" StrokeThickness="1" Stroke="{StaticResource borderBrush}" HorizontalAlignment="Center" Margin="50 50" /> - <controls:TableGrid RowHeight="50" Margin="10" Grid.Column="2"> - <TextBlock FontWeight="SemiBold">Auto Login</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.AutoLogin}"></ToggleButton> + <TextBlock FontWeight="SemiBold">Default Spool Type</TextBlock> + <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.SpoolTypes}" SelectedItem="{Binding ActiveMachine.DefaultSpoolType}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> - <!--<TextBlock FontWeight="SemiBold">Auto Check For Updates</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.AutoCheckForUpdates}"></ToggleButton>--> + <TextBlock FontWeight="SemiBold">OS Key</TextBlock> + <TextBox Text="{Binding ActiveMachine.OsKey}"></TextBox> - <TextBlock FontWeight="SemiBold">Setup Activation</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupActivation}"></ToggleButton> + <TextBlock FontWeight="SemiBold">Device COM Port</TextBlock> + <TextBox Text="{Binding ActiveMachine.DeviceComPort}"></TextBox> + </controls:TableGrid> + <Rectangle Grid.Column="1" StrokeThickness="1" Stroke="{StaticResource borderBrush}" HorizontalAlignment="Center" Margin="50 50" /> + <controls:TableGrid RowHeight="50" Margin="10" Grid.Column="2"> + <TextBlock FontWeight="SemiBold">Auto Login</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.AutoLogin}"></ToggleButton> - <TextBlock FontWeight="SemiBold">Setup Remote Assistance</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupRemoteAssistance}"></ToggleButton> + <TextBlock FontWeight="SemiBold">Auto Check For Updates</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.AutoCheckForUpdates}"></ToggleButton> - <TextBlock FontWeight="SemiBold">Setup UWF</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupUwf}"></ToggleButton> + <TextBlock FontWeight="SemiBold">Setup Activation</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupActivation}"></ToggleButton> - <TextBlock FontWeight="SemiBold">Setup Firmware</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupFirmware}"></ToggleButton> + <TextBlock FontWeight="SemiBold">Setup Remote Assistance</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupRemoteAssistance}"></ToggleButton> - <TextBlock FontWeight="SemiBold">Setup FPGA</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupFpga}"></ToggleButton> + <TextBlock FontWeight="SemiBold">Setup UWF</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupUwf}"></ToggleButton> - <TextBlock FontWeight="SemiBold">Is Demo Machine</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.IsDemo}"></ToggleButton> + <TextBlock FontWeight="SemiBold">Setup Firmware</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupFirmware}"></ToggleButton> - <TextBlock FontWeight="SemiBold">Suspend Version Update</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SuspendVersionUpdate}"></ToggleButton> + <TextBlock FontWeight="SemiBold">Setup FPGA</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupFpga}"></ToggleButton> - <TextBlock FontWeight="SemiBold">Force Version Update</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.ForceVersionUpdate}"></ToggleButton> + <TextBlock FontWeight="SemiBold">Is Demo Machine</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.IsDemo}"></ToggleButton> - <TextBlock FontWeight="SemiBold">Update Schema on Update</TextBlock> - <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.PerformSchemaUpdateOnDataUpdate}"></ToggleButton> - </controls:TableGrid> - </Grid> - </Border> + <TextBlock FontWeight="SemiBold">Suspend Version Update</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SuspendVersionUpdate}"></ToggleButton> - <Border Visibility="{Binding ActiveMachine.IsDeviceRegistered,Converter={StaticResource BoolToVisConverter}}" Margin="0 10 0 0" CornerRadius="5" Background="{StaticResource TransparentBackgroundBrush600}" Padding="20" BorderBrush="{StaticResource borderBrush}" BorderThickness="1"> - <DockPanel> - <StackPanel DockPanel.Dock="Left"> - <TextBlock FontSize="16" FontWeight="SemiBold">Device Registration</TextBlock> - <TextBlock Margin="0 10 0 0"> - <Run FontWeight="SemiBold">Device ID:</Run> - <Run Text="{Binding ActiveMachine.DeviceId}"></Run> - </TextBlock> - <TextBlock Margin="0 5 0 0"> - <Run FontWeight="SemiBold">Device Name:</Run> - <Run Text="{Binding ActiveMachine.DeviceName}"></Run> - </TextBlock> - </StackPanel> + <TextBlock FontWeight="SemiBold">Force Version Update</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.ForceVersionUpdate}"></ToggleButton> - <Button Command="{Binding ResetDeviceRegistrationCommand}" HorizontalAlignment="Center" VerticalAlignment="Center" Background="{StaticResource RedBrush300}" BorderBrush="{StaticResource RedBrush300}" Padding="10" Height="45" Width="240">RESET DEVICE REGISTRATION</Button> - </DockPanel> - </Border> - </StackPanel> + <TextBlock FontWeight="SemiBold">Update Schema on Update</TextBlock> + <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.PerformSchemaUpdateOnDataUpdate}"></ToggleButton> + </controls:TableGrid> + </Grid> + </Border> </Grid> </DockPanel> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdateDetailsDialog.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdateDetailsDialog.xaml deleted file mode 100644 index 0e793dc6a..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdateDetailsDialog.xaml +++ /dev/null @@ -1,94 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.MachineDesigner.Views.MachineUpdateDetailsDialog" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" - xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" - xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" - xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" - mc:Ignorable="d" - d:DesignHeight="400" d:DesignWidth="700" Height="700" Width="1280" Background="White" d:DataContext="{d:DesignInstance Type=vm:MachineUpdateDetailsDialogVM, IsDesignTimeCreatable=False}"> - <UserControl.Resources> - <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> - <converters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter" /> - <converters:StringToOneLineConverter x:Key="StringToOneLineConverter" /> - </UserControl.Resources> - - <Grid> - <Grid Grid.RowSpan="2"> - <Grid.RowDefinitions> - <RowDefinition Height="60"/> - <RowDefinition Height="31*"/> - <RowDefinition Height="50"/> - </Grid.RowDefinitions> - - <StackPanel Orientation="Horizontal" DataContext="{Binding Update}"> - <materialDesign:PackIcon Width="42" Height="42" VerticalAlignment="Center"> - <materialDesign:PackIcon.Style> - <Style TargetType="materialDesign:PackIcon"> - <Setter Property="Kind" Value="Information"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsSetup}" Value="True"> - <Setter Property="Kind" Value="Settings"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsUpdate}" Value="True"> - <Setter Property="Kind" Value="CloudDownload"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsDataBase}" Value="True"> - <Setter Property="Kind" Value="Database"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsSynchronization}" Value="True"> - <Setter Property="Kind" Value="Sync"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsOfflineUpdate}" Value="True"> - <Setter Property="Kind" Value="Sd"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsOfflineFirmwareUpgrade}" Value="True"> - <Setter Property="Kind" Value="Chip"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsStarted}" Value="True"> - <Setter Property="Foreground" Value="{StaticResource OrangeBrush}"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsCompleted}" Value="True"> - <Setter Property="Foreground" Value="{StaticResource GreenBrush }"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsFailed}" Value="True"> - <Setter Property="Foreground" Value="Red"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </materialDesign:PackIcon.Style> - </materialDesign:PackIcon> - <TextBlock VerticalAlignment="Center" Text="{Binding UpdateStatus,Converter={StaticResource EnumToDescriptionConverter}}" TextWrapping="NoWrap" Height="22" TextTrimming="CharacterEllipsis" Width="500" Margin="10 0 0 0" FontSize="16"></TextBlock> - </StackPanel> - - <Grid Grid.Row="1"> - <DockPanel> - <Grid DockPanel.Dock="Top"> - <controls:TableGrid RowHeight="30"> - <TextBlock Text="Started On:" FontWeight="SemiBold" /> - <TextBlock Text="{Binding Update.StartDate,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}"></TextBlock> - <TextBlock Text="Application:" FontWeight="SemiBold" /> - <TextBlock Text="{Binding Update.ApplicationVersion}"></TextBlock> - <TextBlock Text="Firmware:" FontWeight="SemiBold" /> - <TextBlock Text="{Binding Update.FirmwareVersion}"></TextBlock> - <TextBlock Text="Ended:" FontWeight="SemiBold" /> - <TextBlock Text="{Binding Update.EndDate,TargetNullValue='Never',FallbackValue='Never',Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}"></TextBlock> - </controls:TableGrid> - </Grid> - - <Border Padding="5" BorderThickness="1" BorderBrush="{StaticResource BorderBrushGainsboro}"> - <TextBox BorderThickness="0" Text="{Binding Update.FailedLog,TargetNullValue='No further Information available.'}" Style="{x:Null}" TextWrapping="NoWrap" IsReadOnly="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Background="Transparent" /> - </Border> - </DockPanel> - </Grid> - - <Grid Grid.Row="2"> - <Button HorizontalAlignment="Right" Width="140" Command="{Binding CloseCommand}">CLOSE</Button> - </Grid> - </Grid> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdateDetailsDialog.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdateDetailsDialog.xaml.cs deleted file mode 100644 index 8bb051c51..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdateDetailsDialog.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -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.MachineDesigner.Views -{ - /// <summary> - /// Interaction logic for MachineCreationDialog.xaml - /// </summary> - public partial class MachineUpdateDetailsDialog : UserControl - { - public MachineUpdateDetailsDialog() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdatesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdatesView.xaml deleted file mode 100644 index bd272718d..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdatesView.xaml +++ /dev/null @@ -1,114 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.MachineDesigner.Views.MachineUpdatesView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" - xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner" - xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" - xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" - xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" - mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1500" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - <UserControl.Resources> - <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> - <converters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter" /> - <converters:StringToOneLineConverter x:Key="StringToOneLineConverter" /> - </UserControl.Resources> - - <Grid Margin="20" DataContext="{Binding MachineUpdatesViewVM}"> - <DockPanel IsEnabled="{Binding IsFree}"> - <Grid DockPanel.Dock="Bottom"> - - </Grid> - - <Grid Margin="0 20"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="38*"/> - <ColumnDefinition Width="117*"/> - </Grid.ColumnDefinitions> - - <local:MachineView Margin="30 80 0 0" DataContext="{Binding Machine}" IsHitTestVisible="False" VerticalAlignment="Top" Height="241" /> - - <DockPanel Grid.Column="1" Margin="50 100 50 50"> - <Grid DockPanel.Dock="Bottom" Height="50"> - <StackPanel Orientation="Horizontal"> - <CheckBox IsChecked="{Binding DisplayMachineSetups}">Machine Setups</CheckBox> - <CheckBox IsChecked="{Binding DisplayApplicationUpdates}" Margin="30 0">Software Updates</CheckBox> - <CheckBox IsChecked="{Binding DisplayDatabaseUpdates}">Database Updates</CheckBox> - <CheckBox IsChecked="{Binding DisplaySynchronizations}" Margin="30 0 0 0">Synchronizations</CheckBox> - <CheckBox IsChecked="{Binding DisplayOfflineUpdates}" Margin="30 0 0 0">Offline Updates</CheckBox> - <CheckBox IsChecked="{Binding DisplayFirmwareUpgrades}" Margin="30 0 0 0">Offline Firmware Upgrades</CheckBox> - </StackPanel> - - <Button Command="{Binding RefreshCommand}" HorizontalAlignment="Right" Width="150" Style="{StaticResource MaterialDesignFlatButton}">REFRESH</Button> - </Grid> - <Grid> - <DataGrid Margin="0 0 0 10" SelectionUnit="FullRow" BorderBrush="{StaticResource borderBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True" ItemsSource="{Binding Updates}" SelectedItem="{Binding SelectedUpdate}"> - <DataGrid.CellStyle> - <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> - <Setter Property="BorderThickness" Value="0"/> - <Setter Property="FocusVisualStyle" Value="{x:Null}"/> - <Setter Property="VerticalContentAlignment" Value="Center"></Setter> - </Style> - </DataGrid.CellStyle> - <DataGrid.Columns> - <DataGridTemplateColumn Header=""> - <DataGridTemplateColumn.CellTemplate> - <DataTemplate> - <materialDesign:PackIcon Width="16" Height="16"> - <materialDesign:PackIcon.Style> - <Style TargetType="materialDesign:PackIcon"> - <Setter Property="Kind" Value="Information"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsSetup}" Value="True"> - <Setter Property="Kind" Value="Settings"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsUpdate}" Value="True"> - <Setter Property="Kind" Value="CloudDownload"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsDataBase}" Value="True"> - <Setter Property="Kind" Value="Database"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsSynchronization}" Value="True"> - <Setter Property="Kind" Value="Sync"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsOfflineUpdate}" Value="True"> - <Setter Property="Kind" Value="Sd"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsOfflineFirmwareUpgrade}" Value="True"> - <Setter Property="Kind" Value="Chip"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsStarted}" Value="True"> - <Setter Property="Foreground" Value="{StaticResource OrangeBrush}"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsCompleted}" Value="True"> - <Setter Property="Foreground" Value="{StaticResource GreenBrush }"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding IsFailed}" Value="True"> - <Setter Property="Foreground" Value="Red"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </materialDesign:PackIcon.Style> - </materialDesign:PackIcon> - </DataTemplate> - </DataGridTemplateColumn.CellTemplate> - </DataGridTemplateColumn> - <DataGridTextColumn Header="STARTED" Binding="{Binding StartDate,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" /> - <DataGridTextColumn Header="APPLICATION" Binding="{Binding ApplicationVersion}" Width="Auto" /> - <DataGridTextColumn Header="FIRMWARE" Binding="{Binding FirmwareVersion}" Width="Auto" /> - <DataGridTextColumn Header="ENDED" Binding="{Binding EndDate,TargetNullValue='Never',FallbackValue='Never',Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" /> - <DataGridTextColumn Header="STATUS" Binding="{Binding UpdateStatus,Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto" /> - <DataGridTextColumn Header="REASON" Binding="{Binding FailedReason,Converter={StaticResource StringToOneLineConverter},ConverterParameter='80'}" Width="*" /> - </DataGrid.Columns> - </DataGrid> - </Grid> - </DockPanel> - </Grid> - </DockPanel> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdatesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdatesView.xaml.cs deleted file mode 100644 index d13ef2d0e..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineUpdatesView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -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.MachineDesigner.Views -{ - /// <summary> - /// Interaction logic for SpoolsView.xaml - /// </summary> - public partial class MachineUpdatesView : UserControl - { - public MachineUpdatesView() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml index a231e92a3..35b578b6a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml @@ -15,7 +15,6 @@ d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> <UserControl.Resources> <converters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter" /> - <converters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter" /> </UserControl.Resources> <Grid> @@ -74,8 +73,7 @@ <DataGridTextColumn Header="NAME" Binding="{Binding Name}" Width="Auto" /> <DataGridTextColumn Header="ORGANIZATION" Binding="{Binding Organization.Name}" Width="Auto" /> <DataGridTextColumn Header="VERSION" Binding="{Binding MachineVersion.Name}" Width="Auto" /> - <DataGridTextColumn Header="REGISTERED" Binding="{Binding IsDeviceRegistered,Converter={StaticResource BooleanToYesNoConverter}}" Width="Auto" /> - <DataGridTextColumn Header="DEMO MACHINE" Binding="{Binding IsDemo,Converter={StaticResource BooleanToYesNoConverter}}" Width="Auto" /> + <DataGridTextColumn Header="DEMO MACHINE" Binding="{Binding IsDemo}" Width="Auto" /> <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="1*" /> </DataGrid.Columns> </controls:DoubleClickDataGrid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml index 833086bf0..bc9b038dc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml @@ -9,7 +9,7 @@ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - <Grid IsEnabled="{Binding IsFree}"> + <Grid> <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide"> <local:MachinesView /> <local:MachineDetailsView/> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml index f08da88d1..3663f72f8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/SpoolsView.xaml @@ -9,14 +9,8 @@ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" - xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - <UserControl.Resources> - <converters:EmptyStringToNullConverter x:Key="EmptyStringToNullConverter" /> - </UserControl.Resources> - <Grid Margin="20"> <DockPanel> <Grid DockPanel.Dock="Bottom"> @@ -73,7 +67,10 @@ </Style> </DataGridComboBoxColumn.EditingElementStyle> </DataGridComboBoxColumn> - <DataGridTextColumn Header="LIMIT SWITCH START POINT OFFSET" Binding="{Binding LimitSwitchStartPointOffset,Converter={StaticResource EmptyStringToNullConverter}}" Width="1*" /> + <DataGridTextColumn Header="START OFFSET PULSES" Binding="{Binding StartOffsetPulses}" Width="Auto" /> + <DataGridTextColumn Header="BACKING RATE" Binding="{Binding BackingRate}" Width="Auto" /> + <DataGridTextColumn Header="SEGMENT OFFSET PULSES" Binding="{Binding SegmentOffsetPulses}" Width="Auto" /> + <DataGridTextColumn Header="BOTTOM BACKING RATE" Binding="{Binding BottomBackingRate}" Width="1*" /> </DataGrid.Columns> </DataGrid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/TupView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/TupView.xaml deleted file mode 100644 index 895a26ca0..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/TupView.xaml +++ /dev/null @@ -1,60 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.MachineDesigner.Views.TupView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" - xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner" - xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" - xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" - mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" Background="Transparent"> - - <Grid Margin="20" DataContext="{Binding TupViewVM}"> - <DockPanel IsEnabled="{Binding IsFree}"> - <Grid DockPanel.Dock="Bottom"> - - </Grid> - - <Grid Margin="0 20"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="38*"/> - <ColumnDefinition Width="117*"/> - </Grid.ColumnDefinitions> - - <local:MachineView Margin="30 80 0 0" DataContext="{Binding Machine}" IsHitTestVisible="False" VerticalAlignment="Top" Height="241" /> - - <DockPanel Grid.Column="1" Margin="50 100 300 100"> - <TextBlock DockPanel.Dock="Top"> - <Run>Create a complete update package (.tup) in order to update this machine offline using a removable storage device.</Run> - <LineBreak/> - <Run>The latest PPC version is </Run> - <Run Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" Text="{Binding LatestVersion,FallbackValue='loading...',TargetNullValue='loading...'}"></Run> - </TextBlock> - <Grid Margin="0 20 0 0"> - <Border Background="{StaticResource Transparent200}" CornerRadius="5" Padding="60" BorderThickness="1" BorderBrush="Silver"> - <DockPanel> - <DockPanel DockPanel.Dock="Top" Height="40"> - <Button Command="{Binding SelectFileCommand}" DockPanel.Dock="Right" BorderBrush="Silver" BorderThickness="1" Padding="0" Height="Auto" Width="40" Margin="5 0 0 0" Style="{StaticResource MaterialDesignFlatButton}"> - <material:PackIcon Kind="Folder" /> - </Button> - <TextBox materialDesign:HintAssist.Hint="Select package location" BorderBrush="Silver" BorderThickness="1" Text="{Binding FilePath}" IsReadOnly="True" VerticalContentAlignment="Center" Padding="10 0 0 0"></TextBox> - </DockPanel> - <StackPanel DockPanel.Dock="Bottom"> - <TextBlock HorizontalAlignment="Center" Text="{Binding Progress.Message,FallbackValue='Ready',TargetNullValue='Ready'}"></TextBlock> - <ProgressBar Margin="0 10 0 0" Height="15" IsIndeterminate="{Binding Progress.IsIntermediate}" Value="{Binding Progress.Progress}" Maximum="{Binding Progress.Total}"></ProgressBar> - </StackPanel> - <Grid> - <Button Command="{Binding CreateTupFileCommand}" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="20 10" Height="60" Width="300">GENERATE UPDATE PACKAGE</Button> - </Grid> - </DockPanel> - </Border> - </Grid> - </DockPanel> - </Grid> - </DockPanel> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/TupView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/TupView.xaml.cs deleted file mode 100644 index fe01296d8..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/TupView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -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.MachineDesigner.Views -{ - /// <summary> - /// Interaction logic for SpoolsView.xaml - /// </summary> - public partial class TupView : UserControl - { - public TupView() - { - InitializeComponent(); - } - } -} |
