diff options
96 files changed, 1650 insertions, 137 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 79d6f7e2a..fa3574dc5 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex bb32c6e47..553558665 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Graphics/job-emb.png b/Software/Graphics/job-emb.png Binary files differnew file mode 100644 index 000000000..15f9c73bb --- /dev/null +++ b/Software/Graphics/job-emb.png diff --git a/Software/Graphics/sewing-machine-circle.png b/Software/Graphics/sewing-machine-circle.png Binary files differnew file mode 100644 index 000000000..24f104a14 --- /dev/null +++ b/Software/Graphics/sewing-machine-circle.png diff --git a/Software/PMR/Messages/Embroidery/ConvertFileInput.proto b/Software/PMR/Messages/Embroidery/ConvertFileInput.proto new file mode 100644 index 000000000..65f30cdc6 --- /dev/null +++ b/Software/PMR/Messages/Embroidery/ConvertFileInput.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package Tango.PMR.Embroidery; +option java_package = "com.twine.tango.pmr.embroidery"; + +message ConvertFileInput +{ + string SourceFile = 1; + string TargetFile = 2; +} diff --git a/Software/PMR/Messages/Embroidery/ConvertFileOutput.proto b/Software/PMR/Messages/Embroidery/ConvertFileOutput.proto new file mode 100644 index 000000000..b52f5f1c3 --- /dev/null +++ b/Software/PMR/Messages/Embroidery/ConvertFileOutput.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Embroidery; +option java_package = "com.twine.tango.pmr.embroidery"; + +message ConvertFileOutput +{ + bool Successful = 1; +} diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp index 55eba8a93..3c68c0b57 100644 --- a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.cpp @@ -7,6 +7,8 @@ #include "PMR\Embroidery\StitchFlag.pb-c.h" #include "PMR\Embroidery\StitchColor.pb-c.h" #include "PMR\Embroidery\Extents.pb-c.h" +#include "PMR\Embroidery\ConvertFileInput.pb-c.h" +#include "PMR\Embroidery\ConvertFileOutput.pb-c.h" @@ -93,3 +95,33 @@ size_t Adapter::AnalyzeEmbroideryFile(uint8_t * input_buffer, size_t input_buffe return analyze_output__pack(output, output_buffer); } + +size_t Adapter::ConvertFile(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer) +{ + //Unpack input... + ConvertFileInput *input = convert_file_input__unpack(NULL, input_buffer_size, input_buffer); + + //Initialize Output... + ConvertFileOutput* output = (ConvertFileOutput*)malloc(sizeof(ConvertFileOutput)); + convert_file_output__init(output); + + EmbPattern* p = 0; + int successful = 0; + + output->has_successful = true; + + p = embPattern_create(); + + output->successful = embPattern_read(p, input->sourcefile); + + if (output->successful) + { + output->successful = embPattern_write(p, input->targetfile); + embPattern_free(p); + } + + //Pack output... + output_buffer = (uint8_t*)malloc(convert_file_output__get_packed_size(output)); + + return convert_file_output__pack(output, output_buffer); +} diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.h b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.h index 9b4de128a..fe5149952 100644 --- a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.h +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Adapter.h @@ -6,7 +6,11 @@ class Adapter { public: Adapter(); + ~Adapter(); + size_t AnalyzeEmbroideryFile(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer); + + size_t ConvertFile(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer); }; diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Exports.cpp b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Exports.cpp index ba4ed6cbb..841a6adf4 100644 --- a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Exports.cpp +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Exports.cpp @@ -13,3 +13,9 @@ extern "C" EXPORT_API size_t __cdecl AnalyzeEmbroideryFile(uint8_t* input_buffer return adapter.AnalyzeEmbroideryFile(input_buffer, input_buffer_size, output_buffer); } +extern "C" EXPORT_API size_t __cdecl ConvertFile(uint8_t* input_buffer, size_t input_buffer_size, uint8_t*& output_buffer) +{ + Adapter adapter; + return adapter.ConvertFile(input_buffer, input_buffer_size, output_buffer); +} + diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileInput.pb-c.c b/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileInput.pb-c.c new file mode 100644 index 000000000..7bc45b2cf --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileInput.pb-c.c @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ConvertFileInput.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "ConvertFileInput.pb-c.h" +void convert_file_input__init + (ConvertFileInput *message) +{ + static const ConvertFileInput init_value = CONVERT_FILE_INPUT__INIT; + *message = init_value; +} +size_t convert_file_input__get_packed_size + (const ConvertFileInput *message) +{ + assert(message->base.descriptor == &convert_file_input__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t convert_file_input__pack + (const ConvertFileInput *message, + uint8_t *out) +{ + assert(message->base.descriptor == &convert_file_input__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t convert_file_input__pack_to_buffer + (const ConvertFileInput *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &convert_file_input__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ConvertFileInput * + convert_file_input__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ConvertFileInput *) + protobuf_c_message_unpack (&convert_file_input__descriptor, + allocator, len, data); +} +void convert_file_input__free_unpacked + (ConvertFileInput *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &convert_file_input__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor convert_file_input__field_descriptors[2] = +{ + { + "SourceFile", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ConvertFileInput, sourcefile), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TargetFile", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ConvertFileInput, targetfile), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned convert_file_input__field_indices_by_name[] = { + 0, /* field[0] = SourceFile */ + 1, /* field[1] = TargetFile */ +}; +static const ProtobufCIntRange convert_file_input__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor convert_file_input__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ConvertFileInput", + "ConvertFileInput", + "ConvertFileInput", + "", + sizeof(ConvertFileInput), + 2, + convert_file_input__field_descriptors, + convert_file_input__field_indices_by_name, + 1, convert_file_input__number_ranges, + (ProtobufCMessageInit) convert_file_input__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileInput.pb-c.h b/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileInput.pb-c.h new file mode 100644 index 000000000..085ba2129 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileInput.pb-c.h @@ -0,0 +1,72 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ConvertFileInput.proto */ + +#ifndef PROTOBUF_C_ConvertFileInput_2eproto__INCLUDED +#define PROTOBUF_C_ConvertFileInput_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _ConvertFileInput ConvertFileInput; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _ConvertFileInput +{ + ProtobufCMessage base; + char *sourcefile; + char *targetfile; +}; +#define CONVERT_FILE_INPUT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&convert_file_input__descriptor) \ + , NULL, NULL } + + +/* ConvertFileInput methods */ +void convert_file_input__init + (ConvertFileInput *message); +size_t convert_file_input__get_packed_size + (const ConvertFileInput *message); +size_t convert_file_input__pack + (const ConvertFileInput *message, + uint8_t *out); +size_t convert_file_input__pack_to_buffer + (const ConvertFileInput *message, + ProtobufCBuffer *buffer); +ConvertFileInput * + convert_file_input__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void convert_file_input__free_unpacked + (ConvertFileInput *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*ConvertFileInput_Closure) + (const ConvertFileInput *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor convert_file_input__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_ConvertFileInput_2eproto__INCLUDED */ diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileOutput.pb-c.c b/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileOutput.pb-c.c new file mode 100644 index 000000000..01121784f --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileOutput.pb-c.c @@ -0,0 +1,92 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ConvertFileOutput.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "ConvertFileOutput.pb-c.h" +void convert_file_output__init + (ConvertFileOutput *message) +{ + static const ConvertFileOutput init_value = CONVERT_FILE_OUTPUT__INIT; + *message = init_value; +} +size_t convert_file_output__get_packed_size + (const ConvertFileOutput *message) +{ + assert(message->base.descriptor == &convert_file_output__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t convert_file_output__pack + (const ConvertFileOutput *message, + uint8_t *out) +{ + assert(message->base.descriptor == &convert_file_output__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t convert_file_output__pack_to_buffer + (const ConvertFileOutput *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &convert_file_output__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ConvertFileOutput * + convert_file_output__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ConvertFileOutput *) + protobuf_c_message_unpack (&convert_file_output__descriptor, + allocator, len, data); +} +void convert_file_output__free_unpacked + (ConvertFileOutput *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &convert_file_output__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor convert_file_output__field_descriptors[1] = +{ + { + "Successful", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(ConvertFileOutput, has_successful), + offsetof(ConvertFileOutput, successful), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned convert_file_output__field_indices_by_name[] = { + 0, /* field[0] = Successful */ +}; +static const ProtobufCIntRange convert_file_output__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor convert_file_output__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ConvertFileOutput", + "ConvertFileOutput", + "ConvertFileOutput", + "", + sizeof(ConvertFileOutput), + 1, + convert_file_output__field_descriptors, + convert_file_output__field_indices_by_name, + 1, convert_file_output__number_ranges, + (ProtobufCMessageInit) convert_file_output__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileOutput.pb-c.h b/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileOutput.pb-c.h new file mode 100644 index 000000000..c3714ce09 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/PMR/Embroidery/ConvertFileOutput.pb-c.h @@ -0,0 +1,72 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ConvertFileOutput.proto */ + +#ifndef PROTOBUF_C_ConvertFileOutput_2eproto__INCLUDED +#define PROTOBUF_C_ConvertFileOutput_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _ConvertFileOutput ConvertFileOutput; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _ConvertFileOutput +{ + ProtobufCMessage base; + protobuf_c_boolean has_successful; + protobuf_c_boolean successful; +}; +#define CONVERT_FILE_OUTPUT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&convert_file_output__descriptor) \ + , 0, 0 } + + +/* ConvertFileOutput methods */ +void convert_file_output__init + (ConvertFileOutput *message); +size_t convert_file_output__get_packed_size + (const ConvertFileOutput *message); +size_t convert_file_output__pack + (const ConvertFileOutput *message, + uint8_t *out); +size_t convert_file_output__pack_to_buffer + (const ConvertFileOutput *message, + ProtobufCBuffer *buffer); +ConvertFileOutput * + convert_file_output__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void convert_file_output__free_unpacked + (ConvertFileOutput *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*ConvertFileOutput_Closure) + (const ConvertFileOutput *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor convert_file_output__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_ConvertFileOutput_2eproto__INCLUDED */ diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Tango.Embroidery.vcxproj b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Tango.Embroidery.vcxproj index a1b46dae7..691cefcdc 100644 --- a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Tango.Embroidery.vcxproj +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Tango.Embroidery.vcxproj @@ -148,6 +148,8 @@ <ClInclude Include="Adapter.h" /> <ClInclude Include="PMR\Embroidery\AnalyzeInput.pb-c.h" /> <ClInclude Include="PMR\Embroidery\AnalyzeOutput.pb-c.h" /> + <ClInclude Include="PMR\Embroidery\ConvertFileInput.pb-c.h" /> + <ClInclude Include="PMR\Embroidery\ConvertFileOutput.pb-c.h" /> <ClInclude Include="PMR\Embroidery\EmbroideryFile.pb-c.h" /> <ClInclude Include="PMR\Embroidery\Extents.pb-c.h" /> <ClInclude Include="PMR\Embroidery\Stitch.pb-c.h" /> @@ -161,6 +163,8 @@ <ClCompile Include="Exports.cpp" /> <ClCompile Include="PMR\Embroidery\AnalyzeInput.pb-c.c" /> <ClCompile Include="PMR\Embroidery\AnalyzeOutput.pb-c.c" /> + <ClCompile Include="PMR\Embroidery\ConvertFileInput.pb-c.c" /> + <ClCompile Include="PMR\Embroidery\ConvertFileOutput.pb-c.c" /> <ClCompile Include="PMR\Embroidery\EmbroideryFile.pb-c.c" /> <ClCompile Include="PMR\Embroidery\Extents.pb-c.c" /> <ClCompile Include="PMR\Embroidery\Stitch.pb-c.c" /> diff --git a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Tango.Embroidery.vcxproj.filters b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Tango.Embroidery.vcxproj.filters index 22880e107..1a925e6e7 100644 --- a/Software/Visual_Studio/Embroidery/Tango.Embroidery/Tango.Embroidery.vcxproj.filters +++ b/Software/Visual_Studio/Embroidery/Tango.Embroidery/Tango.Embroidery.vcxproj.filters @@ -51,6 +51,12 @@ <ClInclude Include="PMR\Embroidery\AnalyzeOutput.pb-c.h"> <Filter>PMR</Filter> </ClInclude> + <ClInclude Include="PMR\Embroidery\ConvertFileInput.pb-c.h"> + <Filter>PMR</Filter> + </ClInclude> + <ClInclude Include="PMR\Embroidery\ConvertFileOutput.pb-c.h"> + <Filter>PMR</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="Adapter.cpp"> @@ -83,5 +89,11 @@ <ClCompile Include="Exports.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="PMR\Embroidery\ConvertFileInput.pb-c.c"> + <Filter>PMR</Filter> + </ClCompile> + <ClCompile Include="PMR\Embroidery\ConvertFileOutput.pb-c.c"> + <Filter>PMR</Filter> + </ClCompile> </ItemGroup> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileConverter.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileConverter.cs new file mode 100644 index 000000000..b4752f2a6 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileConverter.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR; +using Tango.PMR.Embroidery; + +namespace Tango.EmbroideryUI +{ + public static class EmbroideryFileConverter + { + [DllImport("Tango.Embroidery.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "ConvertFile")] + public static extern int ConvertFile(IntPtr data, int size, ref IntPtr output); + + public static void ConvertEmbroideryFile(String sourceFile, String targetFile) + { + ConvertFileInput input = new ConvertFileInput(); + input.SourceFile = sourceFile; + input.TargetFile = targetFile; + + + NativePMR<ConvertFileInput, ConvertFileOutput> nativePMR = new NativePMR<ConvertFileInput, ConvertFileOutput>(ConvertFile); + ConvertFileOutput output = nativePMR.Invoke(input); + + if (!output.Successful) + { + throw new IOException("Error occurred in native embroidery library."); + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj index d8de4fd64..9ef098618 100644 --- a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj @@ -56,6 +56,7 @@ </Page> </ItemGroup> <ItemGroup> + <Compile Include="EmbroideryFileConverter.cs" /> <Compile Include="EmbroideryFileEditor.xaml.cs"> <DependentUpon>EmbroideryFileEditor.xaml</DependentUpon> </Compile> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs index 01cbee209..b53f28bd4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.MachineStudio.Common; using Tango.MachineStudio.DB.Views; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs index f3bdb974e..38e82257f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.MachineStudio.Common; using Tango.MachineStudio.DataCapture.Views; using Tango.SharedUI.Helpers; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ByteArrayToBitmapSourceConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ByteArrayToBitmapSourceConverter.cs new file mode 100644 index 000000000..d839b0060 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ByteArrayToBitmapSourceConverter.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class ByteArrayToBitmapSourceConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + byte[] bytes = value as byte[]; + if (bytes != null) + { + return bytes.ToBitmapSource(); + } + + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs index 0dc35e3bf..9ac8de012 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.MachineStudio.Common; using Tango.MachineStudio.Developer.Views; using Tango.SharedUI.Helpers; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/job-emb.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/job-emb.png Binary files differnew file mode 100644 index 000000000..15f9c73bb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/job-emb.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 7bf4d22cd..378fb443b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -67,6 +67,7 @@ <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> <Reference Include="System.Reactive.Core, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll</HintPath> </Reference> @@ -82,6 +83,7 @@ <Reference Include="System.Reactive.Windows.Threading, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll</HintPath> </Reference> + <Reference Include="System.Speech" /> <Reference Include="System.Windows" /> <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath> @@ -105,6 +107,7 @@ <Compile Include="Converters\BrushStopToColorConverter.cs" /> <Compile Include="Converters\BrushStopToOffsetLimitConverter.cs" /> <Compile Include="Converters\BrushStopToOffsetValueConverter.cs" /> + <Compile Include="Converters\ByteArrayToBitmapSourceConverter.cs" /> <Compile Include="Converters\InkVolumeToLiquidRmlFactor.cs" /> <Compile Include="Converters\JobProgressToPositionConverter.cs" /> <Compile Include="Converters\JobToColumnDefinitionsConverter.cs" /> @@ -120,8 +123,12 @@ <Compile Include="Navigation\DeveloperNavigationManager.cs" /> <Compile Include="Navigation\DeveloperNavigationView.cs" /> <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\EmbroideryDisplayViewVM.cs" /> <Compile Include="ViewModels\EmbroideryImportViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\EmbroideryDisplayView.xaml.cs"> + <DependentUpon>EmbroideryDisplayView.xaml</DependentUpon> + </Compile> <Compile Include="Views\EmbroideryImportView.xaml.cs"> <DependentUpon>EmbroideryImportView.xaml</DependentUpon> </Compile> @@ -141,6 +148,10 @@ <Compile Include="Views\RunningJobView.xaml.cs"> <DependentUpon>RunningJobView.xaml</DependentUpon> </Compile> + <Page Include="Views\EmbroideryDisplayView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\EmbroideryImportView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -336,5 +347,11 @@ <ItemGroup> <Resource Include="Images\sewing-machine.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\job-emb.png" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="bip.wav" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryDisplayViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryDisplayViewVM.cs new file mode 100644 index 000000000..74cb2ffa6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryDisplayViewVM.cs @@ -0,0 +1,38 @@ +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.SharedUI; + +namespace Tango.MachineStudio.Developer.ViewModels +{ + public class EmbroideryDisplayViewVM : DialogViewVM + { + private Job _job; + + public Job Job + { + get { return _job; } + set { _job = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand ExportCommand { get; set; } + + public EmbroideryDisplayViewVM() + { + ExportCommand = new RelayCommand(() => + { + Accept(); + }); + } + + public EmbroideryDisplayViewVM(Job job) : this() + { + Job = job; + } + } +} 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 c265c7d25..76fe33a87 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 @@ -28,6 +28,11 @@ using Tango.BL; using Microsoft.Win32; using Tango.PMR.Embroidery; using Tango.EmbroideryUI; +using System.IO; +using System.Windows; +using Tango.Core.Helpers; +using System.Speech.Synthesis; +using System.Media; namespace Tango.MachineStudio.Developer.ViewModels { @@ -38,7 +43,8 @@ namespace Tango.MachineStudio.Developer.ViewModels public class MainViewVM : ViewModel<IMainView>, IShutdownRequestBlocker, IShutdownListener { private static object _syncLock = new object(); - private const string EMB_FORMATS = "Embroidery Files|*.pes;*.hus"; + private const string EMB_FORMATS_EXPORT = "Baby Lock (PES)|*.pes|Tajima (DST)|*.dst|EXP|*.exp|PCS|*.pcs|HUS|*.hus|KSM|*.ksm"; + private const string EMB_FORMATS_IMPORT = "Embroidery Files|*.pes;*.hus;*.dst"; private INotificationProvider _notification; private TimeSpan _runningJobEstimatedDuration; @@ -49,6 +55,8 @@ namespace Tango.MachineStudio.Developer.ViewModels private ObservablesContext _machineDbContext; private ObservablesContext _activeJobDbContext; private LogManager LogManager = LogManager.Default; + private SpeechSynthesizer _speech; + private SoundPlayer _soundPlayer; #region Properties @@ -577,6 +585,10 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> public RelayCommand ImportEmbroideryFileCommand { get; set; } + /// <summary> + /// Gets or sets the display job embroidery file command. + /// </summary> + public RelayCommand<Job> DisplayJobEmbroideryFileCommand { get; set; } #endregion #region Constructors @@ -625,6 +637,10 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Initializing relay commands..."); + _speech = new SpeechSynthesizer(); + _soundPlayer = new SoundPlayer(EmbeddedResourceHelper.GetEmbeddedResourceStream("Tango.MachineStudio.Developer.bip.wav")); + _speech.SelectVoice(_speech.GetInstalledVoices().LastOrDefault(x => x.VoiceInfo.Gender == VoiceGender.Female).VoiceInfo.Name); + //Initialize Commands... EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null); EditRMLCommand = new RelayCommand(EditRML, () => SelectedRML != null); @@ -648,6 +664,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0); PushProcessParametersCommand = new RelayCommand(PushProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0 && SelectedProcessParametersTable != null && MachineOperator != null); ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null); + DisplayJobEmbroideryFileCommand = new RelayCommand<Job>(DisplayJobEmbroideryFile); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; } @@ -891,6 +908,9 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Setting job failed state..."); IsJobRunning = false; IsJobFailed = true; + + _soundPlayer.Play(); + _speech.SpeakAsync("Job Failed!"); } /// <summary> @@ -901,6 +921,8 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Setting job completed state..."); IsJobRunning = false; IsJobCompleted = true; + _soundPlayer.Play(); + _speech.SpeakAsync("Job Completed!"); } /// <summary> @@ -958,12 +980,27 @@ namespace Tango.MachineStudio.Developer.ViewModels } if (remaining < segmentDuration) { - segment.Started = true; + if (!segment.Started) + { + segment.Started = true; + _soundPlayer.Play(); + + if (segment.ID != -1) + { + _speech.SpeakAsync(String.Format("Segment {0} Started.", segment.SegmentIndex)); + } + else + { + _speech.SpeakAsync(String.Format("Inter Segment Started.")); + } + } } if (remaining <= TimeSpan.Zero) { - segment.Completed = true; - segment.Started = false; + if (!segment.Completed) + { + segment.Completed = true; + } } } }; @@ -1020,6 +1057,7 @@ namespace Tango.MachineStudio.Developer.ViewModels segments.Add(new Segment() { Length = job.InterSegmentLength, + ID = -1, BrushStops = new System.Collections.ObjectModel.ObservableCollection<BrushStop>() { new BrushStop() @@ -1588,18 +1626,20 @@ namespace Tango.MachineStudio.Developer.ViewModels { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Select embroidery file"; - dlg.Filter = EMB_FORMATS; - if (dlg.ShowDialog().Value) + dlg.Filter = EMB_FORMATS_IMPORT; + if (dlg.ShowDialogCenter()) { + var view = new EmbroideryImportView(); + _notification.ShowModalDialog<EmbroideryImportViewVM, EmbroideryImportView>( - new EmbroideryImportViewVM() { FileName = dlg.FileName }, + new EmbroideryImportViewVM() { FileName = dlg.FileName }, view, (vm) => { String jobName = _notification.ShowTextInput("Please provide a job name", "Name"); if (jobName != null) { - AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.EmbroideryFile); + AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.EmbroideryFile, dlg.FileName, view.EmbroideryImageBytes); } }, () => @@ -1609,7 +1649,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } } - private async void AddJobFromEmbroideryFile(String jobName, List<EmbroideryPath> paths, EmbroideryFile embroideryFile) + private async void AddJobFromEmbroideryFile(String jobName, List<EmbroideryPath> paths, EmbroideryFile embroideryFile, String fileName, byte[] imageBytes) { LogManager.Log(String.Format("Adding new job from embroidery file {0}...", jobName)); @@ -1623,12 +1663,17 @@ namespace Tango.MachineStudio.Developer.ViewModels job.SpoolType = _machineDbContext.SpoolTypes.FirstOrDefault(); job.Machine = SelectedMachine; + job.EmbroideryFileName = Path.GetFileName(fileName); + job.EmbroideryFileData = File.ReadAllBytes(fileName); + job.EmbroideryJpeg = imageBytes; + job.HasEmbroideryFile = true; + foreach (var path in paths.Skip(1)) { Segment segment = new Segment(); segment.Length = path.Length / 1000d; segment.Name = "Embroidery Segment"; - segment.SegmentIndex = paths.IndexOf(path) + 1; + segment.SegmentIndex = paths.IndexOf(path) + 2; if (path.Brush is SolidColorBrush) { @@ -1639,7 +1684,7 @@ namespace Tango.MachineStudio.Developer.ViewModels Red = brush.Color.R, Green = brush.Color.G, Blue = brush.Color.B, - ColorSpace = _machineDbContext.ColorSpaces.ToList().SingleOrDefault(x => x.Code == BL.Entities.ColorSpaces.RGB.ToInt32()), + ColorSpace = _machineDbContext.ColorSpaces.ToList().SingleOrDefault(x => x.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32()), }); } else @@ -1655,7 +1700,7 @@ namespace Tango.MachineStudio.Developer.ViewModels Green = stop.Color.G, Blue = stop.Color.B, OffsetPercent = stop.Offset, - ColorSpace = _machineDbContext.ColorSpaces.ToList().SingleOrDefault(x => x.Code == BL.Entities.ColorSpaces.RGB.ToInt32()), + ColorSpace = _machineDbContext.ColorSpaces.ToList().SingleOrDefault(x => x.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32()), }); } } @@ -1670,6 +1715,35 @@ namespace Tango.MachineStudio.Developer.ViewModels LoadSelectedJob(); } + private void DisplayJobEmbroideryFile(Job job) + { + _notification.ShowModalDialog<EmbroideryDisplayViewVM, EmbroideryDisplayView>(new EmbroideryDisplayViewVM(job), (vm) => + { + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Select embroidery file location and format"; + dlg.Filter = EMB_FORMATS_EXPORT; + dlg.FileName = job.EmbroideryFileName; + if (dlg.ShowDialogCenter()) + { + try + { + String tempPath = PathHelper.GetTempFolderPath(); + String filePath = Path.Combine(tempPath, job.EmbroideryFileName); + File.WriteAllBytes(filePath, job.EmbroideryFileData); + EmbroideryFileConverter.ConvertEmbroideryFile(filePath, dlg.FileName); + _notification.ShowInfo("Embroidery file exported successfully."); + } + catch (Exception ex) + { + LogManager.Log(ex, "An error has occurred while trying to export the attached embroidery file."); + _notification.ShowError("An error has occurred while trying to export the attached embroidery file."); + } + } + + }, () => { }); + } + #endregion #region Override Methods diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml new file mode 100644 index 000000000..a753453f9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml @@ -0,0 +1,51 @@ +<UserControl x:Class="Tango.MachineStudio.Developer.Views.EmbroideryDisplayView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:emb="clr-namespace:Tango.EmbroideryUI;assembly=Tango.EmbroideryUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:converters="clr-namespace:Tango.MachineStudio.Developer.Converters" + xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" + mc:Ignorable="d" + Width="600" Height="350" Background="White" d:DataContext="{d:DesignInstance Type=vm:EmbroideryDisplayViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:ByteArrayToBitmapSourceConverter x:Key="ByteArrayToBitmapSourceConverter" /> + </UserControl.Resources> + + <Grid> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="60"/> + <RowDefinition Height="593*"/> + <RowDefinition Height="60"/> + </Grid.RowDefinitions> + + <Grid> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/sewing-machine.png" Width="48"></Image> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20" Text="{Binding Job.EmbroideryFileName}"></TextBlock> + </StackPanel> + + <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle> + </Grid> + + <Grid Grid.Row="1"> + <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="{Binding Job.EmbroideryJpeg,Converter={StaticResource ByteArrayToBitmapSourceConverter}}"></Image> + </Grid> + + <Grid Grid.Row="2"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Height="40" Command="{Binding ExportCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Export" Width="24" Height="24" /> + <TextBlock Margin="5 0 0 0" FontSize="16">EXPORT</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml.cs new file mode 100644 index 000000000..7d0771098 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml.cs @@ -0,0 +1,28 @@ +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.Developer.Views +{ + /// <summary> + /// Interaction logic for EmbroideryDisplayView.xaml + /// </summary> + public partial class EmbroideryDisplayView : UserControl + { + public EmbroideryDisplayView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml index 220e7d3ab..d084aabcf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml @@ -47,7 +47,7 @@ </Grid> <Grid Grid.Row="2" Grid.Column="1"> - <Button Height="50" Command="{Binding ImportCommand}"> + <Button Height="50" Click="OnImportClick" Command="{Binding ImportCommand}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="Import" Width="24" Height="24" /> <TextBlock Margin="5 0 0 0" FontSize="16">IMPORT</TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs index c34b6fef7..ce481a87b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs @@ -12,6 +12,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Developer.Views { @@ -20,9 +21,17 @@ namespace Tango.MachineStudio.Developer.Views /// </summary> public partial class EmbroideryImportView : UserControl { + public byte[] EmbroideryImageBytes { get; set; } + public EmbroideryImportView() { InitializeComponent(); } + + private void OnImportClick(object sender, RoutedEventArgs e) + { + var source = UIHelper.TakeSnapshot(editor); + EmbroideryImageBytes = source.ToJpegBytes(50); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 9ba41f688..1dea01de7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -438,13 +438,13 @@ <Grid HorizontalAlignment="Right" Margin="0 0 10 0"> <StackPanel Orientation="Horizontal"> - <Button Height="70" Width="135" Margin="0 0 10 0" Background="White" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding DiscardJobCommand}"> + <Button Height="70" Width="100" Margin="0 0 10 0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding DiscardJobCommand}"> <StackPanel> <materialDesign:PackIcon HorizontalAlignment="Center" Width="24" Height="24" Kind="KeyboardBackspace" /> <TextBlock VerticalAlignment="Center" Margin="0 10 0 0">TO JOBS</TextBlock> </StackPanel> </Button> - <Button Height="70" Width="135" Margin="0 0 0 0" Background="White" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding SaveJobCommand}"> + <Button Height="70" Width="100" Margin="0 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding SaveJobCommand}"> <StackPanel> <materialDesign:PackIcon HorizontalAlignment="Center" Width="24" Height="24" Kind="ContentSave" /> <TextBlock VerticalAlignment="Center" Margin="0 10 0 0">SAVE JOB</TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml index 2115f2503..ebacd122c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -131,8 +131,29 @@ <DataGrid.Columns> <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> - <DataTemplate> - <Image Source="../Images/rgb.png" Width="40" Margin="5"></Image> + <DataTemplate DataType="{x:Type observables:Job}"> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <Image Source="../Images/rgb.png" Width="40" Margin="5"></Image> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HasEmbroideryFile}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <Button ToolTip="Press to display the embroidery file information." Style="{StaticResource emptyButton}" Cursor="Hand" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DisplayJobEmbroideryFileCommand}" CommandParameter="{Binding}"> + <Image Source="../Images/job-emb.png" Width="40" Margin="5"></Image> + </Button> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 7a50a499e..c4915a4c8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -132,7 +132,7 @@ <StackPanel Margin="0 0 0 0" HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock Margin="0 0 0 0" FontSize="14" HorizontalAlignment="Right"> - <Run Text="{Binding Length,Mode=OneWay}"></Run> + <Run Text="{Binding Length,Mode=OneWay,StringFormat=N2}"></Run> <Run FontSize="12" Text="m"></Run> </TextBlock> <materialDesign:PackIcon HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Kind="Triangle" Width="12" Height="12"> @@ -197,7 +197,7 @@ <StackPanel Margin="0 -5 -40 0" HorizontalAlignment="Right"> <TextBlock FontSize="14"> - <Run Text="{Binding RunningJob.Length,Mode=OneWay}"></Run> + <Run Text="{Binding RunningJob.Length,Mode=OneWay,StringFormat=N2}"></Run> <Run FontSize="13" Text="m"></Run> </TextBlock> <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="FlagCheckered" Width="20" Height="20"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wav b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wav Binary files differnew file mode 100644 index 000000000..5a1d74045 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wav diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs index 62fc02083..71b86b54a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.MachineStudio.Common; using Tango.MachineStudio.HardwareDesigner.Views; using Tango.SharedUI.Helpers; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs index f086f1873..c770695c6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.MachineStudio.Common; using Tango.MachineStudio.MachineDesigner.Views; using Tango.SharedUI.Helpers; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs index ad5f2f91c..62a208d87 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.MachineStudio.Common; using Tango.MachineStudio.Stubs.Views; using Tango.SharedUI.Helpers; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs index 998475d1e..1a05c9248 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.MachineStudio.Common; using Tango.MachineStudio.Synchronization.Views; using Tango.SharedUI.Helpers; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs index f31fdc9fd..92293e7d0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.MachineStudio.Common; using Tango.MachineStudio.Technician.Views; using Tango.SharedUI.Helpers; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/CommonDialogExtensions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/CommonDialogExtensions.cs new file mode 100644 index 000000000..886ccdd1e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/CommonDialogExtensions.cs @@ -0,0 +1,15 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +public static class CommonDialogExtensions +{ + public static bool ShowDialogCenter(this CommonDialog dialog) + { + return dialog.ShowDialog(Application.Current.MainWindow).Value; + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs index 1107222ef..ee01def9e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using Tango.BL.Entities; +using Tango.BL.Enumerations; namespace Tango.MachineStudio.Common { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs index 79bcc9bf9..ce60715a8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs @@ -102,6 +102,17 @@ namespace Tango.MachineStudio.Common.Notifications void ShowModalDialog<VM, View>(VM vm, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; /// <summary> + /// Shows the specified view with the specified view model as it's data context. + /// </summary> + /// <typeparam name="VM">The type of the mm.</typeparam> + /// <typeparam name="View">The type of the view.</typeparam> + /// <param name="vm">The view model.</param> + /// <param name="view">The view.</param> + /// <param name="onAccept">The accept action.</param> + /// <param name="onCancel">The cancel action.</param> + void ShowModalDialog<VM, View>(VM vm, View view, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; + + /// <summary> /// Creates a new view by a naming convention of the specified view model type. /// </summary> /// <typeparam name="VM">The type of the view model.</typeparam> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleBase.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleBase.cs index 3d17b245f..11da53c6c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleBase.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleBase.cs @@ -7,6 +7,7 @@ using System.Windows; using System.Windows.Media.Imaging; using Tango.Core; using Tango.BL.Entities; +using Tango.BL.Enumerations; namespace Tango.MachineStudio.Common { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index bc102a017..457646223 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -87,6 +87,7 @@ <Compile Include="Converters\SecondsToGraphPointsConverter.cs" /> <Compile Include="Diagnostics\DefaultDiagnosticsFrameProvider.cs" /> <Compile Include="Diagnostics\IDiagnosticsFrameProvider.cs" /> + <Compile Include="ExtensionMethods\CommonDialogExtensions.cs" /> <Compile Include="Helpers\GraphsHelper.cs" /> <Compile Include="Notifications\BarItem.cs" /> <Compile Include="Notifications\DialogViewVM.cs" /> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index b3c4f5cb3..bc57aee20 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -8,6 +8,7 @@ using Tango.Core; using Tango.BL.Entities; using Tango.MachineStudio.Common.Authentication; using Tango.BL; +using Tango.BL.Enumerations; namespace Tango.MachineStudio.UI.Authentication { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index a07c0ef13..1c9b8732f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -193,6 +193,56 @@ namespace Tango.MachineStudio.UI.Notifications } /// <summary> + /// Shows the specified view with the specified view model as it's data context. + /// </summary> + /// <typeparam name="VM">The type of the mm.</typeparam> + /// <typeparam name="View">The type of the view.</typeparam> + /// <param name="vm">The view model.</param> + /// <param name="view">The view.</param> + /// <param name="onAccept">The accept action.</param> + /// <param name="onCancel">The cancel action.</param> + public void ShowModalDialog<VM, View>(VM vm, View view, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM + { + DialogWindow dialog = new DialogWindow(); + dialog.Owner = Application.Current.MainWindow; + dialog.InnerContent = view; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + view.Loaded += (x, y) => + { + VM context = vm; + dialog.DataContext = context; + + Action onAcceptAction = null; + onAcceptAction = new Action(() => + { + dialog.Close(); + onAccept(context); + context.Accepted -= onAcceptAction; + }); + + Action onCancelAction = null; + onCancelAction = new Action(() => + { + dialog.Close(); + + if (onCancel != null) + { + onCancel(); + } + + context.Canceled -= onCancelAction; + }); + + context.Accepted += onAcceptAction; + context.Canceled += onCancelAction; + + context.OnShow(); + }; + dialog.ShowDialog(); + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } + + /// <summary> /// Creates a new view by a naming convention of the specified view model type. /// </summary> /// <typeparam name="VM">The type of the view model.</typeparam> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs index 6deb9ac7b..907dcf757 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs @@ -12,6 +12,7 @@ using Tango.BL.Entities; using Tango.Logging; using Tango.MachineStudio.Common.Update; using Tango.BL; +using Tango.BL.Enumerations; namespace Tango.MachineStudio.UpdateService { diff --git a/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcAttribute.cs b/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcAttribute.cs index c8ffbdc63..26c4144d4 100644 --- a/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcAttribute.cs +++ b/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcAttribute.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.BL.Enumerations; namespace Tango.BL.Dispensing { diff --git a/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcResolver.cs b/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcResolver.cs index 55811f6eb..89aa28111 100644 --- a/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcResolver.cs +++ b/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcResolver.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; using System.Reflection; +using Tango.BL.Enumerations; namespace Tango.BL.Dispensing { diff --git a/Software/Visual_Studio/Tango.BL/Dispensing/LubricantDispensingCalc.cs b/Software/Visual_Studio/Tango.BL/Dispensing/LubricantDispensingCalc.cs index 24003b92b..023b2b288 100644 --- a/Software/Visual_Studio/Tango.BL/Dispensing/LubricantDispensingCalc.cs +++ b/Software/Visual_Studio/Tango.BL/Dispensing/LubricantDispensingCalc.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.BL.Enumerations; namespace Tango.BL.Dispensing { diff --git a/Software/Visual_Studio/Tango.BL/Dispensing/StandardColorDispensingCalc.cs b/Software/Visual_Studio/Tango.BL/Dispensing/StandardColorDispensingCalc.cs index 7892dc9ce..a0e098b0a 100644 --- a/Software/Visual_Studio/Tango.BL/Dispensing/StandardColorDispensingCalc.cs +++ b/Software/Visual_Studio/Tango.BL/Dispensing/StandardColorDispensingCalc.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.BL.Enumerations; using static Tango.BL.Entities.BrushStop; namespace Tango.BL.Dispensing diff --git a/Software/Visual_Studio/Tango.BL/Dispensing/TransparentLiquidDispensingCalc.cs b/Software/Visual_Studio/Tango.BL/Dispensing/TransparentLiquidDispensingCalc.cs index 769915753..81c0179db 100644 --- a/Software/Visual_Studio/Tango.BL/Dispensing/TransparentLiquidDispensingCalc.cs +++ b/Software/Visual_Studio/Tango.BL/Dispensing/TransparentLiquidDispensingCalc.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.BL.Enumerations; namespace Tango.BL.Dispensing { diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs index d8d821563..8a8c12342 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs @@ -299,6 +299,86 @@ namespace Tango.BL.Entities } + protected Boolean _hasembroideryfile; + /// <summary> + /// Gets or sets the job has embroidery file. + /// </summary> + [Column("HAS_EMBROIDERY_FILE")] + + public Boolean HasEmbroideryFile + { + get + { + return _hasembroideryfile; + } + + set + { + _hasembroideryfile = value; RaisePropertyChanged(nameof(HasEmbroideryFile)); + } + + } + + protected Byte[] _embroideryfiledata; + /// <summary> + /// Gets or sets the job embroidery file data. + /// </summary> + [Column("EMBROIDERY_FILE_DATA")] + + public Byte[] EmbroideryFileData + { + get + { + return _embroideryfiledata; + } + + set + { + _embroideryfiledata = value; RaisePropertyChanged(nameof(EmbroideryFileData)); + } + + } + + protected String _embroideryfilename; + /// <summary> + /// Gets or sets the job embroidery file name. + /// </summary> + [Column("EMBROIDERY_FILE_NAME")] + + public String EmbroideryFileName + { + get + { + return _embroideryfilename; + } + + set + { + _embroideryfilename = value; RaisePropertyChanged(nameof(EmbroideryFileName)); + } + + } + + protected Byte[] _embroideryjpeg; + /// <summary> + /// Gets or sets the job embroidery jpeg. + /// </summary> + [Column("EMBROIDERY_JPEG")] + + public Byte[] EmbroideryJpeg + { + get + { + return _embroideryjpeg; + } + + set + { + _embroideryjpeg = value; RaisePropertyChanged(nameof(EmbroideryJpeg)); + } + + } + protected ObservableCollection<JobRun> _jobruns; /// <summary> /// Gets or sets the job job runs. diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/ActionTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/ActionTypes.cs index 5165a8218..ef7272ca0 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/ActionTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/ActionTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum ActionTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/CartridgeTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/CartridgeTypes.cs index 0b31ccc08..6cd89a1b5 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/CartridgeTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/CartridgeTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum CartridgeTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/ColorSpaces.cs b/Software/Visual_Studio/Tango.BL/Enumerations/ColorSpaces.cs index a2f97c579..b434310ba 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/ColorSpaces.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/ColorSpaces.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum ColorSpaces { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/DispenserTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/DispenserTypes.cs index a78c5c47c..13a24ecd6 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/DispenserTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/DispenserTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum DispenserTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/EventTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/EventTypes.cs index 59305e0f4..14475dec9 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/EventTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/EventTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum EventTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/FiberShapes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/FiberShapes.cs index 5b2adac06..15f71f0c4 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/FiberShapes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/FiberShapes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum FiberShapes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/FiberSynths.cs b/Software/Visual_Studio/Tango.BL/Enumerations/FiberSynths.cs index bcfc2ad2b..5a75f36c3 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/FiberSynths.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/FiberSynths.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum FiberSynths { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/HardwareDancerTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/HardwareDancerTypes.cs index 8badd85e4..593b27da3 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/HardwareDancerTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/HardwareDancerTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum HardwareDancerTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/HardwareMotorTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/HardwareMotorTypes.cs index 47120fe5b..1f4957cf7 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/HardwareMotorTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/HardwareMotorTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum HardwareMotorTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs index 72ff16f5c..cbdcf2b96 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum HardwarePidControlTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/HardwareWinderTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/HardwareWinderTypes.cs index e7d7188d0..75a286586 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/HardwareWinderTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/HardwareWinderTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum HardwareWinderTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/IdsPackFormulas.cs b/Software/Visual_Studio/Tango.BL/Enumerations/IdsPackFormulas.cs index 947f4e638..96b7a78a3 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/IdsPackFormulas.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/IdsPackFormulas.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum IdsPackFormulas { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/LinearMassDensityUnits.cs b/Software/Visual_Studio/Tango.BL/Enumerations/LinearMassDensityUnits.cs index 5ef742b16..d4b25d068 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/LinearMassDensityUnits.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/LinearMassDensityUnits.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum LinearMassDensityUnits { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/LiquidTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/LiquidTypes.cs index 6fa93d2dc..f717bea9f 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/LiquidTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/LiquidTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum LiquidTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/MediaConditions.cs b/Software/Visual_Studio/Tango.BL/Enumerations/MediaConditions.cs index 9eeb86435..8d88e6b1d 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/MediaConditions.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/MediaConditions.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum MediaConditions { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/MediaMaterials.cs b/Software/Visual_Studio/Tango.BL/Enumerations/MediaMaterials.cs index c5cdd5003..7f3417eeb 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/MediaMaterials.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/MediaMaterials.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum MediaMaterials { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/MediaPurposes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/MediaPurposes.cs index 6b79f5711..c6b3e6b76 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/MediaPurposes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/MediaPurposes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum MediaPurposes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/MidTankTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/MidTankTypes.cs index a5ded3bf8..aab37e558 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/MidTankTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/MidTankTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum MidTankTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs index 8daeb7c63..a8a4aa2c0 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum Permissions { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Rmls.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Rmls.cs index c8e78e6be..d7b94296d 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/Rmls.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/Rmls.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum Rmls { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs index c7e75cac4..c99739f12 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum Roles { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/SpoolTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/SpoolTypes.cs index 28820672f..e6fe07728 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/SpoolTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/SpoolTypes.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum SpoolTypes { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TechDispensers.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TechDispensers.cs index e14fbb397..ffc43c8da 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/TechDispensers.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TechDispensers.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum TechDispensers { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TechHeaters.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TechHeaters.cs index 55a06b135..075422bb7 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/TechHeaters.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TechHeaters.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum TechHeaters { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TechIos.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TechIos.cs index aaf476fc7..4ceb20295 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/TechIos.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TechIos.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum TechIos { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TechMonitors.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TechMonitors.cs index 8e3e20f7d..d6de60eb7 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/TechMonitors.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TechMonitors.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum TechMonitors { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TechMotors.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TechMotors.cs index e99aacc83..e0fc51206 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/TechMotors.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TechMotors.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum TechMotors { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/TechValves.cs b/Software/Visual_Studio/Tango.BL/Enumerations/TechValves.cs index 24b0a10c3..f8476a16b 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/TechValves.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/TechValves.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.Integration.Observables +namespace Tango.BL.Enumerations { public enum TechValves { diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/WindingMethods.cs b/Software/Visual_Studio/Tango.BL/Enumerations/WindingMethods.cs index b732708cf..64eac1c66 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/WindingMethods.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/WindingMethods.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.ComponentModel; -namespace Tango.BL.Entities +namespace Tango.BL.Enumerations { public enum WindingMethods { diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs index 139054738..f265657ec 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs @@ -12,16 +12,6 @@ namespace Tango.BL public partial class ObservablesContext : DbContext { /// <summary> - /// Initializes a new instance of the <see cref="ObservablesContext" /> class. - /// </summary> - /// <param name="path">The server file path.</param> - /// <param name="isFile">if set to <c>true</c> will try to connect to an .mdf file.</param> - public ObservablesContext(String path) : base(ComposeConnectionString(path)) - { - - } - - /// <summary> /// Gets or sets the ActionTypes. /// </summary> public DbSet<ActionType> ActionTypes diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs index 1834c15df..584e6c783 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs @@ -12,6 +12,16 @@ namespace Tango.BL public partial class ObservablesContext { /// <summary> + /// Initializes a new instance of the <see cref="ObservablesContext" /> class. + /// </summary> + /// <param name="path">The server file path.</param> + /// <param name="isFile">if set to <c>true</c> will try to connect to an .mdf file.</param> + public ObservablesContext(String path) : base(ComposeConnectionString(path)) + { + + } + + /// <summary> /// Composes the connection string. ///</summary> /// <param name="source">The source.</param> diff --git a/Software/Visual_Studio/Tango.BL/ObservablesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/ObservablesExtensions/BrushStop.cs index deeb9a68d..8ab24b308 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesExtensions/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesExtensions/BrushStop.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using System.Windows.Media; using Tango.Core; using Tango.BL; +using Tango.BL.Enumerations; namespace Tango.BL.Entities { @@ -37,8 +38,6 @@ namespace Tango.BL.Entities set { _liquidVolumes = value; RaisePropertyChangedAuto(); } } - - private Color _color; /// <summary> /// Gets or sets the brush stop color. /// </summary> diff --git a/Software/Visual_Studio/Tango.BL/ObservablesExtensions/User.cs b/Software/Visual_Studio/Tango.BL/ObservablesExtensions/User.cs index 540255afa..52b3970dc 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesExtensions/User.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesExtensions/User.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Enumerations; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesContextCodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesContextCodeFile.cshtml index 1879cb3f2..e7e9fa5a6 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesContextCodeFile.cshtml +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesContextCodeFile.cshtml @@ -11,16 +11,6 @@ namespace Tango.BL { public partial class ObservablesContext : DbContext { - /// <summary> - /// Initializes a new instance of the <see cref="ObservablesContext" /> class. - /// </summary> - /// <param name="path">The server file path.</param> - /// <param name="isFile">if set to <c>true</c> will try to connect to an .mdf file.</param> - public ObservablesContext(String path, bool isFile) : base(ComposeConnectionString(path, isFile)) - { - - } - @foreach (var prop in Model.Properties) { <div> diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapSourceExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapSourceExtensions.cs new file mode 100644 index 000000000..11844df36 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapSourceExtensions.cs @@ -0,0 +1,242 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +public static class BitmapSourceExtensions +{ + /// <summary> + /// Converts the bitmap source to GDI+ bitmap. + /// </summary> + /// <param name="bitmapsource">The bitmap source.</param> + /// <returns></returns> + public static System.Drawing.Bitmap ToGDIBitmap(this BitmapSource bitmapsource) + { + if (bitmapsource != null) + { + using (MemoryStream stream = new MemoryStream()) + { + BitmapEncoder enc = new BmpBitmapEncoder(); + enc.Frames.Add(BitmapFrame.Create(bitmapsource)); + enc.Save(stream); + + using (var tempBitmap = new System.Drawing.Bitmap(stream)) + { + // According to MSDN, one "must keep the stream open for the lifetime of the Bitmap." + // So we return a copy of the new bitmap, allowing us to dispose both the bitmap and the stream. + return new System.Drawing.Bitmap(tempBitmap); + } + } + } + else + { + return new System.Drawing.Bitmap(1, 1); + } + } + + /// <summary> + /// Save to the BMP file. + /// </summary> + /// <param name="bitmapSource">The bitmap source.</param> + /// <param name="fileName">Name of the file.</param> + public static void SaveBmpFile(this BitmapSource bitmapSource, String fileName) + { + using (FileStream fs = new FileStream(fileName, FileMode.Create)) + { + BitmapEncoder enc = new BmpBitmapEncoder(); + enc.Frames.Add(BitmapFrame.Create(bitmapSource)); + enc.Save(fs); + } + } + + /// <summary> + /// Save to the PNG file. + /// </summary> + /// <param name="bitmapSource">The bitmap source.</param> + /// <param name="fileName">Name of the file.</param> + public static void SavePngFile(this BitmapSource bitmapSource, String fileName) + { + using (FileStream fs = new FileStream(fileName, FileMode.Create)) + { + PngBitmapEncoder enc = new PngBitmapEncoder(); + enc.Frames.Add(BitmapFrame.Create(bitmapSource)); + enc.Save(fs); + } + } + + /// <summary> + /// Save to the JPEG file. + /// </summary> + /// <param name="bitmapSource">The bitmap source.</param> + /// <param name="fileName">Name of the file.</param> + /// <param name="quality">The quality.</param> + public static void SaveJpegFile(this BitmapSource bitmapSource, String fileName, int quality = 100) + { + using (FileStream fs = new FileStream(fileName, FileMode.Create)) + { + JpegBitmapEncoder enc = new JpegBitmapEncoder(); + enc.QualityLevel = quality; + enc.Frames.Add(BitmapFrame.Create(bitmapSource)); + enc.Save(fs); + } + } + + /// <summary> + /// Converts the bitmap source to bitmap image. + /// </summary> + /// <param name="bitmapSource">The bitmap source.</param> + /// <returns></returns> + public static BitmapImage ConvertToBitmapImage(this BitmapSource bitmapSource) + { + JpegBitmapEncoder encoder = new JpegBitmapEncoder(); + MemoryStream memoryStream = new MemoryStream(); + BitmapImage bImg = new BitmapImage(); + + encoder.Frames.Add(BitmapFrame.Create(bitmapSource)); + encoder.Save(memoryStream); + + bImg.BeginInit(); + bImg.StreamSource = new MemoryStream(memoryStream.ToArray()); + bImg.EndInit(); + + memoryStream.Close(); + + return bImg; + } + + /// <summary> + /// Converts the Bitmap Source to Writeable Bitmap. + /// </summary> + /// <param name="bitmapsource">The bitmap source.</param> + /// <returns></returns> + public static WriteableBitmap ToWritableBitmap(this BitmapSource bitmapsource) + { + WriteableBitmap w = new WriteableBitmap(bitmapsource); + return w; + } + + /// <summary> + /// Converts the BitmapSource to byte array. + /// </summary> + /// <param name="bitmapsource">The bitmap source.</param> + /// <param name="format">The pixel format.</param> + /// <returns></returns> + public static byte[] ToBytes(this BitmapSource bitmapsource, PixelFormat format) + { + var bm = new FormatConvertedBitmap(bitmapsource, format, null, 0); + + BitmapEncoder encoder = new BmpBitmapEncoder(); + byte[] bytes = null; + using (MemoryStream stream = new MemoryStream()) + { + encoder.Frames.Add(BitmapFrame.Create(bm)); + encoder.Save(stream); + bytes = stream.ToArray(); + stream.Close(); + } + + return bytes; + } + + /// <summary> + /// Converts the Bitmap Source to JPEG byte array. + /// </summary> + /// <param name="bitmapsource">The bitmap source.</param> + /// <param name="quality">Compression quality.</param> + /// <returns></returns> + public static byte[] ToJpegBytes(this BitmapSource bitmapsource, int quality = 100) + { + var bm = new FormatConvertedBitmap(bitmapsource, PixelFormats.Bgr24, null, 0); + + JpegBitmapEncoder encoder = new JpegBitmapEncoder(); + encoder.QualityLevel = quality; + byte[] bytes = null; + using (MemoryStream stream = new MemoryStream()) + { + encoder.Frames.Add(BitmapFrame.Create(bm)); + encoder.Save(stream); + bytes = stream.ToArray(); + stream.Close(); + } + + return bytes; + } + + /// <summary> + /// Converts the BitmapSource to PNG byte array. + /// </summary> + /// <param name="bitmapsource">The bitmap source.</param> + /// <returns></returns> + public static byte[] ToPngBytes(this BitmapSource bitmapsource) + { + PngBitmapEncoder encoder = new PngBitmapEncoder(); + byte[] bytes = null; + using (MemoryStream stream = new MemoryStream()) + { + encoder.Frames.Add(BitmapFrame.Create(bitmapsource)); + encoder.Save(stream); + bytes = stream.ToArray(); + stream.Close(); + } + + return bytes; + } + + /// <summary> + /// Converts the BitmapSource to BMP byte array. + /// </summary> + /// <param name="bitmapsource">The bitmap source.</param> + /// <returns></returns> + public static byte[] ToBmpBytes(this BitmapSource bitmapsource) + { + BmpBitmapEncoder encoder = new BmpBitmapEncoder(); + byte[] bytes = null; + using (MemoryStream stream = new MemoryStream()) + { + encoder.Frames.Add(BitmapFrame.Create(bitmapsource)); + encoder.Save(stream); + bytes = stream.ToArray(); + stream.Close(); + } + + return bytes; + } + + /// <summary> + /// Converts the byte array to a Bitmap Source. + /// </summary> + /// <param name="bytes">The bytes.</param> + /// <returns></returns> + public static BitmapSource ToBitmapSource(this byte[] bytes) + { + var image = new BitmapImage(); + using (var mem = new MemoryStream(bytes)) + { + mem.Position = 0; + image.BeginInit(); + image.CreateOptions = BitmapCreateOptions.PreservePixelFormat; + image.CacheOption = BitmapCacheOption.OnLoad; + image.UriSource = null; + image.StreamSource = mem; + image.EndInit(); + } + image.Freeze(); + return image; + } + + /// <summary> + /// Converts the bitmap source format. + /// </summary> + /// <param name="bitmapsource">The bitmap source.</param> + /// <param name="format">The format.</param> + /// <returns></returns> + public static BitmapSource ConvertFormat(this BitmapSource bitmapsource, PixelFormat format) + { + var bm = new FormatConvertedBitmap(bitmapsource, format, null, 0); + return bm; + } +} diff --git a/Software/Visual_Studio/Tango.Core/Helpers/EmbeddedResourceHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/EmbeddedResourceHelper.cs new file mode 100644 index 000000000..d1d556296 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Helpers/EmbeddedResourceHelper.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Core.Helpers +{ + public static class EmbeddedResourceHelper + { + public static Stream GetEmbeddedResourceStream(String relativePath) + { + Assembly asm = Assembly.GetCallingAssembly(); + return asm.GetManifestResourceStream(relativePath); + } + } +} diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index c3a8f3ccf..76ea72fbe 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -58,6 +58,7 @@ <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Core" /> <Reference Include="System.Data.Entity.Design" /> + <Reference Include="System.Drawing" /> <Reference Include="System.Windows" /> <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath> @@ -81,6 +82,7 @@ <Compile Include="Cryptography\ICryptographer.cs" /> <Compile Include="Cryptography\Rfc2898Cryptographer.cs" /> <Compile Include="ExtendedObject.cs" /> + <Compile Include="ExtensionMethods\BitmapSourceExtensions.cs" /> <Compile Include="ExtensionMethods\DateTimeExtensions.cs" /> <Compile Include="ExtensionMethods\DependencyObjectExtensions.cs" /> <Compile Include="ExtensionMethods\EnumExtensions.cs" /> @@ -95,6 +97,7 @@ <Compile Include="ExtensionMethods\StringExtensions.cs" /> <Compile Include="Helpers\AssemblyHelper.cs" /> <Compile Include="Helpers\ColorHelper.cs" /> + <Compile Include="Helpers\EmbeddedResourceHelper.cs" /> <Compile Include="Helpers\FileHelper.cs" /> <Compile Include="Helpers\PathHelper.cs" /> <Compile Include="Helpers\ThreadsHelper.cs" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs index f70556346..364c46d8d 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs @@ -38,6 +38,10 @@ namespace Tango.DAL.Remote.DB public bool ENABLE_LUBRICATION { get; set; } public int JOB_INDEX { get; set; } public int ESTIMATED_DURATION_MILI { get; set; } + public bool HAS_EMBROIDERY_FILE { get; set; } + public byte[] EMBROIDERY_FILE_DATA { get; set; } + public string EMBROIDERY_FILE_NAME { get; set; } + public byte[] EMBROIDERY_JPEG { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<JOB_RUNS> JOB_RUNS { 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 906362edf..7f913ba59 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -487,6 +487,10 @@ <Property Name="ENABLE_LUBRICATION" Type="bit" Nullable="false" /> <Property Name="JOB_INDEX" Type="int" Nullable="false" /> <Property Name="ESTIMATED_DURATION_MILI" Type="int" Nullable="false" /> + <Property Name="HAS_EMBROIDERY_FILE" Type="bit" Nullable="false" /> + <Property Name="EMBROIDERY_FILE_DATA" Type="image" /> + <Property Name="EMBROIDERY_FILE_NAME" Type="nvarchar" MaxLength="100" /> + <Property Name="EMBROIDERY_JPEG" Type="image" /> </EntityType> <EntityType Name="LINEAR_MASS_DENSITY_UNITS"> <Key> @@ -2960,6 +2964,10 @@ <Property Name="ENABLE_LUBRICATION" Type="Boolean" Nullable="false" /> <Property Name="JOB_INDEX" Type="Int32" Nullable="false" /> <Property Name="ESTIMATED_DURATION_MILI" Type="Int32" Nullable="false" /> + <Property Name="HAS_EMBROIDERY_FILE" Type="Boolean" Nullable="false" /> + <Property Name="EMBROIDERY_FILE_DATA" Type="Binary" MaxLength="Max" FixedLength="false" /> + <Property Name="EMBROIDERY_FILE_NAME" Type="String" MaxLength="100" FixedLength="false" Unicode="true" /> + <Property Name="EMBROIDERY_JPEG" Type="Binary" MaxLength="Max" FixedLength="false" /> <NavigationProperty Name="JOB_RUNS" Relationship="RemoteModel.FK_JOB_RUNS_JOBS" FromRole="JOB" ToRole="JOB_RUNS" /> <NavigationProperty Name="MACHINE" Relationship="RemoteModel.FK_JOBS_MACHINES" FromRole="JOB" ToRole="MACHINE" /> <NavigationProperty Name="RML" Relationship="RemoteModel.FK_JOBS_RMLS" FromRole="JOB" ToRole="RML" /> @@ -4782,6 +4790,10 @@ <EntitySetMapping Name="JOBS"> <EntityTypeMapping TypeName="RemoteModel.JOB"> <MappingFragment StoreEntitySet="JOBS"> + <ScalarProperty Name="EMBROIDERY_JPEG" ColumnName="EMBROIDERY_JPEG" /> + <ScalarProperty Name="EMBROIDERY_FILE_NAME" ColumnName="EMBROIDERY_FILE_NAME" /> + <ScalarProperty Name="EMBROIDERY_FILE_DATA" ColumnName="EMBROIDERY_FILE_DATA" /> + <ScalarProperty Name="HAS_EMBROIDERY_FILE" ColumnName="HAS_EMBROIDERY_FILE" /> <ScalarProperty Name="ESTIMATED_DURATION_MILI" ColumnName="ESTIMATED_DURATION_MILI" /> <ScalarProperty Name="JOB_INDEX" ColumnName="JOB_INDEX" /> <ScalarProperty Name="ENABLE_LUBRICATION" ColumnName="ENABLE_LUBRICATION" /> 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 e8e05bfe3..086143a4d 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,72 +5,72 @@ <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1"> - <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="6" PointY="86.75" /> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="50" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="1.5" PointY="57.125" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="77.625" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="1.5" PointY="68.125" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="1.5" PointY="71" /> - <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="10.75" PointY="16.375" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="6" PointY="58" /> - <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="5.25" PointY="14.75" /> - <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="31" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="8.5" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="6.25" PointY="2.5" /> - <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="0.75" PointY="61.75" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="37.875" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="6" PointY="44.25" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="80.5" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="54.25" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="6" PointY="39.625" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="8.25" PointY="39.75" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="27.25" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="21.375" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="4.5" PointY="69.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="6.75" PointY="69.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="4.5" PointY="83.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="6.75" PointY="77.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="1.5" PointY="84.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="3.75" PointY="72.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="73.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="4.5" PointY="79.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="6.75" PointY="74.125" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="6" PointY="61" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="8.25" PointY="49.25" /> - <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="7.5" PointY="8.125" /> - <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="5.25" PointY="8.25" /> - <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="15" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="6" PointY="35.625" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="8.25" PointY="14.875" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="5.25" PointY="21.75" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="0.75" PointY="46.5" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="3" PointY="45" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="5.25" PointY="54.875" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="8.25" PointY="33.375" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="18.625" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="24.25" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="7.75" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="10.75" /> - <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="6" PointY="49.875" /> - <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="0.75" PointY="33.25" /> - <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="8" PointY="64.875" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="25" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="26.25" /> - <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="12.25" /> - <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="8" PointY="54.75" /> - <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="10.25" PointY="54.875" /> - <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="7.5" PointY="18.375" /> - <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="3" PointY="25.75" /> - <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="0.75" PointY="1.25" /> - <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="2.75" PointY="1.25" /> - <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="0.75" PointY="4.25" /> - <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="2.75" PointY="4.25" /> - <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="9.75" PointY="8.25" /> - <EntityTypeShape EntityType="RemoteModel.TECH_MOTORS" Width="1.5" PointX="10.75" PointY="1.25" /> - <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="10.75" PointY="5.25" /> - <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="3" PointY="21" /> - <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="10.25" PointY="24.75" /> - <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="3" PointY="60.75" /> + <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="7" PointY="83.625" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="74.875" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="1.5" PointY="67.875" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="62" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="1.5" PointY="53.25" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="1.5" PointY="64.875" /> + <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="12.75" PointY="15.375" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="6.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="5.25" PointY="15.75" /> + <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="32.375" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="10.5" PointY="6.75" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="8.25" PointY="8.5" /> + <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3.75" PointY="57" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="70.75" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="6.75" PointY="73.75" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="59.125" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="56.125" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="7" PointY="79.5" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="9.25" PointY="79.625" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="25.25" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="22.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="4.5" PointY="65.875" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="6.75" PointY="54.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="4.5" PointY="53.875" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="6.75" PointY="48.5" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="7.5" PointY="65.875" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="9.75" PointY="48.5" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="49.5" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="1.5" PointY="45.875" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="3.75" PointY="49.75" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="6.75" PointY="4.5" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="9" PointY="33.375" /> + <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="10.5" PointY="14" /> + <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="8.25" PointY="13.875" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="16" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="8.625" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="5.25" PointY="11.75" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="8.25" PointY="42.125" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3.75" PointY="46.25" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="6" PointY="60.375" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="8.25" PointY="59.5" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="9.25" PointY="55.25" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="19.625" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="8.75" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="11.75" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="28.25" /> + <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="6.75" PointY="70.625" /> + <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3.75" PointY="73.125" /> + <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="9" PointY="3.25" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="26.375" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="27.625" /> + <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="13.25" /> + <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="9" PointY="22.125" /> + <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="11.25" PointY="23.25" /> + <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="10.5" PointY="17.375" /> + <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="6" PointY="37.25" /> + <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="0.75" PointY="2.125" /> + <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="2.75" PointY="2.125" /> + <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="0.75" PointY="5.125" /> + <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="11.75" PointY="2.125" /> + <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="12.75" PointY="6.125" /> + <EntityTypeShape EntityType="RemoteModel.TECH_MOTORS" Width="1.5" PointX="2.75" PointY="5.125" /> + <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="12.75" PointY="11.125" /> + <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="6" PointY="41.375" /> + <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="11.25" PointY="42.125" /> + <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="6" PointY="20.25" /> <AssociationConnector Association="RemoteModel.FK_EVENTS_ACTIONS_ACTIONS" /> <AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" /> <AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" /> diff --git a/Software/Visual_Studio/Tango.PMR/Embroidery/ConvertFileInput.cs b/Software/Visual_Studio/Tango.PMR/Embroidery/ConvertFileInput.cs new file mode 100644 index 000000000..3b07dea67 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Embroidery/ConvertFileInput.cs @@ -0,0 +1,188 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ConvertFileInput.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Embroidery { + + /// <summary>Holder for reflection information generated from ConvertFileInput.proto</summary> + public static partial class ConvertFileInputReflection { + + #region Descriptor + /// <summary>File descriptor for ConvertFileInput.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ConvertFileInputReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChZDb252ZXJ0RmlsZUlucHV0LnByb3RvEhRUYW5nby5QTVIuRW1icm9pZGVy", + "eSI6ChBDb252ZXJ0RmlsZUlucHV0EhIKClNvdXJjZUZpbGUYASABKAkSEgoK", + "VGFyZ2V0RmlsZRgCIAEoCUIgCh5jb20udHdpbmUudGFuZ28ucG1yLmVtYnJv", + "aWRlcnliBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Embroidery.ConvertFileInput), global::Tango.PMR.Embroidery.ConvertFileInput.Parser, new[]{ "SourceFile", "TargetFile" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ConvertFileInput : pb::IMessage<ConvertFileInput> { + private static readonly pb::MessageParser<ConvertFileInput> _parser = new pb::MessageParser<ConvertFileInput>(() => new ConvertFileInput()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<ConvertFileInput> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Embroidery.ConvertFileInputReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertFileInput() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertFileInput(ConvertFileInput other) : this() { + sourceFile_ = other.sourceFile_; + targetFile_ = other.targetFile_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertFileInput Clone() { + return new ConvertFileInput(this); + } + + /// <summary>Field number for the "SourceFile" field.</summary> + public const int SourceFileFieldNumber = 1; + private string sourceFile_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SourceFile { + get { return sourceFile_; } + set { + sourceFile_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "TargetFile" field.</summary> + public const int TargetFileFieldNumber = 2; + private string targetFile_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string TargetFile { + get { return targetFile_; } + set { + targetFile_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ConvertFileInput); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ConvertFileInput other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SourceFile != other.SourceFile) return false; + if (TargetFile != other.TargetFile) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (SourceFile.Length != 0) hash ^= SourceFile.GetHashCode(); + if (TargetFile.Length != 0) hash ^= TargetFile.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (SourceFile.Length != 0) { + output.WriteRawTag(10); + output.WriteString(SourceFile); + } + if (TargetFile.Length != 0) { + output.WriteRawTag(18); + output.WriteString(TargetFile); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (SourceFile.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SourceFile); + } + if (TargetFile.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(TargetFile); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ConvertFileInput other) { + if (other == null) { + return; + } + if (other.SourceFile.Length != 0) { + SourceFile = other.SourceFile; + } + if (other.TargetFile.Length != 0) { + TargetFile = other.TargetFile; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + SourceFile = input.ReadString(); + break; + } + case 18: { + TargetFile = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Embroidery/ConvertFileOutput.cs b/Software/Visual_Studio/Tango.PMR/Embroidery/ConvertFileOutput.cs new file mode 100644 index 000000000..f5d77e7ef --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Embroidery/ConvertFileOutput.cs @@ -0,0 +1,159 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ConvertFileOutput.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Embroidery { + + /// <summary>Holder for reflection information generated from ConvertFileOutput.proto</summary> + public static partial class ConvertFileOutputReflection { + + #region Descriptor + /// <summary>File descriptor for ConvertFileOutput.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ConvertFileOutputReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChdDb252ZXJ0RmlsZU91dHB1dC5wcm90bxIUVGFuZ28uUE1SLkVtYnJvaWRl", + "cnkiJwoRQ29udmVydEZpbGVPdXRwdXQSEgoKU3VjY2Vzc2Z1bBgBIAEoCEIg", + "Ch5jb20udHdpbmUudGFuZ28ucG1yLmVtYnJvaWRlcnliBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Embroidery.ConvertFileOutput), global::Tango.PMR.Embroidery.ConvertFileOutput.Parser, new[]{ "Successful" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ConvertFileOutput : pb::IMessage<ConvertFileOutput> { + private static readonly pb::MessageParser<ConvertFileOutput> _parser = new pb::MessageParser<ConvertFileOutput>(() => new ConvertFileOutput()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<ConvertFileOutput> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Embroidery.ConvertFileOutputReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertFileOutput() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertFileOutput(ConvertFileOutput other) : this() { + successful_ = other.successful_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConvertFileOutput Clone() { + return new ConvertFileOutput(this); + } + + /// <summary>Field number for the "Successful" field.</summary> + public const int SuccessfulFieldNumber = 1; + private bool successful_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Successful { + get { return successful_; } + set { + successful_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ConvertFileOutput); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ConvertFileOutput other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Successful != other.Successful) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Successful != false) hash ^= Successful.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Successful != false) { + output.WriteRawTag(8); + output.WriteBool(Successful); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Successful != false) { + size += 1 + 1; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ConvertFileOutput other) { + if (other == null) { + return; + } + if (other.Successful != false) { + Successful = other.Successful; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Successful = input.ReadBool(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs index 0f8c24626..158e00b5e 100644 --- a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs +++ b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs @@ -13,7 +13,7 @@ namespace Tango.PMR /// <summary> /// Contains PMR extension methods. /// </summary> - public static class ExtensionMethods + public static class ExtensionMethods { /// <summary> /// Gets the protobuf <see cref="OriginalNameAttribute"/> attribute value from the message type. diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index 6b595e501..b36887b0b 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -90,6 +90,8 @@ <Compile Include="Diagnostics\ThreadJoggingResponse.cs" /> <Compile Include="Embroidery\AnalyzeInput.cs" /> <Compile Include="Embroidery\AnalyzeOutput.cs" /> + <Compile Include="Embroidery\ConvertFileInput.cs" /> + <Compile Include="Embroidery\ConvertFileOutput.cs" /> <Compile Include="Embroidery\EmbroideryFile.cs" /> <Compile Include="Embroidery\Extents.cs" /> <Compile Include="Embroidery\Stitch.cs" /> |
