diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-11-14 14:30:42 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-11-14 14:30:42 +0200 |
| commit | 7d9ab3b87aed944167d77244b00fbdd4224725e2 (patch) | |
| tree | 9a2a56059a0332182a7ecf4aa4237eae132f97f7 | |
| parent | c19568d8dc2677fe8dd57d55a737535c718f52f5 (diff) | |
| download | Tango-7d9ab3b87aed944167d77244b00fbdd4224725e2.tar.gz Tango-7d9ab3b87aed944167d77244b00fbdd4224725e2.zip | |
Added support for SMS notifications on TS & X4.
24 files changed, 336 insertions, 11 deletions
diff --git a/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj b/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj index f7cf513c6..24a69a82f 100644 --- a/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj +++ b/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj @@ -61,6 +61,7 @@ <Content Include="PPC\Touch.txt" /> <Content Include="TCC\Play Console.txt" /> <Content Include="TeamViewer\License.txt" /> + <Content Include="Twilio\Twilio.txt" /> <Content Include="VMWare\Custom Resolution.txt" /> <Content Include="VMWare\License Key.txt" /> <Content Include="SciChart\License.txt" /> @@ -70,7 +71,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Notes/Tango.Notes/Twilio/Twilio.txt b/Software/Visual_Studio/Notes/Tango.Notes/Twilio/Twilio.txt new file mode 100644 index 000000000..a84bb902c --- /dev/null +++ b/Software/Visual_Studio/Notes/Tango.Notes/Twilio/Twilio.txt @@ -0,0 +1,8 @@ +User: roy@twine-s.com +Password: Baxp55Ff4Yp425w1 +Recovery Code: Y3Z6YF73G6HE3VFY5LRSCALK +Account Name: Twine +Account SID: AC05c701c7c282134811f96a120119ac34 +Auth Token: e2c4cd2c0d431ed64f5c9832c1322096 +API SID: SK92f80e67f9f5b3b80318c6fbe704b330 +API Secret: SiPL4vpjvnhdVcc0KfIXWbNp7a3EgrMS
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 694658be6..5a08c5cd1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -386,6 +386,28 @@ </StackPanel> </touch:TouchExpander> + <!--SMS--> + <touch:TouchExpander Margin="0 20 0 0" Header="SMS Notifications" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> + <StackPanel> + <controls:TableGrid Margin="10" RowHeight="60" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable Notifications</TextBlock> + <touch:TouchToggleSlider x:Name="chkEnableSMS" IsChecked="{Binding Settings.SMSNotificationSettings.Enable}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"/> + + <TextBlock VerticalAlignment="Center">Notify When Job Completes</TextBlock> + <touch:TouchToggleSlider IsEnabled="{Binding ElementName=chkEnableSMS,Path=IsChecked}" Style="{StaticResource TouchToggleDisabledGray}" IsChecked="{Binding Settings.SMSNotificationSettings.SendWhenJobCompletes}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"/> + + <TextBlock VerticalAlignment="Center">Notify When Job Fails</TextBlock> + <touch:TouchToggleSlider IsEnabled="{Binding ElementName=chkEnableSMS,Path=IsChecked}" Style="{StaticResource TouchToggleDisabledGray}" IsChecked="{Binding Settings.SMSNotificationSettings.SendWhenJobFails}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"/> + + <TextBlock VerticalAlignment="Bottom">Minimum meters for notification</TextBlock> + <touch:TouchNumericTextBox IsEnabled="{Binding ElementName=chkEnableSMS,Path=IsChecked}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="1" Maximum="60" Value="{Binding Settings.SMSNotificationSettings.MinimumNotificationMeters}" HasDecimalPoint="False" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox> + </controls:TableGrid> + + <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" ><Run>Phone Numbers</Run> <Run FontSize="12" Foreground="{StaticResource TangoGrayTextBrush}"> (comma separated)</Run></TextBlock> + <touch:TouchMultiLineTextBox IsEnabled="{Binding ElementName=chkEnableSMS,Path=IsChecked}" Height="80" Text="{Binding Settings.SMSNotificationSettings.Numbers}" FontSize="16" CaretBrush="Black"></touch:TouchMultiLineTextBox> + </StackPanel> + </touch:TouchExpander> + <!--TECHNICIAN--> <touch:TouchExpander Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 20 0 0" Header="Advanced" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 98f8f27fd..da39b40ec 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -11,6 +11,7 @@ using Tango.Logging; using Tango.PMR.Integration; using Tango.PMR.Printing; using Tango.PPC.Common.Lubrication; +using Tango.PPC.Common.SMS; using Tango.Settings; using Tango.Transport.Adapters; using Tango.Web; @@ -413,6 +414,11 @@ namespace Tango.PPC.Common public bool EnableJerricanChangePopup { get; set; } /// <summary> + /// Gets or sets the SMS notification settings. + /// </summary> + public SMSNotificationSettings SMSNotificationSettings { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="PPCSettings"/> class. /// </summary> public PPCSettings() @@ -481,6 +487,8 @@ namespace Tango.PPC.Common ScreenSaverStartDuration = 5; EnableScreenSaver = true; EnableRemoteJobUpload = true; + + SMSNotificationSettings = new SMSNotificationSettings(); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs index 7064a48e1..436b82d01 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs @@ -21,6 +21,7 @@ using Tango.PPC.Common.RemoteAssistance; using Tango.PPC.Common.RemoteDesktop; using Tango.PPC.Common.RemoteJobUpload; using Tango.PPC.Common.Resume; +using Tango.PPC.Common.SMS; using Tango.PPC.Common.Storage; using Tango.PPC.Common.Synchronization; using Tango.PPC.Common.ThreadLoading; @@ -149,6 +150,9 @@ namespace Tango.PPC.Common [TangoInject] public IJobResumeManager JobResumeManager { get; set; } + [TangoInject] + public ISMSNotificationProvider SMSNotificationProvider { get; set; } + private PPCSettings _settings; /// <summary> /// Gets the main PPC settings. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/SMS/DefaultSMSNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/SMS/DefaultSMSNotificationProvider.cs new file mode 100644 index 000000000..0b810bb52 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/SMS/DefaultSMSNotificationProvider.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.DI; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; +using Tango.PPC.Common.Threading; +using Tango.PPC.Common.Web; +using Tango.Settings; + +namespace Tango.PPC.Common.SMS +{ + [TangoCreateWhenRegistered] + public class DefaultSMSNotificationProvider : ExtendedObject, ISMSNotificationProvider + { + private PPCWebClient _webClient; + private IMachineProvider _machineProvider; + private PPCSettings _settings; + + public DefaultSMSNotificationProvider(PPCWebClient ppcWebClient, IMachineProvider machineProvider) + { + _webClient = ppcWebClient; + _machineProvider = machineProvider; + _settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + _machineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted; + _machineProvider.MachineOperator.PrintingFailed += MachineOperator_PrintingFailed; + } + + private async void MachineOperator_PrintingFailed(object sender, Integration.Operation.PrintingFailedEventArgs e) + { + if (_settings.SMSNotificationSettings.Enable && _settings.SMSNotificationSettings.SendWhenJobFails) + { + if (e.Job.Designation == BL.Enumerations.JobDesignations.Default) + { + try + { + await SendMessage($"Job '{e.Job.Name}' failed at position {Math.Round(e.JobHandler.Status.ProgressMinusSettingUp, 1)}\n{e.Exception.Message}."); + } + catch { } + } + } + } + + private async void MachineOperator_PrintingCompleted(object sender, Integration.Operation.PrintingEventArgs e) + { + if (_settings.SMSNotificationSettings.Enable && _settings.SMSNotificationSettings.SendWhenJobCompletes) + { + if (e.Job.Designation == BL.Enumerations.JobDesignations.Default) + { + try + { + await SendMessage($"Job '{e.Job.Name}' has completed successfully."); + } + catch { } + } + } + } + + public Task SendMessage(string message) + { + return SendMessage(ParsePhoneNumbers(_settings.SMSNotificationSettings.Numbers), message); + } + + public async Task SendMessage(List<string> numbers, string message) + { + try + { + LogManager.Log($"Sending SMS notification..."); + if (numbers.Count > 0) + { + await _webClient.SendSMS(new SendSMSRequest() { PhoneNumbers = numbers, Message = message }); + LogManager.Log($"SMS notification sent successfully..."); + } + else + { + throw new ArgumentOutOfRangeException("No phone numbers defined."); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error sending SMS."); + throw ex; + } + } + + public static List<String> ParsePhoneNumbers(String phoneNumbers) + { + if (phoneNumbers.Contains(",")) + { + return phoneNumbers.Split(',').Select(x => x.Trim(' ', '\n')).Where(x => x.IsNotNullOrEmpty()).ToList(); + } + else if (phoneNumbers.IsNotNullOrEmpty()) + { + return new List<string>() { phoneNumbers }; + } + else + { + return new List<string>(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/SMS/ISMSNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/SMS/ISMSNotificationProvider.cs new file mode 100644 index 000000000..927a3e602 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/SMS/ISMSNotificationProvider.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.SMS +{ + public interface ISMSNotificationProvider + { + Task SendMessage(List<String> numbers, String message); + Task SendMessage(String message); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/SMS/SMSNotificationSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/SMS/SMSNotificationSettings.cs new file mode 100644 index 000000000..77d31974d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/SMS/SMSNotificationSettings.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.SMS +{ + public class SMSNotificationSettings + { + public bool Enable { get; set; } + + public String Numbers { get; set; } + + public bool SendWhenJobCompletes { get; set; } + + public bool SendWhenJobFails { get; set; } + + public int MinimumNotificationMeters { get; set; } + + public SMSNotificationSettings() + { + SendWhenJobCompletes = true; + SendWhenJobFails = true; + MinimumNotificationMeters = 100; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 08ad6ec1c..f3e7d4e5e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -232,6 +232,9 @@ <Compile Include="Resume\JobResumeDroppedEventArgs.cs" /> <Compile Include="Resume\JobResumeModel.cs" /> <Compile Include="Resume\JobResumeUpdatedEventArgs.cs" /> + <Compile Include="SMS\DefaultSMSNotificationProvider.cs" /> + <Compile Include="SMS\ISMSNotificationProvider.cs" /> + <Compile Include="SMS\SMSNotificationSettings.cs" /> <Compile Include="SQL\DefaultRemoteSqlService.cs" /> <Compile Include="SQL\IRemoteSqlService.cs" /> <Compile Include="Statistics\DefaultStatisticsService.cs" /> @@ -261,6 +264,8 @@ <Compile Include="Publish\SequenceItem.cs" /> <Compile Include="Publish\SynchronizationOptions.cs" /> <Compile Include="UWF\AlternativeUnifiedWriteFilterManager.cs" /> + <Compile Include="Web\SendSMSResponse.cs" /> + <Compile Include="Web\SendSMSRequest.cs" /> <Compile Include="Web\CheckForUpdateRequest.cs" /> <Compile Include="Web\CheckForUpdateResponse.cs" /> <Compile Include="MachineUpdate\DbCompareResult.cs" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/PPCWebClientBase.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/PPCWebClientBase.cs index 35150a9d6..0363285f8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/PPCWebClientBase.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/PPCWebClientBase.cs @@ -122,6 +122,15 @@ namespace Tango.PPC.Common.Web } /// <summary> + /// Executes the SendSMS action and returns Tango.PPC.Common.Web.SendSMSResponse. + /// </summary> + /// <returns></returns> + public Task<Tango.PPC.Common.Web.SendSMSResponse> SendSMS(Tango.PPC.Common.Web.SendSMSRequest request) + { + return Post<Tango.PPC.Common.Web.SendSMSRequest, Tango.PPC.Common.Web.SendSMSResponse>("SendSMS", request); + } + + /// <summary> /// Executes the GetLatestVersion action and returns Tango.PPC.Common.Web.LatestVersionResponse. /// </summary> /// <returns></returns> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/SendSMSRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/SendSMSRequest.cs new file mode 100644 index 000000000..ff07e9540 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/SendSMSRequest.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.Web +{ + public class SendSMSRequest : WebRequestMessage + { + public List<String> PhoneNumbers { get; set; } + + public String Message { get; set; } + + public SendSMSRequest() + { + PhoneNumbers = new List<string>(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/SendSMSResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/SendSMSResponse.cs new file mode 100644 index 000000000..28c983911 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/SendSMSResponse.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.Web +{ + public class SendSMSResponse : WebResponseMessage + { + + } +} 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 0f65f833e..ca20fe608 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -39,6 +39,8 @@ using System.Threading; using System.Reflection; using Tango.PPC.UI.ViewsContracts; using Tango.PPC.Common.Build; +using Tango.Core.Components; +using static Tango.Core.Components.CmdCommand; namespace Tango.PPC.UI.PPCApplication { @@ -265,6 +267,22 @@ namespace Tango.PPC.UI.PPCApplication { _watchdogServer.Start(); } + + Task.Factory.StartNew(async () => + { + try + { + LogManager.Log("Disabling Proxy..."); + CmdCommand cmd = null; + CmdCommandResult result = null; + cmd = new CmdCommand("taskkill", "/F /IM proxifier.exe"); + result = await cmd.Run(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Unable to disable the proxy.\n{ex.Message}"); + } + }); #endif LogManager.Log("Reading Core settings..."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 35620b261..c920fdbad 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -1004,7 +1004,7 @@ if $(ConfigurationName) == Eureka copy /Y "$(ProjectDir)Intro.wmv" "$(TargetDir) </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> <Import Project="..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets" Condition="Exists('..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets')" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 4d8a4d465..340ecb13e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -34,6 +34,7 @@ using Tango.PPC.Common.RemoteJob; using Tango.PPC.Common.RemoteJobUpload; using Tango.PPC.Common.RemoteNotifications; using Tango.PPC.Common.Resume; +using Tango.PPC.Common.SMS; using Tango.PPC.Common.SQL; using Tango.PPC.Common.Statistics; using Tango.PPC.Common.Storage; @@ -116,6 +117,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister<IRemoteJobUploadService>(); TangoIOC.Default.Unregister<IStatisticsService>(); TangoIOC.Default.Unregister<IJobResumeManager>(); + TangoIOC.Default.Unregister<ISMSNotificationProvider>(); if (App.StartupArgs != null && App.StartupArgs.Contains("-webDebug")) { @@ -172,6 +174,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<IRemoteJobUploadService, DefaultRemoteJobUploadService>(); TangoIOC.Default.Register<IStatisticsService, DefaultStatisticsService>(); TangoIOC.Default.Register<IJobResumeManager, DefaultJobResumeManager>(); + TangoIOC.Default.Register<ISMSNotificationProvider, DefaultSMSNotificationProvider>(); TangoIOC.Default.Register<LoadingViewVM>(); TangoIOC.Default.Register<MainViewVM>(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.xaml index 66328ea2d..81b4a3351 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleSlider.xaml @@ -85,7 +85,28 @@ </Setter> </Style> - <Style x:Key="TouchToggleButtonCheck" TargetType="{x:Type local:TouchToggleSlider}" BasedOn="{StaticResource {x:Type local:TouchToggleSlider}}"> + <Style x:Key="TouchToggleDisabledGray" TargetType="{x:Type local:TouchToggleSlider}" BasedOn="{StaticResource {x:Type local:TouchToggleSlider}}"> + <Style.Triggers> + <Trigger Property="IsChecked" Value="True"> + <Setter Property="BorderBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + <Setter Property="ThumbBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </Trigger> + <Trigger Property="IsChecked" Value="False"> + <Setter Property="BorderBrush" Value="{StaticResource TangoGrayBrush}" /> + <Setter Property="ThumbBrush" Value="{StaticResource TangoGrayBrush}" /> + </Trigger> + <Trigger Property="IsEnabled" Value="True"> + <Setter Property="BorderBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + <Setter Property="ThumbBrush" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </Trigger> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="BorderBrush" Value="{StaticResource TangoGrayBrush}" /> + <Setter Property="ThumbBrush" Value="{StaticResource TangoGrayBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + + <Style x:Key="TouchToggleButtonCheck" TargetType="{x:Type local:TouchToggleSlider}" BasedOn="{StaticResource {x:Type local:TouchToggleSlider}}"> <Setter Property="BorderThickness" Value="0"></Setter> <Setter Property="UncheckedBackground" Value="{StaticResource TangoGrayBrush}"></Setter> <Setter Property="CheckedBackground" Value="{StaticResource TangoGreenBrush}"></Setter> diff --git a/Software/Visual_Studio/Utilities/Tango.WebClientGenerator/App.config b/Software/Visual_Studio/Utilities/Tango.WebClientGenerator/App.config index d16ea39e7..f52bb32ea 100644 --- a/Software/Visual_Studio/Utilities/Tango.WebClientGenerator/App.config +++ b/Software/Visual_Studio/Utilities/Tango.WebClientGenerator/App.config @@ -27,7 +27,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" /> + <bindingRedirect oldVersion="0.0.0.0-5.0.5.0" newVersion="5.0.5.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> @@ -85,6 +85,10 @@ <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 06b2fd232..d8f514c42 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -25,6 +25,9 @@ using Tango.Core.Cryptography; using Tango.MachineService.Filters; using Tango.BL.DTO; using Z.EntityFramework.Plus; +using Twilio; +using Twilio.Rest.Api.V2010.Account; +using Twilio.Types; namespace Tango.MachineService.Controllers { @@ -48,6 +51,7 @@ namespace Tango.MachineService.Controllers { _pendingUploads = new List<PPCPendingUpload>(); _pendingUpdates = new List<PPCPendingUpdate>(); + TwilioClient.Init(MachineServiceConfig.TWILIO_ACCOUNT_SID, MachineServiceConfig.TWILIO_AUTH_TOKEN); } public PPCController() @@ -830,6 +834,27 @@ namespace Tango.MachineService.Controllers #endregion + #region SMS + + [HttpPost] + [JwtTokenFilter] + public SendSMSResponse SendSMS(SendSMSRequest request) + { + var response = new SendSMSResponse(); + + if (MachineServiceConfig.TWILIO_ENABLE_SMS) + { + foreach (var phone in request.PhoneNumbers) + { + MessageResource.Create(from: MachineServiceConfig.TWILIO_FROM_NUMBER, to: new PhoneNumber(phone), body: request.Message); + } + } + + return response; + } + + #endregion + #region Version Upload [HttpPost] diff --git a/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs b/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs index bdddbab8f..e8240fd46 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs @@ -25,5 +25,10 @@ namespace Tango.MachineService public static String FSE_TFS_USER_EMAIL => ConfigurationManager.AppSettings[nameof(FSE_TFS_USER_EMAIL)].ToString(); public static String SEND_GRID_API_KEY => ConfigurationManager.AppSettings[nameof(SEND_GRID_API_KEY)].ToString(); + + public static bool TWILIO_ENABLE_SMS => bool.Parse(ConfigurationManager.AppSettings[nameof(TWILIO_ENABLE_SMS)].ToString()); + public static String TWILIO_ACCOUNT_SID => ConfigurationManager.AppSettings[nameof(TWILIO_ACCOUNT_SID)].ToString(); + public static String TWILIO_AUTH_TOKEN => ConfigurationManager.AppSettings[nameof(TWILIO_AUTH_TOKEN)].ToString(); + public static String TWILIO_FROM_NUMBER => ConfigurationManager.AppSettings[nameof(TWILIO_FROM_NUMBER)].ToString(); } }
\ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs index 131483550..5faac7b11 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs @@ -24,4 +24,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.22.0")] +[assembly: AssemblyVersion("3.0.23.0")] diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj index 3cb22c5b1..e011cf63c 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj +++ b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj @@ -182,8 +182,8 @@ <HintPath>..\..\packages\Microsoft.SqlServer.SqlManagementObjects.140.17283.0\lib\net40\Microsoft.SqlServer.WmiEnum.dll</HintPath> </Reference> <Reference Include="Microsoft.WindowsAzure.Storage, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> - <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> - <HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> + <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> <Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL"> <HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath> @@ -269,6 +269,9 @@ <HintPath>..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath> </Reference> <Reference Include="System.Xml.Linq" /> + <Reference Include="Twilio, Version=7.6.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Twilio.7.6.0\lib\net35\Twilio.dll</HintPath> + </Reference> <Reference Include="WebGrease"> <Private>True</Private> <HintPath>..\..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> @@ -507,7 +510,7 @@ <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> </WebProjectProperties> </FlavorProperties> - <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> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Web.config b/Software/Visual_Studio/Web/Tango.MachineService/Web.config index 54cb322d9..8cc11ebb5 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Web.config +++ b/Software/Visual_Studio/Web/Tango.MachineService/Web.config @@ -38,6 +38,11 @@ <add key="FSE_TFS_USER_EMAIL" value="fse@twine-s.com" /> <add key="SEND_GRID_API_KEY" value="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" /> + + <add key="TWILIO_ACCOUNT_SID" value="AC05c701c7c282134811f96a120119ac34" /> + <add key="TWILIO_AUTH_TOKEN" value="e2c4cd2c0d431ed64f5c9832c1322096" /> + <add key="TWILIO_FROM_NUMBER" value="+16466815605" /> + <add key="TWILIO_ENABLE_SMS" value="true" /> </appSettings> <!-- For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367. @@ -90,7 +95,7 @@ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> - <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /> diff --git a/Software/Visual_Studio/Web/Tango.MachineService/packages.config b/Software/Visual_Studio/Web/Tango.MachineService/packages.config index f2f83d078..ff05c3063 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/packages.config +++ b/Software/Visual_Studio/Web/Tango.MachineService/packages.config @@ -36,13 +36,14 @@ <package id="Microsoft.SqlServer.SqlManagementObjects" version="140.17283.0" targetFramework="net461" /> <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" /> <package id="Modernizr" version="2.6.2" targetFramework="net45" /> - <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" /> + <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" /> <package id="Owin" version="1.0" targetFramework="net461" /> <package id="Respond" version="1.2.0" targetFramework="net45" /> <package id="System.Data.SQLite" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.EF6" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.Linq" version="1.0.108.0" targetFramework="net46" /> + <package id="Twilio" version="7.6.0" targetFramework="net461" /> <package id="WebGrease" version="1.5.2" targetFramework="net45" /> <package id="Z.EntityFramework.Extensions" version="5.1.6" targetFramework="net461" /> <package id="Z.EntityFramework.Plus.EF6" version="5.1.6" targetFramework="net461" /> |
