diff options
| author | Roy <roy.mail.net@gmail.com> | 2017-12-26 21:16:15 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2017-12-26 21:16:15 +0200 |
| commit | 2ea2bb5bcd96045f1bd6cb4c3d8b8416dbaa05dc (patch) | |
| tree | a21ff27fff08876e835df82c5242def1f0d09c17 /Software | |
| parent | 6450fc175114a6f8d0b75cb21386d1bb0c902711 (diff) | |
| download | Tango-2ea2bb5bcd96045f1bd6cb4c3d8b8416dbaa05dc.tar.gz Tango-2ea2bb5bcd96045f1bd6cb4c3d8b8416dbaa05dc.zip | |
MERGE
Diffstat (limited to 'Software')
165 files changed, 7700 insertions, 296 deletions
diff --git a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/DateConverter.java b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/DateConverter.java index 165d0f161..548b1dd09 100644 --- a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/DateConverter.java +++ b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/DateConverter.java @@ -21,14 +21,14 @@ public class DateConverter extends TypeConverter<String,DateTime> @Override public String getDBValue(DateTime model) { - DateTimeFormatter dtfOut = DateTimeFormat.forPattern("yyyy-MM-dd hh:mm:ss"); + DateTimeFormatter dtfOut = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS"); return dtfOut.print(model); } @Override public DateTime getModelValue(String data) { - DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-dd hh:mm:ss"); + DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS"); DateTime jodatime = dtf.parseDateTime(data); return jodatime; } diff --git a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/TangoDB.java b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/TangoDB.java index 367cbc088..53bb6a8e2 100644 --- a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/TangoDB.java +++ b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/TangoDB.java @@ -37,7 +37,7 @@ public class TangoDB { database_name = "Tango.db"; database_path = ContextHelper.getApplicationContext().getDatabasePath(database_name).getPath(); - database_backup_path = Environment.getExternalStorageDirectory() + "/BACKUP/" + "backup.db"; + database_backup_path = ContextHelper.getApplicationContext().getDatabasePath("backup").getPath(); try { diff --git a/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb b/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb Binary files differindex 0419b065c..f7af9b52f 100644 --- a/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb +++ b/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/MachineIdentityProvider.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/MachineIdentityProvider.java index b4f2d3c4d..c72b9cea4 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/MachineIdentityProvider.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/MachineIdentityProvider.java @@ -1,4 +1,8 @@ package com.twine.tango.integration.providers; +import com.twine.tango.dal.dao.TangoDAO; +import com.twine.tango.dal.entities.Machine; + +import static br.com.zbra.androidlinq.Linq.stream; /** @@ -6,10 +10,10 @@ package com.twine.tango.integration.providers; */ public class MachineIdentityProvider implements IMachineIdentityProvider { - @Override public String getSerialNumber() { - return "1234"; + Machine machine = stream(TangoDAO.getAllMachines()).firstOrNull(); + return machine != null ? machine.getSerialNumber() : "0000"; } } diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/ExternalBridgeService.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/ExternalBridgeService.java index 709d5a271..24ae72eba 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/ExternalBridgeService.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/ExternalBridgeService.java @@ -22,6 +22,7 @@ import com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClas import com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest; import com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse; import com.twine.tango.transport.ITransportAdapter; +import com.twine.tango.transport.ResponseErrorException; import com.twine.tango.transport.adapters.TcpTransportAdapter; import com.twine.tango.transport.transporters.ProtoTransporter; @@ -198,7 +199,7 @@ public class ExternalBridgeService extends ProtoTransporter implements IExternal if (container.getType() == MessageType.ExternalClientLoginRequest) { ExternalClientLoginRequest request = MessageFactory.parseMessageFromContainer(container); - if (request.getKey().equals("1234")) + if (request.getPassword().equals("Aa123456")) //TODO: Compare with global machine settings password... { getAdapters().get(0).setAuthenticated(true); sendResponse(MessageFactory.createTangoMessage( @@ -235,21 +236,23 @@ public class ExternalBridgeService extends ProtoTransporter implements IExternal //Route to machine... if (container.getContinuous()) { + //noinspection unchecked machineOperator.sendContinuousRequest(MessageFactory.createTangoMessage(container, message)).subscribe((response) -> { sendResponse((TangoMessage<? extends GeneratedMessageV3>) response); }, (ex) -> { - + sendResponse((TangoMessage<? extends GeneratedMessageV3>) ((ResponseErrorException)ex).getResponse()); }); } else { + //noinspection unchecked machineOperator.sendRequest(MessageFactory.createTangoMessage(container, message)).subscribe((response) -> { sendResponse((TangoMessage<? extends GeneratedMessageV3>) response); }, (ex) -> { - + sendResponse((TangoMessage<? extends GeneratedMessageV3>) ((ResponseErrorException)ex).getResponse()); }); } } diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/SynchronizationService.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/SynchronizationService.java index 0f3d98982..53b4c8194 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/SynchronizationService.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/SynchronizationService.java @@ -1,5 +1,7 @@ package com.twine.tango.integration.services; +import android.os.AsyncTask; + import com.elvishew.xlog.XLog; import com.google.protobuf.ByteString; import com.snatik.storage.Storage; @@ -10,12 +12,18 @@ import com.twine.tango.integration.services.IExternalBridgeService.MessageReceiv import com.twine.tango.pmr.MessageFactory; import com.twine.tango.pmr.TangoMessage; import com.twine.tango.pmr.common.MessageTypeOuterClass.MessageType; +import com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest; +import com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse; +import com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest; +import com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse; import com.twine.tango.pmr.stubs.CalculateRequestOuterClass.CalculateRequest; import com.twine.tango.pmr.stubs.CalculateResponseOuterClass.CalculateResponse; import com.twine.tango.pmr.synchronization.SynchronizeDBRequestOuterClass.SynchronizeDBRequest; import com.twine.tango.web.WebApiFactory; import com.twine.tango.web.ISynchronizationAPI; +import java.io.IOException; + import javax.inject.Inject; import io.reactivex.Completable; @@ -39,14 +47,96 @@ public class SynchronizationService implements ISynchronizationService { this.machineIdentityProvider = machineIdentityProvider; this.bridgeService = bridgeService; - //this.bridgeService.registerMessageHandler(this::handleCalculateRequest, MessageType.CalculateRequest); + this.bridgeService.registerMessageHandler(this::handleDirectSynchronizationRequest, MessageType.DirectSynchronizationRequest); + this.bridgeService.<OverrideDataBaseRequest>registerMessageHandler(this::handleOverrideDataBaseRequest, MessageType.OverrideDataBaseRequest); + } - private void handleCalculateRequest(Object o, MessageReceivedArgs<CalculateRequest> e) + private void handleOverrideDataBaseRequest(Object o, MessageReceivedArgs<OverrideDataBaseRequest> request) { - CalculateResponse response = CalculateResponse.newBuilder().setSum(e.getMessage().getA() + e.getMessage().getB()).build(); - TangoMessage<CalculateResponse> tangoMessage = MessageFactory.createTangoMessage(CalculateResponse.class, response, e.getContainer().getToken()); - bridgeService.sendResponse(tangoMessage); + AsyncTask.execute(() -> + { + try + { + //Backup DataBase. + TangoDB.backup(); + + //Replace Database. + TangoDB.replace(request.getMessage().getRemoteDB().toByteArray()); + + //Create response. + OverrideDataBaseResponse response = OverrideDataBaseResponse.newBuilder() + .setSuccessful(true) + .build(); + + TangoMessage<OverrideDataBaseResponse> message = MessageFactory.createTangoMessage( + OverrideDataBaseResponse.class, + response); + + bridgeService.sendResponse(message, request.getContainer().getToken()).subscribe(() -> + { + + },(ex) -> + { + XLog.e(ex); + }); + + } catch (Exception e) + { + XLog.e(e); + //Create response. + OverrideDataBaseResponse response = OverrideDataBaseResponse.newBuilder() + .setSuccessful(false) + .build(); + + TangoMessage<OverrideDataBaseResponse> message = MessageFactory.createTangoMessage( + OverrideDataBaseResponse.class, + response); + + bridgeService.sendResponse(message, request.getContainer().getToken()).subscribe(() -> + { + + },(ex) -> + { + XLog.e(ex); + }); + } + }); + } + + private void handleDirectSynchronizationRequest(Object o, MessageReceivedArgs<DirectSynchronizationRequest> request) + { + AsyncTask.execute(() -> + { + try + { + Storage storage = new Storage(ContextHelper.getApplicationContext()); + + //Read current DB file bytes. + byte[] data = storage.readFile(TangoDB.getDataBasePath()); + + //Create synchronization response. + DirectSynchronizationResponse response = DirectSynchronizationResponse.newBuilder() + .setLocalDB(ByteString.copyFrom(data)) + .build(); + + TangoMessage<DirectSynchronizationResponse> message = MessageFactory.createTangoMessage( + DirectSynchronizationResponse.class, + response); + + bridgeService.sendResponse(message, request.getContainer().getToken()).subscribe(() -> + { + + },(ex) -> + { + XLog.e(ex); + }); + + } catch (Exception e) + { + XLog.e(e); + } + }); } @Override diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/common/MessageTypeOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/common/MessageTypeOuterClass.java index 27d581c93..c6aaf8d17 100644 --- a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/common/MessageTypeOuterClass.java +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/common/MessageTypeOuterClass.java @@ -163,6 +163,22 @@ public final class MessageTypeOuterClass { * <code>ExternalClientLoginResponse = 35;</code> */ ExternalClientLoginResponse(35), + /** + * <code>DirectSynchronizationRequest = 36;</code> + */ + DirectSynchronizationRequest(36), + /** + * <code>DirectSynchronizationResponse = 37;</code> + */ + DirectSynchronizationResponse(37), + /** + * <code>OverrideDataBaseRequest = 38;</code> + */ + OverrideDataBaseRequest(38), + /** + * <code>OverrideDataBaseResponse = 39;</code> + */ + OverrideDataBaseResponse(39), UNRECOGNIZED(-1), ; @@ -310,6 +326,22 @@ public final class MessageTypeOuterClass { * <code>ExternalClientLoginResponse = 35;</code> */ public static final int ExternalClientLoginResponse_VALUE = 35; + /** + * <code>DirectSynchronizationRequest = 36;</code> + */ + public static final int DirectSynchronizationRequest_VALUE = 36; + /** + * <code>DirectSynchronizationResponse = 37;</code> + */ + public static final int DirectSynchronizationResponse_VALUE = 37; + /** + * <code>OverrideDataBaseRequest = 38;</code> + */ + public static final int OverrideDataBaseRequest_VALUE = 38; + /** + * <code>OverrideDataBaseResponse = 39;</code> + */ + public static final int OverrideDataBaseResponse_VALUE = 39; public final int getNumber() { @@ -366,6 +398,10 @@ public final class MessageTypeOuterClass { case 33: return ExternalBridgeUdpDiscoveryPacket; case 34: return ExternalClientLoginRequest; case 35: return ExternalClientLoginResponse; + case 36: return DirectSynchronizationRequest; + case 37: return DirectSynchronizationResponse; + case 38: return OverrideDataBaseRequest; + case 39: return OverrideDataBaseResponse; default: return null; } } @@ -427,7 +463,7 @@ public final class MessageTypeOuterClass { descriptor; static { java.lang.String[] descriptorData = { - "\n\021MessageType.proto\022\020Tango.PMR.Common*\326\007" + + "\n\021MessageType.proto\022\020Tango.PMR.Common*\326\010" + "\n\013MessageType\022\007\n\003RGB\020\000\022\007\n\003Job\020\001\022\013\n\007Segme" + "nt\020\002\022\024\n\020CalculateRequest\020\003\022\025\n\021CalculateR" + "esponse\020\004\022\023\n\017ProgressRequest\020\005\022\024\n\020Progre" + @@ -452,8 +488,11 @@ public final class MessageTypeOuterClass { "ubValveRequest\020\037\022\025\n\021StubValveResponse\020 \022" + "$\n ExternalBridgeUdpDiscoveryPacket\020!\022\036\n" + "\032ExternalClientLoginRequest\020\"\022\037\n\033Externa" + - "lClientLoginResponse\020#B\034\n\032com.twine.tang" + - "o.pmr.commonb\006proto3" + "lClientLoginResponse\020#\022 \n\034DirectSynchron" + + "izationRequest\020$\022!\n\035DirectSynchronizatio" + + "nResponse\020%\022\033\n\027OverrideDataBaseRequest\020&" + + "\022\034\n\030OverrideDataBaseResponse\020\'B\034\n\032com.tw" + + "ine.tango.pmr.commonb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/DirectSynchronizationRequestOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/DirectSynchronizationRequestOuterClass.java new file mode 100644 index 000000000..b2d324b39 --- /dev/null +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/DirectSynchronizationRequestOuterClass.java @@ -0,0 +1,441 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DirectSynchronizationRequest.proto + +package com.twine.tango.pmr.integration; + +public final class DirectSynchronizationRequestOuterClass { + private DirectSynchronizationRequestOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface DirectSynchronizationRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:Tango.PMR.Integration.DirectSynchronizationRequest) + com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code Tango.PMR.Integration.DirectSynchronizationRequest} + */ + public static final class DirectSynchronizationRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Tango.PMR.Integration.DirectSynchronizationRequest) + DirectSynchronizationRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DirectSynchronizationRequest.newBuilder() to construct. + private DirectSynchronizationRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { + super(builder); + } + private DirectSynchronizationRequest() { + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DirectSynchronizationRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest.class, com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest.Builder.class); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest)) { + return super.equals(obj); + } + com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest other = (com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest) obj; + + boolean result = true; + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code Tango.PMR.Integration.DirectSynchronizationRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements + // @@protoc_insertion_point(builder_implements:Tango.PMR.Integration.DirectSynchronizationRequest) + com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest.class, com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest.Builder.class); + } + + // Construct using com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_descriptor; + } + + public com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest getDefaultInstanceForType() { + return com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest.getDefaultInstance(); + } + + public com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest build() { + com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest buildPartial() { + com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest result = new com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest(this); + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest) { + return mergeFrom((com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest other) { + if (other == com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest.getDefaultInstance()) return this; + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Tango.PMR.Integration.DirectSynchronizationRequest) + } + + // @@protoc_insertion_point(class_scope:Tango.PMR.Integration.DirectSynchronizationRequest) + private static final com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest(); + } + + public static com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser<DirectSynchronizationRequest> + PARSER = new com.google.protobuf.AbstractParser<DirectSynchronizationRequest>() { + public DirectSynchronizationRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DirectSynchronizationRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser<DirectSynchronizationRequest> parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser<DirectSynchronizationRequest> getParserForType() { + return PARSER; + } + + public com.twine.tango.pmr.integration.DirectSynchronizationRequestOuterClass.DirectSynchronizationRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\"DirectSynchronizationRequest.proto\022\025Ta" + + "ngo.PMR.Integration\"\036\n\034DirectSynchroniza" + + "tionRequestB!\n\037com.twine.tango.pmr.integ" + + "rationb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Tango_PMR_Integration_DirectSynchronizationRequest_descriptor, + new java.lang.String[] { }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/DirectSynchronizationResponseOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/DirectSynchronizationResponseOuterClass.java new file mode 100644 index 000000000..e1187ec4b --- /dev/null +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/DirectSynchronizationResponseOuterClass.java @@ -0,0 +1,508 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DirectSynchronizationResponse.proto + +package com.twine.tango.pmr.integration; + +public final class DirectSynchronizationResponseOuterClass { + private DirectSynchronizationResponseOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface DirectSynchronizationResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:Tango.PMR.Integration.DirectSynchronizationResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * <code>bytes LocalDB = 1;</code> + */ + com.google.protobuf.ByteString getLocalDB(); + } + /** + * Protobuf type {@code Tango.PMR.Integration.DirectSynchronizationResponse} + */ + public static final class DirectSynchronizationResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Tango.PMR.Integration.DirectSynchronizationResponse) + DirectSynchronizationResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use DirectSynchronizationResponse.newBuilder() to construct. + private DirectSynchronizationResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { + super(builder); + } + private DirectSynchronizationResponse() { + localDB_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DirectSynchronizationResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + + localDB_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse.class, com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse.Builder.class); + } + + public static final int LOCALDB_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString localDB_; + /** + * <code>bytes LocalDB = 1;</code> + */ + public com.google.protobuf.ByteString getLocalDB() { + return localDB_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!localDB_.isEmpty()) { + output.writeBytes(1, localDB_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!localDB_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, localDB_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse)) { + return super.equals(obj); + } + com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse other = (com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse) obj; + + boolean result = true; + result = result && getLocalDB() + .equals(other.getLocalDB()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LOCALDB_FIELD_NUMBER; + hash = (53 * hash) + getLocalDB().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code Tango.PMR.Integration.DirectSynchronizationResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements + // @@protoc_insertion_point(builder_implements:Tango.PMR.Integration.DirectSynchronizationResponse) + com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse.class, com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse.Builder.class); + } + + // Construct using com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + localDB_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_descriptor; + } + + public com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse getDefaultInstanceForType() { + return com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse.getDefaultInstance(); + } + + public com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse build() { + com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse buildPartial() { + com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse result = new com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse(this); + result.localDB_ = localDB_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse) { + return mergeFrom((com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse other) { + if (other == com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse.getDefaultInstance()) return this; + if (other.getLocalDB() != com.google.protobuf.ByteString.EMPTY) { + setLocalDB(other.getLocalDB()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.ByteString localDB_ = com.google.protobuf.ByteString.EMPTY; + /** + * <code>bytes LocalDB = 1;</code> + */ + public com.google.protobuf.ByteString getLocalDB() { + return localDB_; + } + /** + * <code>bytes LocalDB = 1;</code> + */ + public Builder setLocalDB(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + localDB_ = value; + onChanged(); + return this; + } + /** + * <code>bytes LocalDB = 1;</code> + */ + public Builder clearLocalDB() { + + localDB_ = getDefaultInstance().getLocalDB(); + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Tango.PMR.Integration.DirectSynchronizationResponse) + } + + // @@protoc_insertion_point(class_scope:Tango.PMR.Integration.DirectSynchronizationResponse) + private static final com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse(); + } + + public static com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser<DirectSynchronizationResponse> + PARSER = new com.google.protobuf.AbstractParser<DirectSynchronizationResponse>() { + public DirectSynchronizationResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DirectSynchronizationResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser<DirectSynchronizationResponse> parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser<DirectSynchronizationResponse> getParserForType() { + return PARSER; + } + + public com.twine.tango.pmr.integration.DirectSynchronizationResponseOuterClass.DirectSynchronizationResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n#DirectSynchronizationResponse.proto\022\025T" + + "ango.PMR.Integration\"0\n\035DirectSynchroniz" + + "ationResponse\022\017\n\007LocalDB\030\001 \001(\014B!\n\037com.tw" + + "ine.tango.pmr.integrationb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Tango_PMR_Integration_DirectSynchronizationResponse_descriptor, + new java.lang.String[] { "LocalDB", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginRequestOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginRequestOuterClass.java index 9717c3d11..4709d4992 100644 --- a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginRequestOuterClass.java +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginRequestOuterClass.java @@ -19,14 +19,14 @@ public final class ExternalClientLoginRequestOuterClass { com.google.protobuf.MessageOrBuilder { /** - * <code>string key = 1;</code> + * <code>string Password = 1;</code> */ - java.lang.String getKey(); + java.lang.String getPassword(); /** - * <code>string key = 1;</code> + * <code>string Password = 1;</code> */ com.google.protobuf.ByteString - getKeyBytes(); + getPasswordBytes(); } /** * Protobuf type {@code Tango.PMR.Integration.ExternalClientLoginRequest} @@ -41,7 +41,7 @@ public final class ExternalClientLoginRequestOuterClass { super(builder); } private ExternalClientLoginRequest() { - key_ = ""; + password_ = ""; } @java.lang.Override @@ -75,7 +75,7 @@ public final class ExternalClientLoginRequestOuterClass { case 10: { java.lang.String s = input.readStringRequireUtf8(); - key_ = s; + password_ = s; break; } } @@ -102,34 +102,34 @@ public final class ExternalClientLoginRequestOuterClass { com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.class, com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.Builder.class); } - public static final int KEY_FIELD_NUMBER = 1; - private volatile java.lang.Object key_; + public static final int PASSWORD_FIELD_NUMBER = 1; + private volatile java.lang.Object password_; /** - * <code>string key = 1;</code> + * <code>string Password = 1;</code> */ - public java.lang.String getKey() { - java.lang.Object ref = key_; + public java.lang.String getPassword() { + java.lang.Object ref = password_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); - key_ = s; + password_ = s; return s; } } /** - * <code>string key = 1;</code> + * <code>string Password = 1;</code> */ public com.google.protobuf.ByteString - getKeyBytes() { - java.lang.Object ref = key_; + getPasswordBytes() { + java.lang.Object ref = password_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); - key_ = b; + password_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; @@ -148,8 +148,8 @@ public final class ExternalClientLoginRequestOuterClass { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getKeyBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + if (!getPasswordBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, password_); } unknownFields.writeTo(output); } @@ -159,8 +159,8 @@ public final class ExternalClientLoginRequestOuterClass { if (size != -1) return size; size = 0; - if (!getKeyBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + if (!getPasswordBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, password_); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -178,8 +178,8 @@ public final class ExternalClientLoginRequestOuterClass { com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest other = (com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest) obj; boolean result = true; - result = result && getKey() - .equals(other.getKey()); + result = result && getPassword() + .equals(other.getPassword()); result = result && unknownFields.equals(other.unknownFields); return result; } @@ -191,8 +191,8 @@ public final class ExternalClientLoginRequestOuterClass { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + KEY_FIELD_NUMBER; - hash = (53 * hash) + getKey().hashCode(); + hash = (37 * hash) + PASSWORD_FIELD_NUMBER; + hash = (53 * hash) + getPassword().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -322,7 +322,7 @@ public final class ExternalClientLoginRequestOuterClass { } public Builder clear() { super.clear(); - key_ = ""; + password_ = ""; return this; } @@ -346,7 +346,7 @@ public final class ExternalClientLoginRequestOuterClass { public com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest buildPartial() { com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest result = new com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest(this); - result.key_ = key_; + result.password_ = password_; onBuilt(); return result; } @@ -388,8 +388,8 @@ public final class ExternalClientLoginRequestOuterClass { public Builder mergeFrom(com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest other) { if (other == com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.getDefaultInstance()) return this; - if (!other.getKey().isEmpty()) { - key_ = other.key_; + if (!other.getPassword().isEmpty()) { + password_ = other.password_; onChanged(); } this.mergeUnknownFields(other.unknownFields); @@ -419,71 +419,71 @@ public final class ExternalClientLoginRequestOuterClass { return this; } - private java.lang.Object key_ = ""; + private java.lang.Object password_ = ""; /** - * <code>string key = 1;</code> + * <code>string Password = 1;</code> */ - public java.lang.String getKey() { - java.lang.Object ref = key_; + public java.lang.String getPassword() { + java.lang.Object ref = password_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); - key_ = s; + password_ = s; return s; } else { return (java.lang.String) ref; } } /** - * <code>string key = 1;</code> + * <code>string Password = 1;</code> */ public com.google.protobuf.ByteString - getKeyBytes() { - java.lang.Object ref = key_; + getPasswordBytes() { + java.lang.Object ref = password_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); - key_ = b; + password_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** - * <code>string key = 1;</code> + * <code>string Password = 1;</code> */ - public Builder setKey( + public Builder setPassword( java.lang.String value) { if (value == null) { throw new NullPointerException(); } - key_ = value; + password_ = value; onChanged(); return this; } /** - * <code>string key = 1;</code> + * <code>string Password = 1;</code> */ - public Builder clearKey() { + public Builder clearPassword() { - key_ = getDefaultInstance().getKey(); + password_ = getDefaultInstance().getPassword(); onChanged(); return this; } /** - * <code>string key = 1;</code> + * <code>string Password = 1;</code> */ - public Builder setKeyBytes( + public Builder setPasswordBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - key_ = value; + password_ = value; onChanged(); return this; } @@ -551,9 +551,9 @@ public final class ExternalClientLoginRequestOuterClass { static { java.lang.String[] descriptorData = { "\n ExternalClientLoginRequest.proto\022\025Tang" + - "o.PMR.Integration\")\n\032ExternalClientLogin" + - "Request\022\013\n\003key\030\001 \001(\tB!\n\037com.twine.tango." + - "pmr.integrationb\006proto3" + "o.PMR.Integration\".\n\032ExternalClientLogin" + + "Request\022\020\n\010Password\030\001 \001(\tB!\n\037com.twine.t" + + "ango.pmr.integrationb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -572,7 +572,7 @@ public final class ExternalClientLoginRequestOuterClass { internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_descriptor, - new java.lang.String[] { "Key", }); + new java.lang.String[] { "Password", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/OverrideDataBaseRequestOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/OverrideDataBaseRequestOuterClass.java new file mode 100644 index 000000000..b02fae384 --- /dev/null +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/OverrideDataBaseRequestOuterClass.java @@ -0,0 +1,508 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: OverrideDataBaseRequest.proto + +package com.twine.tango.pmr.integration; + +public final class OverrideDataBaseRequestOuterClass { + private OverrideDataBaseRequestOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface OverrideDataBaseRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:Tango.PMR.Integration.OverrideDataBaseRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * <code>bytes RemoteDB = 1;</code> + */ + com.google.protobuf.ByteString getRemoteDB(); + } + /** + * Protobuf type {@code Tango.PMR.Integration.OverrideDataBaseRequest} + */ + public static final class OverrideDataBaseRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Tango.PMR.Integration.OverrideDataBaseRequest) + OverrideDataBaseRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use OverrideDataBaseRequest.newBuilder() to construct. + private OverrideDataBaseRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { + super(builder); + } + private OverrideDataBaseRequest() { + remoteDB_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private OverrideDataBaseRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + + remoteDB_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest.class, com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest.Builder.class); + } + + public static final int REMOTEDB_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString remoteDB_; + /** + * <code>bytes RemoteDB = 1;</code> + */ + public com.google.protobuf.ByteString getRemoteDB() { + return remoteDB_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!remoteDB_.isEmpty()) { + output.writeBytes(1, remoteDB_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!remoteDB_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, remoteDB_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest)) { + return super.equals(obj); + } + com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest other = (com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest) obj; + + boolean result = true; + result = result && getRemoteDB() + .equals(other.getRemoteDB()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + REMOTEDB_FIELD_NUMBER; + hash = (53 * hash) + getRemoteDB().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code Tango.PMR.Integration.OverrideDataBaseRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements + // @@protoc_insertion_point(builder_implements:Tango.PMR.Integration.OverrideDataBaseRequest) + com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest.class, com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest.Builder.class); + } + + // Construct using com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + remoteDB_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_descriptor; + } + + public com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest getDefaultInstanceForType() { + return com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest.getDefaultInstance(); + } + + public com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest build() { + com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest buildPartial() { + com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest result = new com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest(this); + result.remoteDB_ = remoteDB_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest) { + return mergeFrom((com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest other) { + if (other == com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest.getDefaultInstance()) return this; + if (other.getRemoteDB() != com.google.protobuf.ByteString.EMPTY) { + setRemoteDB(other.getRemoteDB()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.ByteString remoteDB_ = com.google.protobuf.ByteString.EMPTY; + /** + * <code>bytes RemoteDB = 1;</code> + */ + public com.google.protobuf.ByteString getRemoteDB() { + return remoteDB_; + } + /** + * <code>bytes RemoteDB = 1;</code> + */ + public Builder setRemoteDB(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + remoteDB_ = value; + onChanged(); + return this; + } + /** + * <code>bytes RemoteDB = 1;</code> + */ + public Builder clearRemoteDB() { + + remoteDB_ = getDefaultInstance().getRemoteDB(); + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Tango.PMR.Integration.OverrideDataBaseRequest) + } + + // @@protoc_insertion_point(class_scope:Tango.PMR.Integration.OverrideDataBaseRequest) + private static final com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest(); + } + + public static com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser<OverrideDataBaseRequest> + PARSER = new com.google.protobuf.AbstractParser<OverrideDataBaseRequest>() { + public OverrideDataBaseRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OverrideDataBaseRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser<OverrideDataBaseRequest> parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser<OverrideDataBaseRequest> getParserForType() { + return PARSER; + } + + public com.twine.tango.pmr.integration.OverrideDataBaseRequestOuterClass.OverrideDataBaseRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\035OverrideDataBaseRequest.proto\022\025Tango.P" + + "MR.Integration\"+\n\027OverrideDataBaseReques" + + "t\022\020\n\010RemoteDB\030\001 \001(\014B!\n\037com.twine.tango.p" + + "mr.integrationb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Tango_PMR_Integration_OverrideDataBaseRequest_descriptor, + new java.lang.String[] { "RemoteDB", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/OverrideDataBaseResponseOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/OverrideDataBaseResponseOuterClass.java new file mode 100644 index 000000000..562f4259c --- /dev/null +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/OverrideDataBaseResponseOuterClass.java @@ -0,0 +1,506 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: OverrideDataBaseResponse.proto + +package com.twine.tango.pmr.integration; + +public final class OverrideDataBaseResponseOuterClass { + private OverrideDataBaseResponseOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface OverrideDataBaseResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:Tango.PMR.Integration.OverrideDataBaseResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * <code>bool Successful = 1;</code> + */ + boolean getSuccessful(); + } + /** + * Protobuf type {@code Tango.PMR.Integration.OverrideDataBaseResponse} + */ + public static final class OverrideDataBaseResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Tango.PMR.Integration.OverrideDataBaseResponse) + OverrideDataBaseResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use OverrideDataBaseResponse.newBuilder() to construct. + private OverrideDataBaseResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { + super(builder); + } + private OverrideDataBaseResponse() { + successful_ = false; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private OverrideDataBaseResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + + successful_ = input.readBool(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse.class, com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse.Builder.class); + } + + public static final int SUCCESSFUL_FIELD_NUMBER = 1; + private boolean successful_; + /** + * <code>bool Successful = 1;</code> + */ + public boolean getSuccessful() { + return successful_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (successful_ != false) { + output.writeBool(1, successful_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (successful_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, successful_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse)) { + return super.equals(obj); + } + com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse other = (com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse) obj; + + boolean result = true; + result = result && (getSuccessful() + == other.getSuccessful()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SUCCESSFUL_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getSuccessful()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code Tango.PMR.Integration.OverrideDataBaseResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements + // @@protoc_insertion_point(builder_implements:Tango.PMR.Integration.OverrideDataBaseResponse) + com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse.class, com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse.Builder.class); + } + + // Construct using com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + successful_ = false; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_descriptor; + } + + public com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse getDefaultInstanceForType() { + return com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse.getDefaultInstance(); + } + + public com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse build() { + com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse buildPartial() { + com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse result = new com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse(this); + result.successful_ = successful_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse) { + return mergeFrom((com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse other) { + if (other == com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse.getDefaultInstance()) return this; + if (other.getSuccessful() != false) { + setSuccessful(other.getSuccessful()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean successful_ ; + /** + * <code>bool Successful = 1;</code> + */ + public boolean getSuccessful() { + return successful_; + } + /** + * <code>bool Successful = 1;</code> + */ + public Builder setSuccessful(boolean value) { + + successful_ = value; + onChanged(); + return this; + } + /** + * <code>bool Successful = 1;</code> + */ + public Builder clearSuccessful() { + + successful_ = false; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Tango.PMR.Integration.OverrideDataBaseResponse) + } + + // @@protoc_insertion_point(class_scope:Tango.PMR.Integration.OverrideDataBaseResponse) + private static final com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse(); + } + + public static com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser<OverrideDataBaseResponse> + PARSER = new com.google.protobuf.AbstractParser<OverrideDataBaseResponse>() { + public OverrideDataBaseResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OverrideDataBaseResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser<OverrideDataBaseResponse> parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser<OverrideDataBaseResponse> getParserForType() { + return PARSER; + } + + public com.twine.tango.pmr.integration.OverrideDataBaseResponseOuterClass.OverrideDataBaseResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\036OverrideDataBaseResponse.proto\022\025Tango." + + "PMR.Integration\".\n\030OverrideDataBaseRespo" + + "nse\022\022\n\nSuccessful\030\001 \001(\010B!\n\037com.twine.tan" + + "go.pmr.integrationb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Tango_PMR_Integration_OverrideDataBaseResponse_descriptor, + new java.lang.String[] { "Successful", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java index abd12e0f0..2e076b1c8 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java @@ -40,6 +40,20 @@ public interface ITransportAdapter extends ITransportComponent { */ void setAddress(String address); + /** + * Sets the adapter mode. + * + * @param mode the mode + */ + void setAdapterMode(TransportAdapterMode mode); + + /** + * Gets the adapter mode. + * + * @return the adapter mode + */ + TransportAdapterMode getAdapterMode(); + /** * Gets whether this adapter is authenticated. diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java index 9d2bce329..1ad704829 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java @@ -8,6 +8,7 @@ import com.twine.tango.pmr.common.MessageContainerOuterClass.MessageContainer; import org.joda.time.Period; +import io.reactivex.Completable; import io.reactivex.Observable; import io.reactivex.Single; @@ -73,7 +74,7 @@ public interface ITransporter extends ITransportComponent { * @param response the response * @return the single */ - <Response extends GeneratedMessageV3> Single<Response> sendResponse(TangoMessage<Response> response); + <Response extends GeneratedMessageV3> Completable sendResponse(TangoMessage<Response> response); /** * Sends a response with the specified request token. @@ -83,7 +84,7 @@ public interface ITransporter extends ITransportComponent { * @param token the token * @return the single */ - <Response extends GeneratedMessageV3> Single<Response> sendResponse(TangoMessage<Response> response,String token); + <Response extends GeneratedMessageV3> Completable sendResponse(TangoMessage<Response> response,String token); /** * Sets request received listener. diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/transporters/ResponseErrorException.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ResponseErrorException.java index 465412f68..896e92b38 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/transporters/ResponseErrorException.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ResponseErrorException.java @@ -1,5 +1,6 @@ -package com.twine.tango.transport.transporters; +package com.twine.tango.transport; +import com.twine.tango.pmr.TangoMessage; import com.twine.tango.pmr.common.ErrorCodeOuterClass.ErrorCode; @@ -10,6 +11,18 @@ public class ResponseErrorException extends Exception { private ErrorCode error; + private TangoMessage response; + + public TangoMessage getResponse() + { + return response; + } + + public void setResponse(TangoMessage response) + { + this.response = response; + } + /** * Gets the error. * @@ -35,9 +48,10 @@ public class ResponseErrorException extends Exception * * @param error the error */ - public ResponseErrorException(ErrorCode error) + public ResponseErrorException(ErrorCode error,TangoMessage response) { super("Response received with error " + error.toString()); setError(error); + setResponse(response); } } diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java index b9221ea27..6d5667ada 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java @@ -6,6 +6,9 @@ import com.twine.tango.core.IEventHandler; import com.twine.tango.core.ObjectDisposedException; import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.Arrays; import io.reactivex.Completable; @@ -15,18 +18,20 @@ import io.reactivex.Completable; */ public abstract class TransportAdapterBase implements ITransportAdapter { - + protected static final int MAX_BUFFER_SIZE = 1024 * 1024 * 10; //10 MB. private boolean isAuthenticated; private String address; private Event<TransportComponentState> stateChangedEvent; private IEventHandler<byte[]> dataAvailableListener; private TransportComponentState state; + private TransportAdapterMode adapterMode; /** * Instantiates a new Transport adapter base. */ public TransportAdapterBase() { + setAdapterMode(TransportAdapterMode.NO_HEADER); stateChangedEvent = new Event<>(); setAuthenticated(true); } @@ -56,6 +61,18 @@ public abstract class TransportAdapterBase implements ITransportAdapter } @Override + public void setAdapterMode(TransportAdapterMode mode) + { + adapterMode = mode; + } + + @Override + public TransportAdapterMode getAdapterMode() + { + return adapterMode; + } + + @Override public boolean isAuthenticated() { return isAuthenticated; @@ -155,4 +172,36 @@ public abstract class TransportAdapterBase implements ITransportAdapter setState(TransportComponentState.Failed); XLog.e(ex); } + + /** + * Applies any additional headers if required. + * + * @param data the data + * @return the byte [ ] + */ + protected byte[] postProcessBuffer(byte[] data) + { + if (adapterMode == TransportAdapterMode.NO_HEADER) + { + return data; + } else + { + byte[] size = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putInt(data.length).array(); + return concatByteArrays(size, data); + } + } + + /** + * Concat byte arrays byte [ ]. + * + * @param first the first + * @param second the second + * @return the byte [ ] + */ + protected byte[] concatByteArrays(byte[] first, byte[] second) + { + byte[] result = Arrays.copyOf(first, first.length + second.length); + System.arraycopy(second, 0, result, first.length, second.length); + return result; + } } diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterMode.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterMode.java new file mode 100644 index 000000000..699be758d --- /dev/null +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterMode.java @@ -0,0 +1,17 @@ +package com.twine.tango.transport; + + +/** + * Represents an {@link com.twine.tango.transport.ITransportAdapter} read/write mode. + */ +public enum TransportAdapterMode +{ + /** + * Pure protobuf message with no message size. + */ + NO_HEADER, + /** + * Prepends and truncates the message size before writing and reading. + */ + PREPEND_HEADER +} diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java index 3c09d547f..ff192bc3b 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java @@ -16,7 +16,6 @@ import com.twine.tango.pmr.MessageFactory; import com.twine.tango.pmr.TangoMessage; import com.twine.tango.pmr.common.ErrorCodeOuterClass.ErrorCode; import com.twine.tango.pmr.common.MessageContainerOuterClass.MessageContainer; -import com.twine.tango.transport.transporters.ResponseErrorException; import org.joda.time.Period; @@ -414,13 +413,13 @@ public abstract class TransporterBase implements ITransporter } @Override - public <Response extends GeneratedMessageV3> Single<Response> sendResponse(TangoMessage<Response> response) + public <Response extends GeneratedMessageV3> Completable sendResponse(TangoMessage<Response> response) { return sendResponse(response, response.getContainer().getToken()); } @Override - public <Response extends GeneratedMessageV3> Single<Response> sendResponse(TangoMessage<Response> response, String token) + public <Response extends GeneratedMessageV3> Completable sendResponse(TangoMessage<Response> response, String token) { response.getContainer().setToken(token); @@ -459,7 +458,7 @@ public abstract class TransporterBase implements ITransporter TransportMessage<Response> message = new TransportMessage<>(adapter, token, response, TransportMessageDirection.Response, onSerializingMessage(response), subject); sendingQueue.add(message); - return subject.singleOrError(); + return subject.singleOrError().toCompletable(); } //endregion @@ -537,7 +536,7 @@ public abstract class TransporterBase implements ITransporter pendingRequests.add(message); } else { - message.setResult(true, true); + message.setResult(new Object(), true); } } catch (Exception ex) { @@ -613,8 +612,7 @@ public abstract class TransporterBase implements ITransporter } else { XLog.i("Parsing inner response message and setting pending request task result..."); - request.setException(new ResponseErrorException(container.getError())); - + request.setException(new ResponseErrorException(container.getError(), onParseTangoMessage(data.second))); } } catch (Exception ex) { @@ -638,7 +636,7 @@ public abstract class TransporterBase implements ITransporter } else { XLog.i("Response has returned with error: " + container.getError().toString()); - request.setException(new ResponseErrorException(container.getError())); + request.setException(new ResponseErrorException(container.getError(), onParseTangoMessage(data.second))); } } catch (Exception ex) { diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/TcpTransportAdapter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/TcpTransportAdapter.java index b72d1669b..f2e7a83a8 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/TcpTransportAdapter.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/TcpTransportAdapter.java @@ -5,6 +5,7 @@ import android.os.SystemClock; import com.elvishew.xlog.XLog; import com.twine.tango.core.ObjectDisposedException; import com.twine.tango.transport.TransportAdapterBase; +import com.twine.tango.transport.TransportAdapterMode; import com.twine.tango.transport.TransportComponentState; import java.io.IOException; @@ -12,6 +13,8 @@ import java.io.InputStream; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.nio.channels.Selector; import io.reactivex.Completable; @@ -36,6 +39,7 @@ public class TcpTransportAdapter extends TransportAdapterBase super(); setAddress("127.0.0.1"); setPort(9999); + setAdapterMode(TransportAdapterMode.PREPEND_HEADER); } public TcpTransportAdapter(String address, int port) @@ -144,7 +148,7 @@ public class TcpTransportAdapter extends TransportAdapterBase try { - socket.getOutputStream().write(data); + socket.getOutputStream().write(postProcessBuffer(data)); } catch (IOException e) { onFailed(e); @@ -167,39 +171,59 @@ public class TcpTransportAdapter extends TransportAdapterBase { InputStream stream = socket.getInputStream(); - if (stream.available() > 0) + if (getAdapterMode() == TransportAdapterMode.NO_HEADER) { - byte[] data = new byte[stream.available()]; - int read = stream.read(data); - - if (read == -1) + if (stream.available() > 0) { - throw new SocketException("Error reading from TCP adapter."); + byte[] data = new byte[stream.available()]; + int read = stream.read(data); + + if (read == -1) + { + throw new SocketException("Error reading from TCP adapter."); + } + + onDataAvailable(data); + } + } + else + { + if (stream.available() > 4) + { + byte[] size = new byte[4]; + + int read = stream.read(size, 0, size.length); + + if (read == -1) + { + throw new SocketException("Error reading from TCP adapter."); + } + + int expectedSize = ByteBuffer.wrap(size).order(ByteOrder.LITTLE_ENDIAN).getInt(); + + while (stream.available() < expectedSize) + { + SystemClock.sleep(10); + + if (getState() != TransportComponentState.Connected) + { + break; + } + } + + byte[] data = new byte[expectedSize]; + read = stream.read(data); + + if (read == -1) + { + throw new SocketException("Error reading from TCP adapter."); + } + + onDataAvailable(data); } - - onDataAvailable(data); } SystemClock.sleep(10); -// counter++; - -// if (counter > 200) -// { -// try -// { -// if (socket.getChannel().keyFor(selector).isWritable() && socket.getChannel().keyFor(selector).isReadable()) -// { -// onFailed(new SocketTimeoutException("Client disconnected.")); -// return; -// } -// } catch (Exception e) -// { -// onFailed(e); -// return; -// } -// -// counter = 0; -// } } } catch (Exception e) @@ -210,4 +234,20 @@ public class TcpTransportAdapter extends TransportAdapterBase } //endregion + + //region Private Methods + + private void setSocketProperties() + { + try + { + socket.setReceiveBufferSize(MAX_BUFFER_SIZE); + socket.setSendBufferSize(MAX_BUFFER_SIZE); + } catch (SocketException e) + { + e.printStackTrace(); + } + } + + //endregion } diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/UsbTransportAdapter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/UsbTransportAdapter.java index 8ad55708c..60efe976a 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/UsbTransportAdapter.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/UsbTransportAdapter.java @@ -15,9 +15,13 @@ import com.felhr.usbserial.UsbSerialInterface; import com.twine.tango.core.ContextHelper; import com.twine.tango.core.ObjectDisposedException; import com.twine.tango.transport.TransportAdapterBase; +import com.twine.tango.transport.TransportAdapterMode; import com.twine.tango.transport.TransportComponentState; import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.Arrays; import java.util.Map; import io.reactivex.Completable; @@ -37,6 +41,8 @@ public class UsbTransportAdapter extends TransportAdapterBase private UsbManager usbManager; private boolean hasPermission; private PublishSubject connectionSubject; + private byte[] current_buffer; + private int current_buffer_bar; public UsbTransportAdapter() { @@ -51,7 +57,7 @@ public class UsbTransportAdapter extends TransportAdapterBase @Override public void write(byte[] data) throws ObjectDisposedException, IOException { - serial.write(data); + serial.write(postProcessBuffer(data)); } @Override @@ -126,7 +132,54 @@ public class UsbTransportAdapter extends TransportAdapterBase private void onUsbReceiveData(byte[] data) { - onDataAvailable(data); + if (getAdapterMode() == TransportAdapterMode.NO_HEADER) + { + onDataAvailable(data); + } else + { + if (current_buffer == null) + { + byte[] size = Arrays.copyOfRange(data, 0, 4); + int expectedSize = ByteBuffer.wrap(size).order(ByteOrder.LITTLE_ENDIAN).getInt(); + current_buffer = new byte[expectedSize]; + byte[] rest = Arrays.copyOfRange(data, 4, data.length); + if (rest.length == expectedSize) + { + current_buffer = null; + onDataAvailable(rest); + } else + { + current_buffer_bar = rest.length; + ByteBuffer.wrap(current_buffer).put(rest); + } + } else + { + int remaining = current_buffer.length - current_buffer_bar; + + if (data.length < remaining) + { + current_buffer_bar += data.length; + ByteBuffer.wrap(current_buffer).put(data); + } else if (data.length > remaining) + { + byte[] end = Arrays.copyOfRange(data, 0, remaining); + ByteBuffer.wrap(current_buffer).put(end); + onDataAvailable(current_buffer); + current_buffer = null; + current_buffer_bar = 0; + byte[] rest = Arrays.copyOfRange(data, remaining, data.length); + onUsbReceiveData(rest); + } + else //Equals + { + byte[] end = Arrays.copyOfRange(data, 0, remaining); + ByteBuffer.wrap(current_buffer).put(end); + onDataAvailable(current_buffer); + current_buffer = null; + current_buffer_bar = 0; + } + } + } } @Override diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex f3d6c1aa6..8c68d77f1 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 0a80c5341..d80e67e97 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Graphics/Machine Studio Modules/stubs.jpg b/Software/Graphics/Machine Studio Modules/stubs.jpg Binary files differnew file mode 100644 index 000000000..f9dd9b246 --- /dev/null +++ b/Software/Graphics/Machine Studio Modules/stubs.jpg diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index e77095809..aed740ad1 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -41,4 +41,8 @@ enum MessageType ExternalBridgeUdpDiscoveryPacket = 33; ExternalClientLoginRequest = 34; ExternalClientLoginResponse = 35; + DirectSynchronizationRequest = 36; + DirectSynchronizationResponse = 37; + OverrideDataBaseRequest = 38; + OverrideDataBaseResponse = 39; } diff --git a/Software/PMR/Messages/Integration/DirectSynchronizationRequest.proto b/Software/PMR/Messages/Integration/DirectSynchronizationRequest.proto new file mode 100644 index 000000000..9a50d2b27 --- /dev/null +++ b/Software/PMR/Messages/Integration/DirectSynchronizationRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message DirectSynchronizationRequest +{ + +}
\ No newline at end of file diff --git a/Software/PMR/Messages/Integration/DirectSynchronizationResponse.proto b/Software/PMR/Messages/Integration/DirectSynchronizationResponse.proto new file mode 100644 index 000000000..19343b60f --- /dev/null +++ b/Software/PMR/Messages/Integration/DirectSynchronizationResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message DirectSynchronizationResponse +{ + bytes LocalDB = 1; +}
\ No newline at end of file diff --git a/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto b/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto index 3c7d701b5..624532823 100644 --- a/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto +++ b/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto @@ -5,5 +5,5 @@ option java_package = "com.twine.tango.pmr.integration"; message ExternalClientLoginRequest { - string key = 1; + string Password = 1; }
\ No newline at end of file diff --git a/Software/PMR/Messages/Integration/OverrideDataBaseRequest.proto b/Software/PMR/Messages/Integration/OverrideDataBaseRequest.proto new file mode 100644 index 000000000..9c46f4349 --- /dev/null +++ b/Software/PMR/Messages/Integration/OverrideDataBaseRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message OverrideDataBaseRequest +{ + bytes RemoteDB = 1; +}
\ No newline at end of file diff --git a/Software/PMR/Messages/Integration/OverrideDataBaseResponse.proto b/Software/PMR/Messages/Integration/OverrideDataBaseResponse.proto new file mode 100644 index 000000000..715831419 --- /dev/null +++ b/Software/PMR/Messages/Integration/OverrideDataBaseResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message OverrideDataBaseResponse +{ + bool Successful = 1; +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/LiquidTypeRmlsToStringConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/LiquidTypeRmlsToStringConverter.cs new file mode 100644 index 000000000..0bbcd68a3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/LiquidTypeRmlsToStringConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.DAL.Observables; +using Tango.MachineStudio.DB.ViewModels; + +namespace Tango.MachineStudio.DB.Converters +{ + public class LiquidTypeRmlsToStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) return ""; + + if (value is IEnumerable<LiquidTypesRml>) + { + IEnumerable<LiquidTypesRml> liquidRmls = value as IEnumerable<LiquidTypesRml>; + return String.Join(", ", liquidRmls.Where(x => !x.Deleted).Select(x => x.Rml.Name)); + } + else + { + IEnumerable<MultiComboVM<Rml>> rmls = value as IEnumerable<MultiComboVM<Rml>>; + return String.Join(", ", rmls.Where(x => x.IsSelected).Select(x => x.Entity.Name)); + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj index bd6166b4f..12af196bc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj @@ -88,6 +88,7 @@ </ItemGroup> <ItemGroup> <Compile Include="Converters\EventTypeActionsToStringConverter.cs" /> + <Compile Include="Converters\LiquidTypeRmlsToStringConverter.cs" /> <Compile Include="Converters\RolesPermissionsToStringConverter.cs" /> <Compile Include="DBModule.cs" /> <Compile Include="Messages\CloseEntityEditViewMessage.cs" /> @@ -101,6 +102,7 @@ <Compile Include="ViewModels\CartridgesViewVM.cs" /> <Compile Include="ViewModels\CartridgeTypesViewVM.cs" /> <Compile Include="ViewModels\ConfigurationsViewVM.cs" /> + <Compile Include="ViewModels\ContactsViewVM.cs" /> <Compile Include="ViewModels\DbTableViewModel.cs" /> <Compile Include="ViewModels\DialogOpenMode.cs" /> <Compile Include="ViewModels\DispenserTypesViewVM.cs" /> @@ -108,14 +110,22 @@ <Compile Include="ViewModels\EmbeddedFirmwareVersionsViewVM.cs" /> <Compile Include="ViewModels\EmbeddedSoftwareVersionsViewVM.cs" /> <Compile Include="ViewModels\EventTypesViewVM.cs" /> + <Compile Include="ViewModels\FiberShapesViewVM.cs" /> + <Compile Include="ViewModels\FiberSynthsViewVM.cs" /> <Compile Include="ViewModels\HardwareVersionsViewVM.cs" /> <Compile Include="ViewModels\IdsPacksViewVM.cs" /> + <Compile Include="ViewModels\LinearMassDensityUnitsViewVM.cs" /> <Compile Include="ViewModels\LiquidTypesViewVM.cs" /> <Compile Include="ViewModels\MachinesViewVM.cs" /> <Compile Include="ViewModels\MachineVersionsViewVM.cs" /> + <Compile Include="ViewModels\MediaColorsViewVM.cs" /> + <Compile Include="ViewModels\MediaConditionsViewVM.cs" /> + <Compile Include="ViewModels\MediaMaterialsViewVM.cs" /> + <Compile Include="ViewModels\MediaPurposesViewVM.cs" /> <Compile Include="ViewModels\MultiComboVM.cs" /> <Compile Include="ViewModels\OrganizationsViewVM.cs" /> <Compile Include="ViewModels\PermissionsViewVM.cs" /> + <Compile Include="ViewModels\RmlsViewVM.cs" /> <Compile Include="ViewModels\RolesViewVM.cs" /> <Compile Include="ViewModels\UsersViewVM.cs" /> <Compile Include="ViewModels\EntityViewModel.cs" /> @@ -127,6 +137,60 @@ <Compile Include="Views\DBViews\ActionTypeView.xaml.cs"> <DependentUpon>ActionTypeView.xaml</DependentUpon> </Compile> + <Compile Include="Views\DBViews\RmlView.xaml.cs"> + <DependentUpon>RmlView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\RmlsView.xaml.cs"> + <DependentUpon>RmlsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ContactView.xaml.cs"> + <DependentUpon>ContactView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ContactsView.xaml.cs"> + <DependentUpon>ContactsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MediaConditionsView.xaml.cs"> + <DependentUpon>MediaConditionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MediaConditionView.xaml.cs"> + <DependentUpon>MediaConditionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\LinearMassDensityUnitsView.xaml.cs"> + <DependentUpon>LinearMassDensityUnitsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\LinearMassDensityUnitView.xaml.cs"> + <DependentUpon>LinearMassDensityUnitView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\FiberShapesView.xaml.cs"> + <DependentUpon>FiberShapesView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\FiberShapeView.xaml.cs"> + <DependentUpon>FiberShapeView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\FiberSynthsView.xaml.cs"> + <DependentUpon>FiberSynthsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\FiberSynthView.xaml.cs"> + <DependentUpon>FiberSynthView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MediaPurposesView.xaml.cs"> + <DependentUpon>MediaPurposesView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MediaMaterialsView.xaml.cs"> + <DependentUpon>MediaMaterialsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MediaColorView.xaml.cs"> + <DependentUpon>MediaColorView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MediaPurposView.xaml.cs"> + <DependentUpon>MediaPurposView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MediaMaterialView.xaml.cs"> + <DependentUpon>MediaMaterialView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MediaColorsView.xaml.cs"> + <DependentUpon>MediaColorsView.xaml</DependentUpon> + </Compile> <Compile Include="Views\DBViews\IdsPacksView.xaml.cs"> <DependentUpon>IdsPacksView.xaml</DependentUpon> </Compile> @@ -288,6 +352,78 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Views\DBViews\RmlView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\RmlsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ContactView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ContactsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MediaConditionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MediaConditionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\LinearMassDensityUnitsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\LinearMassDensityUnitView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\FiberShapesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\FiberShapeView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\FiberSynthsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\FiberSynthView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MediaPurposesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MediaMaterialsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MediaColorView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MediaPurposView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MediaMaterialView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MediaColorsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Views\DBViews\IdsPacksView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs index 8bc6ff1c0..fa4139389 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs @@ -44,6 +44,17 @@ namespace Tango.MachineStudio.DB SimpleIoc.Default.Register<EventTypesViewVM>(); SimpleIoc.Default.Register<ActionTypesViewVM>(); + + SimpleIoc.Default.Register<ContactsViewVM>(); + + SimpleIoc.Default.Register<MediaMaterialsViewVM>(); + SimpleIoc.Default.Register<MediaColorsViewVM>(); + SimpleIoc.Default.Register<MediaPurposesViewVM>(); + SimpleIoc.Default.Register<MediaConditionsViewVM>(); + SimpleIoc.Default.Register<LinearMassDensityUnitsViewVM>(); + SimpleIoc.Default.Register<FiberShapesViewVM>(); + SimpleIoc.Default.Register<FiberSynthsViewVM>(); + SimpleIoc.Default.Register<RmlsViewVM>(); } public static MainViewVM MainViewVM @@ -237,5 +248,77 @@ namespace Tango.MachineStudio.DB return ServiceLocator.Current.GetInstance<ActionTypesViewVM>(); } } + + public static ContactsViewVM ContactsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<ContactsViewVM>(); + } + } + + public static MediaMaterialsViewVM MediaMaterialsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MediaMaterialsViewVM>(); + } + } + + public static MediaColorsViewVM MediaColorsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MediaColorsViewVM>(); + } + } + + public static MediaPurposesViewVM MediaPurposesViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MediaPurposesViewVM>(); + } + } + + public static MediaConditionsViewVM MediaConditionsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MediaConditionsViewVM>(); + } + } + + public static LinearMassDensityUnitsViewVM LinearMassDensityUnitsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<LinearMassDensityUnitsViewVM>(); + } + } + + public static FiberShapesViewVM FiberShapesViewVM + { + get + { + return ServiceLocator.Current.GetInstance<FiberShapesViewVM>(); + } + } + + public static FiberSynthsViewVM FiberSynthsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<FiberSynthsViewVM>(); + } + } + + public static RmlsViewVM RmlsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<RmlsViewVM>(); + } + } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ContactsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ContactsViewVM.cs new file mode 100644 index 000000000..6f44d51f0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ContactsViewVM.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; +using SimpleValidator.Extensions; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class ContactsViewVM : DbTableViewModel<Contact> + { + public ContactsViewVM(INotificationProvider notification) : base(notification) + { + } + + protected override void OnValidating() + { + base.OnValidating(); + + if (!EditEntity.Email.IsEmail()) + { + ValidationErrors.Add("Email address is invalid"); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/FiberShapesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/FiberShapesViewVM.cs new file mode 100644 index 000000000..c4954f9b3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/FiberShapesViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class FiberShapesViewVM : DbTableViewModel<FiberShape> + { + public FiberShapesViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/FiberSynthsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/FiberSynthsViewVM.cs new file mode 100644 index 000000000..6b157fc0d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/FiberSynthsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class FiberSynthsViewVM : DbTableViewModel<FiberSynth> + { + public FiberSynthsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LinearMassDensityUnitsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LinearMassDensityUnitsViewVM.cs new file mode 100644 index 000000000..9ac38a7c4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LinearMassDensityUnitsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class LinearMassDensityUnitsViewVM : DbTableViewModel<LinearMassDensityUnit> + { + public LinearMassDensityUnitsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs index 2ec2d59bb..eaa482a41 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -12,6 +13,64 @@ namespace Tango.MachineStudio.DB.ViewModels { public LiquidTypesViewVM(INotificationProvider notification) : base(notification) { + SelectedRmls = new ObservableCollection<MultiComboVM<Rml>>(); + } + + private ObservableCollection<MultiComboVM<Rml>> _selectedRmls; + public ObservableCollection<MultiComboVM<Rml>> SelectedRmls + { + get { return _selectedRmls; } + set { _selectedRmls = value; RaisePropertyChangedAuto(); } + } + + protected override void OnEdit() + { + SelectedRmls = Adapter.Rmls.Select(x => new MultiComboVM<Rml>(x, () => RaisePropertyChanged(nameof(SelectedRmls)))).ToObservableCollection(); + + foreach (var rml in SelectedRmls) + { + if (SelectedEntity.LiquidTypesRmls.ToList().Exists(x => x.Rml == rml.Entity && !x.Deleted)) + { + rml.IsSelected = true; + } + } + + base.OnEdit(); + } + + protected override void OnAdd() + { + SelectedRmls = Adapter.Rmls.Select(x => new MultiComboVM<Rml>(x, () => RaisePropertyChanged(nameof(SelectedRmls)))).ToObservableCollection(); + + base.OnAdd(); + } + + protected override void OnBeforeEntitySave(DialogOpenMode mode, LiquidType liquid) + { + base.OnBeforeEntitySave(mode, liquid); + + foreach (var rml in SelectedRmls) + { + var liquidRml = liquid.LiquidTypesRmls.SingleOrDefault(x => x.Rml == rml.Entity); + + if (liquidRml != null) + { + liquidRml.Deleted = !rml.IsSelected; + } + else + { + if (rml.IsSelected) + { + liquid.LiquidTypesRmls.Add(new LiquidTypesRml() + { + Rml = rml.Entity, + LiquidTypes = liquid, + RmlGuid = rml.Entity.Guid, + LiquidTypeGuid = liquid.Guid + }); + } + } + } } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaColorsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaColorsViewVM.cs new file mode 100644 index 000000000..4227cc27a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaColorsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class MediaColorsViewVM : DbTableViewModel<MediaColor> + { + public MediaColorsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaConditionsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaConditionsViewVM.cs new file mode 100644 index 000000000..451e20ff0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaConditionsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class MediaConditionsViewVM : DbTableViewModel<MediaCondition> + { + public MediaConditionsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaMaterialsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaMaterialsViewVM.cs new file mode 100644 index 000000000..534ebc0d8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaMaterialsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class MediaMaterialsViewVM : DbTableViewModel<MediaMaterial> + { + public MediaMaterialsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaPurposesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaPurposesViewVM.cs new file mode 100644 index 000000000..4850f6316 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MediaPurposesViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class MediaPurposesViewVM : DbTableViewModel<MediaPurpos> + { + public MediaPurposesViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RmlsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RmlsViewVM.cs new file mode 100644 index 000000000..740a4969b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RmlsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class RmlsViewVM : DbTableViewModel<Rml> + { + public RmlsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs index 6af1184aa..044b8a88a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs @@ -80,12 +80,17 @@ namespace Tango.MachineStudio.DB.ViewModels if (EditEntity.Email != null) { - if (Adapter.Users.ToList().Exists(x => x.Email.ToLower() == EditEntity.Email.ToLower())) + if (Adapter.Users.ToList().Exists(x => x != EditEntity && x.Email.ToLower() == EditEntity.Email.ToLower())) { ValidationErrors.Add("Email already exist"); } } + if (!EditEntity.Email.IsEmail()) + { + ValidationErrors.Add("Email address is invalid"); + } + if (!EditEntity.Password.IsMinLength(4)) { ValidationErrors.Add("Password must have at least 4 characters"); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactView.xaml new file mode 100644 index 000000000..999ad9e71 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactView.xaml @@ -0,0 +1,30 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ContactView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="First Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.FirstName,Mode=TwoWay}"></TextBox> + <TextBlock Text="Last Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastName,Mode=TwoWay}"></TextBox> + <TextBlock Text="Email:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Email,Mode=TwoWay}"></TextBox> + <TextBlock Text="Phone:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.PhoneNumber,Mode=TwoWay}"></TextBox> + <TextBlock Text="Fax:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Fax,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactView.xaml.cs new file mode 100644 index 000000000..88397c92a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for AddressView.xaml + /// </summary> + public partial class ContactView : UserControl + { + public ContactView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactsView.xaml new file mode 100644 index 000000000..e05808d83 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactsView.xaml @@ -0,0 +1,27 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ContactsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.ContactsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.ContactsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="First Name" Binding="{Binding FirstName}"></DataGridTextColumn> + <DataGridTextColumn Header="Last Name" Binding="{Binding LastName}"></DataGridTextColumn> + <DataGridTextColumn Header="Full Name" Binding="{Binding FullName}"></DataGridTextColumn> + <DataGridTextColumn Header="Email" Binding="{Binding Email}"></DataGridTextColumn> + <DataGridTextColumn Header="Phone" Binding="{Binding PhoneNumber}"></DataGridTextColumn> + <DataGridTextColumn Header="Fax" Binding="{Binding Fax}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactsView.xaml.cs new file mode 100644 index 000000000..a8c6eb814 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ContactsView.xaml.cs @@ -0,0 +1,31 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class ContactsView : UserControl + { + public ContactsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapeView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapeView.xaml new file mode 100644 index 000000000..dfca47372 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapeView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.FiberShapeView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapeView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapeView.xaml.cs new file mode 100644 index 000000000..477a2445d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapeView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class FiberShapeView : UserControl + { + public FiberShapeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapesView.xaml new file mode 100644 index 000000000..f46b5894e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapesView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.FiberShapesView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.FiberShapesViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.FiberShapesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapesView.xaml.cs new file mode 100644 index 000000000..66190eee9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberShapesView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class FiberShapesView : UserControl + { + public FiberShapesView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthView.xaml new file mode 100644 index 000000000..b200f9efc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.FiberSynthView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthView.xaml.cs new file mode 100644 index 000000000..55ac39620 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class FiberSynthView : UserControl + { + public FiberSynthView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthsView.xaml new file mode 100644 index 000000000..bec19add1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthsView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.FiberSynthsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.FiberSynthsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.FiberSynthsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthsView.xaml.cs new file mode 100644 index 000000000..d6e652cf9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/FiberSynthsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class FiberSynthsView : UserControl + { + public FiberSynthsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitView.xaml new file mode 100644 index 000000000..e845249b4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.LinearMassDensityUnitView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitView.xaml.cs new file mode 100644 index 000000000..bf37d1a5b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class LinearMassDensityUnitView : UserControl + { + public LinearMassDensityUnitView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitsView.xaml new file mode 100644 index 000000000..41d719dad --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitsView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.LinearMassDensityUnitsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.LinearMassDensityUnitsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.LinearMassDensityUnitsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitsView.xaml.cs new file mode 100644 index 000000000..f419bc926 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LinearMassDensityUnitsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class LinearMassDensityUnitsView : UserControl + { + public LinearMassDensityUnitsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypeView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypeView.xaml index 3a14b27df..3f934de0a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypeView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypeView.xaml @@ -6,7 +6,9 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:localConverters="clr-namespace:Tango.MachineStudio.DB.Converters" xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" mc:Ignorable="d" @@ -14,7 +16,8 @@ <UserControl.Resources> <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> - + <localConverters:LiquidTypeRmlsToStringConverter x:Key="LiquidTypeRmlsToStringConverter"></localConverters:LiquidTypeRmlsToStringConverter> + <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> <Setter Property="Margin" Value="2" /> @@ -37,6 +40,18 @@ <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> <TextBlock Text="Color:" FontWeight="Bold"></TextBlock> <colorPicker:ColorPickerCombo SelectedColor="{Binding EditEntity.Color,Mode=TwoWay,Converter={StaticResource ColorToIntegerConverter},UpdateSourceTrigger=PropertyChanged}"></colorPicker:ColorPickerCombo> + + <TextBlock Text="Recommended Media:" FontWeight="Bold"></TextBlock> + <ComboBox x:Name="comboRmls" SelectionChanged="comboRmls_SelectionChanged" ItemsSource="{Binding SelectedRmls}" materialDesign:HintAssist.Hint="{Binding SelectedRmls,Converter={StaticResource LiquidTypeRmlsToStringConverter},UpdateSourceTrigger=PropertyChanged}"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <CheckBox IsChecked="{Binding IsSelected}" Width="20"/> + <TextBlock Text="{Binding Entity.Name}" MinWidth="100" /> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> </controls:TableGrid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypeView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypeView.xaml.cs index f82defb24..468f52586 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypeView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypeView.xaml.cs @@ -24,5 +24,11 @@ namespace Tango.MachineStudio.DB.Views.DBViews { InitializeComponent(); } + + private void comboRmls_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + comboRmls.SelectedItem = null; + comboRmls.Text = "Press to select"; + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesView.xaml index 4e1fe4279..4da0a8b59 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesView.xaml @@ -6,12 +6,14 @@ xmlns:global="clr-namespace:Tango.MachineStudio.DB" xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:localConverters="clr-namespace:Tango.MachineStudio.DB.Converters" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.LiquidTypesViewVM}"> <UserControl.Resources> <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + <localConverters:LiquidTypeRmlsToStringConverter x:Key="LiquidTypeRmlsToStringConverter"></localConverters:LiquidTypeRmlsToStringConverter> </UserControl.Resources> <Grid> @@ -34,6 +36,7 @@ </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> + <DataGridTextColumn Header="Recommended Media" Binding="{Binding LiquidTypesRmls,Converter={StaticResource LiquidTypeRmlsToStringConverter}}"></DataGridTextColumn> </DataGrid.Columns> </DataGrid> </controls:DbTableView> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorView.xaml new file mode 100644 index 000000000..a88add000 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorView.xaml @@ -0,0 +1,34 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MediaColorView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + + <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> + <Setter Property="Margin" Value="2" /> + </Style> + </UserControl.Resources> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Color:" FontWeight="Bold"></TextBlock> + <colorPicker:ColorPickerCombo SelectedColor="{Binding EditEntity.Color,Mode=TwoWay,Converter={StaticResource ColorToIntegerConverter},UpdateSourceTrigger=PropertyChanged}"></colorPicker:ColorPickerCombo> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorView.xaml.cs new file mode 100644 index 000000000..de09b9aaf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class MediaColorView : UserControl + { + public MediaColorView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorsView.xaml new file mode 100644 index 000000000..644c865da --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorsView.xaml @@ -0,0 +1,38 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MediaColorsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.MediaColorsViewVM}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + </UserControl.Resources> + + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.MediaColorsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTemplateColumn Header="Color"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Rectangle Width="50"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter},Mode=TwoWay}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorsView.xaml.cs new file mode 100644 index 000000000..ceae18ec8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaColorsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class MediaColorsView : UserControl + { + public MediaColorsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionView.xaml new file mode 100644 index 000000000..cbee759b1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MediaConditionView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionView.xaml.cs new file mode 100644 index 000000000..64238c2fc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class MediaConditionView : UserControl + { + public MediaConditionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionsView.xaml new file mode 100644 index 000000000..08f144710 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionsView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MediaConditionsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.MediaConditionsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.MediaConditionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionsView.xaml.cs new file mode 100644 index 000000000..74ab29af0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaConditionsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class MediaConditionsView : UserControl + { + public MediaConditionsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialView.xaml new file mode 100644 index 000000000..b7e0a88fe --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MediaMaterialView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialView.xaml.cs new file mode 100644 index 000000000..4ddcca14e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class MediaMaterialView : UserControl + { + public MediaMaterialView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialsView.xaml new file mode 100644 index 000000000..7530cf9df --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialsView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MediaMaterialsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.MediaMaterialsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.MediaMaterialsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialsView.xaml.cs new file mode 100644 index 000000000..26fbfb73a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaMaterialsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class MediaMaterialsView : UserControl + { + public MediaMaterialsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposView.xaml new file mode 100644 index 000000000..9b352cc59 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MediaPurposView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposView.xaml.cs new file mode 100644 index 000000000..08bc7f6a6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class MediaPurposView : UserControl + { + public MediaPurposView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposesView.xaml new file mode 100644 index 000000000..ee4903f69 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposesView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MediaPurposesView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.MediaPurposesViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.MediaPurposesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposesView.xaml.cs new file mode 100644 index 000000000..f780e5009 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MediaPurposesView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class MediaPurposesView : UserControl + { + public MediaPurposesView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml new file mode 100644 index 000000000..adf5310ee --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml @@ -0,0 +1,98 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.RmlView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:RmlsViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + </UserControl.Resources> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name}"></TextBox> + + <TextBlock Text="Manufacturer:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Manufacturer}"></TextBox> + + <TextBlock Text="Material:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.MediaMaterials}" SelectedItem="{Binding EditEntity.MediaMaterials,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Color:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.MediaColors}" SelectedItem="{Binding EditEntity.MediaColors,Mode=TwoWay}"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <Rectangle Width="16" Height="16" VerticalAlignment="Center"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + + <TextBlock Text="Purpose:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.MediaPurposes}" SelectedItem="{Binding EditEntity.MediaPurposes,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Condition:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.MediaConditions}" SelectedItem="{Binding EditEntity.MediaConditions,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Linear Mass Density Unit:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.LinearMassDensityUnits}" SelectedItem="{Binding EditEntity.LinearMassDensityUnits,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Fiber Shape:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.FiberShapes}" SelectedItem="{Binding EditEntity.FiberShapes,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Fiber Syntheses:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.FiberSynths}" SelectedItem="{Binding EditEntity.FiberSynths,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Fiber Size:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.FiberSize,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Fibers Count:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.NumberOfFibers,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Plies Per Fiber:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.PliesPerFiber,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Plies Per Thread:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.PliesPerThread,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Twisted:" FontWeight="Bold"></TextBlock> + <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding EditEntity.Twisted}" Style="{StaticResource MaterialDesignSwitchToggleButton}" /> + + <TextBlock Text="Air Entanglement:" FontWeight="Bold"></TextBlock> + <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding EditEntity.AirEntanglement}" Style="{StaticResource MaterialDesignSwitchToggleButton}" /> + + <TextBlock Text="Lubricant:" FontWeight="Bold"></TextBlock> + <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding EditEntity.Lubricant}" Style="{StaticResource MaterialDesignSwitchToggleButton}" /> + + <TextBlock Text="Tensile Strength:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.TensileStrength,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Elongation Break Percentage:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.ElongationAtBreakPercentage,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Estimated Thread Diameter:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.EstimatedThreadDiameter,Mode=TwoWay}"></mahapps:NumericUpDown> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml.cs new file mode 100644 index 000000000..124f007ae --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class RmlView : UserControl + { + public RmlView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml new file mode 100644 index 000000000..0a02c6821 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml @@ -0,0 +1,57 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.RmlsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.RmlsViewVM}"> + + <UserControl.Resources> + <converters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter"></converters:BooleanToYesNoConverter> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + </UserControl.Resources> + + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.RmlsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Manufacturer" Binding="{Binding Manufacturer}"></DataGridTextColumn> + <DataGridTextColumn Header="Material" Binding="{Binding MediaMaterials.Name}"></DataGridTextColumn> + <DataGridTemplateColumn Header="Color"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Rectangle Width="50"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding MediaColors.Color,Converter={StaticResource ColorToIntegerConverter},Mode=TwoWay}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="Purpose" Binding="{Binding MediaPurposes.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Condition" Binding="{Binding MediaConditions.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Linear Mass Density Unit" Binding="{Binding LinearMassDensityUnits.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Fiber Shape" Binding="{Binding FiberShapes.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Fiber Syntheses" Binding="{Binding FiberSynths.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Fiber Size" Binding="{Binding FiberSize}"></DataGridTextColumn> + <DataGridTextColumn Header="Fibers Count" Binding="{Binding NumberOfFibers}"></DataGridTextColumn> + <DataGridTextColumn Header="Plies Per Fiber" Binding="{Binding PliesPerFiber}"></DataGridTextColumn> + <DataGridTextColumn Header="Plies Per Thread" Binding="{Binding PliesPerThread}"></DataGridTextColumn> + <DataGridTextColumn Header="Twisted" Binding="{Binding Twisted,Converter={StaticResource BooleanToYesNoConverter}}"></DataGridTextColumn> + <DataGridTextColumn Header="Air Entanglement" Binding="{Binding AirEntanglement,Converter={StaticResource BooleanToYesNoConverter}}"></DataGridTextColumn> + <DataGridTextColumn Header="Lubricant" Binding="{Binding Lubricant,Converter={StaticResource BooleanToYesNoConverter}}"></DataGridTextColumn> + <DataGridTextColumn Header="Tensile Strength" Binding="{Binding TensileStrength}"></DataGridTextColumn> + <DataGridTextColumn Header="Elongation Break Percentage" Binding="{Binding ElongationAtBreakPercentage}"></DataGridTextColumn> + <DataGridTextColumn Header="Estimated Thread Diameter" Binding="{Binding EstimatedThreadDiameter}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml.cs new file mode 100644 index 000000000..2909bdb6f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml.cs @@ -0,0 +1,31 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class RmlsView : UserControl + { + public RmlsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Images/stubs.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Images/stubs.jpg Binary files differnew file mode 100644 index 000000000..f9dd9b246 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Images/stubs.jpg diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..45c89075b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Machine Studio Stubs Module")] + +[assembly: ComVisible(false)] + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Resources.Designer.cs new file mode 100644 index 000000000..e712344b4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Resources.Designer.cs @@ -0,0 +1,92 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.Stubs.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.Stubs.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// <summary> + /// Looks up a localized string similar to using System; + ///using System.Text; + ///using System.Linq; + ///using System.Drawing; + ///using System.Diagnostics; + ///using System.Windows.Forms; + ///using System.Threading; + ///using System.Threading.Tasks; + ///using System.Collections.Generic; + ///using Tango.Stubs.UI; + /// + ///public void OnExecute(StubManager stubManager) + ///{ + /// for (int i = 0; i < 10; i++) + /// { + /// stubManager.Run("calculate", 10, 5); + /// Thread.Sleep(10); + /// } + ///} + /// + ///. + /// </summary> + internal static string CodeTabTemplate { + get { + return ResourceManager.GetString("CodeTabTemplate", resourceCulture); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Resources.resx new file mode 100644 index 000000000..7693cadac --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Resources.resx @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="CodeTabTemplate" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\CodeTabTemplate.cs;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> + </data> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Settings.Designer.cs new file mode 100644 index 000000000..465246f32 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.Stubs.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Resources/CodeTabTemplate.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Resources/CodeTabTemplate.cs new file mode 100644 index 000000000..b21e6e758 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Resources/CodeTabTemplate.cs @@ -0,0 +1,20 @@ +using System; +using System.Text; +using System.Linq; +using System.Drawing; +using System.Diagnostics; +using System.Windows.Forms; +using System.Threading; +using System.Threading.Tasks; +using System.Collections.Generic; +using Tango.MachineStudio.Stubs; + +public void OnExecute(StubManager stubManager) +{ + for (int i = 0; i < 10; i++) + { + stubManager.Run("calculate", 10, 5); + Thread.Sleep(10); + } +} + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubManager.cs new file mode 100644 index 000000000..8e0eafa3a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubManager.cs @@ -0,0 +1,181 @@ +using Google.Protobuf; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tango.PMR; +using Tango.PMR.Common; +using Tango.Stubs; +using Tango.Transport; +using Tango.Transport.Adapters; + +namespace Tango.MachineStudio.Stubs +{ + /// <summary> + /// Represents a manager capable of executing stub scripts asynchronously. + /// </summary> + public class StubManager + { + private ITransportAdapter _adapter; //Holds the USB transport adapter. + + /// <summary> + /// Occurs when the stub has failed to execute. + /// </summary> + public event EventHandler<Exception> Failed; + + /// <summary> + /// Occurs when the stub has completed successfully. + /// </summary> + public event EventHandler<String> Completed; + + /// <summary> + /// Occurs when the stub has been initialized and executed. + /// </summary> + public event EventHandler<String> Executed; + + /// <summary> + /// Gets a value indicating whether this <see cref="StubManager"/> is aborted. + /// </summary> + internal bool Aborted { get; private set; } + + /// <summary> + /// Initializes a new instance of the <see cref="StubManager"/> class. + /// </summary> + /// <param name="adapter">The adapter.</param> + public StubManager(ITransportAdapter adapter) + { + _adapter = adapter; + } + + /// <summary> + /// Aborts the current script. + /// </summary> + internal void Abort() + { + Aborted = true; + } + + /// <summary> + /// Runs the specified stub name. + /// </summary> + /// <param name="stubName">Name of the stub.</param> + /// <param name="args">The arguments.</param> + public void Run(String stubName, params Object[] args) + { + if (Aborted) return; + + var stubType = StubBase.GetAvailableRequestStubs().SingleOrDefault(x => x.Name.ToLower() == stubName.ToLower() || x.Name.Replace("Request", "").ToLower() == stubName.ToLower()); + if (stubType == null) + { + OnFailed(new ArgumentException("Invalid stub '" + stubName + "'.")); + return; + } + + var stubProps = stubType.GetProperties(BindingFlags.Public | BindingFlags.Instance); + + if (stubProps.Length > args.Length) + { + OnFailed(new ArgumentOutOfRangeException("Not enough arguments for " + stubType.Name + ".")); + return; + } + + Executed?.Invoke(this, stubType.Name); + + try + { + MessageContainer container = new MessageContainer(); + container.Token = Guid.NewGuid().ToString(); + container.Type = MessageFactory.ParseMessageType(stubType.Name); + + Object request = Activator.CreateInstance(stubType); + + int argIndex = 0; + foreach (var prop in stubProps) + { + String arg = args[argIndex++].ToString(); + + if (prop.PropertyType == typeof(UInt32)) + { + prop.SetValue(request, UInt32.Parse(arg)); + } + else if (prop.PropertyType == typeof(bool)) + { + prop.SetValue(request, bool.Parse(arg)); + } + else + { + object converted = Convert.ChangeType(arg, prop.PropertyType); + prop.SetValue(request, converted); + } + } + + container.Data = typeof(IMessage).GetExtensionMethod(typeof(ByteString).Assembly, "ToByteString").Invoke(request, new object[] { request }) as ByteString; + + byte[] requestData = container.ToByteArray(); + + bool done = false; + + Task.Factory.StartNew(() => + { + _adapter.Write(requestData); + + DateTime startTime = DateTime.Now; + + MessageContainer responseContainer = null; + + _adapter.DataAvailable += (sender, data) => + { + responseContainer = MessageFactory.ParseContainer(data); + }; + + while (responseContainer == null) + { + Thread.Sleep(2); + + if (DateTime.Now > startTime.AddSeconds(2)) + { + done = true; + OnFailed(new TimeoutException("Response has failed to arrive after 2 seconds.")); + return; + } + } + + IMessage message = MessageFactory.ParseMessageFromContainer(responseContainer); + OnCompleted(JsonConvert.SerializeObject(message, Formatting.Indented)); + done = true; + }); + + while (!done) + { + Thread.Sleep(2); + } + } + catch (Exception ex) + { + OnFailed(ex); + } + } + + /// <summary> + /// Raises the <see cref="Failed"/> event. + /// </summary> + /// <param name="ex">The exception.</param> + protected virtual void OnFailed(Exception ex) + { + Failed?.Invoke(this, ex); + } + + /// <summary> + /// Raises the <see cref="Completed"/> event. + /// </summary> + /// <param name="response">The response.</param> + protected virtual void OnCompleted(String response) + { + Completed?.Invoke(this, response); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubOnExecuteParameters.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubOnExecuteParameters.cs new file mode 100644 index 000000000..761375818 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubOnExecuteParameters.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Scripting; + +namespace Tango.MachineStudio.Stubs +{ + /// <summary> + /// Represents the global object which will be sent to the scripting engine. + /// </summary> + /// <seealso cref="Tango.Scripting.OnExecuteParameters" /> + public class StubOnExecuteParameters : OnExecuteParameters + { + /// <summary> + /// Provides access to the script stub manager. + /// </summary> + public StubManager stubManager; + + /// <summary> + /// Initializes a new instance of the <see cref="StubOnExecuteParameters"/> class. + /// </summary> + /// <param name="manager">The manager.</param> + public StubOnExecuteParameters(StubManager manager) + { + stubManager = manager; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs new file mode 100644 index 000000000..2c4b6c76e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Stubs.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Stubs +{ + public class StubsModule : IStudioModule + { + public string Name => "Stubs"; + + public string Description => "Execute machine tests using an interactive C# scripting editor"; + + public BitmapSource Image => ResourceHelper.GetImageFromResources("Images/stubs.jpg"); + + public FrameworkElement MainView => new MainView(); + + public Permissions Permission => Permissions.RunSynchronizationModule; + + public bool IsInitialized => true; + + public void Dispose() + { + //throw new NotImplementedException(); + } + + public void Initialize() + { + //throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj new file mode 100644 index 000000000..436a8b3ff --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{22C2AA72-9493-4D0D-B421-8EF9789FB192}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.MachineStudio.Stubs</RootNamespace> + <AssemblyName>Tango.MachineStudio.Stubs</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignColors, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <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> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\CodeTabTemplate.cs" /> + <Compile Include="StubManager.cs" /> + <Compile Include="StubOnExecuteParameters.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\CodeTabVM.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModels\StubSnippetVM.cs" /> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + <SubType> + </SubType> + </Compile> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="StubsModule.cs" /> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj"> + <Project>{6c55b776-26d4-4db3-a6ab-87e783b2f3d1}</Project> + <Name>ICSharpCode.AvalonEdit</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.DAL.Observables\Tango.DAL.Observables.csproj"> + <Project>{0ecd6da8-7aa6-48d9-8b65-279d176ad9af}</Project> + <Name>Tango.DAL.Observables</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Scripting\Tango.Scripting.csproj"> + <Project>{401989e7-ae1e-4002-b0ee-9a9f63740b97}</Project> + <Name>Tango.Scripting</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Stubs\Tango.Stubs.csproj"> + <Project>{1981b537-39e9-4e7d-8430-27466481aeee}</Project> + <Name>Tango.Stubs</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj"> + <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> + <Name>Tango.MachineStudio.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\stubs.jpg" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModelLocator.cs new file mode 100644 index 000000000..02ac1b8dd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModelLocator.cs @@ -0,0 +1,33 @@ +using GalaSoft.MvvmLight.Ioc; +using Microsoft.Practices.ServiceLocation; +using Tango.MachineStudio.Stubs.ViewModels; + +namespace Tango.MachineStudio.Stubs +{ + /// <summary> + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// </summary> + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + + //SimpleIoc.Default.Unregister<INotificationProvider>(); + + SimpleIoc.Default.Register<MainViewVM>(); + } + + public static MainViewVM MainViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MainViewVM>(); + } + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/CodeTabVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/CodeTabVM.cs new file mode 100644 index 000000000..451e1a1f0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/CodeTabVM.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Stubs.ViewModels +{ + /// <summary> + /// Represents a single script editor tab view model; + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> + public class CodeTabVM : ViewModel + { + private String _title; + /// <summary> + /// Gets or sets the script title/file name. + /// </summary> + public String Title + { + get + { + return File != null ? Path.GetFileName(File) : _title; + } + set + { + _title = value; + RaisePropertyChanged(nameof(Title)); + } + } + + private String _file; + /// <summary> + /// Gets or sets the full script file path. + /// </summary> + public String File + { + get { return _file; } + set + { + _file = value; + RaisePropertyChanged(nameof(File)); + RaisePropertyChanged(nameof(Title)); + } + } + + private String _code; + /// <summary> + /// Gets or sets the script code. + /// </summary> + public String Code + { + get { return _code; } + set { _code = value; RaisePropertyChanged(nameof(Code)); } + } + + private bool _isRunning; + /// <summary> + /// Gets or sets a value indicating whether this instance is running. + /// </summary> + public bool IsRunning + { + get { return _isRunning; } + set { _isRunning = value; RaisePropertyChangedAuto(); } + } + + private RelayCommand _insertCodeSnippetCommand; + /// <summary> + /// Gets or sets the insert snippet command. (Inserts stub snippet to editor) + /// </summary> + public RelayCommand InsertSnippetCommand + { + get { return _insertCodeSnippetCommand; } + set { _insertCodeSnippetCommand = value; RaisePropertyChanged(nameof(InsertSnippetCommand)); } + } + + /// <summary> + /// Initializes a new instance of the <see cref="CodeTabVM"/> class. + /// </summary> + public CodeTabVM() + { + Title = "untitled"; + Code = Properties.Resources.CodeTabTemplate; + } + + /// <summary> + /// Returns a <see cref="System.String" /> that represents this instance. + /// </summary> + /// <returns> + /// A <see cref="System.String" /> that represents this instance. + /// </returns> + public override string ToString() + { + return Title; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..d7e641735 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs @@ -0,0 +1,525 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.Core.Commands; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.Scripting; +using Tango.Settings; +using Tango.SharedUI; +using Tango.Stubs; +using Tango.Transport; +using Tango.Transport.Adapters; + +namespace Tango.MachineStudio.Stubs.ViewModels +{ + /// <summary> + /// Represents the script execution utility main view model. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> + public class MainViewVM : ViewModel + { + private UsbTransportAdapter _adapter; //Holds the USB transport adapter. + private StubManager _stubManager; + private INotificationProvider _notification; + + #region Properties + + public IStudioApplicationManager ApplicationManager { get; set; } + + private bool _useConnectedMachine; + /// <summary> + /// Gets or sets a value indicating whether [use connected machine]. + /// </summary> + public bool UseConnectedMachine + { + get { return _useConnectedMachine; } + set { _useConnectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + /// <summary> + /// Gets or sets the code tabs. + /// </summary> + public ObservableCollection<CodeTabVM> CodeTabs { get; set; } + + /// <summary> + /// Gets or sets the additional highlight C# types. + /// </summary> + public ObservableCollection<KeyValuePair<String, Type>> HighlightTypes { get; set; } + + /// <summary> + /// Gets or sets the collection of stub snippets. + /// </summary> + public ObservableCollection<StubSnippetVM> StubSnippets { get; set; } + + private StubSnippetVM _selectedStubSnippet; + /// <summary> + /// Gets or sets the selected stub snippet. + /// </summary> + public StubSnippetVM SelectedStubSnippet + { + get { return _selectedStubSnippet; } + set { _selectedStubSnippet = value; RaisePropertyChanged(nameof(SelectedStubSnippet)); } + } + + private String _log; + /// <summary> + /// Gets or sets the current response log. + /// </summary> + public String Log + { + get { return _log; } + set { _log = value; RaisePropertyChanged(nameof(Log)); } + } + + private CodeTabVM _selectedCodeTab; + /// <summary> + /// Gets or sets the selected code tab. + /// </summary> + public CodeTabVM SelectedCodeTab + { + get { return _selectedCodeTab; } + set { _selectedCodeTab = value; RaisePropertyChanged(nameof(SelectedCodeTab)); InvalidateRelayCommands(); } + } + + private bool _isConnected; + /// <summary> + /// Gets or sets a value indicating whether the USB adapter is connected. + /// </summary> + public bool IsConnected + { + get { return _isConnected; } + set { _isConnected = value; RaisePropertyChanged(nameof(IsConnected)); InvalidateRelayCommands(); } + } + + private List<String> _ports; + /// <summary> + /// Gets or sets the available USB ports. + /// </summary> + public List<String> Ports + { + get { return _ports; } + set { _ports = value; RaisePropertyChanged(nameof(Ports)); } + } + + private String _selectedPort; + /// <summary> + /// Gets or sets the selected USB port. + /// </summary> + public String SelectedPort + { + get { return _selectedPort; } + set { _selectedPort = value; RaisePropertyChanged(nameof(SelectedPort)); InvalidateRelayCommands(); } + } + + private String _status; + /// <summary> + /// Gets or sets the current status bar text. + /// </summary> + public String Status + { + get { return _status; } + set { _status = value; RaisePropertyChanged(nameof(Status)); } + } + + private bool _isRunning; + /// <summary> + /// Gets or sets a value indicating whether a stub is currently running. + /// </summary> + public bool IsRunning + { + get { return _isRunning; } + set { _isRunning = value; RaisePropertyChanged(nameof(IsRunning)); InvalidateRelayCommands(); } + } + + #endregion + + #region Commands + + /// <summary> + /// Gets or sets the new command. + /// </summary> + public RelayCommand NewCommand { get; set; } + + /// <summary> + /// Gets or sets the close tab command. + /// </summary> + public RelayCommand<CodeTabVM> CloseTabCommand { get; set; } + + /// <summary> + /// Gets or sets the run command. + /// </summary> + public RelayCommand RunCommand { get; set; } + + /// <summary> + /// Gets or sets the stop command. + /// </summary> + public RelayCommand StopCommand { get; set; } + + /// <summary> + /// Gets or sets the toggle connection command. + /// </summary> + public RelayCommand ToggleConnectionCommand { get; set; } + + /// <summary> + /// Gets or sets the open command. + /// </summary> + public RelayCommand OpenCommand { get; set; } + + /// <summary> + /// Gets or sets the save command. + /// </summary> + public RelayCommand SaveCommand { get; set; } + + /// <summary> + /// Gets or sets the save as command. + /// </summary> + public RelayCommand SaveAsCommand { get; set; } + + /// <summary> + /// Gets or sets the stub snippet selected command. + /// </summary> + public RelayCommand StubSnippetSelectedCommand { get; set; } + + /// <summary> + /// Gets or sets the insert snippet command. + /// </summary> + public RelayCommand<String> InsertSnippetCommand { get; set; } + + /// <summary> + /// Gets or sets the exit command. + /// </summary> + public RelayCommand ExitCommand { get; set; } + + #endregion + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="MainViewVM"/> class. + /// </summary> + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notification) + { + ApplicationManager = applicationManager; + _notification = notification; + + CodeTabs = new ObservableCollection<CodeTabVM>(); + + NewCommand = new RelayCommand(CreateNewTab); + CloseTabCommand = new RelayCommand<CodeTabVM>(OnTabClosing); + RunCommand = new RelayCommand(RunTab, (x) => (IsConnected || UseConnectedMachine) && !IsRunning && SelectedCodeTab != null); + StopCommand = new RelayCommand(StopTab, (x) => (IsConnected || UseConnectedMachine) && IsRunning && SelectedCodeTab != null); + InsertSnippetCommand = new RelayCommand<string>((x) => { }); + + HighlightTypes = new ObservableCollection<KeyValuePair<string, Type>>(); + HighlightTypes.Add(new KeyValuePair<string, Type>("stubManager", typeof(StubManager))); + + StubSnippets = new ObservableCollection<StubSnippetVM>(); + + foreach (var stubType in StubBase.GetAvailableRequestStubs()) + { + StubSnippetVM snippet = new StubSnippetVM(); + snippet.Name = stubType.Name.Replace("Stub_", ""); + snippet.Code = String.Format("stubManager.Run(\"{0}\" ,{1});", stubType.Name, String.Join(", ", stubType.GetProperties(BindingFlags.Public | BindingFlags.Instance).Select(x => x.PropertyType.Name == "string" ? "\"string\"" : x.PropertyType.Name))); + StubSnippets.Add(snippet); + } + + ToggleConnectionCommand = new RelayCommand(ToggleConnection, (x) => !IsRunning); + OpenCommand = new RelayCommand(OpenFile); + SaveCommand = new RelayCommand(SaveFile); + SaveAsCommand = new RelayCommand(SaveAsFile); + StubSnippetSelectedCommand = new RelayCommand(OnStubSnippetSelected); + ExitCommand = new RelayCommand(() => Application.Current.Shutdown()); + + Ports = new List<string>() + { + "COM1", + "COM2", + "COM3", + "COM4", + "COM5", + "COM6", + "COM7", + "COM8", + "COM9", + }; + + SelectedPort = SettingsManager.Default.StubsUI.SelectedPort != null ? SettingsManager.Default.StubsUI.SelectedPort : Ports.First(); + + Status = "Ready"; + + if (SettingsManager.Default.StubsUI.LastTabs.Count > 0) + { + foreach (var file in SettingsManager.Default.StubsUI.LastTabs) + { + if (File.Exists(file)) + { + OpenFile(file); + } + } + } + else + { + CreateNewTab(); + } + + Application.Current.Exit += Current_Exit; + } + + #endregion + + #region Virtual Methods + + /// <summary> + /// Called when a stub snippet is double clicked. + /// </summary> + protected virtual void OnStubSnippetSelected() + { + if (SelectedStubSnippet != null) + { + if (InsertSnippetCommand != null) + { + InsertSnippetCommand.Execute(SelectedStubSnippet.Code); + } + } + } + + /// <summary> + /// Called when user closes a script tab. + /// </summary> + /// <param name="codeTab">The code tab.</param> + protected virtual void OnTabClosing(CodeTabVM codeTab) + { + CodeTabs.Remove(codeTab); + } + + #endregion + + #region Private Methods + + /// <summary> + /// Saves the selected script file. + /// </summary> + private void SaveFile() + { + if (SelectedCodeTab != null) + { + if (SelectedCodeTab.File == null) + { + SaveAsFile(); + } + else + { + File.WriteAllText(SelectedCodeTab.File, SelectedCodeTab.Code); + } + } + } + + /// <summary> + /// Saves the selected script file. + /// </summary> + private void SaveAsFile() + { + if (SelectedCodeTab != null) + { + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "C# Script Files|*.cs"; + dlg.DefaultExt = ".cs"; + if (dlg.ShowDialog().Value) + { + File.WriteAllText(dlg.FileName, SelectedCodeTab.Code); + SelectedCodeTab.File = dlg.FileName; + } + } + } + + /// <summary> + /// Opens a script from HD. + /// </summary> + private void OpenFile() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "C# Script Files|*.cs"; + dlg.Multiselect = true; + if (dlg.ShowDialog().Value) + { + foreach (var file in dlg.FileNames) + { + OpenFile(file); + } + } + } + + /// <summary> + /// Opens the file. + /// </summary> + /// <param name="file">The file.</param> + private void OpenFile(String file) + { + var newTab = new CodeTabVM(); + newTab.File = file; + newTab.Code = File.ReadAllText(file); + CodeTabs.Add(newTab); + SelectedCodeTab = newTab; + } + + /// <summary> + /// Toggles the USB adapter connection. + /// </summary> + private void ToggleConnection() + { + try + { + if (!IsConnected) + { + _adapter = new UsbTransportAdapter(SelectedPort); + _adapter.Connect().Wait(); + IsConnected = true; + } + else + { + _adapter.Disconnect().Wait(); + IsConnected = false; + } + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString(), "Tango"); + } + } + + /// <summary> + /// Creates a new script tab. + /// </summary> + private void CreateNewTab() + { + var newTab = new CodeTabVM(); + CodeTabs.Add(newTab); + SelectedCodeTab = newTab; + } + + /// <summary> + /// Runs the selected script tab. + /// </summary> + private async void RunTab() + { + if (UseConnectedMachine && !ApplicationManager.IsMachineConnected) + { + _notification.ShowError("Cannot execute stub while 'Connected Machine' is set but not machine connected."); + return; + } + + IsRunning = true; + SelectedCodeTab.IsRunning = true; + Log = (DateTime.Now.ToTimeString() + ": ") + "Executing script '" + SelectedCodeTab.Title + "'..." + Environment.NewLine; + + await Task.Factory.StartNew(async () => + { + try + { + ITransportAdapter adapter = _adapter; + + if (ApplicationManager.IsMachineConnected && UseConnectedMachine) + { + adapter = ApplicationManager.ConnectedMachine.Adapters.First(); + } + + _stubManager = new StubManager(adapter); + var thisStubManager = _stubManager; + _stubManager.Completed += Manager_Completed; + _stubManager.Failed += Manager_Failed; + _stubManager.Executed += Manager_Executed; + + ScriptEngine engine = new ScriptEngine(new StubOnExecuteParameters(_stubManager)); + + engine.ReferencedAssemblies.Add(this.GetType()); + await engine.Run(SelectedCodeTab.Code); + + if (!thisStubManager.Aborted) + { + IsRunning = false; + SelectedCodeTab.IsRunning = false; + } + } + catch (Exception ex) + { + IsRunning = false; + SelectedCodeTab.IsRunning = false; + MessageBox.Show(ex.Message, "Tango"); + } + }); + } + + /// <summary> + /// Stops the currently current script. + /// </summary> + private void StopTab() + { + if (_stubManager != null) + { + _stubManager.Abort(); + IsRunning = false; + SelectedCodeTab.IsRunning = false; + Status = "Stopped!"; + Log += (DateTime.Now.ToTimeString() + ": ") + "Stopped!" + Environment.NewLine; + } + } + + #endregion + + #region Event Handlers + + /// <summary> + /// Handled the <see cref="StubManager"/> Executed event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="stubName">Name of the stub.</param> + private void Manager_Executed(object sender, string stubName) + { + Log += (DateTime.Now.ToTimeString() + ": ") + "Executing '" + stubName + "'..." + Environment.NewLine; + Status = "Executing " + stubName + "..."; + } + + /// <summary> + /// Handled the <see cref="StubManager"/> Failed event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="ex">The exception.</param> + private void Manager_Failed(object sender, Exception ex) + { + if (IsRunning) + { + Log += (DateTime.Now.ToTimeString() + ": ") + ex.Message + Environment.NewLine; + Status = "Failed!"; + } + } + + /// <summary> + /// Handled the <see cref="StubManager"/> Completed event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="response">The response.</param> + private void Manager_Completed(object sender, string response) + { + Log += (DateTime.Now.ToTimeString() + ": ") + "Response Received:" + Environment.NewLine; + Log += (DateTime.Now.ToTimeString() + ": ") + response + Environment.NewLine; + Status = "Completed"; + } + + private void Current_Exit(object sender, ExitEventArgs e) + { + SettingsManager.Default.MachineStudio.StubsModule.SelectedPort = SelectedPort; + SettingsManager.Default.MachineStudio.StubsModule.LastTabs = CodeTabs.Select(x => x.File).ToList(); + SettingsManager.SaveDefaultSettings(); + } + + #endregion + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/StubSnippetVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/StubSnippetVM.cs new file mode 100644 index 000000000..d99906f20 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/StubSnippetVM.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Stubs.ViewModels +{ + /// <summary> + /// Represents a single stub snippet view model. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> + public class StubSnippetVM : ViewModel + { + private String _name; + /// <summary> + /// Gets or sets the stub name. + /// </summary> + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChanged(nameof(Name)); } + } + + private String _code; + /// <summary> + /// Gets or sets the snippet code. + /// </summary> + public String Code + { + get { return _code; } + set { _code = value; RaisePropertyChanged(nameof(Code)); } + } + + /// <summary> + /// Returns a <see cref="System.String" /> that represents this instance. + /// </summary> + /// <returns> + /// A <see cref="System.String" /> that represents this instance. + /// </returns> + public override string ToString() + { + return Name; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml new file mode 100644 index 000000000..5a71b48d1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml @@ -0,0 +1,319 @@ +<UserControl x:Class="Tango.MachineStudio.Stubs.Views.MainView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:views="clr-namespace:Tango.MachineStudio.Stubs.Views" + xmlns:fa="http://schemas.fontawesome.io/icons/" + xmlns:global="clr-namespace:Tango.MachineStudio.Stubs" + xmlns:local="clr-namespace:Tango.MachineStudio.Stubs.Views" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="#202020" Foreground="Gainsboro" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <UserControl.Resources> + + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! --> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" /> + + <!-- Accent and AppTheme setting --> + + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" /> + + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Styles.xaml" /> + + <ResourceDictionary> + <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter> + <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter> + <Style BasedOn="{StaticResource MetroTabItem}" TargetType="{x:Type TabItem}"> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="True"> + <Setter Property="Background" Value="#007ACC"></Setter> + </DataTrigger> + </Style.Triggers> + <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="12"></Setter> + <Setter Property="HeaderTemplate"> + <Setter.Value> + <DataTemplate> + <Border> + <StackPanel Orientation="Horizontal"> + <mahapps:ProgressRing Width="5" Height="5" Margin="0 0 5 0" Foreground="White" Visibility="{Binding IsRunning,Converter={StaticResource BooleanToVisibilityConverter}}"></mahapps:ProgressRing> + <TextBlock Text="{Binding Title}" ToolTip="{Binding File}" Foreground="Gainsboro" VerticalAlignment="Center"></TextBlock> + <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CloseTabCommand}" CommandParameter="{Binding}" Margin="5 0 0 0" Cursor="Hand" Width="24" Height="24" VerticalAlignment="Center" Style="{DynamicResource MetroCircleButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0"> + <StackPanel Orientation="Horizontal"> + <fa:ImageAwesome Width="10" Height="10" Icon="Close" Foreground="Gainsboro"></fa:ImageAwesome> + </StackPanel> + </Button> + </StackPanel> + </Border> + </DataTemplate> + </Setter.Value> + </Setter> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <Grid Background="#181818"> + <controls:ScriptEditorControl Text="{Binding Code,Mode=TwoWay}" InsertSnippetCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.InsertSnippetCommand,Mode=TwoWay}" SaveCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SaveCommand}" HighlightTypes="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.HighlightTypes}" RunCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RunCommand}" StopCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StopCommand}" /> + </Grid> + </DataTemplate> + </Setter.Value> + </Setter> + </Style> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </UserControl.Resources> + <UserControl.Style> + <Style TargetType="UserControl"> + <Style.Triggers> + <DataTrigger Binding="{Binding IsRunning}" Value="True"> + <Setter Property="Cursor" Value="AppStarting"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </UserControl.Style> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Grid> + <Menu IsMainMenu="True" BorderThickness="0" Height="30" Padding="0 10 0 0"> + <MenuItem Header="File"> + <MenuItem Header="New" Command="{Binding NewCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="FileOutline" Width="12" Foreground="Gainsboro" Margin="2" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Open" MinWidth="150" Command="{Binding OpenCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="FolderOutline" Width="12" Foreground="Gainsboro" Margin="2" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Save" Command="{Binding SaveCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Save" Width="12" Foreground="Gainsboro" Margin="2" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Save as" Command="{Binding SaveAsCommand}"> + <MenuItem.Icon> + <Grid> + <fa:ImageAwesome Icon="Save" Width="10" Foreground="Gainsboro" Margin="2" /> + <fa:ImageAwesome Icon="Save" Width="10" Foreground="Gainsboro" Margin="2 -5 -5 2" /> + </Grid> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Exit" Command="{Binding ExitCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="SignOut" Width="12" Foreground="Gainsboro" Margin="2" /> + </MenuItem.Icon> + </MenuItem> + </MenuItem> + <MenuItem Header="Edit"> + <MenuItem Header="Cut" MinWidth="150" Command="Cut"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Cut" Width="12" Foreground="Gainsboro" Margin="2" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Copy" Command="Copy"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Copy" Width="12" Foreground="Gainsboro" Margin="2" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Paste" Command="Paste"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Paste" Width="12" Foreground="Gainsboro" Margin="2" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Undo" Command="Undo"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Undo" Width="12" Foreground="Gainsboro" Margin="2" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Redo" Command="Redo"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Repeat" Width="12" Foreground="Gainsboro" Margin="2" /> + </MenuItem.Icon> + </MenuItem> + </MenuItem> + <MenuItem Header="Build"> + <MenuItem Header="Run (F5)" MinWidth="150" Command="{Binding RunCommand}" > + <MenuItem.Icon> + <fa:ImageAwesome Icon="Play" Width="12" Margin="2"> + <fa:ImageAwesome.Style> + <Style TargetType="fa:ImageAwesome"> + <Setter Property="Foreground" Value="#8DD28A"></Setter> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="Gray"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </fa:ImageAwesome.Style> + </fa:ImageAwesome> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Stop" Command="{Binding StopCommand}" IsEnabled="False"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Stop" Width="12" Margin="2"> + <fa:ImageAwesome.Style> + <Style TargetType="fa:ImageAwesome"> + <Setter Property="Foreground" Value="#F38B76"></Setter> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="Gray"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </fa:ImageAwesome.Style> + </fa:ImageAwesome> + </MenuItem.Icon> + </MenuItem> + </MenuItem> + </Menu> + </Grid> + + <Grid Grid.Row="2"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="250"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="5"/> + <RowDefinition Height="0.5*"/> + </Grid.RowDefinitions> + + <Grid> + <TabControl x:Name="tabControl" Margin="5" ItemsSource="{Binding CodeTabs}" SelectedItem="{Binding SelectedCodeTab}"> + + </TabControl> + + <Grid HorizontalAlignment="Right" Margin="0 45 40 0" VerticalAlignment="Top" Visibility="{Binding IsRunning,Converter={StaticResource BooleanToVisibilityConverter}}"> + <StackPanel Orientation="Horizontal"> + <mahapps:ProgressRing Foreground="#007ACC" Width="20" Height="20"></mahapps:ProgressRing> + <TextBlock Text="Running..." FontStyle="Italic" Margin="10 0 0 0" FontSize="14" VerticalAlignment="Center"></TextBlock> + </StackPanel> + </Grid> + </Grid> + + <Grid Grid.Column="1" Grid.RowSpan="3"> + <Grid VerticalAlignment="Bottom" Height="25" Background="#007ACC"> + + </Grid> + <DockPanel> + <GroupBox Header="COMMUNICATION PORT" VerticalAlignment="Top" DockPanel.Dock="Top" Margin="0 2 0 0"> + <StackPanel> + <Grid VerticalAlignment="Center"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"></ColumnDefinition> + <ColumnDefinition Width="*"></ColumnDefinition> + </Grid.ColumnDefinitions> + <CheckBox x:Name="chkUseCurrentMachine" ToolTip="Use the currently connected machine to execute stubs" Margin="0 0 0 0" VerticalAlignment="Center" IsChecked="{Binding UseConnectedMachine}">Connected Machine</CheckBox> + <ComboBox Grid.Column="1" IsEnabled="{Binding ElementName=chkUseCurrentMachine,Path=IsChecked,Converter={StaticResource BooleanInverseConverter}}" Margin="10 0 0 0" BorderThickness="0" ItemsSource="{Binding Ports}" Height="35" SelectedItem="{Binding SelectedPort}"></ComboBox> + </Grid> + </StackPanel> + </GroupBox> + + <GroupBox Header="CONNECTION" DockPanel.Dock="Bottom" VerticalAlignment="Bottom" Margin="0 10 0 25"> + <StackPanel> + <Button IsEnabled="{Binding ElementName=chkUseCurrentMachine,Path=IsChecked,Converter={StaticResource BooleanInverseConverter}}" Height="50" MinWidth="100" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding ToggleConnectionCommand}"> + <Button.Style> + <Style TargetType="Button" BasedOn="{StaticResource AccentedSquareButtonStyle}"> + <Style.Triggers> + <DataTrigger Binding="{Binding IsConnected}" Value="False"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Orientation="Horizontal"> + <fa:ImageAwesome Icon="Link" Width="16"></fa:ImageAwesome> + <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">CONNECT</TextBlock> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsConnected}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Orientation="Horizontal"> + <fa:ImageAwesome Icon="Unlink" Width="16"></fa:ImageAwesome> + <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">DISCONNECT</TextBlock> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Button.Style> + </Button> + </StackPanel> + </GroupBox> + + <GroupBox Header="STUB SNIPPETS" Margin="0 10 0 0"> + <Grid> + <ListBox BorderThickness="0" ItemsSource="{Binding StubSnippets}" HorizontalContentAlignment="Stretch" SelectedItem="{Binding SelectedStubSnippet}"> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> + <Setter Property="Padding" Value="0"></Setter> + <Setter Property="Margin" Value="0 2 0 2"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + </Style> + </ListBox.ItemContainerStyle> + <ListBox.ItemTemplate> + <DataTemplate> + <Border BorderThickness="1" BorderBrush="#007ACC" Padding="8" Background="Transparent"> + <Border.InputBindings> + <MouseBinding Gesture="LeftDoubleClick" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StubSnippetSelectedCommand}"/> + </Border.InputBindings> + <Grid> + <fa:ImageAwesome Icon="ArrowLeft" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5 0 0 0" Foreground="#007ACC" Width="16" Height="16"></fa:ImageAwesome> + <TextBlock VerticalAlignment="Center" FontSize="11" HorizontalAlignment="Center" Text="{Binding Name}"></TextBlock> + </Grid> + </Border> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </Grid> + </GroupBox> + </DockPanel> + </Grid> + + <GridSplitter Margin="5 0 5 0" Grid.Row="1" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Center"> + <GridSplitter.Background> + <LinearGradientBrush> + <GradientStop/> + <GradientStop Color="#007ACC" Offset="0.5"/> + <GradientStop Offset="1"/> + </LinearGradientBrush> + </GridSplitter.Background> + </GridSplitter> + + <Grid Grid.Row="2"> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="25"/> + </Grid.RowDefinitions> + <GroupBox Header="Response"> + <Grid Background="#151515"> + <TextBox x:Name="txtLog" FontFamily="Lucida Console" TextChanged="TextBox_TextChanged" Background="Transparent" Text="{Binding Log}" BorderThickness="0" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Padding="5" IsReadOnly="True" TextWrapping="Wrap" FontSize="11" Foreground="Gainsboro"></TextBox> + </Grid> + </GroupBox> + <StatusBar Background="#007ACC" Grid.Row="1"> + <TextBlock Text="{Binding Status}"></TextBlock> + </StatusBar> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml.cs new file mode 100644 index 000000000..5eee980de --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml.cs @@ -0,0 +1,53 @@ +using Microsoft.Practices.ServiceLocation; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +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; +using Tango.MachineStudio.Stubs.ViewModels; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.Stubs.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl + { + public MainView() : base() + { + InitializeComponent(); + this.Loaded += MainView_Loaded; + } + + private void MainView_Loaded(object sender, RoutedEventArgs e) + { + ServiceLocator.Current.GetInstance<MainViewVM>().CodeTabs.RemoveAt(0); + } + + //Auto scroll to bottom of response log each time it is changed. + private void TextBox_TextChanged(object sender, TextChangedEventArgs e) + { + Task.Factory.StartNew(() => + { + Thread.Sleep(50); + + this.Dispatcher.Invoke(() => + { + txtLog.SelectionStart = txtLog.Text.Length; + txtLog.ScrollToEnd(); + }); + }); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config new file mode 100644 index 000000000..5d794b958 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/packages.config new file mode 100644 index 000000000..a29d1ec82 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/packages.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> + <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> + <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> + <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> + <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> + <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> + <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/App.config index 00d1c3941..158702ed3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/App.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/App.config @@ -12,4 +12,19 @@ </providers> </entityFramework> + <runtime> + + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + + <dependentAssembly> + + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + + </dependentAssembly> + + </assemblyBinding> + + </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj index 19eecc2e1..bc47bbb0b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj @@ -51,6 +51,9 @@ <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> </Reference> @@ -66,6 +69,22 @@ <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> + <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> + <Reference Include="System.Reactive.Interfaces, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Linq, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.PlatformServices, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll</HintPath> + </Reference> + <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.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> </Reference> @@ -150,6 +169,10 @@ <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> + <Content Include="..\..\..\..\DB\Tango.db"> + <Link>Tango.db</Link> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <None Include="App.config" /> <None Include="packages.config" /> <None Include="Properties\Settings.settings"> @@ -186,6 +209,10 @@ <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> <Name>Tango.Settings</Name> @@ -198,6 +225,10 @@ <Project>{7ada4e86-cad7-4968-a210-3a8a9e5153ab}</Project> <Name>Tango.Synchronization</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj"> <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/DirectSynchronizationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/DirectSynchronizationViewVM.cs index ba3521009..f265fafe7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/DirectSynchronizationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/DirectSynchronizationViewVM.cs @@ -1,20 +1,286 @@ -using System; +using Google.Protobuf; +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Core.Helpers; +using Tango.DAL.Observables; using Tango.Integration.Services; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.MachineStudio.Synchronization.Navigation; +using Tango.PMR.Integration; using Tango.SharedUI; +using Tango.Synchronization; +using Tango.Synchronization.Local; +using Tango.Synchronization.Remote; namespace Tango.MachineStudio.Synchronization.ViewModels { public class DirectSynchronizationViewVM : ViewModel { - public ExternalBridgeScanner Scanner { get; set; } + private SyncNavigationManager _navigation; + private String _slaveDBFile; + private String _masterDBFile; + private LocalDBComparer _comparer; + private INotificationProvider _notification; + private bool _isWorking; - public DirectSynchronizationViewVM(ExternalBridgeScanner scanner) + public IStudioApplicationManager ApplicationManager { get; set; } + + public DirectSynchronizationViewVM(IStudioApplicationManager applicationManager, SyncNavigationManager navigation, INotificationProvider notification) + { + ApplicationManager = applicationManager; + + _navigation = navigation; + _notification = notification; + + BackCommand = new RelayCommand(() => _navigation.NavigateTo(NavigationView.MenuView)); + + Differences = new ObservableCollection<Diff>(); + + CompareCommand = new RelayCommand(Compare, (x) => !_isWorking && SelectedMachine != null); + CommitAllCommand = new RelayCommand(Synchronize, (x) => Differences.Count > 0 && !_isWorking && SelectedMachine != null); + } + + #region Commands + + /// <summary> + /// Gets or sets the back command. + /// </summary> + public RelayCommand BackCommand { get; set; } + + /// <summary> + /// Gets or sets the browse master database command. + /// </summary> + public RelayCommand BrowseMasterDBCommand { get; set; } + + /// <summary> + /// Gets or sets the browse slave database command. + /// </summary> + public RelayCommand BrowseSlaveDBCommand { get; set; } + + /// <summary> + /// Gets or sets the compare command. + /// </summary> + public RelayCommand CompareCommand { get; set; } + + /// <summary> + /// Gets or sets the commit command. + /// </summary> + public RelayCommand CommitCommand { get; set; } + + /// <summary> + /// Gets or sets the commit all command. + /// </summary> + public RelayCommand CommitAllCommand { get; set; } + + /// <summary> + /// Gets or sets the clean command. + /// </summary> + public RelayCommand CleanCommand { get; set; } + + #endregion + + #region Properties + + private bool _isClearMachine; + /// <summary> + /// Gets or sets a value indicating whether this instance is clear machine. + /// </summary> + public bool IsClearMachine + { + get { return _isClearMachine; } + set + { + _isClearMachine = value; + RaisePropertyChangedAuto(); + } + } + + private ObservableCollection<Diff> _differences; + /// <summary> + /// Gets or sets the differences. + /// </summary> + public ObservableCollection<Diff> Differences + { + get { return _differences; } + set { _differences = value; RaisePropertyChanged(nameof(Differences)); } + } + + private Diff _selectedDifference; + /// <summary> + /// Gets or sets the selected difference. + /// </summary> + public Diff SelectedDifference + { + get { return _selectedDifference; } + set { _selectedDifference = value; RaisePropertyChanged(nameof(SelectedDifference)); InvalidateRelayCommands(); } + } + + private Machine _selectedMachine; + /// <summary> + /// Gets or sets the selected machine. + /// </summary> + public Machine SelectedMachine + { + get { return _selectedMachine; } + set { _selectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + #endregion + + private void Compare() + { + if (SelectedMachine.SerialNumber != ApplicationManager.ConnectedMachine.SerialNumber) + { + if (!_notification.ShowQuestion("The selected machine serial number does not match the connected machine. Are you sure you want to continue?")) + { + return; + } + } + + Task.Factory.StartNew(async () => + { + using (_notification.PushTaskItem("Downloading machine database...")) + { + try + { + _isWorking = true; + InvalidateRelayCommands(); + Thread.Sleep(1500); + + ApplicationManager.ConnectedMachine.RequestTimeout = TimeSpan.FromSeconds(10); + var response = await ApplicationManager.ConnectedMachine.SendRequest<DirectSynchronizationRequest, DirectSynchronizationResponse>(new DirectSynchronizationRequest()); + + using (_notification.PushTaskItem("Generating temporary files...")) + { + String tempFolder = PathHelper.GetTempFolderPath(); + + //File path for the reflected remote data base SQLite. + _masterDBFile = Path.Combine(tempFolder, "Remote.db"); + //File path for the received machine SQLite db. + _slaveDBFile = Path.Combine(tempFolder, "Local.db"); + + //Save the machine db to file. + File.WriteAllBytes(_slaveDBFile, response.Message.LocalDB.ToByteArray()); + + //Copy the SQLite db template. + File.Copy(Path.Combine(PathHelper.GetStartupPath(), "Tango.db"), _masterDBFile); + + //Synchronize the SQL Server db with the new SQLite template. (Overwrite basically) + RemoteDBSynchronizer.Synchronize(_masterDBFile, SelectedMachine.SerialNumber, true); + + using (_notification.PushTaskItem("Comparing database...")) + { + _comparer = new LocalDBComparer(new SQLiteDataBase(_masterDBFile), new SQLiteDataBase(_slaveDBFile)); + + var diffs = _comparer.Compare(); + Differences = new ObservableCollection<Diff>(diffs); + + if (diffs.Where(x => x.Action != DiffAction.ReplaceTableDataInSlave).Count() > 0) + { + ShowInfo("Found " + Differences.Where(x => x.Action != DiffAction.ReplaceTableDataInSlave).Count() + " differences."); + } + else + { + ShowInfo("The machine database is synchronized."); + } + } + } + } + catch (Exception ex) + { + ShowError(ex.Message); + } + finally + { + _isWorking = false; + SelectedDifference = null; + InvalidateRelayCommands(); + } + } + }); + } + + private void Synchronize() + { + if (IsClearMachine) + { + if (!_notification.ShowQuestion("This will erase and override the existing machine database. Do you want to proceed?")) + { + return; + } + } + + Task.Factory.StartNew(async () => + { + using (_notification.PushTaskItem("Synchronizing...")) + { + try + { + _isWorking = true; + InvalidateRelayCommands(); + Thread.Sleep(1500); + + for (int i = 0; i < Differences.Count; i++) + { + var diff = Differences[i]; + + diff.Commit(); + InvokeUINow(() => Differences.Remove(diff)); + i--; + } + + _comparer.Dispose(); + + byte[] remoteDbBytes = IsClearMachine ? File.ReadAllBytes(_masterDBFile) : File.ReadAllBytes(_slaveDBFile); + + var response = await ApplicationManager.ConnectedMachine.SendRequest<OverrideDataBaseRequest, OverrideDataBaseResponse>(new OverrideDataBaseRequest() + { + RemoteDB = ByteString.CopyFrom(remoteDbBytes) + }); + + if (!response.Message.Successful) + { + ShowError("The remote machine has reported some error while trying to override the database."); + } + else + { + PathHelper.TryDeleteFile(_slaveDBFile); + PathHelper.TryDeleteFile(_masterDBFile); + _slaveDBFile = null; + _masterDBFile = null; + InvalidateRelayCommands(); + } + } + catch (Exception ex) + { + ShowError(ex.Message); + } + finally + { + _isWorking = false; + SelectedDifference = null; + InvalidateRelayCommands(); + } + } + }); + } + + private void ShowError(String message) + { + InvokeUINow(() => _notification.ShowError(message)); + } + + private void ShowInfo(String message) { - Scanner = scanner; + InvokeUINow(() => _notification.ShowInfo(message)); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml index 7dc0cdacc..4c5a719b5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml @@ -5,29 +5,199 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:synchronization="clr-namespace:Tango.Synchronization;assembly=Tango.Synchronization" + xmlns:providers="clr-namespace:Tango.MachineStudio.Synchronization.AutoComplete" + xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" xmlns:global="clr-namespace:Tango.MachineStudio.Synchronization" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.Synchronization.Views" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.DirectSynchronizationViewVM}"> + d:DesignHeight="720" d:DesignWidth="1280" DataContext="{x:Static global:ViewModelLocator.DirectSynchronizationViewVM}"> + + <UserControl.Resources> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"></converters:BooleanToVisibilityInverseConverter> + + <providers:MachinesProvider x:Key="MachinesProvider"></providers:MachinesProvider> + + <VisualBrush x:Key="badgeBackground"> + <VisualBrush.Visual> + <Border> + <Path Stretch="Fill" RenderTransformOrigin="0.5,0.5"> + <Path.RenderTransform> + <ScaleTransform ScaleX="-1"></ScaleTransform> + </Path.RenderTransform> + <Path.Fill> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Color="#EEEEEE" Offset="0.4" /> + <GradientStop Color="White" Offset="1"/> + </LinearGradientBrush> + </Path.Fill> + <Path.Data> + <PathGeometry Figures="M 53.868 43.913 H 19.511 c -0.444 0 -0.875 -0.151 -1.221 -0.428 L 0.734 29.439 c -0.978 -0.783 -0.978 -2.271 0 -3.053 L 18.29 12.341 c 0.347 -0.277 0.777 -0.428 1.221 -0.428 h 34.356 c 1.081 0 1.958 0.877 1.958 1.958 v 28.084 c 0 1.081 -0.876 1.958 -1.957 1.958 z" FillRule="NonZero"/> + </Path.Data> + </Path> + </Border> + </VisualBrush.Visual> + </VisualBrush> + </UserControl.Resources> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="100" /> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="300"/> - <ColumnDefinition Width="1*"/> - </Grid.ColumnDefinitions> + <StackPanel Orientation="Horizontal" Margin="20"> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Margin="0 5 0 0" VerticalAlignment="Center" Command="{Binding BackCommand}"> + <materialDesign:PackIcon Kind="ArrowLeft" Foreground="#303030" ToolTip="Back" VerticalAlignment="Center" Width="40" Height="40"></materialDesign:PackIcon> + </Button> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="30">Direct Database Synchronization</TextBlock> + </StackPanel> + </Grid> + + <Grid Margin="20" Grid.Row="1"> + <GroupBox Header="Compare & Synchronize"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="57*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition MaxWidth="250" /> + <ColumnDefinition/> + </Grid.ColumnDefinitions> + + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20 0 0 0"> + <Image Source="../Images/remote-db.png" Width="100" Margin="10" Opacity="0.8" HorizontalAlignment="Left" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Background="{StaticResource badgeBackground}" Padding="5" Width="200" FontSize="14" HorizontalAlignment="Left">Remote Database</TextBlock> + <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> + <fa:ImageAwesome Icon="Key" Width="16" Height="16"></fa:ImageAwesome> + <autoComplete:AutoCompleteTextBox Margin="5 0 0 0" Width="170" materialDesign:HintAssist.Hint="Enter machine serial number" DisplayMember="SerialNumber" Provider="{StaticResource ResourceKey=MachinesProvider}" SelectedItem="{Binding SelectedMachine,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> + <autoComplete:AutoCompleteTextBox.ItemTemplate> + <DataTemplate> + <TextBlock Text="{Binding SerialNumber}"></TextBlock> + </DataTemplate> + </autoComplete:AutoCompleteTextBox.ItemTemplate> + <autoComplete:AutoCompleteTextBox.LoadingContent> + <TextBlock Text="Loading..." Margin="5" FontSize="14" /> + </autoComplete:AutoCompleteTextBox.LoadingContent> + </autoComplete:AutoCompleteTextBox> + </StackPanel> + </StackPanel> - <ListBox ItemsSource="{Binding Scanner.AvailableMachines}" SelectedItem="{Binding SelectedMachine}"> - <ListBox.ItemTemplate> - <DataTemplate> - <StackPanel> - <TextBlock Text="{Binding SerialNumber}"></TextBlock> - <TextBlock Text="{Binding Organization}"></TextBlock> + <StackPanel Margin="20 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="1" > + <Image Source="../Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="110"></Image> + <TextBlock Margin="0 20 0 0"> + <Run FontWeight="Bold">IP Address:</Run> + <Run Text="{Binding ApplicationManager.ConnectedMachine.IPAddress,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock Margin="0 5 0 0"> + <Run FontWeight="Bold">Serial Number:</Run> + <Run Text="{Binding ApplicationManager.ConnectedMachine.SerialNumber,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock Margin="0 5 0 0"> + <Run FontWeight="Bold">Organization:</Run> + <Run Text="{Binding ApplicationManager.ConnectedMachine.Organization,Mode=OneWay}"></Run> + </TextBlock> </StackPanel> - </DataTemplate> - </ListBox.ItemTemplate> - </ListBox> - + + </Grid> + + <Button Margin="20 10" Grid.Row="1" Width="200" Height="40" HorizontalAlignment="Left" Command="{Binding CompareCommand}"> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">COMPARE</TextBlock> + <fa:ImageAwesome Icon="LongArrowRight" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=Foreground}" Width="16"></fa:ImageAwesome> + </StackPanel> + </Button> + + <Grid Grid.Column="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="625*"/> + <ColumnDefinition Width="347*"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="20"/> + <RowDefinition Height="205*"/> + </Grid.RowDefinitions> + <TextBlock Margin="10 5 0 0" FontSize="14">Differences</TextBlock> + <ListBox Margin="10" Background="#F1F1F1" Grid.Row="1" ItemsSource="{Binding Differences}" SelectedItem="{Binding SelectedDifference,Mode=TwoWay}"> + <ListBox.ItemTemplate> + <DataTemplate> + <Border Padding="10"> + <StackPanel Orientation="Horizontal"> + <fa:ImageAwesome Icon="Cog" Width="20" Height="20" Foreground="Gray"></fa:ImageAwesome> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Text="{Binding Description}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Foreground" Value="Red"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Action}" Value="ReplaceTableDataInSlave"> + <Setter Property="Foreground" Value="#404040"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </StackPanel> + </Border> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + + <TextBlock Margin="10 0 0 0" VerticalAlignment="Bottom" Grid.Column="1">SQL Command</TextBlock> + <TextBox Grid.Column="1" Margin="10" Style="{x:Null}" BorderThickness="0" Foreground="Gray" FontSize="14" Text="{Binding SelectedDifference.Command,Mode=OneWay}" IsReadOnly="True" Background="#F1F1F1" Padding="5" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" AcceptsReturn="True" Grid.Row="1"></TextBox> + </Grid> + + <Grid Grid.Row="1" Grid.Column="1"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" Margin="0 0 20 0"> + <TextBlock>Clear Machine Before Synchronization</TextBlock> + <ToggleButton Margin="10 0 0 0" IsChecked="{Binding IsClearMachine}" Foreground="Red" Style="{StaticResource MaterialDesignSwitchToggleButton}" ></ToggleButton> + </StackPanel> + <Button Margin="10 10" Grid.Row="1" Width="160" Height="40" HorizontalAlignment="Right" Command="{Binding CommitAllCommand}"> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">SYNCHRONIZE</TextBlock> + <fa:ImageAwesome Icon="SortAmountAsc" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=Foreground}" Width="16"></fa:ImageAwesome> + </StackPanel> + </Button> + </StackPanel> + </Grid> + </Grid> + </GroupBox> + </Grid> + + <Grid Grid.Row="1" Visibility="Hidden"> + <Grid.Background> + <SolidColorBrush Color="White" Opacity="0.8"></SolidColorBrush> + </Grid.Background> + + <TextBlock Foreground="Silver" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="40"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Style.Triggers> + <EventTrigger RoutedEvent="Loaded"> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01" RepeatBehavior="Forever"> + <LinearDoubleKeyFrame Value="0" KeyTime="00:00:00"></LinearDoubleKeyFrame> + <LinearDoubleKeyFrame Value="1" KeyTime="00:00:0.5"></LinearDoubleKeyFrame> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </EventTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + No Machine Connection + </TextBlock> </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/LocalSynchronizationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/LocalSynchronizationView.xaml index 72297e2cb..e5a4aac5a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/LocalSynchronizationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/LocalSynchronizationView.xaml @@ -43,18 +43,14 @@ <Grid> <StackPanel Orientation="Horizontal" Margin="20"> <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Margin="0 5 0 0" VerticalAlignment="Center" Command="{Binding BackCommand}"> - <materialDesign:PackIcon Kind="Backburger" Foreground="#303030" ToolTip="Back" VerticalAlignment="Center" Width="40" Height="40"></materialDesign:PackIcon> + <materialDesign:PackIcon Kind="ArrowLeft" Foreground="#303030" ToolTip="Back" VerticalAlignment="Center" Width="40" Height="40"></materialDesign:PackIcon> </Button> <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="30">Local Database Synchronization</TextBlock> </StackPanel> </Grid> <Grid Grid.Row="1"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="800"/> - <ColumnDefinition Width="1*"/> - </Grid.ColumnDefinitions> <Grid Margin="20"> - <GroupBox Header="Compare"> + <GroupBox Header="Compare & Synchronize"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="57*"/> @@ -102,6 +98,10 @@ </Button> <Grid Grid.Column="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="671*"/> + <ColumnDefinition Width="301*"/> + </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="20"/> <RowDefinition Height="205*"/> @@ -130,51 +130,32 @@ </DataTemplate> </ListBox.ItemTemplate> </ListBox> - </Grid> - - <Button Margin="10 10" Grid.Column="1" Grid.Row="1" Width="160" Height="40" Background="#FF4F4F" BorderBrush="#FF4F4F" HorizontalAlignment="Right" Command="{Binding CleanCommand}"> - <StackPanel Orientation="Horizontal"> - <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">CLEAN SLAVE</TextBlock> - <fa:ImageAwesome Icon="TrashOutline" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=Foreground}" Width="16"></fa:ImageAwesome> - </StackPanel> - </Button> - </Grid> - </GroupBox> - </Grid> - <Grid Grid.Column="1" Margin="20"> - <GroupBox Header="Synchronize"> - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="1*"/> - <RowDefinition Height="Auto"/> - </Grid.RowDefinitions> - - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="20"/> - <RowDefinition Height="71*"/> - </Grid.RowDefinitions> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Bottom">SQL Command</TextBlock> - <TextBox Margin="10" Style="{x:Null}" BorderThickness="0" Foreground="Gray" FontSize="14" Text="{Binding SelectedDifference.Command,Mode=OneWay}" IsReadOnly="True" Background="#F1F1F1" Padding="5" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" AcceptsReturn="True" Grid.Row="1"></TextBox> + <TextBlock Grid.Column="1" Margin="10 0 0 0" VerticalAlignment="Bottom">SQL Command</TextBlock> + <TextBox Grid.Column="1" Margin="10" Style="{x:Null}" BorderThickness="0" Foreground="Gray" FontSize="14" Text="{Binding SelectedDifference.Command,Mode=OneWay}" IsReadOnly="True" Background="#F1F1F1" Padding="5" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" AcceptsReturn="True" Grid.Row="1"></TextBox> </Grid> - <Grid Grid.Row="1"> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> - <Button Margin="10 10" Grid.Row="1" Width="160" Height="40" HorizontalAlignment="Right" Command="{Binding CommitCommand}"> - <StackPanel Orientation="Horizontal"> - <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">COMMIT</TextBlock> - <fa:ImageAwesome Icon="Bolt" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=Foreground}" Width="16"></fa:ImageAwesome> - </StackPanel> - </Button> - <Button Margin="10 10" Grid.Row="1" Width="160" Height="40" HorizontalAlignment="Right" Command="{Binding CommitAllCommand}"> - <StackPanel Orientation="Horizontal"> - <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">COMMIT ALL</TextBlock> - <fa:ImageAwesome Icon="SortAmountAsc" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=Foreground}" Width="16"></fa:ImageAwesome> - </StackPanel> - </Button> - </StackPanel> - </Grid> + <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right" Grid.Column="1"> + <Button Margin="10 10" Width="160" Height="40" Background="#FF4F4F" BorderBrush="#FF4F4F" Command="{Binding CleanCommand}"> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">CLEAN SLAVE</TextBlock> + <fa:ImageAwesome Icon="TrashOutline" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=Foreground}" Width="16"></fa:ImageAwesome> + </StackPanel> + </Button> + <Button Margin="10 10" Grid.Row="1" Width="160" Height="40" HorizontalAlignment="Right" Command="{Binding CommitCommand}"> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">COMMIT</TextBlock> + <fa:ImageAwesome Icon="Bolt" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=Foreground}" Width="16"></fa:ImageAwesome> + </StackPanel> + </Button> + <Button Margin="10 10" Grid.Row="1" Width="160" Height="40" HorizontalAlignment="Right" Command="{Binding CommitAllCommand}"> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">COMMIT ALL</TextBlock> + <fa:ImageAwesome Icon="SortAmountAsc" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=Foreground}" Width="16"></fa:ImageAwesome> + </StackPanel> + </Button> + </StackPanel> + </Grid> </GroupBox> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/RemoteSynchronizationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/RemoteSynchronizationView.xaml index 2487aab64..9bb995bd8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/RemoteSynchronizationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/RemoteSynchronizationView.xaml @@ -48,7 +48,7 @@ <Grid> <StackPanel Orientation="Horizontal" Margin="20"> <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Margin="0 5 0 0" VerticalAlignment="Center" Command="{Binding BackCommand}"> - <materialDesign:PackIcon Kind="Backburger" Foreground="#303030" ToolTip="Back" VerticalAlignment="Center" Width="40" Height="40"></materialDesign:PackIcon> + <materialDesign:PackIcon Kind="ArrowLeft" Foreground="#303030" ToolTip="Back" VerticalAlignment="Center" Width="40" Height="40"></materialDesign:PackIcon> </Button> <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="30">Local Database Synchronization</TextBlock> </StackPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/packages.config index 8d8f972d1..1fa8e3268 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/packages.config @@ -3,8 +3,15 @@ <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> + <package id="System.Reactive" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Core" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Linq" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.PlatformServices" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Windows.Threading" version="3.1.1" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config index 692b77528..d38c3ed69 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -27,6 +27,46 @@ <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs index 689ac7b38..9a8a6bc96 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -10,6 +10,7 @@ using Tango.Core; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Modules; +using Tango.MachineStudio.Stubs; namespace Tango.MachineStudio.UI.Modules { @@ -49,6 +50,10 @@ namespace Tango.MachineStudio.UI.Modules { if (!_loaded) { + //Preloaded + AllModules.Add(new StubsModule()); + //Preloaded + AllModules.Clear(); string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); @@ -63,8 +68,11 @@ namespace Tango.MachineStudio.UI.Modules { foreach (var moduleType in moduleAssembly.GetTypes().Where(x => !x.IsInterface && typeof(IStudioModule).IsAssignableFrom(x))) { - var module = Activator.CreateInstance(moduleType) as IStudioModule; - AllModules.Add(module); + if (!AllModules.ToList().Exists(x => x.GetType() == moduleType)) + { + var module = Activator.CreateInstance(moduleType) as IStudioModule; + AllModules.Add(module); + } } } } 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 3c245510b..ede66dc19 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -15,6 +15,8 @@ namespace Tango.MachineStudio.UI.Notifications { public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + private static List<Type> viewTypes; + public ObservableCollection<TaskItem> TaskItems { get; private set; } public bool HasTaskItems @@ -99,7 +101,19 @@ namespace Tango.MachineStudio.UI.Notifications { String viewName = typeof(VM).Name.Replace("VM", ""); - var view = Activator.CreateInstance(AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()).Single(x => x.Name == viewName)) as FrameworkElement; + if (viewTypes == null) + { + viewTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()).ToList(); + } + + var viewType = viewTypes.SingleOrDefault(x => x.Name == viewName); + + if (viewType == null) + { + throw new NullReferenceException("Could not locate view " + viewName); + } + + var view = Activator.CreateInstance(viewType) as FrameworkElement; DialogWindow dialog = new DialogWindow(); dialog.Owner = Application.Current.MainWindow; dialog.InnerContent = view; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml index 4f3b826fe..a89f8eeca 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml @@ -24,7 +24,7 @@ <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Click="OnOKClicked"> ACCEPT </Button> - <Button Visibility="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=HasCancel,Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Click="OnCancelClicked"> + <Button Visibility="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=HasCancel,Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignFlatButton}" IsCancel="False" Margin="0 8 8 0" Click="OnCancelClicked"> CANCEL </Button> </StackPanel> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 355d59083..89823e4f7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -77,9 +77,27 @@ <HintPath>..\..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll</HintPath> </Reference> <Reference Include="System" /> + <Reference Include="System.ComponentModel.Composition" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> + <Reference Include="System.Numerics" /> + <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> + <Reference Include="System.Reactive.Interfaces, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Linq, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.PlatformServices, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll</HintPath> + </Reference> + <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.Windows" /> <Reference Include="System.Windows.Forms" /> <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> @@ -114,6 +132,7 @@ <Compile Include="ViewModels\LoadingViewVM.cs" /> <Compile Include="ViewModels\LoginViewVM.cs" /> <Compile Include="ViewModels\MachineConnectionViewVM.cs" /> + <Compile Include="ViewModels\MachineLoginViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\ShutdownViewVM.cs" /> @@ -262,6 +281,10 @@ <Project>{94f7acf8-55e1-4a02-b9bc-a818413fdbbf}</Project> <Name>Tango.MachineStudio.DB</Name> </ProjectReference> + <ProjectReference Include="..\Modules\Tango.MachineStudio.Stubs\Tango.MachineStudio.Stubs.csproj"> + <Project>{22c2aa72-9493-4d0d-b421-8ef9789fb192}</Project> + <Name>Tango.MachineStudio.Stubs</Name> + </ProjectReference> <ProjectReference Include="..\Modules\Tango.MachineStudio.Synchronization\Tango.MachineStudio.Synchronization.csproj"> <Project>{12d0c43c-391f-4c74-92ab-82e9a9beeb9b}</Project> <Name>Tango.MachineStudio.Synchronization</Name> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index e40f589af..70912ba98 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -63,6 +63,7 @@ namespace Tango.MachineStudio.UI SimpleIoc.Default.Register<ShutdownViewVM>(); SimpleIoc.Default.Register<LoginViewVM>(); SimpleIoc.Default.Register<MachineConnectionViewVM>(); + SimpleIoc.Default.Register<MachineLoginViewVM>(); LogManager.RegisterLogger(new VSOutputLogger()); LogManager.RegisterLogger(new FileLogger()); @@ -114,5 +115,13 @@ namespace Tango.MachineStudio.UI return ServiceLocator.Current.GetInstance<MachineConnectionViewVM>(); } } + + public MachineLoginViewVM MachineLoginViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MachineLoginViewVM>(); + } + } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 6505bcf88..f213af0d4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -31,7 +31,6 @@ namespace Tango.MachineStudio.UI.ViewModels { StaThreadHelper.StartStaThread(() => { - Thread.Sleep(1000); try { ObservablesEntitiesAdapter.Instance.Initialize(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs new file mode 100644 index 000000000..a6ee9ee2a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class MachineLoginViewVM : DialogViewVM + { + public String Password { get; set; } + + public RelayCommand<String> LoginCommand { get; set; } + + public RelayCommand CancelCommand { get; set; } + + public MachineLoginViewVM() + { + LoginCommand = new RelayCommand<string>(Login); + CancelCommand = new RelayCommand(Cancel); + } + + private void Login(string password) + { + Password = password; + Accept(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 6c44c8480..92c0afa21 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -124,33 +124,38 @@ namespace Tango.MachineStudio.UI.ViewModels private void ConnectToMachine() { - _notificationProvider.ShowModalDialog<MachineConnectionViewVM>(async (x) => + _notificationProvider.ShowModalDialog<MachineConnectionViewVM>((x) => { if (x.SelectedMachine != null) { - using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "...")) + _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) => { - try + using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "...")) { - await x.SelectedMachine.Connect(); - var authenticated = await x.SelectedMachine.Authenticate(); - if (!authenticated) + try { - _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine."); + await x.SelectedMachine.Connect(); + var authenticated = await x.SelectedMachine.Authenticate(login.Password); + if (!authenticated) + { + _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine."); + } + else + { + ApplicationManager.ConnectedMachine = x.SelectedMachine; + } } - else + catch (Exception ex) { - ApplicationManager.ConnectedMachine = x.SelectedMachine; - var response = await x.SelectedMachine.SendRequest<CalculateRequest, CalculateResponse>(new CalculateRequest() { A = 10, B = 5 }); - _notificationProvider.ShowInfo(response.ToString()); + LogManager.Log(ex); + _notificationProvider.ShowError(ex.Message); } + + InvalidateRelayCommands(); } - catch (Exception ex) - { - LogManager.Log(ex); - _notificationProvider.ShowError(ex.Message); - } - } + }); + + InvalidateRelayCommands(); } InvalidateRelayCommands(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml index 2d172837a..32108c652 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -77,7 +77,7 @@ </Grid> <Grid Grid.Row="1"> - <Button HorizontalAlignment="Right" Width="140" Command="{Binding ConnectCommand}" Click="OnConnectClicked">CONNECT</Button> + <Button HorizontalAlignment="Right" Width="140" Command="{Binding ConnectCommand}">CONNECT</Button> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml.cs index 58cec1987..6c8e305e9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml.cs @@ -24,11 +24,5 @@ namespace Tango.MachineStudio.UI.Views { InitializeComponent(); } - - private void OnConnectClicked(object sender, RoutedEventArgs e) - { - Window.GetWindow(this).DialogResult = true; - Window.GetWindow(this).Close(); - } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml index 83f7cc884..04f787c41 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml @@ -3,10 +3,37 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> + d:DesignHeight="200" d:DesignWidth="550" Background="White" DataContext="{Binding MachineLoginViewVM, Source={StaticResource Locator}}"> <Grid> - + <DockPanel LastChildFill="True"> + <StackPanel Margin="10" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom"> + <Button Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}" Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0"> + LOGIN + </Button> + <Button Command="{Binding CancelCommand}" Style="{StaticResource MaterialDesignFlatButton}" Margin="0 8 0 0"> + CANCEL + </Button> + </StackPanel> + <Grid Margin="10"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Top"> + <Grid> + <Image Source="../Images/machine-trans.png" Width="42" RenderOptions.BitmapScalingMode="Fant"></Image> + <materialDesign:PackIcon Kind="Lock" VerticalAlignment="Bottom" Width="24" Height="24" HorizontalAlignment="Right" Foreground="{StaticResource AccentColorBrush}" /> + </Grid> + <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="18" Text="Machine Login" Width="400"></TextBlock> + </StackPanel> + + <StackPanel Margin="60 0 0 0"> + <TextBlock Margin="0 15 0 0">Enter machine password</TextBlock> + <PasswordBox x:Name="txtPass" Margin="0 0 0 0" HorizontalAlignment="Left" PasswordChanged="txtPass_PasswordChanged" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="*********" Width="300" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" /> + </StackPanel> + </StackPanel> + </Grid> + </DockPanel> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml.cs index c0bfdc25d..c5161b477 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml.cs @@ -23,6 +23,29 @@ namespace Tango.MachineStudio.UI.Views public MachineLoginView() { InitializeComponent(); + + this.Loaded += MachineLoginView_Loaded; + } + + private void MachineLoginView_Loaded(object sender, RoutedEventArgs e) + { + txtPass.Focusable = true; + txtPass.Focus(); + txtPass.Password = String.Empty; + Password = String.Empty; + } + + public String Password + { + get { return (String)GetValue(PasswordProperty); } + set { SetValue(PasswordProperty, value); } + } + public static readonly DependencyProperty PasswordProperty = + DependencyProperty.Register("Password", typeof(String), typeof(MachineLoginView), new PropertyMetadata(null)); + + private void txtPass_PasswordChanged(object sender, RoutedEventArgs e) + { + Password = txtPass.Password; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index fc9db8adc..14858c049 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -86,9 +86,8 @@ <StackPanel> <Button Content="Machine Connection" Command="{Binding ConnectCommand}" /> <Button Content="Disconnect Machine" Command="{Binding DisconnectCommand}" /> - <Button Content="Exit" /> <Separator/> - <Button Content="Goodbye"/> + <Button Content="Exit" /> </StackPanel> </materialDesign:PopupBox> <Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config index 25ad810bd..ae67b1d1c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config @@ -11,4 +11,10 @@ <package id="MvvmLight" version="5.3.0.0" targetFramework="net46" /> <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> <package id="SimpleValidator" version="0.6.1.0" targetFramework="net46" /> + <package id="System.Reactive" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Core" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Linq" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.PlatformServices" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Windows.Threading" version="3.1.1" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs index 00c785ac0..63487fe1b 100644 --- a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs +++ b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs @@ -20,6 +20,11 @@ namespace Tango.Core.Helpers return tempDirectory; } + public static String GetStartupPath() + { + return AppDomain.CurrentDomain.BaseDirectory; + } + public static bool TryDeleteFolder(String path) { try diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx index aa2095368..4bd90ccea 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx @@ -393,6 +393,7 @@ <Property Name="GUID" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> <Property Name="MANUFACTURER" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> <Property Name="MATERIAL_GUID" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> <Property Name="COLOR_GUID" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> @@ -942,6 +943,7 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> <Property Name="MANUFACTURER" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> <Property Name="MATERIAL_GUID" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> <Property Name="COLOR_GUID" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> @@ -1457,6 +1459,7 @@ <ScalarProperty Name="COLOR_GUID" ColumnName="COLOR_GUID" /> <ScalarProperty Name="MATERIAL_GUID" ColumnName="MATERIAL_GUID" /> <ScalarProperty Name="MANUFACTURER" ColumnName="MANUFACTURER" /> + <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/RML.cs b/Software/Visual_Studio/Tango.DAL.Local/DB/RML.cs index 8b7723d95..d84850194 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/RML.cs +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/RML.cs @@ -18,6 +18,7 @@ namespace Tango.DAL.Local.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public string NAME { get; set; } public string MANUFACTURER { get; set; } public string MATERIAL_GUID { get; set; } public string COLOR_GUID { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs index df2302456..b0f85c1ab 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs @@ -10,6 +10,25 @@ namespace Tango.DAL.Observables public class Rml : ObservableEntity<RML> { + private String _name; + /// <summary> + /// Gets or sets the rml name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private String _manufacturer; /// <summary> /// Gets or sets the rml manufacturer. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberShapes.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberShapes.cs index 53a56c61f..9b32088fa 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberShapes.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberShapes.cs @@ -8,5 +8,12 @@ namespace Tango.DAL.Observables { public enum FiberShapes { + + /// <summary> + /// (Triangle) + /// </summary> + [Description("Triangle")] + Triangle = 1, + } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynths.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynths.cs index aa2dfec11..66ef5b189 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynths.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynths.cs @@ -8,5 +8,12 @@ namespace Tango.DAL.Observables { public enum FiberSynths { + + /// <summary> + /// (Some syntheses type) + /// </summary> + [Description("Some syntheses type")] + Somesynthesestype = 1, + } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/LinearMassDensityUnits.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/LinearMassDensityUnits.cs index e5fc1e320..6d2903333 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/LinearMassDensityUnits.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/LinearMassDensityUnits.cs @@ -8,5 +8,12 @@ namespace Tango.DAL.Observables { public enum LinearMassDensityUnits { + + /// <summary> + /// (Dex) + /// </summary> + [Description("Dex")] + Dex = 1, + } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaConditions.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaConditions.cs index 8f7016c5d..d961ef8a5 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaConditions.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaConditions.cs @@ -8,5 +8,12 @@ namespace Tango.DAL.Observables { public enum MediaConditions { + + /// <summary> + /// (Treated) + /// </summary> + [Description("Treated")] + Treated = 1, + } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaMaterials.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaMaterials.cs index 252b2772a..552b43d55 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaMaterials.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaMaterials.cs @@ -8,5 +8,12 @@ namespace Tango.DAL.Observables { public enum MediaMaterials { + + /// <summary> + /// (Nylon) + /// </summary> + [Description("Nylon")] + Nylon = 1, + } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaPurposes.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaPurposes.cs index c47a96064..aae066631 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaPurposes.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaPurposes.cs @@ -8,5 +8,12 @@ namespace Tango.DAL.Observables { public enum MediaPurposes { + + /// <summary> + /// (Embroidery) + /// </summary> + [Description("Embroidery")] + Embroidery = 1, + } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs index b5a9747b2..63fdce62a 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs @@ -129,6 +129,22 @@ namespace Tango.DAL.Observables eventType.EventTypesActions = eventType.EventTypesActions.Where(x => !x.Deleted).ToObservableCollection(); } + MediaMaterials = Context.MEDIA_MATERIALS.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MediaMaterial>(x)).ToObservableCollection(); + + MediaColors = Context.MEDIA_COLORS.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MediaColor>(x)).ToObservableCollection(); + + MediaPurposes = Context.MEDIA_PURPOSES.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MediaPurpos>(x)).ToObservableCollection(); + + MediaConditions = Context.MEDIA_CONDITIONS.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MediaCondition>(x)).ToObservableCollection(); + + LinearMassDensityUnits = Context.LINEAR_MASS_DENSITY_UNITS.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<LinearMassDensityUnit>(x)).ToObservableCollection(); + + FiberShapes = Context.FIBER_SHAPES.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<FiberShape>(x)).ToObservableCollection(); + + FiberSynths = Context.FIBER_SYNTHS.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<FiberSynth>(x)).ToObservableCollection(); + + Rmls = Context.RMLS.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Rml>(x)).ToObservableCollection(); + InitCollectionSources(); } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs index adf1cc8d2..6c681437f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs @@ -24,6 +24,7 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public string NAME { get; set; } public string MANUFACTURER { get; set; } public string MATERIAL_GUID { get; set; } public string COLOR_GUID { 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 030b534a8..4cc5f3b22 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -408,6 +408,7 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> <Property Name="MANUFACTURER" Type="nvarchar" MaxLength="50" Nullable="false" /> <Property Name="MATERIAL_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="COLOR_GUID" Type="varchar" MaxLength="36" Nullable="false" /> @@ -1887,6 +1888,7 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <Property Name="MANUFACTURER" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <Property Name="MATERIAL_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="COLOR_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> @@ -2950,6 +2952,7 @@ <ScalarProperty Name="COLOR_GUID" ColumnName="COLOR_GUID" /> <ScalarProperty Name="MATERIAL_GUID" ColumnName="MATERIAL_GUID" /> <ScalarProperty Name="MANUFACTURER" ColumnName="MANUFACTURER" /> + <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> 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 ff3da16b4..4448347e9 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,45 +5,45 @@ <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1"> - <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="15.5" PointY="20.375" /> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="3" PointY="15.125" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="20" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="16.875" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="10.625" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="0.75" PointY="6.375" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="0.75" PointY="29.5" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE" Width="1.5" PointX="3" PointY="29.5" /> - <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="4.75" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="3" PointY="19.375" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="0.75" PointY="32.875" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="3" PointY="32.75" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="26.25" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="13.75" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="7.5" PointY="12.375" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="17.75" PointY="12.375" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="11.75" PointY="23.5" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="11.75" PointY="14.375" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="23.125" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="5.25" PointY="5.75" /> - <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="11.75" PointY="26.625" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="16.25" PointY="3.375" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="5.25" PointY="10.375" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="7.5" PointY="7" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="9.75" PointY="6.5" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="9.75" PointY="10.25" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="11.75" PointY="20.625" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="11.75" PointY="29.75" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="11.75" PointY="17.5" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="11.75" PointY="4.125" /> - <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="5.25" PointY="17.375" /> - <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="12.5" PointY="33.375" /> - <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="14" PointY="1.875" /> - <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="12.5" PointY="10.375" /> - <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="14.75" PointY="10.375" /> - <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="5.75" PointY="1.5" /> - <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="7.5" PointY="15.875" /> - <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="14.75" PointY="16.375" /> + <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="12.5" PointY="40.75" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="3" PointY="23" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="26" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="22.875" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="29" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="0.75" PointY="13.5" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="0.75" PointY="6" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE" Width="1.5" PointX="3" PointY="3.625" /> + <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="7.5" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="3" PointY="19" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="0.75" PointY="32.625" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="3" PointY="32.625" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="16.625" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="9.125" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="7.5" PointY="19.625" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="14.75" PointY="19.75" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="11.75" PointY="27.25" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="11.75" PointY="24.125" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="19.75" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="5.25" PointY="8.625" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="11.75" PointY="30.375" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="14.875" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="16.25" PointY="10" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="5.25" PointY="13.25" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="7.5" PointY="9.875" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="9.75" PointY="9.375" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="9.75" PointY="13.125" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="11.75" PointY="18.125" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="11.75" PointY="33.5" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="11.75" PointY="7" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="11.75" PointY="21" /> + <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="5.25" PointY="21.25" /> + <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="10.5" PointY="37.375" /> + <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="14" PointY="4.75" /> + <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="10.5" PointY="2.625" /> + <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="12.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="5.75" PointY="4.25" /> + <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="7.5" PointY="15.125" /> + <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="12.75" PointY="14.75" /> <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.Integration/Services/ExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs index 47e30f46f..1ecbf4c22 100644 --- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs +++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs @@ -53,9 +53,9 @@ namespace Tango.Integration.Services await base.Connect(); } - public async Task<bool> Authenticate() + public async Task<bool> Authenticate(String password) { - var response = await SendRequest<ExternalClientLoginRequest, ExternalClientLoginResponse>(new ExternalClientLoginRequest() { Key = "1234" }); + var response = await SendRequest<ExternalClientLoginRequest, ExternalClientLoginResponse>(new ExternalClientLoginRequest() { Password = password }); return response.Message.Authenticated; } diff --git a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs index 6eb0ac5f9..c5cb1d378 100644 --- a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs +++ b/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs @@ -17,6 +17,6 @@ namespace Tango.Integration.Services String IPAddress { get; set; } - Task<bool> Authenticate(); + Task<bool> Authenticate(String password); } } diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index 07079271b..d5be47c1c 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static MessageTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirWBwoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirWCAoLTWVz", "c2FnZVR5cGUSBwoDUkdCEAASBwoDSm9iEAESCwoHU2VnbWVudBACEhQKEENh", "bGN1bGF0ZVJlcXVlc3QQAxIVChFDYWxjdWxhdGVSZXNwb25zZRAEEhMKD1By", "b2dyZXNzUmVxdWVzdBAFEhQKEFByb2dyZXNzUmVzcG9uc2UQBhIcChhTdHVi", @@ -44,8 +44,11 @@ namespace Tango.PMR.Common { "ZXBlck1vdG9yUmVzcG9uc2UQHhIUChBTdHViVmFsdmVSZXF1ZXN0EB8SFQoR", "U3R1YlZhbHZlUmVzcG9uc2UQIBIkCiBFeHRlcm5hbEJyaWRnZVVkcERpc2Nv", "dmVyeVBhY2tldBAhEh4KGkV4dGVybmFsQ2xpZW50TG9naW5SZXF1ZXN0ECIS", - "HwobRXh0ZXJuYWxDbGllbnRMb2dpblJlc3BvbnNlECNCHAoaY29tLnR3aW5l", - "LnRhbmdvLnBtci5jb21tb25iBnByb3RvMw==")); + "HwobRXh0ZXJuYWxDbGllbnRMb2dpblJlc3BvbnNlECMSIAocRGlyZWN0U3lu", + "Y2hyb25pemF0aW9uUmVxdWVzdBAkEiEKHURpcmVjdFN5bmNocm9uaXphdGlv", + "blJlc3BvbnNlECUSGwoXT3ZlcnJpZGVEYXRhQmFzZVJlcXVlc3QQJhIcChhP", + "dmVycmlkZURhdGFCYXNlUmVzcG9uc2UQJ0IcChpjb20udHdpbmUudGFuZ28u", + "cG1yLmNvbW1vbmIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -91,6 +94,10 @@ namespace Tango.PMR.Common { [pbr::OriginalName("ExternalBridgeUdpDiscoveryPacket")] ExternalBridgeUdpDiscoveryPacket = 33, [pbr::OriginalName("ExternalClientLoginRequest")] ExternalClientLoginRequest = 34, [pbr::OriginalName("ExternalClientLoginResponse")] ExternalClientLoginResponse = 35, + [pbr::OriginalName("DirectSynchronizationRequest")] DirectSynchronizationRequest = 36, + [pbr::OriginalName("DirectSynchronizationResponse")] DirectSynchronizationResponse = 37, + [pbr::OriginalName("OverrideDataBaseRequest")] OverrideDataBaseRequest = 38, + [pbr::OriginalName("OverrideDataBaseResponse")] OverrideDataBaseResponse = 39, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Integration/DirectSynchronizationRequest.cs b/Software/Visual_Studio/Tango.PMR/Integration/DirectSynchronizationRequest.cs new file mode 100644 index 000000000..ef2ae14c0 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/DirectSynchronizationRequest.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DirectSynchronizationRequest.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.Integration { + + /// <summary>Holder for reflection information generated from DirectSynchronizationRequest.proto</summary> + public static partial class DirectSynchronizationRequestReflection { + + #region Descriptor + /// <summary>File descriptor for DirectSynchronizationRequest.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DirectSynchronizationRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiJEaXJlY3RTeW5jaHJvbml6YXRpb25SZXF1ZXN0LnByb3RvEhVUYW5nby5Q", + "TVIuSW50ZWdyYXRpb24iHgocRGlyZWN0U3luY2hyb25pemF0aW9uUmVxdWVz", + "dEIhCh9jb20udHdpbmUudGFuZ28ucG1yLmludGVncmF0aW9uYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.DirectSynchronizationRequest), global::Tango.PMR.Integration.DirectSynchronizationRequest.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DirectSynchronizationRequest : pb::IMessage<DirectSynchronizationRequest> { + private static readonly pb::MessageParser<DirectSynchronizationRequest> _parser = new pb::MessageParser<DirectSynchronizationRequest>(() => new DirectSynchronizationRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<DirectSynchronizationRequest> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.DirectSynchronizationRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DirectSynchronizationRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DirectSynchronizationRequest(DirectSynchronizationRequest other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DirectSynchronizationRequest Clone() { + return new DirectSynchronizationRequest(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DirectSynchronizationRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DirectSynchronizationRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + 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) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DirectSynchronizationRequest other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/DirectSynchronizationResponse.cs b/Software/Visual_Studio/Tango.PMR/Integration/DirectSynchronizationResponse.cs new file mode 100644 index 000000000..c881eb5a2 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/DirectSynchronizationResponse.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DirectSynchronizationResponse.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.Integration { + + /// <summary>Holder for reflection information generated from DirectSynchronizationResponse.proto</summary> + public static partial class DirectSynchronizationResponseReflection { + + #region Descriptor + /// <summary>File descriptor for DirectSynchronizationResponse.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DirectSynchronizationResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiNEaXJlY3RTeW5jaHJvbml6YXRpb25SZXNwb25zZS5wcm90bxIVVGFuZ28u", + "UE1SLkludGVncmF0aW9uIjAKHURpcmVjdFN5bmNocm9uaXphdGlvblJlc3Bv", + "bnNlEg8KB0xvY2FsREIYASABKAxCIQofY29tLnR3aW5lLnRhbmdvLnBtci5p", + "bnRlZ3JhdGlvbmIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.DirectSynchronizationResponse), global::Tango.PMR.Integration.DirectSynchronizationResponse.Parser, new[]{ "LocalDB" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DirectSynchronizationResponse : pb::IMessage<DirectSynchronizationResponse> { + private static readonly pb::MessageParser<DirectSynchronizationResponse> _parser = new pb::MessageParser<DirectSynchronizationResponse>(() => new DirectSynchronizationResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<DirectSynchronizationResponse> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.DirectSynchronizationResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DirectSynchronizationResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DirectSynchronizationResponse(DirectSynchronizationResponse other) : this() { + localDB_ = other.localDB_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DirectSynchronizationResponse Clone() { + return new DirectSynchronizationResponse(this); + } + + /// <summary>Field number for the "LocalDB" field.</summary> + public const int LocalDBFieldNumber = 1; + private pb::ByteString localDB_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString LocalDB { + get { return localDB_; } + set { + localDB_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DirectSynchronizationResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DirectSynchronizationResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LocalDB != other.LocalDB) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (LocalDB.Length != 0) hash ^= LocalDB.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 (LocalDB.Length != 0) { + output.WriteRawTag(10); + output.WriteBytes(LocalDB); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (LocalDB.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(LocalDB); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DirectSynchronizationResponse other) { + if (other == null) { + return; + } + if (other.LocalDB.Length != 0) { + LocalDB = other.LocalDB; + } + } + + [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: { + LocalDB = input.ReadBytes(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs index 2b614b2ed..a3a1295d5 100644 --- a/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs @@ -23,13 +23,13 @@ namespace Tango.PMR.Integration { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiBFeHRlcm5hbENsaWVudExvZ2luUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1S", - "LkludGVncmF0aW9uIikKGkV4dGVybmFsQ2xpZW50TG9naW5SZXF1ZXN0EgsK", - "A2tleRgBIAEoCUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmludGVncmF0aW9u", - "YgZwcm90bzM=")); + "LkludGVncmF0aW9uIi4KGkV4dGVybmFsQ2xpZW50TG9naW5SZXF1ZXN0EhAK", + "CFBhc3N3b3JkGAEgASgJQiEKH2NvbS50d2luZS50YW5nby5wbXIuaW50ZWdy", + "YXRpb25iBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalClientLoginRequest), global::Tango.PMR.Integration.ExternalClientLoginRequest.Parser, new[]{ "Key" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalClientLoginRequest), global::Tango.PMR.Integration.ExternalClientLoginRequest.Parser, new[]{ "Password" }, null, null, null) })); } #endregion @@ -60,7 +60,7 @@ namespace Tango.PMR.Integration { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ExternalClientLoginRequest(ExternalClientLoginRequest other) : this() { - key_ = other.key_; + password_ = other.password_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -68,14 +68,14 @@ namespace Tango.PMR.Integration { return new ExternalClientLoginRequest(this); } - /// <summary>Field number for the "key" field.</summary> - public const int KeyFieldNumber = 1; - private string key_ = ""; + /// <summary>Field number for the "Password" field.</summary> + public const int PasswordFieldNumber = 1; + private string password_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } + public string Password { + get { return password_; } set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + password_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -92,14 +92,14 @@ namespace Tango.PMR.Integration { if (ReferenceEquals(other, this)) { return true; } - if (Key != other.Key) return false; + if (Password != other.Password) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (Password.Length != 0) hash ^= Password.GetHashCode(); return hash; } @@ -110,17 +110,17 @@ namespace Tango.PMR.Integration { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Key.Length != 0) { + if (Password.Length != 0) { output.WriteRawTag(10); - output.WriteString(Key); + output.WriteString(Password); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + if (Password.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Password); } return size; } @@ -130,8 +130,8 @@ namespace Tango.PMR.Integration { if (other == null) { return; } - if (other.Key.Length != 0) { - Key = other.Key; + if (other.Password.Length != 0) { + Password = other.Password; } } @@ -144,7 +144,7 @@ namespace Tango.PMR.Integration { input.SkipLastField(); break; case 10: { - Key = input.ReadString(); + Password = input.ReadString(); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Integration/OverrideDataBaseRequest.cs b/Software/Visual_Studio/Tango.PMR/Integration/OverrideDataBaseRequest.cs new file mode 100644 index 000000000..05223ca90 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/OverrideDataBaseRequest.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: OverrideDataBaseRequest.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.Integration { + + /// <summary>Holder for reflection information generated from OverrideDataBaseRequest.proto</summary> + public static partial class OverrideDataBaseRequestReflection { + + #region Descriptor + /// <summary>File descriptor for OverrideDataBaseRequest.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static OverrideDataBaseRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch1PdmVycmlkZURhdGFCYXNlUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1SLklu", + "dGVncmF0aW9uIisKF092ZXJyaWRlRGF0YUJhc2VSZXF1ZXN0EhAKCFJlbW90", + "ZURCGAEgASgMQiEKH2NvbS50d2luZS50YW5nby5wbXIuaW50ZWdyYXRpb25i", + "BnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.OverrideDataBaseRequest), global::Tango.PMR.Integration.OverrideDataBaseRequest.Parser, new[]{ "RemoteDB" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class OverrideDataBaseRequest : pb::IMessage<OverrideDataBaseRequest> { + private static readonly pb::MessageParser<OverrideDataBaseRequest> _parser = new pb::MessageParser<OverrideDataBaseRequest>(() => new OverrideDataBaseRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<OverrideDataBaseRequest> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.OverrideDataBaseRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OverrideDataBaseRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OverrideDataBaseRequest(OverrideDataBaseRequest other) : this() { + remoteDB_ = other.remoteDB_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OverrideDataBaseRequest Clone() { + return new OverrideDataBaseRequest(this); + } + + /// <summary>Field number for the "RemoteDB" field.</summary> + public const int RemoteDBFieldNumber = 1; + private pb::ByteString remoteDB_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString RemoteDB { + get { return remoteDB_; } + set { + remoteDB_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as OverrideDataBaseRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(OverrideDataBaseRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (RemoteDB != other.RemoteDB) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (RemoteDB.Length != 0) hash ^= RemoteDB.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 (RemoteDB.Length != 0) { + output.WriteRawTag(10); + output.WriteBytes(RemoteDB); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (RemoteDB.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(RemoteDB); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(OverrideDataBaseRequest other) { + if (other == null) { + return; + } + if (other.RemoteDB.Length != 0) { + RemoteDB = other.RemoteDB; + } + } + + [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: { + RemoteDB = input.ReadBytes(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/OverrideDataBaseResponse.cs b/Software/Visual_Studio/Tango.PMR/Integration/OverrideDataBaseResponse.cs new file mode 100644 index 000000000..38f253bcd --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/OverrideDataBaseResponse.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: OverrideDataBaseResponse.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.Integration { + + /// <summary>Holder for reflection information generated from OverrideDataBaseResponse.proto</summary> + public static partial class OverrideDataBaseResponseReflection { + + #region Descriptor + /// <summary>File descriptor for OverrideDataBaseResponse.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static OverrideDataBaseResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch5PdmVycmlkZURhdGFCYXNlUmVzcG9uc2UucHJvdG8SFVRhbmdvLlBNUi5J", + "bnRlZ3JhdGlvbiIuChhPdmVycmlkZURhdGFCYXNlUmVzcG9uc2USEgoKU3Vj", + "Y2Vzc2Z1bBgBIAEoCEIhCh9jb20udHdpbmUudGFuZ28ucG1yLmludGVncmF0", + "aW9uYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.OverrideDataBaseResponse), global::Tango.PMR.Integration.OverrideDataBaseResponse.Parser, new[]{ "Successful" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class OverrideDataBaseResponse : pb::IMessage<OverrideDataBaseResponse> { + private static readonly pb::MessageParser<OverrideDataBaseResponse> _parser = new pb::MessageParser<OverrideDataBaseResponse>(() => new OverrideDataBaseResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<OverrideDataBaseResponse> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.OverrideDataBaseResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OverrideDataBaseResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OverrideDataBaseResponse(OverrideDataBaseResponse other) : this() { + successful_ = other.successful_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OverrideDataBaseResponse Clone() { + return new OverrideDataBaseResponse(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 OverrideDataBaseResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(OverrideDataBaseResponse 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(OverrideDataBaseResponse 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/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index a720373ae..7226685ea 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -48,9 +48,13 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="ExtensionMethods.cs" /> + <Compile Include="Integration\DirectSynchronizationRequest.cs" /> + <Compile Include="Integration\DirectSynchronizationResponse.cs" /> <Compile Include="Integration\ExternalBridgeUdpDiscoveryPacket.cs" /> <Compile Include="Integration\ExternalClientLoginRequest.cs" /> <Compile Include="Integration\ExternalClientLoginResponse.cs" /> + <Compile Include="Integration\OverrideDataBaseRequest.cs" /> + <Compile Include="Integration\OverrideDataBaseResponse.cs" /> <Compile Include="MessageFactory.cs" /> <Compile Include="NativePMR.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> diff --git a/Software/Visual_Studio/Tango.Scripting/FodyWeavers.xml b/Software/Visual_Studio/Tango.Scripting/FodyWeavers.xml new file mode 100644 index 000000000..c6e1b7c8a --- /dev/null +++ b/Software/Visual_Studio/Tango.Scripting/FodyWeavers.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Weavers> + <Costura /> +</Weavers>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Scripting/Tango.Scripting.csproj b/Software/Visual_Studio/Tango.Scripting/Tango.Scripting.csproj index 091ef5881..bf84d21ab 100644 --- a/Software/Visual_Studio/Tango.Scripting/Tango.Scripting.csproj +++ b/Software/Visual_Studio/Tango.Scripting/Tango.Scripting.csproj @@ -12,6 +12,8 @@ <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -31,6 +33,10 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="Costura, Version=1.6.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL"> + <HintPath>..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll</HintPath> + <Private>False</Private> + </Reference> <Reference Include="Microsoft.CodeAnalysis, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.CodeAnalysis.Common.2.4.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll</HintPath> </Reference> @@ -50,6 +56,7 @@ </Reference> <Reference Include="System.Collections.Immutable, Version=1.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Collections.Immutable.1.4.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath> + <Private>True</Private> </Reference> <Reference Include="System.ComponentModel.Composition" /> <Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> @@ -82,20 +89,25 @@ </Reference> <Reference Include="System.Security.Cryptography.Algorithms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net46\System.Security.Cryptography.Algorithms.dll</HintPath> + <Private>False</Private> </Reference> <Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath> <SpecificVersion>False</SpecificVersion> + <Private>False</Private> </Reference> <Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath> <SpecificVersion>False</SpecificVersion> + <Private>False</Private> </Reference> <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net46\System.Security.Cryptography.X509Certificates.dll</HintPath> + <Private>False</Private> </Reference> <Reference Include="System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Text.Encoding.CodePages.4.4.0\lib\net46\System.Text.Encoding.CodePages.dll</HintPath> + <Private>False</Private> </Reference> <Reference Include="System.Threading.Thread, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll</HintPath> @@ -140,5 +152,17 @@ <Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" /> <Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" /> </ItemGroup> + <ItemGroup> + <None Include="FodyWeavers.xml" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="..\packages\Fody.2.0.0\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.2.0.0\build\dotnet\Fody.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\packages\Fody.2.0.0\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.0.0\build\dotnet\Fody.targets'))" /> + <Error Condition="!Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets'))" /> + </Target> + <Import Project="..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Scripting/packages.config b/Software/Visual_Studio/Tango.Scripting/packages.config index 20a9927d5..4c8f7c311 100644 --- a/Software/Visual_Studio/Tango.Scripting/packages.config +++ b/Software/Visual_Studio/Tango.Scripting/packages.config @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> + <package id="Costura.Fody" version="1.6.2" targetFramework="net46" developmentDependency="true" /> + <package id="Fody" version="2.0.0" targetFramework="net46" developmentDependency="true" /> <package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="net46" /> <package id="Microsoft.CodeAnalysis.Common" version="2.4.0" targetFramework="net46" /> <package id="Microsoft.CodeAnalysis.CSharp" version="2.4.0" targetFramework="net46" /> diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs index 723d85c5d..5265107df 100644 --- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs +++ b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs @@ -17,9 +17,12 @@ namespace Tango.Settings.MachineStudioSettings public SynchronizationModule SynchronizationModule { get; set; } + public StubsModule StubsModule { get; set; } + public MachineStudio() { SynchronizationModule = new SynchronizationModule(); + StubsModule = new StubsModule(); } } } diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/StubsModule.cs b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/StubsModule.cs new file mode 100644 index 000000000..89a60f63c --- /dev/null +++ b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/StubsModule.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Settings.MachineStudioSettings +{ + public class StubsModule + { + public String SelectedPort { get; set; } + + public List<String> LastTabs { get; set; } + + public StubsModule() + { + LastTabs = new List<string>(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj index edd0b1c25..3ea1082d8 100644 --- a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj +++ b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj @@ -46,6 +46,7 @@ <Compile Include="DataBase.cs" /> <Compile Include="Integration.cs" /> <Compile Include="MachineStudioSettings\MachineStudio.cs" /> + <Compile Include="MachineStudioSettings\StubsModule.cs" /> <Compile Include="MachineStudioSettings\SynchronizationModule.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SettingsCollection.cs" /> diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/BooleanToYesNoConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/BooleanToYesNoConverter.cs new file mode 100644 index 000000000..d7db1d17d --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/BooleanToYesNoConverter.cs @@ -0,0 +1,23 @@ +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.SharedUI.Converters +{ + public class BooleanToYesNoConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (bool)value ? "Yes" : "No"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index 3d8bc2701..7fd3f149c 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -82,6 +82,7 @@ <Compile Include="Converters\BooleanInverseConverter.cs" /> <Compile Include="Converters\BooleanToVisibilityConverter.cs" /> <Compile Include="Converters\BooleanToVisibilityInverseConverter.cs" /> + <Compile Include="Converters\BooleanToYesNoConverter.cs" /> <Compile Include="Converters\ColorToIntegerConverter.cs" /> <Compile Include="Converters\DoubleToIntConverter.cs" /> <Compile Include="Converters\EnumToDescriptionConverter.cs" /> diff --git a/Software/Visual_Studio/Tango.Stubs/Stubs/Calculate.cs b/Software/Visual_Studio/Tango.Stubs/Stubs/Calculate.cs index 6afedde96..b0cfc6e08 100644 --- a/Software/Visual_Studio/Tango.Stubs/Stubs/Calculate.cs +++ b/Software/Visual_Studio/Tango.Stubs/Stubs/Calculate.cs @@ -26,15 +26,22 @@ namespace Tango.Stubs.Stubs protected async override Task<string> OnRun(Action<String> multiResponseCallback) { - var response = await Transporter.SendRequest<CalculateRequest, CalculateResponse>( - new CalculateRequest() - { - A = NumberA, - B = NumberB - } - ); + try + { + var response = await Transporter.SendRequest<CalculateRequest, CalculateResponse>( + new CalculateRequest() + { + A = NumberA, + B = NumberB + } + ); - return response.Message.Sum.ToString(); + return response.Message.Sum.ToString(); + } + catch (Exception ex) + { + return ex.Message; + } } } } diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs index 97757deac..1e897f85a 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs @@ -40,6 +40,7 @@ namespace Tango.Transport.Adapters /// </summary> public TcpTransportAdapter() { + AdapterMode = TransportAdapterMode.PREPEND_HEADER; Address = "127.0.0.1"; Port = 9999; } @@ -63,6 +64,7 @@ namespace Tango.Transport.Adapters { _initializedFromConstructor = true; _socket = socket; + SetSocketProperties(); } #endregion @@ -86,6 +88,7 @@ namespace Tango.Transport.Adapters if (!_initializedFromConstructor) { _socket = new TcpClient(Address, Port); + SetSocketProperties(); } State = TransportComponentState.Connected; @@ -137,6 +140,7 @@ namespace Tango.Transport.Adapters try { + data = PostProcessBuffer(data); _socket.GetStream().Write(data, 0, data.Length); } catch (Exception ex) @@ -157,11 +161,38 @@ namespace Tango.Transport.Adapters { while (State == TransportComponentState.Connected) { - if (_socket.Available > 0) + if (AdapterMode == TransportAdapterMode.NO_HEADER) { - byte[] data = new byte[_socket.Available]; - _socket.GetStream().Read(data, 0, data.Length); - OnDataAvailable(data); + if (_socket.Available > 0) + { + byte[] data = new byte[_socket.Available]; + _socket.GetStream().Read(data, 0, data.Length); + OnDataAvailable(data); + } + } + else + { + if (_socket.Available > 4) + { + byte[] size = new byte[4]; + _socket.GetStream().Read(size, 0, size.Length); + int expectedSize = BitConverter.ToInt32(size, 0); + + byte[] data = new byte[expectedSize]; + + while (_socket.Available < expectedSize) + { + Thread.Sleep(10); + + if (State != TransportComponentState.Connected) + { + break; + } + } + + _socket.GetStream().Read(data, 0, data.Length); + OnDataAvailable(data); + } } Thread.Sleep(10); @@ -191,7 +222,17 @@ namespace Tango.Transport.Adapters { OnFailed(ex); } - } + } + + #endregion + + #region Private Methods + + private void SetSocketProperties() + { + _socket.SendBufferSize = MAX_BUFFER_SIZE; + _socket.ReceiveBufferSize = MAX_BUFFER_SIZE; + } #endregion } diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs index 665f2d779..a97f55ee6 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs @@ -58,6 +58,8 @@ namespace Tango.Transport.Adapters _serialPort = new SerialPort(); _serialPort.DataReceived += OnSerialPortDataReceived; _serialPort.PortName = Address; + _serialPort.ReadBufferSize = MAX_BUFFER_SIZE; + _serialPort.WriteBufferSize = MAX_BUFFER_SIZE; _serialPort.Open(); _serialPort.DiscardInBuffer(); _serialPort.DiscardOutBuffer(); @@ -118,6 +120,7 @@ namespace Tango.Transport.Adapters try { + data = PostProcessBuffer(data); _serialPort.Write(data, 0, data.Length); } catch (Exception ex) @@ -137,9 +140,37 @@ namespace Tango.Transport.Adapters { if (e.EventType == SerialData.Eof) return; Thread.Sleep(10); - byte[] data = new byte[_serialPort.BytesToRead]; - _serialPort.Read(data, 0, data.Length); - OnDataAvailable(data); + + if (AdapterMode == TransportAdapterMode.NO_HEADER) + { + byte[] data = new byte[_serialPort.BytesToRead]; + _serialPort.Read(data, 0, data.Length); + OnDataAvailable(data); + } + else + { + if (_serialPort.BytesToRead > 4) + { + byte[] size = new byte[4]; + _serialPort.Read(size, 0, size.Length); + int expectedSize = BitConverter.ToInt32(size, 0); + + byte[] data = new byte[expectedSize]; + + while (_serialPort.BytesToRead < expectedSize) + { + Thread.Sleep(10); + + if (State != TransportComponentState.Connected) + { + break; + } + } + + _serialPort.Read(data, 0, data.Length); + OnDataAvailable(data); + } + } } catch (Exception ex) { diff --git a/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs index b0e055cde..5ab48e503 100644 --- a/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs @@ -29,5 +29,10 @@ namespace Tango.Transport /// Gets or sets the channel address. /// </summary> String Address { get; set; } + + /// <summary> + /// Gets or sets the adapter reading/writing mode. + /// </summary> + TransportAdapterMode AdapterMode { get; set; } } } diff --git a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj index 7b0b1a121..8aea62da8 100644 --- a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj +++ b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj @@ -77,6 +77,7 @@ <Compile Include="Servers\ClientConnectedEventArgs.cs" /> <Compile Include="Servers\TcpServer.cs" /> <Compile Include="TransportAdapterBase.cs" /> + <Compile Include="TransportAdapterMode.cs" /> <Compile Include="TransportComponentState.cs" /> <Compile Include="TransporterBase.cs" /> <Compile Include="Transporters\JsonTransporter.cs" /> diff --git a/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs b/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs index 670ef20c3..04ecdc394 100644 --- a/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs @@ -13,6 +13,8 @@ namespace Tango.Transport /// <seealso cref="Tango.Transport.ITransportAdapter" /> public abstract class TransportAdapterBase : ITransportAdapter { + protected const int MAX_BUFFER_SIZE = 1024 * 1024 * 10; //10 MB. + #region Events /// <summary> @@ -48,6 +50,11 @@ namespace Tango.Transport } } + /// <summary> + /// Gets or sets the adapter reading/writing mode. + /// </summary> + public TransportAdapterMode AdapterMode { get; set; } + #endregion #region Virtual Methods @@ -92,6 +99,23 @@ namespace Tango.Transport } } + /// <summary> + /// Applies any additional headers if required. + /// </summary> + /// <param name="data">The data.</param> + /// <returns></returns> + protected virtual byte[] PostProcessBuffer(byte[] data) + { + if (AdapterMode == TransportAdapterMode.NO_HEADER) + { + return data; + } + else + { + return BitConverter.GetBytes(data.Length).Concat(data).ToArray(); + } + } + #endregion #region Dispose diff --git a/Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs b/Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs new file mode 100644 index 000000000..e89eba38d --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport +{ + /// <summary> + /// Represents an <see cref="ITransportAdapter"/> read/write mode. + /// </summary> + public enum TransportAdapterMode + { + /// <summary> + /// Pure protobuf message with no message size. + /// </summary> + NO_HEADER, + /// <summary> + /// Prepends and truncates the message size before writing and reading. + /// </summary> + PREPEND_HEADER + } +} diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index cf7c79864..b6f8ac529 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -300,7 +300,7 @@ namespace Tango.Transport { if (!source.Task.IsCompleted) { - LogManager.Log("Request message: " + typeof(Response).Name + " had timed out after " + RequestTimeout.TotalSeconds + " seconds."); + LogManager.Log("Request message: " + typeof(Request).Name + " had timed out after " + RequestTimeout.TotalSeconds + " seconds."); LogManager.Log("Setting request task exception..."); source.SetException(new TimeoutException()); } diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 2360fb7f5..7335dcce7 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -103,6 +103,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.AutoComplete", "SideC EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.Integration", "Tango.Integration\Tango.Integration.csproj", "{4206AC58-3B57-4699-8835-90BF6DB01A61}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.MachineStudio.Stubs", "MachineStudio\Modules\Tango.MachineStudio.Stubs\Tango.MachineStudio.Stubs.csproj", "{22C2AA72-9493-4D0D-B421-8EF9789FB192}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -881,6 +883,26 @@ Global {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|x64.Build.0 = Release|Any CPU {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|x86.ActiveCfg = Release|Any CPU {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|x86.Build.0 = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|ARM.ActiveCfg = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|ARM.Build.0 = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|ARM64.Build.0 = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|x64.ActiveCfg = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|x64.Build.0 = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|x86.ActiveCfg = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Debug|x86.Build.0 = Debug|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|Any CPU.ActiveCfg = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|Any CPU.Build.0 = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|ARM.ActiveCfg = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|ARM.Build.0 = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|ARM64.ActiveCfg = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|ARM64.Build.0 = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|x64.ActiveCfg = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|x64.Build.0 = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|x86.ActiveCfg = Release|Any CPU + {22C2AA72-9493-4D0D-B421-8EF9789FB192}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -907,5 +929,6 @@ Global {12D0C43C-391F-4C74-92AB-82E9A9BEEB9B} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} {625B2A26-97A9-45C9-8BCF-6BD30F593E17} = {4443B71C-216E-4D4C-8D19-868F50803813} {BB2ABB74-BA58-4812-83AA-EC8171F42DF4} = {EC62BC9C-F2FE-4333-B7E4-110E38D43958} + {22C2AA72-9493-4D0D-B421-8EF9789FB192} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} EndGlobalSection EndGlobal diff --git a/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db b/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db Binary files differindex 0419b065c..f7af9b52f 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db +++ b/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs index 8540863c0..8b5bee7ae 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/SynchronizationController.cs @@ -37,7 +37,7 @@ namespace Tango.MachineService.Controllers File.Copy(HostingEnvironment.MapPath(@"~/App_Data/Tango.db"), masterSQLiteFile); //Synchronize the SQL Server db with the new SQLite template. (Overwrite basically) - RemoteDBSynchronizer.Synchronize(masterSQLiteFile, request.SerialNumber); + RemoteDBSynchronizer.Synchronize(masterSQLiteFile, request.SerialNumber, true); //Synchronize the received machine db with the filled template. LocalDBSynchronizer.Synchronize(masterSQLiteFile, slaveSQLiteFile); |
