From bd49bdcb109a227130d7db6856e659b435d16530 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 11 Jul 2018 12:37:11 +0300 Subject: Embedded Tango.AnimatedGif ! --- .../MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index 00990166f..0aa0af85a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Tue 07/10/2018 16:54:33.30 +Wed 07/11/2018 11:23:32.16 -- cgit v1.3.1 From 009a02d57e244e9a8ed5d70fc0743f10f68f5a33 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 11 Jul 2018 16:12:53 +0300 Subject: Done some work on PPC & Color Lab Module. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes Software/Graphics/Mobile/sample-dye.png | Bin 0 -> 2120 bytes .../ViewModels/MainViewVM.cs | 41 +++++++ .../Views/MainView.xaml | 73 ++++++----- .../Tango.MachineStudio.UI/Resources/BuildDate.txt | 2 +- .../Native/Tango.ColorLib/Utils/Interp.cpp | 10 ++ .../Tango.PPC.Jobs/Images/JobView/sample-dye.png | Bin 0 -> 2120 bytes .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 3 + .../Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs | 19 +-- .../Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs | 3 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 53 +++++++- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 41 ++++++- .../PPCApplication/DefaultPPCApplicationManager.cs | 10 +- .../Tango.BL/Entities/HardwareMotor.cs | 6 +- Software/Visual_Studio/Tango.BL/Entities/Job.cs | 50 +++++--- .../ExtensionMethods/IEnumerableExtensions.cs | 12 ++ Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 3 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 134 ++++++++++----------- .../Tango.Touch/Controls/TouchNumericTextBox.cs | 4 +- .../Tango.Touch/Controls/TouchToggleButton.cs | 31 ++++- .../Visual_Studio/Utilities/Tango.UITests/App.xaml | 8 +- .../Utilities/Tango.UITests/MainWindow.xaml | 2 +- .../Utilities/Tango.UITests/MainWindow.xaml.cs | 12 +- 25 files changed, 378 insertions(+), 140 deletions(-) create mode 100644 Software/Graphics/Mobile/sample-dye.png create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/sample-dye.png (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 66c3a8783..a94e39894 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 45f9ba68b..e74145160 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/Mobile/sample-dye.png b/Software/Graphics/Mobile/sample-dye.png new file mode 100644 index 000000000..f8989e19a Binary files /dev/null and b/Software/Graphics/Mobile/sample-dye.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs index 48d16104a..0e9109b28 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -13,6 +13,7 @@ using System.Windows.Media; using Tango.BL; using Tango.BL.ColorConversion; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.Core.Commands; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Controls; @@ -32,6 +33,33 @@ namespace Tango.MachineStudio.ColorLab.ViewModels #region Properties + private bool _isVolumesOutOfRange; + /// + /// Gets or sets a value indicating whether the liquid volumes are out of range. + /// + public bool IsVolumesOutOfRange + { + get { return _isVolumesOutOfRange; } + set + { + if (_isVolumesOutOfRange != value) + { + _isVolumesOutOfRange = value; + RaisePropertyChangedAuto(); + } + } + } + + private bool _isOutOfGamut; + /// + /// Gets or sets a value indicating whether the source color is out of gamut. + /// + public bool IsOutOfGamut + { + get { return _isOutOfGamut; } + set { _isOutOfGamut = value; RaisePropertyChangedAuto(); } + } + private ObservableCollection _machines; /// /// Gets or sets the machines. @@ -280,6 +308,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels var output = TangoColorConverter.GetSuggestions(input); + IsOutOfGamut = output.OutOfGamut; + HiveSuggestions = TangoColorConverter.CreateHiveSuggestions(output); }); } @@ -396,6 +426,17 @@ namespace Tango.MachineStudio.ColorLab.ViewModels try { if (LiquidsCalibrationData == null) return; + + //TODO: This is temporary because of out of range volumes. + if (LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > 200) + { + IsVolumesOutOfRange = true; + return; + } + else + { + IsVolumesOutOfRange = false; + } ConversionInput input = new ConversionInput(); input.ColorSpace = PMR.ColorLab.ColorSpace.Volume; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml index 8b62604d6..d8ef015be 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml @@ -26,6 +26,7 @@ + @@ -163,6 +164,12 @@ + + + + Color is out of gamut + + @@ -254,30 +261,39 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + @@ -286,11 +302,14 @@ COMPOSITE - - - - - + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index 0aa0af85a..60d433d99 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Wed 07/11/2018 11:23:32.16 +Wed 07/11/2018 16:02:40.40 diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Utils/Interp.cpp b/Software/Visual_Studio/Native/Tango.ColorLib/Utils/Interp.cpp index 7346a9898..68b7e0c93 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Utils/Interp.cpp +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Utils/Interp.cpp @@ -5,6 +5,7 @@ #include #include +#define epsTol 0.05 Interp::Interp(void) { } @@ -26,6 +27,15 @@ void Interp::Eval(double InValue, double &OutValue) int errType = 0; ind = -1; + //Check Bounds + if((InValuem_xValues[m_length - 1] + epsTol)) + throw std::exception("Value out of Bounds"); + if ((InValue > m_xValues[0] - epsTol) && (InValue < m_xValues[0])) + InValue = m_xValues[0]; + + if ((InValue > m_xValues[m_length - 1] ) && (InValue < m_xValues[m_length - 1]+ epsTol)) + InValue = m_xValues[m_length - 1]; + for (m = 0; m < m_length - 1; ++m) { if (m_xValues[m] <= InValue && m_xValues[m + 1] >= InValue) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/sample-dye.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/sample-dye.png new file mode 100644 index 000000000..f8989e19a Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/sample-dye.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 0163b77c2..aaf9fb453 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -311,5 +311,8 @@ + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index a111d3be2..6039dafb8 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -10,9 +10,10 @@ using Tango.PPC.Common.Navigation; namespace Tango.PPC.Jobs.ViewModels { - public class JobProgressViewVM : PPCViewModel, INavigationResultProvider + public class JobProgressViewVM : PPCViewModel { private Job _job; + public Job Job { get { return _job; } @@ -32,21 +33,21 @@ namespace Tango.PPC.Jobs.ViewModels } - public void OnNavigationObjectReceived(Job job) + public override void OnApplicationStarted() { - Job = job; - var jobHandler = ApplicationManager.ConnectedMachine.Print(Job, Adapter.ProcessParametersTables.First()); - jobHandler.StatusChanged += JobHandler_StatusChanged; + ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; } - public object GetNavigationResult() + private void ApplicationManager_ConnectedMachineChanged(object sender, IMachineOperator e) { - return null; + e.PrintingStarted -= PrintingStarted; + e.PrintingStarted += PrintingStarted; } - public override void OnApplicationStarted() + private void PrintingStarted(object sender, JobHandler jobHandler) { - + Job = jobHandler.Job; + jobHandler.StatusChanged += JobHandler_StatusChanged; } private void JobHandler_StatusChanged(object sender, RunningJobStatus e) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index a59b0fe27..12f2c9642 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -47,7 +47,8 @@ namespace Tango.PPC.Jobs.ViewModels private void StartJob() { - var result = NavigationManager.NavigateForResult(Job); + ApplicationManager.ConnectedMachine.Print(Job, Adapter.ProcessParametersTables.First()); + NavigationManager.NavigateTo(nameof(JobProgressView)); } public override void OnApplicationStarted() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 6b25d323f..82cfc3456 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -39,7 +39,6 @@ namespace Tango.PPC.Jobs.ViewModels #region Properties private Job _job; - /// /// Gets or sets the selected job. /// @@ -172,6 +171,16 @@ namespace Tango.PPC.Jobs.ViewModels /// public RelayCommand TwineCatalogFieldTapCommand { get; set; } + /// + /// Gets or sets the increase decrease samples to dye command. + /// + public RelayCommand IncreaseDecreaseSamplesToDyeCommand { get; set; } + + /// + /// Gets or sets the start sample dye command. + /// + public RelayCommand StartSampleDyeCommand { get; set; } + #endregion #region Constructors @@ -205,9 +214,22 @@ namespace Tango.PPC.Jobs.ViewModels SaveJobCommand = new RelayCommand(SaveJob); ReplaceBrushStopCommand = new RelayCommand(InvokeColorAdjustmentForBrushStop); TwineCatalogFieldTapCommand = new RelayCommand(InvokeTwineCatalogForBrushStop); + IncreaseDecreaseSamplesToDyeCommand = new RelayCommand((x) => + { + if (x == "+") + { + Job.SampleUnitsOrMeters++; + } + else + { + Job.SampleUnitsOrMeters--; + } + }); _check_gamut_thread = new Thread(CheckGamutThreadMethod); _check_gamut_thread.IsBackground = true; + + StartSampleDyeCommand = new RelayCommand(StartSampleDye); } #endregion @@ -390,6 +412,35 @@ namespace Tango.PPC.Jobs.ViewModels #endregion + #region Sample Dye + + /// + /// Starts a sample dye. + /// + private async void StartSampleDye() + { + Job sampleDyeJob = Job.Clone(); + sampleDyeJob.Name += " sample"; + + if (Job.JobType == BL.Enumerations.JobTypes.Embroidery) + { + sampleDyeJob.NumberOfUnits = Job.SampleUnitsOrMeters; + } + else + { + sampleDyeJob.NumberOfUnits = 1; + + foreach (var segment in sampleDyeJob.Segments) + { + segment.Length = Job.SampleUnitsOrMeters; + } + } + + await NavigationManager.NavigateForResult(sampleDyeJob); + } + + #endregion + #region Out Of Gamut Check Thread private void CheckGamutThreadMethod() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index ce7f7b528..43917fe55 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -538,7 +538,11 @@ - + + Additional Tools + + + + + + + + + Sample Dye + + + + + + Dye 1 or more units in order to get approval. + + Once approved, you can dye the entire job. + + + + How many sample units? + + + + + + + + + + START + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index c67e83fc6..8c112ff7a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -193,12 +193,12 @@ namespace Tango.PPC.UI.PPCApplication private async void ConnectToMachine() { - Transport.Discovery.UsbCommunicationScanner scanner = new Transport.Discovery.UsbCommunicationScanner(UsbSerialBaudRates.BR_9600); - var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, TimeSpan.FromSeconds(10)); + //Transport.Discovery.UsbCommunicationScanner scanner = new Transport.Discovery.UsbCommunicationScanner(UsbSerialBaudRates.BR_9600); + //var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, TimeSpan.FromSeconds(10)); - var machine = new MachineOperator(response.Adapter); - await machine.Connect(); - ConnectedMachine = machine; + //var machine = new MachineOperator(response.Adapter); + //await machine.Connect(); + //ConnectedMachine = machine; } } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareMotor.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareMotor.cs index 3104dfafd..cb7abbd64 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareMotor.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareMotor.cs @@ -23,7 +23,7 @@ namespace Tango.BL.Entities /// /// - /// + /// [Table("HARDWARE_MOTORS")] public partial class HardwareMotor : ObservableEntity @@ -584,8 +584,8 @@ namespace Tango.BL.Entities protected Int32 _fsspd; /// - ///The speed in which the motor moves to full step operation. - /// + /// The speed in which the motor moves to full step operation. + /// [Column("FS_SPD")] diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs index 15ac3d199..0adfe0b23 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs @@ -23,7 +23,7 @@ namespace Tango.BL.Entities /// /// - /// + /// [Table("JOBS")] public partial class Job : ObservableEntity @@ -433,13 +433,13 @@ namespace Tango.BL.Entities protected Int32 _status; /// - ///0 = Draft - ///1 = PendingApproval - ///2 = Ready - ///3 = Approved - ///4 = Disrupted - ///5 = Completed - /// + /// 0 = Draft + /// 1 = PendingApproval + /// 2 = Ready + /// 3 = Approved + /// 4 = Disrupted + /// 5 = Completed + /// [Column("STATUS")] @@ -505,9 +505,9 @@ namespace Tango.BL.Entities protected Int32 _type; /// - ///0 = Sewing - ///1 = Embroidery - /// + /// 0 = Sewing + /// 1 = Embroidery + /// [Column("TYPE")] @@ -551,9 +551,9 @@ namespace Tango.BL.Entities protected Int32 _spoolsdistribution; /// - ///0 = All segments per spool - ///1 = One segments per spool - /// + /// 0 = All segments per spool + /// 1 = One segments per spool + /// [Column("SPOOLS_DISTRIBUTION")] @@ -593,6 +593,28 @@ namespace Tango.BL.Entities } + protected Int32 _sampleunitsormeters; + + /// + /// Gets or sets the job sample units or meters. + /// + + [Column("SAMPLE_UNITS_OR_METERS")] + + public Int32 SampleUnitsOrMeters + { + get + { + return _sampleunitsormeters; + } + + set + { + _sampleunitsormeters = value; RaisePropertyChanged(nameof(SampleUnitsOrMeters)); + } + + } + protected ColorSpace _colorspace; /// diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs index ffe164a53..0f15ad060 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs @@ -80,5 +80,17 @@ public static class IEnumerableExtensions { return String.Join(separator, source); } + + /// + /// Returns a distinct collection by the specified property. + /// + /// + /// The source. + /// The property. + /// + public static IEnumerable DistinctBy(this IEnumerable source, Func property) + { + return source.GroupBy(property).Select(g => g.First()); + } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs index 433dacee4..109e876b5 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs @@ -49,6 +49,7 @@ namespace Tango.DAL.Remote.DB public string CUSTOMER_GUID { get; set; } public int SPOOLS_DISTRIBUTION { get; set; } public int NUMBER_OF_HEADS { get; set; } + public int SAMPLE_UNITS_OR_METERS { get; set; } public virtual COLOR_SPACES COLOR_SPACES { get; set; } public virtual CUSTOMER CUSTOMER { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 7f17f8940..9030a9f0b 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -582,6 +582,7 @@ + @@ -3397,6 +3398,7 @@ + @@ -5462,6 +5464,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 668abf151..305fe3ebd 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,78 +5,78 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - + + + + + - - - - + + + + - - - - - - - - + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index c45701e99..aee5fae26 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -70,7 +70,7 @@ namespace Tango.Touch.Controls set { SetValue(MinimumProperty, value); } } public static readonly DependencyProperty MinimumProperty = - DependencyProperty.Register("Minimum", typeof(double), typeof(TouchNumericTextBox), new PropertyMetadata(.0)); + DependencyProperty.Register("Minimum", typeof(double), typeof(TouchNumericTextBox), new PropertyMetadata(0.0)); public double Maximum { @@ -108,6 +108,8 @@ namespace Tango.Touch.Controls _text_box.GotFocus += _text_box_GotFocus; _text_box.TextChanged += _text_box_TextChanged; + Value = Value; + OnValueChanged(); } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleButton.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleButton.cs index 8187645ca..f24d716db 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleButton.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleButton.cs @@ -19,6 +19,8 @@ namespace Tango.Touch.Controls public class TouchToggleButton : ToggleButton, ITouchControl { private Object _uncheckedContent; + private bool _loaded; + private bool first_checked; #region ITouchControl @@ -91,8 +93,33 @@ namespace Tango.Touch.Controls public TouchToggleButton() { - Loaded += (_, __) => _uncheckedContent = Content; - Checked += (_, __) => Content = CheckedContent != null ? CheckedContent : Content; + Loaded += (_, __) => + { + if (!_loaded) + { + _uncheckedContent = Content; + _loaded = true; + } + }; + + Checked += (_, __) => + { + if (_loaded) + { + Content = CheckedContent != null ? CheckedContent : Content; + } + else + { + Loaded += (x, y) => + { + if (!first_checked) + { + Content = CheckedContent != null ? CheckedContent : Content; + first_checked = true; + } + }; + } + }; Unchecked += (_, __) => Content = _uncheckedContent; } } diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/App.xaml b/Software/Visual_Studio/Utilities/Tango.UITests/App.xaml index 0ede32b42..43576481f 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/App.xaml +++ b/Software/Visual_Studio/Utilities/Tango.UITests/App.xaml @@ -6,20 +6,20 @@ StartupUri="MainWindow.xaml"> - - + + --> diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml index 05bcad25c..6f821d30f 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml @@ -16,6 +16,6 @@ Title="MainWindow" Height="500" Width="800" Foreground="Red" DataContext="{Binding RelativeSource={RelativeSource Self}}"> - + diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs index 06613ee1e..c3eca4c76 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs @@ -110,6 +110,14 @@ namespace Tango.UITests public RelayCommand DropCommand { get; set; } + public int Value + { + get { return (int)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register("Value", typeof(int), typeof(MainWindow), new PropertyMetadata(0)); + public MainWindow() { Persons = new ObservableCollection(); @@ -127,9 +135,11 @@ namespace Tango.UITests DropCommand = new RelayCommand(OnDrop); + Value = 10; + InitializeComponent(); - DataContext = new VM(); + //DataContext = new VM(); } private void OnDrop(DropEventArgs e) -- cgit v1.3.1