diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index ab74433a6..36beab19a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -38,8 +38,6 @@ using System.Threading; using Tango.SharedUI.Helpers; using Tango.Core.DI; using Tango.MachineStudio.Common; -using Tango.MachineStudio.Logging.ViewModels; -using Tango.MachineStudio.Logging.Views; using Tango.AutoComplete.Editors; using System.Data.Entity; using System.Runtime.ExceptionServices; @@ -53,6 +51,7 @@ using Microsoft.WindowsAPICodePack.Dialogs; using Tango.BL.Enumerations; using Tango.BL.DTO; using Tango.BL.ActionLogs; +using Tango.MachineStudio.Common.Buid; namespace Tango.MachineStudio.Developer.ViewModels { @@ -68,6 +67,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private const string EMB_FORMATS_IMPORT = "Embroidery Files|*.pes;*.hus;*.dst"; private INotificationProvider _notification; + private IBuildProvider _buildProvider; private TimeSpan _runningJobEstimatedDuration; private DeveloperNavigationManager _navigation; private INavigationManager _msNavigation; @@ -76,7 +76,6 @@ namespace Tango.MachineStudio.Developer.ViewModels private ObservablesContext _activeJobDbContext; private IEventLogger _eventLogger; private ISpeechProvider _speech; - private DataCapture.ViewModels.MainViewVM _dataCaptureVM; private bool _isRecording; private DeveloperModuleSettings _settings; private Thread _colorConversionThread; @@ -769,7 +768,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> /// <param name="applicationManager">The application manager.</param> /// <param name="notificationProvider">The notification provider.</param> - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, INavigationManager navigationManager, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech, IActionLogManager actionLogManager) + public MainViewVM(IBuildProvider buildProvider, IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, INavigationManager navigationManager, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech, IActionLogManager actionLogManager) { _converter = new DefaultColorConverter(); @@ -781,6 +780,7 @@ namespace Tango.MachineStudio.Developer.ViewModels AuthenticationProvider = authentication; _actionLogManager = actionLogManager; + _buildProvider = buildProvider; _notification = notificationProvider; _speech = speech; _navigation = navigation; @@ -791,11 +791,11 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Initializing relay commands..."); - TangoIOC.Default.GetInstanceWhenAvailable<DataCapture.ViewModels.MainViewVM>((vm) => - { - _dataCaptureVM = vm; - _dataCaptureVM.RelayCommandsInvalidated += (_, __) => StartJobAndRecordCommand.RaiseCanExecuteChanged(); - }); + //TangoIOC.Default.GetInstanceWhenAvailable<DataCapture.ViewModels.MainViewVM>((vm) => + //{ + // _dataCaptureVM = vm; + // _dataCaptureVM.RelayCommandsInvalidated += (_, __) => StartJobAndRecordCommand.RaiseCanExecuteChanged(); + //}); //Initialize Commands... EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null && CanWork); @@ -811,7 +811,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null && CanWork); DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null && CanWork); StartJobCommand = new RelayCommand(() => StartJob(), () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null); - StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && CanWork); + //StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && CanWork); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning && CanWork); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); LoadJobCommand = new RelayCommand(() => LoadSelectedJob(), () => SelectedMachineJob != null && CanWork); @@ -856,7 +856,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { Settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>(); - Settings.PropertyChanged += (x, e) => + Settings.PropertyChanged += (x, e) => { if (e.PropertyName == nameof(Settings.UsePreferredLiquidVolumeIndex)) { @@ -872,10 +872,17 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Initializing machine Db context..."); _machineDbContext = ObservablesContext.CreateDefault(); - if (_settings.LastSelectedMachineGuid != null) + if (_buildProvider.BuildType == MSBuildType.Lite) { - LogManager.Log("Setting last selected machine from settings..."); - SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == _settings.LastSelectedMachineGuid); + SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == AuthenticationProvider.Machine.Guid); + } + else + { + if (_settings.LastSelectedMachineGuid != null) + { + LogManager.Log("Setting last selected machine from settings..."); + SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == _settings.LastSelectedMachineGuid); + } } if (_settings.LastSelectedJobGuid != null && SelectedMachine != null) @@ -1352,17 +1359,17 @@ namespace Tango.MachineStudio.Developer.ViewModels private void OnSelectedJobEventChanged() { - if (SelectedJobEvent != null && SelectedJobEvent.Type != BL.Enumerations.EventTypes.APPLICATION_STARTED && !_dialog_shown) - { - _dialog_shown = true; - _notification.ShowModalDialog<EventDetailsViewVM, EventDetailsView>(new EventDetailsViewVM(SelectedJobEvent), (x) => - { + //if (SelectedJobEvent != null && SelectedJobEvent.Type != BL.Enumerations.EventTypes.APPLICATION_STARTED && !_dialog_shown) + //{ + // _dialog_shown = true; + // _notification.ShowModalDialog<EventDetailsViewVM, EventDetailsView>(new EventDetailsViewVM(SelectedJobEvent), (x) => + // { - }, () => - { - _dialog_shown = false; - }); - } + // }, () => + // { + // _dialog_shown = false; + // }); + //} } /// <summary> @@ -1588,9 +1595,9 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> private void StartJobAndRecord() { - _isRecording = true; - _dataCaptureVM.StartDiagnosticsRecording(); - StartJob(); + //_isRecording = true; + //_dataCaptureVM.StartDiagnosticsRecording(); + //StartJob(); } /// <summary> @@ -1598,11 +1605,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> private void StopRecordingIfInProgress() { - if (_isRecording) - { - _isRecording = false; - InvokeUI(() => _dataCaptureVM.StopRecorderOrPlayer()); - } + //if (_isRecording) + //{ + // _isRecording = false; + // InvokeUI(() => _dataCaptureVM.StopRecorderOrPlayer()); + //} } private void BackToJob() @@ -1901,9 +1908,9 @@ namespace Tango.MachineStudio.Developer.ViewModels //var processParamsGroups = _activeJobDbContext.ProcessParametersTablesGroups.ToList(); //var processParams = _activeJobDbContext.ProcessParametersTables.ToList(); - ColorSpaces = _activeJobDbContext.ColorSpaces.ToObservableCollection(); + ColorSpaces = _activeJobDbContext.ColorSpaces.ToList().Where(x => x.Space == BL.Enumerations.ColorSpaces.Volume || x.Space == BL.Enumerations.ColorSpaces.LAB || x.Space == BL.Enumerations.ColorSpaces.RGB).ToObservableCollection(); - Rmls = _activeJobDbContext.Rmls.Where(x => x.MachineType == SelectedMachine.MachineType || x.MachineType == null).ToList().OrderBy(i => i.FinalName).ToObservableCollection(); + Rmls = _activeJobDbContext.Rmls.Where(x => x.CreatedByOrganizationGuid == AuthenticationProvider.CurrentUser.Organization.Guid || _buildProvider.BuildType == MSBuildType.Default).Where(x => x.MachineType == SelectedMachine.MachineType || x.MachineType == null).ToList().OrderBy(i => i.FinalName).ToObservableCollection(); WindingMethods = _activeJobDbContext.WindingMethods.ToObservableCollection(); SpoolTypes = _activeJobDbContext.SpoolTypes.ToObservableCollection(); |
