diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-06 18:01:50 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-06 18:01:50 +0300 |
| commit | d967b4b37644ab6aedac36539f8f6fa5cf3547f2 (patch) | |
| tree | 68433d120d479480c6f50f21d4dcf9d21a21bdfe | |
| parent | 12d7bb4a0323fa4b037a93036cc32f1e2e7cb591 (diff) | |
| download | Tango-d967b4b37644ab6aedac36539f8f6fa5cf3547f2.tar.gz Tango-d967b4b37644ab6aedac36539f8f6fa5cf3547f2.zip | |
Working on TCC..
53 files changed, 1864 insertions, 212 deletions
diff --git a/Software/Android_Studio/ColorCapture/app/build.gradle b/Software/Android_Studio/ColorCapture/app/build.gradle index ae4fcfeb1..00eadc9a6 100644 --- a/Software/Android_Studio/ColorCapture/app/build.gradle +++ b/Software/Android_Studio/ColorCapture/app/build.gradle @@ -23,7 +23,7 @@ android { buildTypes { debug { - buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://10.100.102.46:45455/api/\"" + buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://192.168.1.229:45455/api/\"" buildConfigField "String", "WEB_SERVICE_APP_ID", "\"Tdf793i4ughsiduf8749509237885ehgfdlkghlT\"" } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java index f83826b21..6b99d7ead 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java @@ -51,7 +51,7 @@ public class ViewModelsModule @Singleton public SendToEmailActivityVM provideSendToEmailActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService) { - return new SendToEmailActivityVM(); + return new SendToEmailActivityVM(eventBus, navigationProvider, notificationProvider, tccService); } @Provides diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityBase.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityBase.java index 7863cac80..4c952bbd6 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityBase.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityBase.java @@ -14,6 +14,7 @@ import android.widget.Toast; import com.mobsandgeeks.saripaar.ValidationError; import com.mobsandgeeks.saripaar.Validator; import com.twine.colorcapture.R; +import com.twine.colorcapture.core.IAction1; import java.lang.reflect.Method; import java.util.List; @@ -23,33 +24,36 @@ import javax.inject.Inject; import butterknife.ButterKnife; import io.reactivex.functions.Consumer; +import static com.twine.colorcapture.App.getContext; + /** * Represents a base activity with extra features. * * @param <BindingView> the type parameter * @param <VM> the type parameter */ -public abstract class ActivityBase<BindingView extends ViewDataBinding, VM extends ViewModelBase> extends Activity implements IView, Validator.ValidationListener { - +public abstract class ActivityBase<BindingView extends ViewDataBinding, VM extends ViewModelBase> extends Activity implements IView, Validator.ValidationListener +{ + /** * The constant ACTIVITY_CALLBACK_INTENT. */ protected static final String ACTIVITY_CALLBACK_INTENT = "ACTIVITY_CALLBACK_INTENT"; - + private Consumer<Boolean> lastValidationConsumer; private Validator validator; - + /** * Holds the standard View Model instance. */ @Inject public VM vm; - + /** * Holds the activity data binding instance. */ public BindingView binding; - + @Override protected void onCreate(Bundle savedInstanceState) { @@ -57,105 +61,122 @@ public abstract class ActivityBase<BindingView extends ViewDataBinding, VM exten window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryBackground)); - overridePendingTransition(R.anim.zoom_in,R.anim.zoom_out); + overridePendingTransition(R.anim.zoom_in, R.anim.zoom_out); super.onCreate(savedInstanceState); - + inject(); binding = DataBindingUtil.setContentView(this, getLayoutId()); - try { - + try + { + Method method = binding.getClass().getDeclaredMethod("setVm", vm.getClass()); method.invoke(binding, vm); - + ButterKnife.bind(this, binding.getRoot()); - + validator = new Validator(this); validator.setValidationListener(this); - + String key = getIntent().getStringExtra(ACTIVITY_CALLBACK_INTENT); - if (key != null && !key.isEmpty()) { - ActivityCallbackService.getInstance().runAndRemove(key); + if (key != null && !key.isEmpty()) + { + ActivityCallbackService.getInstance().runAndRemove(key, vm); } onCreating(savedInstanceState); attachView(); - - } catch (Exception e) { + + } + catch (Exception e) + { e.printStackTrace(); } } protected abstract void onCreating(Bundle savedInstanceState); - + @SuppressWarnings("unchecked") @Override - public void attachView() { + public void attachView() + { vm.attachView(this); } - + @Override - public void validateFields(Consumer<Boolean> consumer) { + public void validateFields(Consumer<Boolean> consumer) + { lastValidationConsumer = consumer; validator.validate(); } - + @Override - public void onValidationSucceeded() { - try { + public void onValidationSucceeded() + { + try + { lastValidationConsumer.accept(true); - } catch (Exception e) { + } + catch (Exception e) + { e.printStackTrace(); } } - + @Override - public void onValidationFailed(List<ValidationError> errors) { - for (ValidationError error : errors) { + public void onValidationFailed(List<ValidationError> errors) + { + for (ValidationError error : errors) + { View view = error.getView(); String message = error.getCollatedErrorMessage(this); - - if (view instanceof EditText) { + + if (view instanceof EditText) + { view.requestFocus(); ((EditText) view).setError(message); - } else { + } + else + { Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); } } - - if (lastValidationConsumer != null) { - try { + + if (lastValidationConsumer != null) + { + try + { lastValidationConsumer.accept(false); - } catch (Exception e) { + } + catch (Exception e) + { e.printStackTrace(); } } } - + /** * Gets the activity layout resource id. * * @return the layout id */ protected abstract int getLayoutId(); - + /** * Performs dagger dependency injection. */ protected abstract void inject(); - + /** * Starts an activity and receive a callback from the new activity onCreate method. * - * @param activity the activity * @param callback the callback */ - public void startActivityNotify(Class<?> activity, Runnable callback) { - + public static void startActivityNotify(Intent intent, IAction1<ViewModelBase> callback) + { String key = ActivityCallbackService.getInstance().putCallback(callback); - Intent i = new Intent(getApplicationContext(), activity); - i.putExtra(ACTIVITY_CALLBACK_INTENT, key); - startActivity(i); + intent.putExtra(ACTIVITY_CALLBACK_INTENT, key); + getContext().startActivity(intent); } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityCallbackService.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityCallbackService.java index 0e47af332..f04f6bcfb 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityCallbackService.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityCallbackService.java @@ -1,5 +1,7 @@ package com.twine.colorcapture.mvvm; +import com.twine.colorcapture.core.IAction1; + import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -9,51 +11,56 @@ import java.util.UUID; */ public class ActivityCallbackService { - + private static ActivityCallbackService instance; - - private Map<String, Runnable> callbacks; - - private ActivityCallbackService() { + + private Map<String, IAction1<ViewModelBase>> callbacks; + + private ActivityCallbackService() + { callbacks = new HashMap<>(); } - + /** * Gets instance. * * @return the instance */ - public static ActivityCallbackService getInstance() { - if (instance == null) { + public static ActivityCallbackService getInstance() + { + if (instance == null) + { instance = new ActivityCallbackService(); } - + return instance; } - + /** * Put callback. * * @param key the key * @param callback the callback */ - public void putCallback(String key, Runnable callback) { - callbacks.put(key,callback); + public void putCallback(String key, IAction1<ViewModelBase> callback) + { + callbacks.put(key, callback); } - + /** * Put callback string. * * @param callback the callback * @return the string */ - public String putCallback(Runnable callback) { - + public String putCallback(IAction1<ViewModelBase> callback) + { + String key = UUID.randomUUID().toString(); - callbacks.put(key,callback); + callbacks.put(key, callback); return key; } - + /** * Remove callback. * @@ -63,26 +70,31 @@ public class ActivityCallbackService { callbacks.remove(key); } - + /** * Run. * * @param key the key */ - public void run(String key) + public void run(String key, ViewModelBase vm) { - callbacks.get(key).run(); + callbacks.get(key).invoke(vm); } - + /** * Run and remove. * * @param key the key */ - public void runAndRemove(String key) + public void runAndRemove(String key, ViewModelBase vm) { - callbacks.get(key).run(); - removeCallback(key); + IAction1<ViewModelBase> action = callbacks.get(key); + + if (action != null) + { + action.invoke(vm); + removeCallback(key); + } } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java index 07bb16ecc..17904623a 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java @@ -1,6 +1,7 @@ package com.twine.colorcapture.navigation; import android.app.Activity; +import android.app.ActivityManager; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.content.Context; @@ -10,9 +11,11 @@ import android.support.v7.app.AppCompatActivity; import android.util.Log; import com.twine.colorcapture.R; +import com.twine.colorcapture.mvvm.ActivityBase; import com.twine.colorcapture.mvvm.ExtendedObject; import com.twine.colorcapture.mvvm.FragmentBase; import com.twine.colorcapture.core.IAction1; +import com.twine.colorcapture.mvvm.ViewModelBase; import java.lang.annotation.Annotation; import java.util.ArrayList; @@ -141,7 +144,8 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga preventCurrentHistory = NavigationFragment.class.getField(currentFragmentName).getAnnotations().length > 0; } preventNextHistory = NavigationFragment.class.getField(fragmentName).getAnnotations().length > 0; - } catch (NoSuchFieldException e) + } + catch (NoSuchFieldException e) { e.printStackTrace(); } @@ -189,7 +193,8 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga try { fragment = (FragmentBase) Class.forName(fragmentName).newInstance(); - } catch (Exception ex) + } + catch (Exception ex) { //logManager.log(ex,"Fragment " + fragmentName + " not found."); return; @@ -230,7 +235,7 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga { if (fragmentTo.getVM() instanceof INavigationObjectReceiver && navigationObject != null) { - ((INavigationObjectReceiver)fragmentTo.getVM()).onNavigationObjectReceived(navigationObject); + ((INavigationObjectReceiver) fragmentTo.getVM()).onNavigationObjectReceived(navigationObject); } new Handler().postDelayed(() -> @@ -248,8 +253,6 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga }); - - // try // { // //noinspection ConstantConditions @@ -273,6 +276,17 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga @Override public void navigateTo(NavigationActivity activityValue, boolean addToHistory) { + navigateToActivityInternal(activityValue, addToHistory, null); + } + + @Override + public <T> void navigateWithObjectTo(NavigationActivity activityValue, boolean pushToHistory, T obj) + { + navigateToActivityInternal(activityValue, pushToHistory, obj); + } + + private void navigateToActivityInternal(NavigationActivity activityValue, boolean pushToHistory, Object obj) + { String name = activityValue.name(); String activityName = basePackagePath + "." + name.toLowerCase() + "." + name + "Activity"; try @@ -281,14 +295,24 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga Intent intent = new Intent(context, cls); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - if (!addToHistory) + if (!pushToHistory) { intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NO_HISTORY); } - context.startActivity(intent); + ActivityBase.startActivityNotify(intent, (vm) -> + { + if (obj != null) + { + if (vm instanceof INavigationObjectReceiver) + { + ((INavigationObjectReceiver) vm).onNavigationObjectReceived(obj); + } + } + }); - } catch (ClassNotFoundException e) + } + catch (ClassNotFoundException e) { e.printStackTrace(); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/INavigationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/INavigationProvider.java index f5453bd89..da696cf6a 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/INavigationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/INavigationProvider.java @@ -86,5 +86,7 @@ public interface INavigationProvider void navigateTo(NavigationActivity activityValue, boolean addToHistory); + <T> void navigateWithObjectTo(NavigationActivity activityValue, boolean pushToHistory, T obj); + void addFragmentNavigationListener(FragmentNavigatedListener listener); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java index c0b89fba8..263aad444 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java @@ -8,6 +8,7 @@ import com.squareup.otto.Bus; import com.twine.colorcapture.core.Task.TaskBuilder; import com.twine.colorcapture.dialogs.processing.ProcessingDialog; import com.twine.colorcapture.dialogs.welcome.WelcomeDialog; +import com.twine.colorcapture.logging.LogManager; import com.twine.colorcapture.models.ColorResult; import com.twine.colorcapture.mvvm.DependencyProperty; import com.twine.colorcapture.mvvm.ViewModelBase; @@ -71,7 +72,8 @@ public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implement try { definition = tccService.getDefinition(); - } catch (Exception e) + } + catch (Exception e) { e.printStackTrace(); } @@ -161,13 +163,30 @@ public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implement abort.set(true); }); - DetectionResponse response = tccService.detect(sampleBitmap, barcode); + DetectionResponse response = null; + boolean success = false; - ThreadingUtils.sleep(1000); + try + { + response = tccService.detect(sampleBitmap, barcode); + success = true; + } + catch (Exception ex) + { + LogManager.log(ex, "Error on color detection."); + + invokeUI(() -> + { + notificationProvider.showError("Processing error", "An error occurred while processing your color. Please try again later", (x) -> + { + + }); + }); + } isDetecting.set(false); - if (!abort.get()) + if (!abort.get() && success) { LocalDateTime date = LocalDateTime.now(); DateTimeFormatter fmt = DateTimeFormat.forPattern("d MMMM, yyyy, hh:mm:ss").withLocale(Locale.ENGLISH); diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/result/ResultFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/result/ResultFragmentVM.java index 2e58e2777..4709cd532 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/result/ResultFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/result/ResultFragmentVM.java @@ -32,6 +32,7 @@ public class ResultFragmentVM extends ViewModelBase<IResultFragment> implements { private INavigationProvider navigationProvider; private ITCCService tccService; + private Bus eventBus; public ColorResult colorResult; public DependencyProperty<Boolean> isCameraColorToggled; @@ -59,6 +60,7 @@ public class ResultFragmentVM extends ViewModelBase<IResultFragment> implements sendToMachineCommand = new RelayCommand(this::handleSendToMachineCommand); registerMachineCommand = new RelayCommand(this::handlerRegisterMachineCommand); + this.eventBus = eventBus; eventBus.register(this); } @@ -85,7 +87,7 @@ public class ResultFragmentVM extends ViewModelBase<IResultFragment> implements private void handleEmailCommand() { - navigationProvider.navigateTo(NavigationActivity.SendToEmail, false); + navigationProvider.navigateWithObjectTo(NavigationActivity.SendToEmail, false, colorResult); } private void toggleCameraColor() diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivity.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivity.java index d886de513..deff5b244 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivity.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivity.java @@ -7,13 +7,19 @@ import com.twine.colorcapture.App; import com.twine.colorcapture.R; import com.twine.colorcapture.databinding.ActivitySendToEmailBinding; import com.twine.colorcapture.mvvm.ActivityBase; +import com.twine.colorcapture.notification.INotificationProvider; + +import javax.inject.Inject; public class SendToEmailActivity extends ActivityBase<ActivitySendToEmailBinding, SendToEmailActivityVM> implements ISendToEmailActivity { + @Inject + public INotificationProvider notificationProvider; + @Override protected void onCreating(Bundle savedInstanceState) { - + notificationProvider.registerMainActivity(this); } @Override diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivityVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivityVM.java index 77467fff4..6e17dc12d 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivityVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivityVM.java @@ -1,21 +1,91 @@ package com.twine.colorcapture.views.sendtoemail; +import com.squareup.otto.Bus; +import com.squareup.otto.Subscribe; +import com.twine.colorcapture.core.Task; +import com.twine.colorcapture.dialogs.progress.ProgressDialogVM; import com.twine.colorcapture.models.ColorResult; +import com.twine.colorcapture.mvvm.DependencyProperty; import com.twine.colorcapture.mvvm.RelayCommand; import com.twine.colorcapture.mvvm.ViewModelBase; +import com.twine.colorcapture.navigation.INavigationObjectReceiver; +import com.twine.colorcapture.navigation.INavigationProvider; +import com.twine.colorcapture.notification.INotificationProvider; +import com.twine.colorcapture.web.ITCCService; +import com.twine.colorcapture.web.messages.ResultByEmailRequest; -public class SendToEmailActivityVM extends ViewModelBase<ISendToEmailActivity> +import java.util.concurrent.atomic.AtomicBoolean; + +public class SendToEmailActivityVM extends ViewModelBase<ISendToEmailActivity> implements INavigationObjectReceiver<ColorResult> { + private INavigationProvider navigationProvider; + private INotificationProvider notificationProvider; + private ITCCService tccService; + public RelayCommand sendCommand; public ColorResult colorResult; + public DependencyProperty<String> to; + public DependencyProperty<String> from; + public DependencyProperty<String> message; - public SendToEmailActivityVM() + public SendToEmailActivityVM(Bus eventBus, INavigationProvider navigationProvider, INotificationProvider notificationProvider, ITCCService tccService) { + this.navigationProvider = navigationProvider; + this.notificationProvider = notificationProvider; + this.tccService = tccService; + + to = new DependencyProperty<>(""); + from = new DependencyProperty<>(""); + message = new DependencyProperty<>(""); + sendCommand = new RelayCommand(this::handleSendCommand); } private void handleSendCommand() { + AtomicBoolean abort = new AtomicBoolean(); + ProgressDialogVM vm = notificationProvider.showProgress("Send to email", "Sending color result to " + to.get(), (x) -> + { + abort.set(true); + }); + + new Task.TaskBuilder().setAction(() -> + { + ResultByEmailRequest request = new ResultByEmailRequest(); + request.setDetectionResponse(colorResult.getDetectionResponse()); + request.setTo(to.get()); + request.setFrom(from.get()); + request.setMessage(message.get()); + tccService.sendResultByEmail(request); + }).setError((ex) -> + { + if (!abort.get()) + { + invokeUI(() -> + { + vm.close(); + notificationProvider.showError("Send to email", "An error occurred. Please try again later.", (x) -> + { + }); + }); + } + }).setContinueWith(() -> + { + if (!abort.get()) + { + vm.close(); + notificationProvider.showSuccess("Send to email", "Color result sent successfully", (x) -> + { + }); + navigationProvider.navigateBack(); + } + }).build().start(); + } + + @Override + public void onNavigationObjectReceived(ColorResult colorResult) + { + this.colorResult = colorResult; } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java index 362abe121..48f2f7a28 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java @@ -6,6 +6,8 @@ import com.twine.colorcapture.web.messages.DefinitionResponse; import com.twine.colorcapture.web.messages.DetectionRequest; import com.twine.colorcapture.web.messages.DetectionResponse; import com.twine.colorcapture.web.messages.MachineRegistrationResponse; +import com.twine.colorcapture.web.messages.ResultByEmailRequest; +import com.twine.colorcapture.web.messages.ResultByEmailResponse; import java.io.IOException; import java.util.List; @@ -18,6 +20,8 @@ public interface ITCCService MachineRegistrationResponse register(String serialNumber) throws Exception; + ResultByEmailResponse sendResultByEmail(ResultByEmailRequest request) throws Exception; + boolean isRegistered(); List<String> getOrganizationMachines(); diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java index fe292a839..ee38dac71 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java @@ -8,6 +8,8 @@ import com.twine.colorcapture.web.messages.LoginRequest; import com.twine.colorcapture.web.messages.LoginResponse; import com.twine.colorcapture.web.messages.MachineRegistrationRequest; import com.twine.colorcapture.web.messages.MachineRegistrationResponse; +import com.twine.colorcapture.web.messages.ResultByEmailRequest; +import com.twine.colorcapture.web.messages.ResultByEmailResponse; import io.reactivex.Observable; import retrofit2.Call; @@ -27,4 +29,7 @@ public interface IWebServiceAPI @POST("ColorDetection/Register") Call<MachineRegistrationResponse> register(@Body MachineRegistrationRequest request); + + @POST("ColorDetection/SendResultByEmail") + Call<ResultByEmailResponse> sendResultByEmail(@Body ResultByEmailRequest request); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java index 6999d2f0e..13a27bd34 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java @@ -17,6 +17,8 @@ import com.twine.colorcapture.web.messages.LoginRequest; import com.twine.colorcapture.web.messages.LoginResponse; import com.twine.colorcapture.web.messages.MachineRegistrationRequest; import com.twine.colorcapture.web.messages.MachineRegistrationResponse; +import com.twine.colorcapture.web.messages.ResultByEmailRequest; +import com.twine.colorcapture.web.messages.ResultByEmailResponse; import java.io.IOException; import java.util.List; @@ -76,6 +78,8 @@ public class TCCService implements ITCCService @Override public DetectionResponse detect(Bitmap bitmap, String barcode) throws Exception { + LogManager.log("Sending detection request..."); + ensureAuthenticated(); DetectionRequest request = new DetectionRequest(); @@ -83,15 +87,18 @@ public class TCCService implements ITCCService request.setBitmapString(BitmapUtils.getBitmapBase64String(bitmap)); request.setBarcode(barcode); + LogManager.log("Detection Request:", request); + Response<DetectionResponse> response = webAPI.detect(request).execute(); if (response.isSuccessful()) { + LogManager.log("Detection Response:", response.body()); return response.body(); } else { - throw new Exception(response.message()); + throw LogManager.log(new Exception(response.message())); } } @@ -125,6 +132,30 @@ public class TCCService implements ITCCService } } + @Override + public ResultByEmailResponse sendResultByEmail(ResultByEmailRequest request) throws Exception + { + LogManager.log("Sending result by email..."); + + ensureAuthenticated(); + + LogManager.log("Sending result by email request:", request); + + Response<ResultByEmailResponse> response = webAPI.sendResultByEmail(request).execute(); + + if (response.isSuccessful()) + { + ResultByEmailResponse r = response.body(); + LogManager.log("Result by email sent successfully."); + return r; + } + else + { + throw LogManager.log(new Exception(response.message()), "Send result by email has failed."); + } + } + + private void ensureAuthenticated() throws Exception { if (loginResponse == null) diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/ResultByEmailRequest.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/ResultByEmailRequest.java new file mode 100644 index 000000000..af61e9672 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/ResultByEmailRequest.java @@ -0,0 +1,49 @@ +package com.twine.colorcapture.web.messages; + +public class ResultByEmailRequest +{ + private String from; + private String to; + private String message; + private DetectionResponse detectionResponse; + + public String getFrom() + { + return from; + } + + public void setFrom(String from) + { + this.from = from; + } + + public String getTo() + { + return to; + } + + public void setTo(String to) + { + this.to = to; + } + + public String getMessage() + { + return message; + } + + public void setMessage(String message) + { + this.message = message; + } + + public DetectionResponse getDetectionResponse() + { + return detectionResponse; + } + + public void setDetectionResponse(DetectionResponse detectionResponse) + { + this.detectionResponse = detectionResponse; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/ResultByEmailResponse.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/ResultByEmailResponse.java new file mode 100644 index 000000000..2c4b68770 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/ResultByEmailResponse.java @@ -0,0 +1,5 @@ +package com.twine.colorcapture.web.messages; + +public class ResultByEmailResponse +{ +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/tango/pmr/tcc/DetectionColorFileOuterClass.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/tango/pmr/tcc/DetectionColorFileOuterClass.java new file mode 100644 index 000000000..13521f03f --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/tango/pmr/tcc/DetectionColorFileOuterClass.java @@ -0,0 +1,834 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DetectionColorFile.proto + +package com.twine.tango.pmr.tcc; + +public final class DetectionColorFileOuterClass { + private DetectionColorFileOuterClass() {} + 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 DetectionColorFileOrBuilder extends + // @@protoc_insertion_point(interface_extends:Tango.PMR.TCC.DetectionColorFile) + com.google.protobuf.MessageOrBuilder { + + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + boolean hasRawColor(); + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor getRawColor(); + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder getRawColorOrBuilder(); + + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + boolean hasProcessedColor(); + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor getProcessedColor(); + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder getProcessedColorOrBuilder(); + } + /** + * Protobuf type {@code Tango.PMR.TCC.DetectionColorFile} + */ + public static final class DetectionColorFile extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Tango.PMR.TCC.DetectionColorFile) + DetectionColorFileOrBuilder { + private static final long serialVersionUID = 0L; + // Use DetectionColorFile.newBuilder() to construct. + private DetectionColorFile(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { + super(builder); + } + private DetectionColorFile() { + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DetectionColorFile( + 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: { + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder subBuilder = null; + if (rawColor_ != null) { + subBuilder = rawColor_.toBuilder(); + } + rawColor_ = input.readMessage(com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(rawColor_); + rawColor_ = subBuilder.buildPartial(); + } + + break; + } + case 18: { + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder subBuilder = null; + if (processedColor_ != null) { + subBuilder = processedColor_.toBuilder(); + } + processedColor_ = input.readMessage(com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(processedColor_); + processedColor_ = subBuilder.buildPartial(); + } + + 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.tcc.DetectionColorFileOuterClass.internal_static_Tango_PMR_TCC_DetectionColorFile_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.internal_static_Tango_PMR_TCC_DetectionColorFile_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile.class, com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile.Builder.class); + } + + public static final int RAWCOLOR_FIELD_NUMBER = 1; + private com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor rawColor_; + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public boolean hasRawColor() { + return rawColor_ != null; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor getRawColor() { + return rawColor_ == null ? com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.getDefaultInstance() : rawColor_; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder getRawColorOrBuilder() { + return getRawColor(); + } + + public static final int PROCESSEDCOLOR_FIELD_NUMBER = 2; + private com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor processedColor_; + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public boolean hasProcessedColor() { + return processedColor_ != null; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor getProcessedColor() { + return processedColor_ == null ? com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.getDefaultInstance() : processedColor_; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder getProcessedColorOrBuilder() { + return getProcessedColor(); + } + + 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 (rawColor_ != null) { + output.writeMessage(1, getRawColor()); + } + if (processedColor_ != null) { + output.writeMessage(2, getProcessedColor()); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (rawColor_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getRawColor()); + } + if (processedColor_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getProcessedColor()); + } + 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.tcc.DetectionColorFileOuterClass.DetectionColorFile)) { + return super.equals(obj); + } + com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile other = (com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile) obj; + + boolean result = true; + result = result && (hasRawColor() == other.hasRawColor()); + if (hasRawColor()) { + result = result && getRawColor() + .equals(other.getRawColor()); + } + result = result && (hasProcessedColor() == other.hasProcessedColor()); + if (hasProcessedColor()) { + result = result && getProcessedColor() + .equals(other.getProcessedColor()); + } + 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(); + if (hasRawColor()) { + hash = (37 * hash) + RAWCOLOR_FIELD_NUMBER; + hash = (53 * hash) + getRawColor().hashCode(); + } + if (hasProcessedColor()) { + hash = (37 * hash) + PROCESSEDCOLOR_FIELD_NUMBER; + hash = (53 * hash) + getProcessedColor().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile 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.tcc.DetectionColorFileOuterClass.DetectionColorFile parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile 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.tcc.DetectionColorFileOuterClass.DetectionColorFile parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile 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.tcc.DetectionColorFileOuterClass.DetectionColorFile parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile 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.tcc.DetectionColorFileOuterClass.DetectionColorFile parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile 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.tcc.DetectionColorFileOuterClass.DetectionColorFile 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.TCC.DetectionColorFile} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements + // @@protoc_insertion_point(builder_implements:Tango.PMR.TCC.DetectionColorFile) + com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFileOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.internal_static_Tango_PMR_TCC_DetectionColorFile_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.internal_static_Tango_PMR_TCC_DetectionColorFile_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile.class, com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile.Builder.class); + } + + // Construct using com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile.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(); + if (rawColorBuilder_ == null) { + rawColor_ = null; + } else { + rawColor_ = null; + rawColorBuilder_ = null; + } + if (processedColorBuilder_ == null) { + processedColor_ = null; + } else { + processedColor_ = null; + processedColorBuilder_ = null; + } + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.internal_static_Tango_PMR_TCC_DetectionColorFile_descriptor; + } + + public com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile getDefaultInstanceForType() { + return com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile.getDefaultInstance(); + } + + public com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile build() { + com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile buildPartial() { + com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile result = new com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile(this); + if (rawColorBuilder_ == null) { + result.rawColor_ = rawColor_; + } else { + result.rawColor_ = rawColorBuilder_.build(); + } + if (processedColorBuilder_ == null) { + result.processedColor_ = processedColor_; + } else { + result.processedColor_ = processedColorBuilder_.build(); + } + 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.tcc.DetectionColorFileOuterClass.DetectionColorFile) { + return mergeFrom((com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile other) { + if (other == com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile.getDefaultInstance()) return this; + if (other.hasRawColor()) { + mergeRawColor(other.getRawColor()); + } + if (other.hasProcessedColor()) { + mergeProcessedColor(other.getProcessedColor()); + } + 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.tcc.DetectionColorFileOuterClass.DetectionColorFile parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor rawColor_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder> rawColorBuilder_; + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public boolean hasRawColor() { + return rawColorBuilder_ != null || rawColor_ != null; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor getRawColor() { + if (rawColorBuilder_ == null) { + return rawColor_ == null ? com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.getDefaultInstance() : rawColor_; + } else { + return rawColorBuilder_.getMessage(); + } + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public Builder setRawColor(com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor value) { + if (rawColorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + rawColor_ = value; + onChanged(); + } else { + rawColorBuilder_.setMessage(value); + } + + return this; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public Builder setRawColor( + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder builderForValue) { + if (rawColorBuilder_ == null) { + rawColor_ = builderForValue.build(); + onChanged(); + } else { + rawColorBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public Builder mergeRawColor(com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor value) { + if (rawColorBuilder_ == null) { + if (rawColor_ != null) { + rawColor_ = + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.newBuilder(rawColor_).mergeFrom(value).buildPartial(); + } else { + rawColor_ = value; + } + onChanged(); + } else { + rawColorBuilder_.mergeFrom(value); + } + + return this; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public Builder clearRawColor() { + if (rawColorBuilder_ == null) { + rawColor_ = null; + onChanged(); + } else { + rawColor_ = null; + rawColorBuilder_ = null; + } + + return this; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder getRawColorBuilder() { + + onChanged(); + return getRawColorFieldBuilder().getBuilder(); + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder getRawColorOrBuilder() { + if (rawColorBuilder_ != null) { + return rawColorBuilder_.getMessageOrBuilder(); + } else { + return rawColor_ == null ? + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.getDefaultInstance() : rawColor_; + } + } + /** + * <code>.Tango.PMR.TCC.DetectionColor RawColor = 1;</code> + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder> + getRawColorFieldBuilder() { + if (rawColorBuilder_ == null) { + rawColorBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder>( + getRawColor(), + getParentForChildren(), + isClean()); + rawColor_ = null; + } + return rawColorBuilder_; + } + + private com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor processedColor_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder> processedColorBuilder_; + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public boolean hasProcessedColor() { + return processedColorBuilder_ != null || processedColor_ != null; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor getProcessedColor() { + if (processedColorBuilder_ == null) { + return processedColor_ == null ? com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.getDefaultInstance() : processedColor_; + } else { + return processedColorBuilder_.getMessage(); + } + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public Builder setProcessedColor(com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor value) { + if (processedColorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + processedColor_ = value; + onChanged(); + } else { + processedColorBuilder_.setMessage(value); + } + + return this; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public Builder setProcessedColor( + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder builderForValue) { + if (processedColorBuilder_ == null) { + processedColor_ = builderForValue.build(); + onChanged(); + } else { + processedColorBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public Builder mergeProcessedColor(com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor value) { + if (processedColorBuilder_ == null) { + if (processedColor_ != null) { + processedColor_ = + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.newBuilder(processedColor_).mergeFrom(value).buildPartial(); + } else { + processedColor_ = value; + } + onChanged(); + } else { + processedColorBuilder_.mergeFrom(value); + } + + return this; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public Builder clearProcessedColor() { + if (processedColorBuilder_ == null) { + processedColor_ = null; + onChanged(); + } else { + processedColor_ = null; + processedColorBuilder_ = null; + } + + return this; + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder getProcessedColorBuilder() { + + onChanged(); + return getProcessedColorFieldBuilder().getBuilder(); + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + public com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder getProcessedColorOrBuilder() { + if (processedColorBuilder_ != null) { + return processedColorBuilder_.getMessageOrBuilder(); + } else { + return processedColor_ == null ? + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.getDefaultInstance() : processedColor_; + } + } + /** + * <code>.Tango.PMR.TCC.DetectionColor ProcessedColor = 2;</code> + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder> + getProcessedColorFieldBuilder() { + if (processedColorBuilder_ == null) { + processedColorBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColor.Builder, com.twine.tango.pmr.tcc.DetectionColorOuterClass.DetectionColorOrBuilder>( + getProcessedColor(), + getParentForChildren(), + isClean()); + processedColor_ = null; + } + return processedColorBuilder_; + } + 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.TCC.DetectionColorFile) + } + + // @@protoc_insertion_point(class_scope:Tango.PMR.TCC.DetectionColorFile) + private static final com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile(); + } + + public static com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser<DetectionColorFile> + PARSER = new com.google.protobuf.AbstractParser<DetectionColorFile>() { + public DetectionColorFile parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DetectionColorFile(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser<DetectionColorFile> parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser<DetectionColorFile> getParserForType() { + return PARSER; + } + + public com.twine.tango.pmr.tcc.DetectionColorFileOuterClass.DetectionColorFile getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_Tango_PMR_TCC_DetectionColorFile_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Tango_PMR_TCC_DetectionColorFile_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\030DetectionColorFile.proto\022\rTango.PMR.TC" + + "C\032\024DetectionColor.proto\"|\n\022DetectionColo" + + "rFile\022/\n\010RawColor\030\001 \001(\0132\035.Tango.PMR.TCC." + + "DetectionColor\0225\n\016ProcessedColor\030\002 \001(\0132\035" + + ".Tango.PMR.TCC.DetectionColorB\031\n\027com.twi" + + "ne.tango.pmr.tccb\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[] { + com.twine.tango.pmr.tcc.DetectionColorOuterClass.getDescriptor(), + }, assigner); + internal_static_Tango_PMR_TCC_DetectionColorFile_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Tango_PMR_TCC_DetectionColorFile_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Tango_PMR_TCC_DetectionColorFile_descriptor, + new java.lang.String[] { "RawColor", "ProcessedColor", }); + com.twine.tango.pmr.tcc.DetectionColorOuterClass.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_send_to_email.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_send_to_email.xml index 2e97be0b5..22daa7b14 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_send_to_email.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_send_to_email.xml @@ -21,8 +21,8 @@ android:id="@+id/frameTitle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="20dp" - android:background="@color/colorPrimaryBackground"> + android:background="@color/colorPrimaryBackground" + android:padding="20dp"> <android.support.v7.widget.AppCompatTextView android:id="@+id/txtTitle" @@ -36,29 +36,126 @@ <android.support.v7.widget.AppCompatButton android:id="@+id/btnDone" - android:background="@drawable/button_transparent_fill_ripple" - android:layout_gravity="right" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="17.3sp" - android:letterSpacing="0.07" - android:textStyle="bold" - android:text="Send" + android:layout_gravity="right" android:layout_marginRight="-10dp" + android:background="@drawable/button_transparent_fill_ripple" android:fontFamily="@font/flexo_bold" + android:letterSpacing="0.07" + android:text="Send" android:textAllCaps="false" - bind:command="@{vm.sendCommand}"/> + android:textSize="17.3sp" + android:textStyle="bold" + bind:command="@{vm.sendCommand}" /> </FrameLayout> <LinearLayout - android:layout_below="@id/frameTitle" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" - android:background="@color/white"> + android:layout_below="@id/frameTitle" + android:background="@color/white" + android:orientation="vertical"> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <android.support.v7.widget.AppCompatTextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="left|center" + android:layout_marginLeft="20dp" + android:layout_marginTop="20dp" + android:fontFamily="@font/flexo_light" + android:letterSpacing="0.07" + android:text="Your color is attached" + android:textColor="@color/colorPrimaryBackground" + android:textSize="15.4sp" /> + + <com.github.florent37.shapeofview.shapes.RoundRectView + android:layout_width="80dp" + android:layout_height="80dp" + android:layout_margin="20dp" + bind:shape_roundRect_borderColor="@android:color/black" + bind:shape_roundRect_borderWidth="0dp" + bind:shape_roundRect_bottomLeftRadius="5dp" + bind:shape_roundRect_bottomRightRadius="5dp" + bind:shape_roundRect_topLeftRadius="5dp" + bind:shape_roundRect_topRightRadius="5dp"> + + + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@{vm.colorResult.detectionResponse.getProcessedColor().getColor()}" + tools:background="@color/colorAccent" /> + + </com.github.florent37.shapeofview.shapes.RoundRectView> + + <FrameLayout + android:layout_width="match_parent" + android:layout_height="4dp" + android:background="@color/light_gray" /> + + <android.support.v7.widget.AppCompatEditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="20dp" + android:backgroundTint="@color/colorPrimaryBackground" + android:fontFamily="@font/flexo_light" + android:hint="To" + android:inputType="textEmailAddress" + android:letterSpacing="0.07" + android:text="@={vm.to}" + android:textColor="@color/colorPrimaryBackground" + android:textColorHint="@color/text_gray" + android:textDirection="ltr" + android:textSize="15.4sp" /> + + <android.support.v7.widget.AppCompatEditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="20dp" + android:backgroundTint="@color/colorPrimaryBackground" + android:fontFamily="@font/flexo_light" + android:hint="From" + android:inputType="textEmailAddress" + android:letterSpacing="0.07" + android:text="@={vm.from}" + android:textColor="@color/colorPrimaryBackground" + android:textColorHint="@color/text_gray" + android:textDirection="ltr" + android:textSize="15.4sp" /> + <android.support.v7.widget.AppCompatEditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="20dp" + android:backgroundTint="@color/colorTransparent" + android:fontFamily="@font/flexo_light" + android:gravity="top|left" + android:hint="Message" + android:inputType="textMultiLine" + android:letterSpacing="0.07" + android:lines="8" + android:maxLines="10" + android:minLines="6" + android:scrollbars="vertical" + android:text="@={vm.message}" + android:textColor="@color/colorPrimaryBackground" + android:textColorHint="@color/text_gray" + android:textDirection="ltr" + android:textSize="15.4sp" /> + </LinearLayout> + </ScrollView> </LinearLayout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_result.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_result.xml index 90242ec30..8ca28f881 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_result.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_result.xml @@ -136,7 +136,7 @@ <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@{vm.detectionResponse.getRawColor().getColor()}"></FrameLayout> + android:background="@{vm.detectionResponse.getRawColor().getColor()}"/> </com.github.florent37.shapeofview.shapes.RoundRectView> diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf Binary files differindex 79c194d77..cfb69bcf0 100644 --- a/Software/DB/PPC/Tango.mdf +++ b/Software/DB/PPC/Tango.mdf diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf Binary files differindex 539afcfc3..6911f98f7 100644 --- a/Software/DB/PPC/Tango_log.ldf +++ b/Software/DB/PPC/Tango_log.ldf diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf Binary files differindex b4a83e6b3..7a4520dae 100644 --- a/Software/DB/TCC/TCC.mdf +++ b/Software/DB/TCC/TCC.mdf diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf Binary files differindex d7a91e5ac..85ea1e674 100644 --- a/Software/DB/TCC/TCC_log.ldf +++ b/Software/DB/TCC/TCC_log.ldf diff --git a/Software/PMR/Messages/TCC/DetectionColorFile.proto b/Software/PMR/Messages/TCC/DetectionColorFile.proto new file mode 100644 index 000000000..c5c682aab --- /dev/null +++ b/Software/PMR/Messages/TCC/DetectionColorFile.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +import "DetectionColor.proto"; + +package Tango.PMR.TCC; +option java_package = "com.twine.tango.pmr.tcc"; + +message DetectionColorFile +{ + DetectionColor RawColor = 1; + DetectionColor ProcessedColor = 2; +}
\ No newline at end of file diff --git a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip index ff01e0e07..22a18f1ae 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip @@ -15,10 +15,10 @@ <ROW Property="ARPCOMMENTS" Value="This installer database contains the logic and data required to install [|ProductName]." ValueLocId="*"/> <ROW Property="ARPNOREPAIR" MultiBuildValue="DefaultBuild:1"/> <ROW Property="Manufacturer" Value="Twine"/> - <ROW Property="ProductCode" Value="1033:{2514347C-712C-4620-9B0A-8E734767D7E0} " Type="16"/> + <ROW Property="ProductCode" Value="1033:{3CA3DE1D-D04D-4969-B1E1-969EBE3EB323} " Type="16"/> <ROW Property="ProductLanguage" Value="1033"/> <ROW Property="ProductName" Value="Machine Studio"/> - <ROW Property="ProductVersion" Value="4.0.18.0" Type="32"/> + <ROW Property="ProductVersion" Value="4.0.19.0" Type="32"/> <ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/> <ROW Property="UpgradeCode" Value="{CBEE5CAE-7C5A-4280-98DE-AA98113764E4}"/> <ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/> @@ -787,7 +787,7 @@ <ROW Action="AI_DetectSoftware" Sequence="101"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.BuildComponent"> - <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\Machine Studio\Release" PackageFileName="Machine Studio Installer_v4.0.9" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="Machine Studio Installer_v4.0.18"/> + <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\Machine Studio\Release" PackageFileName="Machine Studio Installer_v4.0.9" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="Machine Studio Installer_v4.0.19"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent"> <ROW Path="<AI_DICTS>ui.ail"/> diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt Binary files differindex 6d87e9201..a603ff06b 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index bb8df5787..aa906ba91 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -41,11 +41,9 @@ <ROW Directory="APPDIR" Directory_Parent="TARGETDIR" DefaultDir="APPDIR:." IsPseudoRoot="1" DirectoryOptions="3"/> <ROW Directory="Configurations_Dir" Directory_Parent="SQLExaminer_Dir" DefaultDir="CONFIG~1|Configurations" DirectoryOptions="3"/> <ROW Directory="DesktopFolder" Directory_Parent="TARGETDIR" DefaultDir="DESKTO~1|DesktopFolder" IsPseudoRoot="1"/> - <ROW Directory="ProtoCompilers_Dir" Directory_Parent="APPDIR" DefaultDir="PROTOC~1|ProtoCompilers" DirectoryOptions="3"/> <ROW Directory="SHORTCUTDIR" Directory_Parent="TARGETDIR" DefaultDir="SHORTC~1|SHORTCUTDIR" IsPseudoRoot="1"/> <ROW Directory="SQLExaminer_Dir" Directory_Parent="APPDIR" DefaultDir="SQLEXA~1|SQLExaminer" DirectoryOptions="3"/> <ROW Directory="TARGETDIR" DefaultDir="SourceDir"/> - <ROW Directory="roslyn_Dir" Directory_Parent="APPDIR" DefaultDir="roslyn" DirectoryOptions="3"/> <ROW Directory="x64_Dir" Directory_Parent="APPDIR" DefaultDir="x64" DirectoryOptions="3"/> <ROW Directory="x86_Dir" Directory_Parent="APPDIR" DefaultDir="x86" DirectoryOptions="3"/> </COMPONENT> @@ -106,7 +104,6 @@ <ROW Component="Newtonsoft.Json.dll" ComponentId="{E556628B-DB87-4249-AF5E-F5D0AC9E6C32}" Directory_="APPDIR" Attributes="0" KeyPath="Newtonsoft.Json.dll"/> <ROW Component="OverrideData.xml" ComponentId="{D7B559ED-70E2-42F9-996D-2D6FDB2ED752}" Directory_="Configurations_Dir" Attributes="0" KeyPath="OverrideData.xml" Type="0"/> <ROW Component="ProductInformation" ComponentId="{1D49743C-F4ED-4BE9-8ED0-3792287247F6}" Directory_="APPDIR" Attributes="4" KeyPath="Version"/> - <ROW Component="ProtoCompilers" ComponentId="{6766E626-14E9-49FD-A19E-9A531A35E72A}" Directory_="ProtoCompilers_Dir" Attributes="0"/> <ROW Component="SA.Binary.dll" ComponentId="{FCC45B67-1B47-46A2-8C0A-6CAA78E7C9F0}" Directory_="SQLExaminer_Dir" Attributes="0" KeyPath="SA.Binary.dll"/> <ROW Component="SA.CodeView.dll" ComponentId="{0C133131-0EB4-4E2B-885F-B62EECF039AB}" Directory_="SQLExaminer_Dir" Attributes="0" KeyPath="SA.CodeView.dll"/> <ROW Component="SA.CommonTypes.dll" ComponentId="{7CE9EB0C-3192-4540-8A08-E7E6C59AA62A}" Directory_="SQLExaminer_Dir" Attributes="0" KeyPath="SA.CommonTypes.dll"/> @@ -172,13 +169,12 @@ <ROW Component="Tango.WiFi.dll" ComponentId="{8082C9BD-5BDB-4C52-BCA6-E8604D4D232B}" Directory_="APPDIR" Attributes="0" KeyPath="Tango.WiFi.dll"/> <ROW Component="mscoree.dll" ComponentId="{85F439D0-8FD0-4B99-888D-336C7A125E3D}" Directory_="APPDIR" Attributes="0" KeyPath="mscoree.dll"/> <ROW Component="msvcp140d.dll" ComponentId="{69E32675-9ACF-4C23-A495-300B78913B66}" Directory_="APPDIR" Attributes="0" KeyPath="msvcp140d.dll"/> - <ROW Component="roslyn" ComponentId="{EF9B72BE-5C5F-407E-91EB-65CEF8030178}" Directory_="roslyn_Dir" Attributes="0"/> <ROW Component="ucrtbased.dll" ComponentId="{B8D025EA-CD16-4EE7-A3E7-713E2BE82BF3}" Directory_="APPDIR" Attributes="0" KeyPath="ucrtbased.dll"/> <ROW Component="vcruntime140.dll" ComponentId="{144594CC-D19B-45E4-A420-7A1BBB122EE3}" Directory_="APPDIR" Attributes="0" KeyPath="vcruntime140.dll"/> <ROW Component="vcruntime140d.dll" ComponentId="{7653420C-C6C3-4F31-97E8-D6DE417D3DF2}" Directory_="APPDIR" Attributes="0" KeyPath="vcruntime140d.dll"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiFeatsComponent"> - <ROW Feature="MainFeature" Title="MainFeature" Description="Description" Display="1" Level="1" Directory_="APPDIR" Attributes="0" Components="AI_CustomARPName AI_ExePath ColorMine.dll CommandLine.dll CommandLine.xml ControlzEx.dll DocumentFormat.OpenXml.dll EFCache.dll EntityFramework.SqlServer.dll EntityFramework.dll FluentFTP.dll FontAwesome.WPF.dll Google.Protobuf.dll Hyak.Common.dll ICSharpCode.AvalonEdit.dll Interop.MSDASC.dll Ionic.Zip.dll JWT.dll License.lic Microsoft.Azure.ActiveDirectory.GraphClient.dll Microsoft.Azure.Common.NetFramework.dll Microsoft.Azure.Common.dll Microsoft.Azure.ResourceManager.dll Microsoft.Data.Edm.dll Microsoft.Data.OData.dll Microsoft.Data.Services.Client.dll Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll Microsoft.IdentityModel.Clients.ActiveDirectory.dll Microsoft.ServiceBus.dll Microsoft.SqlServer.AzureStorageEnum.dll Microsoft.SqlServer.ConnectionInfo.dll Microsoft.SqlServer.Diagnostics.STrace.dll Microsoft.SqlServer.Dmf.Common.dll Microsoft.SqlServer.Management.Sdk.Sfc.dll Microsoft.SqlServer.ServiceBrokerEnum.dll Microsoft.SqlServer.Smo.dll Microsoft.SqlServer.SqlClrProvider.dll Microsoft.SqlServer.SqlEnum.dll Microsoft.TeamFoundation.Client.dll Microsoft.TeamFoundation.Common.dll Microsoft.TeamFoundation.Core.WebApi.dll Microsoft.TeamFoundation.Diff.dll Microsoft.TeamFoundation.Work.WebApi.dll Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.dll Microsoft.TeamFoundation.WorkItemTracking.Client.dll Microsoft.TeamFoundation.WorkItemTracking.Common.dll Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll Microsoft.TeamFoundation.WorkItemTracking.WebApi.dll Microsoft.VisualStudio.Services.Client.Interactive.dll Microsoft.VisualStudio.Services.Common.dll Microsoft.VisualStudio.Services.WebApi.dll Microsoft.WindowsAzure.Storage.dll Newtonsoft.Json.dll OverrideData.xml ProductInformation ProtoCompilers SA.Binary.dll SA.CodeView.dll SA.CommonTypes.dll SA.CommonUI.dll SA.SCBaseProvider.dll SA.SQLDataExaminer.Engine.dll SA.SQLExaminer.Engine.dll SA.Utils.ErrorReporter.dll SHORTCUTDIR SQLDECmd.exe SQLECmd.exe SQLite.Interop.dll SQLite.Interop.dll_1 SimpleValidator.dll System.Data.SQLite.EF6.dll System.Data.SQLite.Linq.dll System.Data.SQLite.dll System.IO.Compression.FileSystem.dll System.IdentityModel.Tokens.Jwt.dll System.Net.Http.Formatting.dll System.Reactive.Core.dll System.Reactive.Interfaces.dll System.Reactive.Linq.dll System.Reactive.PlatformServices.dll System.Spatial.dll System.Web.Http.WebHost.dll System.Web.Http.dll System.Windows.Interactivity.dll Tango.AdvancedInstaller.dll Tango.AnimatedGif.dll Tango.BL.dll Tango.ColorLib.dll Tango.Core.dll Tango.Documents.dll Tango.DragAndDrop.dll Tango.Emulations.dll Tango.Explorer.dll Tango.FirmwareUpdateLib.WPF.dll Tango.FirmwareUpdateLib.dll Tango.Hive.dll Tango.Integration.dll Tango.Logging.dll Tango.PMR.dll Tango.PPC.BootScreen.exe Tango.PPC.Common.dll Tango.PPC.Events.dll Tango.PPC.Jobs.dll Tango.PPC.MachineSettings.dll Tango.PPC.Storage.dll Tango.PPC.Technician.dll Tango.PPC.UI.exe Tango.PPC.Updater.exe Tango.PPC.WatchDog.exe Tango.SQLExaminer.dll Tango.Scripting.dll Tango.Serialization.dll Tango.Settings.dll Tango.SharedUI.dll Tango.TFS.dll Tango.Touch.dll Tango.Transport.dll Tango.Web.dll Tango.WiFi.dll mscoree.dll msvcp140d.dll roslyn ucrtbased.dll vcruntime140.dll vcruntime140d.dll"/> + <ROW Feature="MainFeature" Title="MainFeature" Description="Description" Display="1" Level="1" Directory_="APPDIR" Attributes="0" Components="AI_CustomARPName AI_ExePath ColorMine.dll CommandLine.dll CommandLine.xml ControlzEx.dll DocumentFormat.OpenXml.dll EFCache.dll EntityFramework.SqlServer.dll EntityFramework.dll FluentFTP.dll FontAwesome.WPF.dll Google.Protobuf.dll Hyak.Common.dll ICSharpCode.AvalonEdit.dll Interop.MSDASC.dll Ionic.Zip.dll JWT.dll License.lic Microsoft.Azure.ActiveDirectory.GraphClient.dll Microsoft.Azure.Common.NetFramework.dll Microsoft.Azure.Common.dll Microsoft.Azure.ResourceManager.dll Microsoft.Data.Edm.dll Microsoft.Data.OData.dll Microsoft.Data.Services.Client.dll Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll Microsoft.IdentityModel.Clients.ActiveDirectory.dll Microsoft.ServiceBus.dll Microsoft.SqlServer.AzureStorageEnum.dll Microsoft.SqlServer.ConnectionInfo.dll Microsoft.SqlServer.Diagnostics.STrace.dll Microsoft.SqlServer.Dmf.Common.dll Microsoft.SqlServer.Management.Sdk.Sfc.dll Microsoft.SqlServer.ServiceBrokerEnum.dll Microsoft.SqlServer.Smo.dll Microsoft.SqlServer.SqlClrProvider.dll Microsoft.SqlServer.SqlEnum.dll Microsoft.TeamFoundation.Client.dll Microsoft.TeamFoundation.Common.dll Microsoft.TeamFoundation.Core.WebApi.dll Microsoft.TeamFoundation.Diff.dll Microsoft.TeamFoundation.Work.WebApi.dll Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.dll Microsoft.TeamFoundation.WorkItemTracking.Client.dll Microsoft.TeamFoundation.WorkItemTracking.Common.dll Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll Microsoft.TeamFoundation.WorkItemTracking.WebApi.dll Microsoft.VisualStudio.Services.Client.Interactive.dll Microsoft.VisualStudio.Services.Common.dll Microsoft.VisualStudio.Services.WebApi.dll Microsoft.WindowsAzure.Storage.dll Newtonsoft.Json.dll OverrideData.xml ProductInformation SA.Binary.dll SA.CodeView.dll SA.CommonTypes.dll SA.CommonUI.dll SA.SCBaseProvider.dll SA.SQLDataExaminer.Engine.dll SA.SQLExaminer.Engine.dll SA.Utils.ErrorReporter.dll SHORTCUTDIR SQLDECmd.exe SQLECmd.exe SQLite.Interop.dll SQLite.Interop.dll_1 SimpleValidator.dll System.Data.SQLite.EF6.dll System.Data.SQLite.Linq.dll System.Data.SQLite.dll System.IO.Compression.FileSystem.dll System.IdentityModel.Tokens.Jwt.dll System.Net.Http.Formatting.dll System.Reactive.Core.dll System.Reactive.Interfaces.dll System.Reactive.Linq.dll System.Reactive.PlatformServices.dll System.Spatial.dll System.Web.Http.WebHost.dll System.Web.Http.dll System.Windows.Interactivity.dll Tango.AdvancedInstaller.dll Tango.AnimatedGif.dll Tango.BL.dll Tango.ColorLib.dll Tango.Core.dll Tango.Documents.dll Tango.DragAndDrop.dll Tango.Emulations.dll Tango.Explorer.dll Tango.FirmwareUpdateLib.WPF.dll Tango.FirmwareUpdateLib.dll Tango.Hive.dll Tango.Integration.dll Tango.Logging.dll Tango.PMR.dll Tango.PPC.BootScreen.exe Tango.PPC.Common.dll Tango.PPC.Events.dll Tango.PPC.Jobs.dll Tango.PPC.MachineSettings.dll Tango.PPC.Storage.dll Tango.PPC.Technician.dll Tango.PPC.UI.exe Tango.PPC.Updater.exe Tango.PPC.WatchDog.exe Tango.SQLExaminer.dll Tango.Scripting.dll Tango.Serialization.dll Tango.Settings.dll Tango.SharedUI.dll Tango.TFS.dll Tango.Touch.dll Tango.Transport.dll Tango.Web.dll Tango.WiFi.dll mscoree.dll msvcp140d.dll ucrtbased.dll vcruntime140.dll vcruntime140d.dll"/> <ATTRIBUTE name="CurrentFeature" value="MainFeature"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiFilesComponent"> @@ -487,8 +483,6 @@ </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiCreateFolderComponent"> <ROW Directory_="SHORTCUTDIR" Component_="SHORTCUTDIR" ManualDelete="false"/> - <ROW Directory_="ProtoCompilers_Dir" Component_="ProtoCompilers" ManualDelete="false"/> - <ROW Directory_="roslyn_Dir" Component_="roslyn" ManualDelete="false"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiCustActComponent"> <ROW Action="AI_BACKUP_AI_SETUPEXEPATH" Type="51" Source="AI_SETUPEXEPATH_ORIGINAL" Target="[AI_SETUPEXEPATH]"/> diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk Binary files differindex c6e1d0aed..4853e7fb3 100644 --- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk +++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 4717f932a..91fdbf3aa 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.0.18.0")] +[assembly: AssemblyVersion("4.0.19.0")] [assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationRequest.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationRequest.cs index ef991a7f2..6d3fe77ea 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationRequest.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationRequest.cs @@ -14,7 +14,7 @@ namespace Tango.PPC.Storage.Models public StorageNavigationIntent Intent { get; set; } /// <summary> - /// Gets or sets the file display filter (e.g .tup|.job|.ccp). + /// Gets or sets the file display filter (e.g .tup|.job|.tcc). /// </summary> public String Filter { get; set; } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj index e524c44cb..54683b41e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj @@ -43,6 +43,7 @@ <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> + <Reference Include="System.Management" /> <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> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs index 5f7002e78..47d5835f5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Management; using System.Text; using System.Threading.Tasks; using System.Timers; @@ -31,6 +32,13 @@ namespace Tango.PPC.Technician.ViewModels set { _ram = value; RaisePropertyChangedAuto(); } } + private double _temperature; + public double Temperature + { + get { return _temperature; } + set { _temperature = value; RaisePropertyChangedAuto(); } + } + public RelayCommand RestartCommand { get; set; } public RelayCommand ShutdownCommand { get; set; } @@ -106,6 +114,7 @@ namespace Tango.PPC.Technician.ViewModels { CPU = GetAppCPU(); RAM = GetAppRam(); + Temperature = GetTemperature(); } } @@ -146,5 +155,27 @@ namespace Tango.PPC.Technician.ViewModels Process proc = Process.GetCurrentProcess(); return proc.PrivateMemorySize64; } + + public double GetTemperature() + { + try + { + double cpuTemp = 0; + List<double> avg = new List<double>(); + ManagementObjectSearcher mos = new ManagementObjectSearcher(@"root\WMI", "Select * From MSAcpi_ThermalZoneTemperature"); + + foreach (System.Management.ManagementObject mo in mos.Get()) + { + cpuTemp = Convert.ToDouble(Convert.ToDouble(mo.GetPropertyValue("CurrentTemperature").ToString()) - 2732) / 10; + avg.Add(cpuTemp); + } + + return avg.Average(); + } + catch + { + return 0; + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml index dc13b2918..0b067b09b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml @@ -32,15 +32,20 @@ <Grid Grid.Row="1" Margin="20"> <DockPanel> - <UniformGrid DockPanel.Dock="Top" Columns="2" Margin="50" TextElement.FontSize="{StaticResource TangoHeaderFontSize}"> + <UniformGrid DockPanel.Dock="Top" Columns="3" Margin="50" TextElement.FontSize="{StaticResource TangoHeaderFontSize}"> <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold"> - <Run>CPU Usage:</Run> - <Run Text="{Binding CPU,Mode=OneWay,StringFormat='0.0'}"></Run><Run>%</Run> + <Run>CPU:</Run> + <Run Text="{Binding CPU,Mode=OneWay,StringFormat='0'}"></Run><Run>%</Run> </TextBlock> <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold"> - <Run>RAM Usage:</Run> - <Run Text="{Binding RAM,Mode=OneWay,Converter={StaticResource ByteArrayToFileSizeConverter}}"></Run> + <Run>RAM:</Run> + <Run Text="{Binding RAM,Mode=OneWay,Converter={StaticResource ByteArrayToFileSizeConverter},StringFormat='0'}"></Run> + </TextBlock> + + <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold"> + <Run>TEMP:</Run> + <Run Text="{Binding Temperature,Mode=OneWay,StringFormat='0 °C'}"></Run> </TextBlock> </UniformGrid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> + <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj index aed078a0d..05311004b 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj @@ -76,6 +76,8 @@ <Compile Include="Web\LoginResponse.cs" /> <Compile Include="Web\MachineRegistrationRequest.cs" /> <Compile Include="Web\MachineRegistrationResponse.cs" /> + <Compile Include="Web\ResultByEmailRequest.cs" /> + <Compile Include="Web\ResultByEmailResponse.cs" /> </ItemGroup> <ItemGroup> <Content Include="..\Benchmarks\benchmarks_rgb_lab.csv"> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultByEmailRequest.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultByEmailRequest.cs new file mode 100644 index 000000000..4b77fd144 --- /dev/null +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultByEmailRequest.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.TCC; +using Tango.Transport.Web; + +namespace Tango.TCC.BL.Web +{ + public class ResultByEmailRequest : WebRequestMessage + { + public String From { get; set; } + public String To { get; set; } + public String Message { get; set; } + public ColorDetectionResponse DetectionResponse { get; set; } + } +} diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultByEmailResponse.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultByEmailResponse.cs new file mode 100644 index 000000000..7a8b2bbdb --- /dev/null +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultByEmailResponse.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.TCC.BL.Web +{ + public class ResultByEmailResponse : WebResponseMessage + { + + } +} diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs index a28c2cb12..f95ff1c05 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs @@ -19,6 +19,9 @@ using Tango.TCC.Service.Security; using Tango.Web.Controllers; using Tango.Web.Security; using System.Data.Entity; +using SendGrid; +using SendGrid.Helpers.Mail; +using System.Web; namespace Tango.TCC.Service.Controllers { @@ -185,5 +188,36 @@ namespace Tango.TCC.Service.Controllers return response; } + + [JwtTokenFilter] + [HttpPost] + public ResultByEmailResponse SendResultByEmail(ResultByEmailRequest request) + { + ResultByEmailResponse response = new ResultByEmailResponse(); + + var client = new SendGridClient(TCCServiceConfig.SEND_GRID_API_KEY); + var from = new EmailAddress(request.From); + var subject = "SnapMatch Color Result"; + var to = new EmailAddress(request.To); + var plainTextContent = request.Message; + var htmlContent = $"<div style='color:red;'>{request.Message}.</strong>"; + var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); + + DetectionColorFile file = new DetectionColorFile(); + file.RawColor = request.DetectionResponse.RawColor; + file.ProcessedColor = request.DetectionResponse.ProcessedColor; + + var base64 = Convert.ToBase64String(file.ToBytes()); + msg.AddAttachment("SnapMatch Color.tcc", base64, "application/octet-stream"); + + var result = client.SendEmailAsync(msg).GetAwaiter().GetResult(); + + if(result.StatusCode != HttpStatusCode.Accepted) + { + throw new HttpException(result.StatusCode.ToString()); + } + + return response; + } } } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs index 343d27e0a..00a0f19f0 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs @@ -81,5 +81,10 @@ namespace Tango.TCC.Service /// Gets the database catalog. /// </summary> public static String TANGO_DB_CATALOG => ConfigurationManager.AppSettings[nameof(TANGO_DB_CATALOG)].ToString(); + + /// <summary> + /// Gets the Send Grid API key. + /// </summary> + public static String SEND_GRID_API_KEY => ConfigurationManager.AppSettings[nameof(SEND_GRID_API_KEY)].ToString(); } }
\ No newline at end of file diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj index b7042197c..d0372dcb2 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj @@ -59,12 +59,30 @@ <HintPath>..\..\packages\JWT.5.0.0\lib\net46\JWT.dll</HintPath> </Reference> <Reference Include="Microsoft.CSharp" /> + <Reference Include="SendGrid, Version=9.11.0.0, Culture=neutral, PublicKeyToken=4f047e93159395ca, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Sendgrid.9.11.0\lib\net452\SendGrid.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> + <Reference Include="System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\..\packages\System.Net.Http.4.3.3\lib\net46\System.Net.Http.dll</HintPath> + </Reference> <Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath> </Reference> + <Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath> + </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> + </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> + </Reference> + <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath> + </Reference> <Reference Include="System.Web.Cors, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\packages\Microsoft.AspNet.Cors.5.2.7\lib\net45\System.Web.Cors.dll</HintPath> </Reference> @@ -99,8 +117,6 @@ <Reference Include="Newtonsoft.Json"> <HintPath>..\..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> - <Reference Include="System.Net.Http"> - </Reference> <Reference Include="System.Net.Http.WebRequest"> </Reference> <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config index de53d7d14..831e845aa 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config @@ -41,6 +41,7 @@ <add key="ENABLE_DOUBLE_CHECKING" value="True" /> <add key="ENFORCE_BARCODE_DETECTION" value="True" /> <add key="APP_ID" value="Tdf793i4ughsiduf8749509237885ehgfdlkghlT" /> + <add key="SEND_GRID_API_KEY" value="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" /> </appSettings> @@ -135,6 +136,10 @@ <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" /> </dependentAssembly> + <!--<dependentAssembly> + <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2" /> + </dependentAssembly>--> </assemblyBinding> </runtime> <system.codedom> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config b/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config index 4cd640319..4d2a5fc05 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config @@ -29,6 +29,12 @@ <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" /> <package id="Modernizr" version="2.8.3" targetFramework="net461" /> <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net461" /> + <package id="Sendgrid" version="9.11.0" targetFramework="net461" /> <package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" /> + <package id="System.Net.Http" version="4.3.3" targetFramework="net461" /> + <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" /> + <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" /> + <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" /> + <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" /> <package id="WebGrease" version="1.6.0" targetFramework="net461" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Explorer/ExplorerFileDefinition.cs b/Software/Visual_Studio/Tango.Explorer/ExplorerFileDefinition.cs index 67f93dc6c..5df1900a4 100644 --- a/Software/Visual_Studio/Tango.Explorer/ExplorerFileDefinition.cs +++ b/Software/Visual_Studio/Tango.Explorer/ExplorerFileDefinition.cs @@ -53,7 +53,7 @@ namespace Tango.Explorer { Icon = ResourceHelper.GetImageFromResources("/Images/color.png"), Description = "Tango Color Profile", - Extension = ".ccp", + Extension = ".tcc", }; static ExplorerFileDefinition() diff --git a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs index 1195713cb..9a7289c41 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs @@ -277,22 +277,31 @@ namespace Tango.Integration.Operation private void InvalidateJobProgress(JobStatus s) { + bool invalidProgress = false; + + LogManager.Log($"Updating job progress {s.Progress}/{Status.TotalProgress}..."); + if (s.Progress < 0) { - LogManager.Log($"Negative job progress received '{s.Progress}'.", LogCategory.Error); + LogManager.Log($"Invalid job progress received '{s.Progress}'.", LogCategory.Error); + invalidProgress = true; } if (s.Progress > Status.TotalProgress) { LogManager.Log($"Invalid job progress received '{s.Progress}' while total progress is '{Status.TotalProgress}'.", LogCategory.Error); + invalidProgress = true; } - s.Progress = Math.Max(0, s.Progress); //Make sure the progress is not negative. - s.Progress = Math.Min(s.Progress, Status.TotalProgress); //Make sure the progress is less than total. - if (s.Progress < _last_progress) { LogManager.Log($"Invalid job progress received '{s.Progress}' while last progress was '{_last_progress}'."); + invalidProgress = true; + } + + if (invalidProgress) + { + return; } _last_progress = s.Progress; diff --git a/Software/Visual_Studio/Tango.PMR/TCC/DetectionColorFile.cs b/Software/Visual_Studio/Tango.PMR/TCC/DetectionColorFile.cs new file mode 100644 index 000000000..41c9a3b70 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/TCC/DetectionColorFile.cs @@ -0,0 +1,201 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DetectionColorFile.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.TCC { + + /// <summary>Holder for reflection information generated from DetectionColorFile.proto</summary> + public static partial class DetectionColorFileReflection { + + #region Descriptor + /// <summary>File descriptor for DetectionColorFile.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DetectionColorFileReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChhEZXRlY3Rpb25Db2xvckZpbGUucHJvdG8SDVRhbmdvLlBNUi5UQ0MaFERl", + "dGVjdGlvbkNvbG9yLnByb3RvInwKEkRldGVjdGlvbkNvbG9yRmlsZRIvCghS", + "YXdDb2xvchgBIAEoCzIdLlRhbmdvLlBNUi5UQ0MuRGV0ZWN0aW9uQ29sb3IS", + "NQoOUHJvY2Vzc2VkQ29sb3IYAiABKAsyHS5UYW5nby5QTVIuVENDLkRldGVj", + "dGlvbkNvbG9yQhkKF2NvbS50d2luZS50YW5nby5wbXIudGNjYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.TCC.DetectionColorReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.TCC.DetectionColorFile), global::Tango.PMR.TCC.DetectionColorFile.Parser, new[]{ "RawColor", "ProcessedColor" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DetectionColorFile : pb::IMessage<DetectionColorFile> { + private static readonly pb::MessageParser<DetectionColorFile> _parser = new pb::MessageParser<DetectionColorFile>(() => new DetectionColorFile()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<DetectionColorFile> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.TCC.DetectionColorFileReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DetectionColorFile() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DetectionColorFile(DetectionColorFile other) : this() { + RawColor = other.rawColor_ != null ? other.RawColor.Clone() : null; + ProcessedColor = other.processedColor_ != null ? other.ProcessedColor.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DetectionColorFile Clone() { + return new DetectionColorFile(this); + } + + /// <summary>Field number for the "RawColor" field.</summary> + public const int RawColorFieldNumber = 1; + private global::Tango.PMR.TCC.DetectionColor rawColor_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.TCC.DetectionColor RawColor { + get { return rawColor_; } + set { + rawColor_ = value; + } + } + + /// <summary>Field number for the "ProcessedColor" field.</summary> + public const int ProcessedColorFieldNumber = 2; + private global::Tango.PMR.TCC.DetectionColor processedColor_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.TCC.DetectionColor ProcessedColor { + get { return processedColor_; } + set { + processedColor_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DetectionColorFile); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DetectionColorFile other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(RawColor, other.RawColor)) return false; + if (!object.Equals(ProcessedColor, other.ProcessedColor)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (rawColor_ != null) hash ^= RawColor.GetHashCode(); + if (processedColor_ != null) hash ^= ProcessedColor.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 (rawColor_ != null) { + output.WriteRawTag(10); + output.WriteMessage(RawColor); + } + if (processedColor_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ProcessedColor); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (rawColor_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RawColor); + } + if (processedColor_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ProcessedColor); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DetectionColorFile other) { + if (other == null) { + return; + } + if (other.rawColor_ != null) { + if (rawColor_ == null) { + rawColor_ = new global::Tango.PMR.TCC.DetectionColor(); + } + RawColor.MergeFrom(other.RawColor); + } + if (other.processedColor_ != null) { + if (processedColor_ == null) { + processedColor_ = new global::Tango.PMR.TCC.DetectionColor(); + } + ProcessedColor.MergeFrom(other.ProcessedColor); + } + } + + [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: { + if (rawColor_ == null) { + rawColor_ = new global::Tango.PMR.TCC.DetectionColor(); + } + input.ReadMessage(rawColor_); + break; + } + case 18: { + if (processedColor_ == null) { + processedColor_ = new global::Tango.PMR.TCC.DetectionColor(); + } + input.ReadMessage(processedColor_); + 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 3a99d34da..e988574b1 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -258,6 +258,7 @@ <Compile Include="Stubs\*.cs" /> <Compile Include="TCC\DetectionBenchmark.cs" /> <Compile Include="TCC\DetectionColor.cs" /> + <Compile Include="TCC\DetectionColorFile.cs" /> <Compile Include="TCC\DetectionInput.cs" /> <Compile Include="TCC\DetectionOutput.cs" /> </ItemGroup> @@ -277,7 +278,7 @@ </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.xaml index 769efd930..589194276 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.xaml @@ -6,10 +6,66 @@ <ResourceDictionary Source="../Resources/Colors.xaml" /> </ResourceDictionary.MergedDictionaries> - <Style TargetType="{x:Type local:TouchProgressBar}" BasedOn="{StaticResource {x:Type ProgressBar}}"> - <Setter Property="Background" Value="{StaticResource TangoGrayBrush}"></Setter> - <Setter Property="BorderThickness" Value="0"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Style TargetType="{x:Type local:TouchProgressBar}"> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"/> + <Setter Property="Background" Value="{StaticResource TangoGrayBrush}"/> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ProgressBar}"> + <Grid x:Name="TemplateRoot"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Determinate"/> + <VisualState x:Name="Indeterminate"> + <Storyboard RepeatBehavior="Forever"> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Animation"> + <EasingDoubleKeyFrame KeyTime="0" Value="0.25"/> + <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/> + <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/> + </DoubleAnimationUsingKeyFrames> + <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="Animation"> + <EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/> + <EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/> + <EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/> + </PointAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/> + <Rectangle x:Name="PART_Track"/> + <Grid x:Name="PART_Indicator" ClipToBounds="true" HorizontalAlignment="Left"> + <Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}"/> + <Rectangle x:Name="Animation" Fill="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5"> + <Rectangle.RenderTransform> + <TransformGroup> + <ScaleTransform/> + <SkewTransform/> + <RotateTransform/> + <TranslateTransform/> + </TransformGroup> + </Rectangle.RenderTransform> + </Rectangle> + </Grid> + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="Orientation" Value="Vertical"> + <Setter Property="LayoutTransform" TargetName="TemplateRoot"> + <Setter.Value> + <RotateTransform Angle="-90"/> + </Setter.Value> + </Setter> + </Trigger> + <Trigger Property="IsIndeterminate" Value="true"> + <Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> </Style> + + </ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.UnitTesting/App.config b/Software/Visual_Studio/Tango.UnitTesting/App.config index 1261bcbe9..0490d020e 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/App.config +++ b/Software/Visual_Studio/Tango.UnitTesting/App.config @@ -63,7 +63,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <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" /> @@ -71,27 +71,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> + <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.3.0" newVersion="4.0.3.0" /> + <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.2.0" newVersion="4.0.2.0" /> + <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.1.0.0" newVersion="4.1.0.0" /> + <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.2.0" newVersion="4.0.2.0" /> + <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.1.0.0" newVersion="4.1.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> @@ -107,7 +107,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> @@ -117,6 +117,10 @@ <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2" /> + </dependentAssembly> </assemblyBinding> </runtime> <system.data> diff --git a/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs new file mode 100644 index 000000000..785fa42bf --- /dev/null +++ b/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs @@ -0,0 +1,39 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using SendGrid; +using SendGrid.Helpers.Mail; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.UnitTesting.SendGrid +{ + [TestClass] + [TestCategory("SendGrid")] + public class SendGrid_TST + { + private const string KEY = "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"; + + [TestMethod] + public void Send_Simple_Email() + { + var client = new SendGridClient(KEY); + var from = new EmailAddress("test@example.com", "Example User"); + var subject = "Sending with SendGrid is Fun"; + var to = new EmailAddress("roy@twine-s.com", "Roy Ben Shabat"); + var plainTextContent = "and easy to do anywhere, even with C#"; + var htmlContent = "<div style='color:red;'>and easy to do anywhere, even with C#</strong>"; + var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); + + var bytes = File.ReadAllBytes(@"D:\Downloads\Twine TWN Spec (3).pdf"); + var file = Convert.ToBase64String(bytes); + msg.AddAttachment("Twine Spec.pdf", file, "application/pdf"); + + var response = client.SendEmailAsync(msg).GetAwaiter().GetResult(); + + Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.Accepted); + } + } +} diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 6fd23451d..c7a2cc451 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -84,6 +84,9 @@ <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> + <Reference Include="SendGrid, Version=9.11.0.0, Culture=neutral, PublicKeyToken=4f047e93159395ca, processorArchitecture=MSIL"> + <HintPath>..\packages\Sendgrid.9.11.0\lib\net452\SendGrid.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Configuration" /> @@ -103,10 +106,24 @@ <Private>True</Private> </Reference> <Reference Include="System.Drawing" /> - <Reference Include="System.Net.Http" /> + <Reference Include="System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Net.Http.4.3.3\lib\net46\System.Net.Http.dll</HintPath> + </Reference> <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath> </Reference> + <Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath> + </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> + </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> + </Reference> + <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath> + </Reference> <Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath> </Reference> @@ -126,6 +143,7 @@ <Compile Include="MachineStudio\MachineStudio_TST.cs" /> <Compile Include="Pulse\Pulse_TST.cs" /> <Compile Include="RemoteRunner_TST.cs" /> + <Compile Include="SendGrid\SendGrid_TST.cs" /> <Compile Include="SQLExaminer\SQLExaminer_TST.cs" /> <Compile Include="Core\TemporaryManager_TST.cs" /> <Compile Include="TCC\TCC_TST.cs" /> @@ -289,7 +307,7 @@ <Import Project="..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.UnitTesting/packages.config b/Software/Visual_Studio/Tango.UnitTesting/packages.config index e3fc2d3b6..f6feb1f49 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/packages.config +++ b/Software/Visual_Studio/Tango.UnitTesting/packages.config @@ -11,9 +11,15 @@ <package id="MSTest.TestAdapter" version="1.1.11" targetFramework="net45" /> <package id="MSTest.TestFramework" version="1.1.11" targetFramework="net45" /> <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" /> + <package id="Sendgrid" version="9.11.0" targetFramework="net461" /> <package id="System.Data.SQLite" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.EF6" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.Linq" version="1.0.108.0" targetFramework="net46" /> + <package id="System.Net.Http" version="4.3.3" targetFramework="net461" /> + <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" /> + <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" /> + <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" /> + <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" /> <package id="TestStack.White" version="0.13.3" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 880ff9c4a..a3e349ad0 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -5296,12 +5296,12 @@ Global {B822CBD9-1113-4668-85C9-22AA9C24CE60} = {EC62BC9C-F2FE-4333-B7E4-110E38D43958} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - BuildVersion_UseGlobalSettings = False - BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs - BuildVersion_StartDate = 2000/1/1 - BuildVersion_UpdateFileVersion = False - BuildVersion_UpdateAssemblyVersion = True - BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} + BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear + BuildVersion_UpdateAssemblyVersion = True + BuildVersion_UpdateFileVersion = False + BuildVersion_StartDate = 2000/1/1 + BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs + BuildVersion_UseGlobalSettings = False EndGlobalSection EndGlobal diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml index ab76a9745..3f189f28f 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml @@ -17,12 +17,6 @@ Title="MainWindow" Height="346.703" Width="716.514" DataContext="{Binding RelativeSource={RelativeSource Self}}"> <Grid> - <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center"> - <TextBlock HorizontalAlignment="Center" Margin="0 0 0 10" x:Name="txtStatus"></TextBlock> - <ProgressBar x:Name="prog" VerticalAlignment="Center" Height="15" Width="700"></ProgressBar> - <Button x:Name="btnStart" Click="btnStart_Click" HorizontalAlignment="Center" Padding="30 10" Margin="0 10 0 0">LOAD JOBS</Button> - <Button x:Name="btnChange" Click="btnChange_Click" HorizontalAlignment="Center" Padding="30 10" Margin="0 10 0 0">CHANGE JOB</Button> - <Button x:Name="btnListen" Click="btnListen_Click" HorizontalAlignment="Center" Padding="30 10" Margin="0 10 0 0">START LISTEN</Button> - </StackPanel> + <touch:TouchProgressBar Width="300" Height="10" Maximum="100" Value="50" /> </Grid> </Window> diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs index 2fad8b46b..6c24121ba 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs @@ -47,9 +47,9 @@ namespace Tango.UITests /// </summary> public partial class MainWindow : Window { - private ITableDependency _dep; + //private ITableDependency _dep; - private DataSource _dataSource; + //private DataSource _dataSource; public MainWindow() { @@ -69,11 +69,11 @@ namespace Tango.UITests //this.Closing += MainWindow_Closing; - CmdCommand command = new CmdCommand("wmic", "pagefile list /format:list"); - var result = command.Run().Result; + //CmdCommand command = new CmdCommand("wmic", "pagefile list /format:list"); + //var result = command.Run().Result; - Regex regEx = new Regex("Name=(.+)"); - var pageFiles = regEx.Matches(result.StandardOutput).OfType<Match>().Select(x => x.Groups.OfType<Group>().LastOrDefault()).ToList().Select(x => x.Value.Replace("\n", "").Replace("\r", "")).ToList(); + //Regex regEx = new Regex("Name=(.+)"); + //var pageFiles = regEx.Matches(result.StandardOutput).OfType<Match>().Select(x => x.Groups.OfType<Group>().LastOrDefault()).ToList().Select(x => x.Value.Replace("\n", "").Replace("\r", "")).ToList(); @@ -82,71 +82,71 @@ namespace Tango.UITests } - private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) - { - if (_dep != null) - { - _dep.Stop(); - _dep.Dispose(); - } - } + //private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) + //{ + // //if (_dep != null) + // //{ + // // _dep.Stop(); + // // _dep.Dispose(); + // //} + //} - private void btnStart_Click(object sender, RoutedEventArgs e) - { - Stopwatch watch = Stopwatch.StartNew(); + //private void btnStart_Click(object sender, RoutedEventArgs e) + //{ + // Stopwatch watch = Stopwatch.StartNew(); - using (ObservablesContext db = ObservablesContext.CreateDefault(_dataSource)) - { - var users = db.Users.ToList(); - var jobs = new JobsCollectionBuilder(db).SetAll().WithSegments().WithBrushStops().Build(); - var first_job = jobs.First(); + // using (ObservablesContext db = ObservablesContext.CreateDefault(_dataSource)) + // { + // var users = db.Users.ToList(); + // var jobs = new JobsCollectionBuilder(db).SetAll().WithSegments().WithBrushStops().Build(); + // var first_job = jobs.First(); - if (first_job.Name == "Changed Name 2") - { - Debug.WriteLine("Changed and cached !!!"); - } - else - { - Debug.WriteLine("Not working."); - } - } + // if (first_job.Name == "Changed Name 2") + // { + // Debug.WriteLine("Changed and cached !!!"); + // } + // else + // { + // Debug.WriteLine("Not working."); + // } + // } - Debug.WriteLine($"Time to complete: {watch.Elapsed.TotalSeconds} seconds"); - } + // Debug.WriteLine($"Time to complete: {watch.Elapsed.TotalSeconds} seconds"); + //} - private void btnChange_Click(object sender, RoutedEventArgs e) - { - using (ObservablesContext db = ObservablesContext.CreateDefault(_dataSource)) - { - var jobs = new JobsCollectionBuilder(db).SetAll().WithSegments().WithBrushStops().Build(); - var first_job = jobs.First(); - first_job.Name = "Changed Name 2"; - db.SaveChanges(); - } - } + //private void btnChange_Click(object sender, RoutedEventArgs e) + //{ + // using (ObservablesContext db = ObservablesContext.CreateDefault(_dataSource)) + // { + // var jobs = new JobsCollectionBuilder(db).SetAll().WithSegments().WithBrushStops().Build(); + // var first_job = jobs.First(); + // first_job.Name = "Changed Name 2"; + // db.SaveChanges(); + // } + //} - private void btnListen_Click(object sender, RoutedEventArgs e) - { - String str = _dataSource.ToConnection().ConnectionString; + //private void btnListen_Click(object sender, RoutedEventArgs e) + //{ + // String str = _dataSource.ToConnection().ConnectionString; - var dep = new SqlTableDependency<DAL.Remote.DB.USER>(str, "USERS", "dbo"); - dep.TraceLevel = TraceLevel.Verbose; - dep.TraceListener = new TextWriterTraceListener(Console.Out); + // var dep = new SqlTableDependency<DAL.Remote.DB.USER>(str, "USERS", "dbo"); + // dep.TraceLevel = TraceLevel.Verbose; + // dep.TraceListener = new TextWriterTraceListener(Console.Out); - dep.OnChanged += Changed; - dep.Start(); + // dep.OnChanged += Changed; + // dep.Start(); - _dep = dep; - } + // _dep = dep; + //} - private void Changed(object sender, RecordChangedEventArgs<DAL.Remote.DB.USER> e) - { - var changedEntity = e.Entity; + //private void Changed(object sender, RecordChangedEventArgs<DAL.Remote.DB.USER> e) + //{ + // var changedEntity = e.Entity; - Console.WriteLine("DML operation: " + e.ChangeType); + // Console.WriteLine("DML operation: " + e.ChangeType); - Console.WriteLine(changedEntity.ToJsonString()); - } + // Console.WriteLine(changedEntity.ToJsonString()); + //} } } |
