Example #1
0
        void EventWaterfall(InteractionModel interaction, bool willHover, bool willTouch, bool willGrab)
        {
            if ((!willHover || !willTouch || !willGrab) && interaction.isGrabbed)
            {
                Grab(interaction, false);
            }

            if ((!willHover || !willTouch) && interaction.isTouched)
            {
                Touch(interaction, false);
            }

            if (!willHover && interaction.isHovered)
            {
                Hover(interaction, false);
            }

            if (willHover && !interaction.isHovered)
            {
                Hover(interaction, true);
            }

            if (willTouch && interaction.isHovered && !interaction.isTouched)
            {
                Touch(interaction, true);
            }

            if (willGrab && interaction.isHovered && interaction.isTouched && !interaction.isGrabbed)
            {
                Grab(interaction, true);
            }
        }
Example #2
0
        void OnEnter(Rigidbody rb, bool isSpecial)
        {
            InteractableRef interactableRef = rb.GetComponent <InteractableRef>();

            if (!interactableRef)
            {
                return;
            }

            InteractionModel interaction = model.interactions.Find(x => x.interactable == interactableRef.interactable);

            if (interaction != null)
            {
                if (interaction.totalTouchCount == 0)
                {
                    Touch(interaction, true);
                }

                interaction.totalTouchCount++;
                if (isSpecial)
                {
                    interaction.specialTouchCount++;
                }
            }
        }
Example #3
0
        public Task <Result <List <ProcessedLanguage> > > ProcessAll(string input, InteractionModel languageModel)
        {
            try
            {
                var intentMatches = new List <ProcessedLanguage>();
                foreach (var intent in languageModel.Intents)
                {
                    foreach (var utterance in intent.Utterances)
                    {
                        var slots = MatchSlots(input, utterance);
                        if (slots != null)
                        {
                            intentMatches.Add(new ProcessedLanguage
                            {
                                Intent = intent.Name["voicify"],
                                Slots  = slots,
                            });
                        }
                    }
                }

                return(Task.FromResult <Result <List <ProcessedLanguage> > >(new SuccessResult <List <ProcessedLanguage> >(intentMatches)));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(Task.FromResult <Result <List <ProcessedLanguage> > >(new UnexpectedResult <List <ProcessedLanguage> >()));
            }
        }
Example #4
0
 void Start()
 {
     s = GetComponent <InteractionModel> ();
     s.triggerUpEvents   += HandleTriggerUp;
     s.triggerDownEvents += HandleTriggerDown;
     s.highlightEvents   += HandleHighlight;
 }
Example #5
0
        void OnExit(Rigidbody rb, bool isSpecial)
        {
            InteractableRef interactableRef = rb.GetComponent <InteractableRef>();

            if (!interactableRef)
            {
                return;
            }

            InteractionModel interaction = model.interactions.Find(x => x.interactable == interactableRef.interactable);

            if (interaction != null)
            {
                if (interaction.totalTouchCount == 1)
                {
                    Touch(interaction, false);
                }

                if (interaction.totalTouchCount > 0)
                {
                    interaction.totalTouchCount--;
                }
                if (interaction.specialTouchCount > 0 && isSpecial)
                {
                    interaction.specialTouchCount--;
                }
            }
        }
Example #6
0
 public CitiesAdapter(Activity context, InteractionModel model)
 {
     _context             = context;
     _model               = model;
     _fitler              = new Lazy <CitySuggestionsFilter>(() => new CitySuggestionsFilter(this), true);
     model.CitiesChanged += Model_CitiesChanged;
     UpdateCities();
 }
Example #7
0
        // GET api/<controller>
        public List <InteractionModel> Get()
        {
            List <InteractionModel> tmp = new List <InteractionModel>();

            InteractionManager manager = new InteractionManager();
            var interactions           = manager.GetAll();

            interactions.ToList().ForEach(a => tmp.Add(InteractionModel.Convert(a)));

            return(tmp);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            _authorizationProgressDialogDecorator = new ProgressDialogDecorator(this, Resources.GetString(Resource.String.AuthorizingTitle), Resources.GetString(Resource.String.AuthorizingMessage));
            MainActivity mainActiviy = UIHelper.GetUpperActivity <MainActivity>(this, bundle);

            if (mainActiviy != null)
            {
                _interactionModel = mainActiviy.Model;
                if (_interactionModel != null)
                {
                    _cityModel = _interactionModel.CurrentCity;
                }
            }
            SetContentView(Resource.Layout.AuthenticationLayout);
            //HookModel();
        }
Example #9
0
        void OnExit_Hover(Rigidbody rb)
        {
            InteractableRef interactableRef = rb.GetComponent <InteractableRef>();

            if (!interactableRef)
            {
                return;
            }

            InteractionModel interaction = model.interactions.Find(x => x.interactable == interactableRef.interactable);

            if (interaction != null)
            {
                Hover(interaction, false);

                // Update() will .Remove unhovered interactions after calling EventWaterfall()
            }
        }
Example #10
0
 public InteractionLogic(InteractionModel model, AdaptersExtender adaptersExtender)
 {
     _model                        = model;
     _adaptersExtender             = adaptersExtender;
     model.CurrentCityChanged     += Model_CurrentCityChanged;
     model.EnumerateCitiesDelegate = EnumerateCities;
     _settings                     = new SettingsLogic(new SettingsModel(_adaptersExtender.ServicesFactory.GetCurrentSettingsService()), _adaptersExtender, this);
     _settings.Model.LoadSettings();
     _map = new MapLogic(new MapModel(_adaptersExtender.ServicesFactory.GetCurrentMapService()), _adaptersExtender, this);
     _adaptersExtender.ServicesFactory.GetCurrentDataService().ConnectionStateChanged += InteractionLogic_ConnectionStateChanged;
     _cities = new UpdatableCollectionLoadDecorator <CityLogic, ICityInfo>(RetriveCities, CompareCityInfo, c => true, CreateCityLogic);
     _cities.RequestFailed += Cities_RequestFailed;
     UpdateConnectionStateInfo();
     //System.Threading.Tasks.Task.Factory.StartNew(() =>
     //{
     adaptersExtender.ServicesFactory.GetCurrentHardwareService().LocationChanged += CityLogic_LocationChanged;
     //adaptersExtender.ServicesFactory.GetCurrentHardwareService().RequestLocation();
     //});
 }
Example #11
0
    private void OnTriggerEnter(Collider other)
    {
        Placeable        placeable = other.GetComponentInParent <Placeable>();
        InteractionModel model     = other.GetComponentInParent <InteractionModel>();

        if (placeable)
        {
            Debug.Log("destroyed: " + placeable.gameObject);
            Destroy(placeable);
            Destroy(placeable.gameObject);
        }
        else if (model)
        {
            Debug.Log("destroyed: " + model.gameObject);
            Destroy(model.transform.parent.gameObject);
            Destroy(GameObject.FindObjectOfType <BoundingBox>().gameObject);
            CursorFeedback.Instance.ActivateManipulationModeFeedback(HoloToolkit.Unity.InputModule.Utilities.Interactions.ManipulationMode.None);
        }
    }
        public IHttpActionResult AuthenticateAsPedestrian(PedestrianAuthenticationDTO authenticationInfo)
        {
            InteractionModel interactionModel = InteractionModel.Instance;
            CityModel        cityModel        = interactionModel.Cities.FirstOrDefault(city => city.Id == authenticationInfo.CityId);

            if (cityModel == null)
            {
                return(InternalServerError());
            }
            PedestrianDTO outResult = new PedestrianDTO
            {
                Id          = Guid.NewGuid().ToString(),
                Latitude    = authenticationInfo.Latitude,
                Longitude   = authenticationInfo.Longitude,
                PhoneNumber = authenticationInfo.PhoneNumber,
                SkypeNumber = authenticationInfo.SkypeNumber
            };

            cityModel.AddPedestrian(outResult);
            return(Ok <PedestrianDTO>(outResult));
        }
        public IHttpActionResult AuthenticateAsDriver(DriverAuthenticationDTO authenticationInfo)
        {
            InteractionModel interactionModel = InteractionModel.Instance;
            CityModel        cityModel        = interactionModel.Cities.FirstOrDefault(city => city.Id == authenticationInfo.CityId);

            if (cityModel == null)
            {
                return(InternalServerError());
            }
            return(Ok <DriverDTO>(new DriverDTO
            {
                Id = Guid.NewGuid().ToString(),
                Latitude = authenticationInfo.Latitude,
                Longitude = authenticationInfo.Longitude,
                PhoneNumber = authenticationInfo.PhoneNumber,
                SkypeNumber = authenticationInfo.SkypeNumber,
                PersonName = authenticationInfo.PersonName,
                CarBrand = authenticationInfo.CarBrand,
                CarColor = authenticationInfo.CarColor,
                CarNumber = authenticationInfo.CarNumber
            }));
        }
Example #14
0
        void OnEnter_Hover(Rigidbody rb)
        {
            InteractableRef interactableRef = rb.GetComponent <InteractableRef>();

            if (!interactableRef)
            {
                return;
            }

            InteractionModel interaction = model.interactions.Find(x => x.interactable == interactableRef.interactable);

            if (interaction == null)
            {
                interaction = new InteractionModel();
                interaction.interactable = interactableRef.interactable;
                interaction.interactor   = this;

                model.interactions.Add(interaction);

                Hover(interaction, true);
            }
        }
Example #15
0
        void Grab(InteractionModel interaction, bool willGrab)
        {
            if (interaction.isGrabbed == willGrab)
            {
                return;
            }

            interaction.isGrabbed = willGrab;

            if (willGrab)
            {
                interaction.interactable.onGrab.Invoke(interaction);
                interaction.interactor.onGrab.Invoke(interaction);

                model.totalGrabbing++;
            }
            else
            {
                interaction.interactable.onUngrab.Invoke(interaction);
                interaction.interactor.onUngrab.Invoke(interaction);

                model.totalGrabbing--;
            }
        }
Example #16
0
        void Hover(InteractionModel interaction, bool willHover)
        {
            if (interaction.isHovered == willHover)
            {
                return;
            }

            interaction.isHovered = willHover;

            if (willHover)
            {
                interaction.interactable.onHover.Invoke(interaction);
                interaction.interactor.onHover.Invoke(interaction);

                model.totalHovering++;
            }
            else
            {
                interaction.interactable.onUnhover.Invoke(interaction);
                interaction.interactor.onUnhover.Invoke(interaction);

                model.totalHovering--;
            }
        }
Example #17
0
        void Touch(InteractionModel interaction, bool willTouch)
        {
            if (interaction.isTouched == willTouch)
            {
                return;
            }

            interaction.isTouched = willTouch;

            if (willTouch)
            {
                interaction.interactable.onTouch.Invoke(interaction);
                interaction.interactor.onTouch.Invoke(interaction);

                model.totalTouching++;
            }
            else
            {
                interaction.interactable.onUntouch.Invoke(interaction);
                interaction.interactor.onUntouch.Invoke(interaction);

                model.totalTouching--;
            }
        }
Example #18
0
 public InteractionPresenter(DataSetManagerPresenter dataSetPresenter)
 {
     this.dataSetPresenter = dataSetPresenter;
     this.model            = new InteractionModel();
 }
Example #19
0
        public IActionResult EncryptMessage(InteractionModel interactModel)
        {
            //Generate url's file
            string filePublicKey = parameters.Value.FilesOutput + parameters.Value.PubKeyFile + interactModel.userNameDestination + interactModel.userNameOrigin;
            //Initialize models and classes
            SendMessageModel      sendFirstMessage = new SendMessageModel();
            RSAEncryption         rsaEncrypt       = new RSAEncryption();
            RSASigning            rsaSigning       = new RSASigning(interactModel.userNameDestination + interactModel.userNameOrigin);
            AESEncryption         aesEncryption    = new AESEncryption(parameters.Value.KeyAESSize);
            ResponseSignData      responseSign     = new ResponseSignData();
            ResponseSignData      responseSignId   = new ResponseSignData();
            ResponseEncryptAES    responseAES      = new ResponseEncryptAES();
            ResponseEncryptAESKey responseAESKey   = new ResponseEncryptAESKey();

            // Looking for partner RSA public key
            if (rsaEncrypt.KeysPartnerExists(interactModel.userNameDestination + interactModel.userNameOrigin, filePublicKey))
            {
                FileWriter.WriteOnEvents(EventLevel.Info, "Llaves RSA para cifrado encontradas.");
                FileWriter.WriteOnEvents(EventLevel.Info, "Iniciando firmado de mensaje.");
                //Sign data with RSA Private Key
                responseSign = rsaSigning.signData(interactModel.mensaje);
                if (responseSign.result)
                {
                    //Encrypt Message
                    if (aesEncryption.generateProperties())
                    {
                        responseAES = aesEncryption.EncryptMessage(interactModel.mensaje);
                        if (!responseAES.result)
                        {
                            FileWriter.WriteOnEvents(EventLevel.Error, "Error en el proceso de cifrado de mensaje, verifique los eventos previos.");
                            return(BadRequest(sendFirstMessage));
                        }
                    }
                }
                else
                {
                    FileWriter.WriteOnEvents(EventLevel.Error, "Falla en intento de firma de mensaje, verificar logs anteriores.");
                    return(BadRequest(sendFirstMessage));
                }
            }
            else
            {
                FileWriter.WriteOnEvents(EventLevel.Error,
                                         "Imposible cifrar mensaje, llaves RSA para origen:" +
                                         interactModel.userNameOrigin + "\tdestino:" + interactModel.userNameDestination + " no encontradas");
                return(BadRequest(sendFirstMessage));
            }
            //Encrypt AES Key
            if (responseAES.privateKey != null)
            {
                FileWriter.WriteOnEvents(EventLevel.Info, "Iniciando proceso de cifrado llaves AES con RSA");
                responseAESKey = rsaEncrypt.EncryptAESKey(responseAES.privateKey, filePublicKey);
            }
            else
            {
                FileWriter.WriteOnEvents(EventLevel.Error, "Error en cifrado llave AES con RSA, no existe la llave de AES.");
                return(BadRequest(sendFirstMessage));
            }
            //Generate de sign for server identification
            //responseSignId = rsaSigning.signData(interactModel.userNameOrigin+interactModel.userNameDestination);
            //if(!responseSignId.result){
            //     FileWriter.WriteOnEvents(EventLevel.Error,"Falla en intento de firma de identificacion contra servidor, verificar logs anteriores.");

            //     return BadRequest(sendFirstMessage);
            // }
            //Call the server service and send the data model
            //ServerRequest server = new ServerRequest(parameters.Value.EndpointServer,parameters.Value.SendFirstMessage,parameters.Value.GetRequest);

            sendFirstMessage.encryptedMessage    = responseAES.encryptedData;
            sendFirstMessage.encryptSignature    = responseSign.signData;
            sendFirstMessage.encryptedKey        = responseAESKey.encryptedKey;
            sendFirstMessage.idSignature         = responseSignId.signData;
            sendFirstMessage.initVector          = responseAES.InitVector;
            sendFirstMessage.userNameOrigin      = interactModel.userNameOrigin;
            sendFirstMessage.userNameDestination = interactModel.userNameDestination;

            FileWriter.WriteOnEvents(EventLevel.Info, "Solicitud de envio de llave exitoso.");
            return(Ok(sendFirstMessage));
        }
Example #20
0
        static void Main(string[] args)
        {
            var MyUnitOfWork = new UnitOfWork();

            var student1 = new Student("Alex", "Stoica");
            var student2 = new Student("Tudor", "Melnic");

            var profesor = new Profesor();

            var course  = new Course("Dotnet", profesor.Id);
            var course2 = new Course("CLIW", profesor.Id);

            profesor.Update("Valeriu", "Mardare", course.Id);

            var room  = new Room(course.Id, profesor.Id);
            var room2 = new Room(course.Id, profesor.Id);

            course.SetGeneralRoomId(room);


            var question1 = new Question(student1.Id, room.Id, "student", "Se da cursul asta in sesiune?");

            var question2 = new Question(student2.Id, room.Id, "student", "Putem pleca?");
            var question3 = new Question(student2.Id, room.Id, "student", "Cum rezolvam?");
            var question4 = new Question(student2.Id, room2.Id, "student", "Se face seminarul maine?");
            var question5 = new Question(student2.Id, room2.Id, "student", "Are cineva modele de examen?");

            var answer1 = new Answer(profesor.Id, question1.Id, "Nu", "professor");
            var answer2 = new Answer(profesor.Id, question2.Id, "Nu stiu", "professor");
            var answer3 = new Answer(profesor.Id, question2.Id, "Merge", "professor");

            MyUnitOfWork.StudentRepository.Add(student1);
            MyUnitOfWork.StudentRepository.Add(student2);

            MyUnitOfWork.ProfesorRepository.Add(profesor);

            MyUnitOfWork.CourseRepository.Add(course);
            MyUnitOfWork.CourseRepository.Add(course2);

            MyUnitOfWork.RoomRepository.Add(room);
            MyUnitOfWork.RoomRepository.Add(room2);


            MyUnitOfWork.QuestionRepository.Add(question1);
            MyUnitOfWork.QuestionRepository.Add(question2);
            MyUnitOfWork.QuestionRepository.Add(question3);
            MyUnitOfWork.QuestionRepository.Add(question4);
            MyUnitOfWork.QuestionRepository.Add(question5);


            MyUnitOfWork.AnswerRepository.Add(answer1);
            MyUnitOfWork.AnswerRepository.Add(answer2);
            MyUnitOfWork.AnswerRepository.Add(answer3);

            var relationship1 = new StudentCourseRelationship(student1.Id, course.Id);
            var relationship2 = new StudentCourseRelationship(student2.Id, course.Id);
            var relationship3 = new StudentCourseRelationship(student2.Id, course2.Id);

            var StudRoomRel1  = new StudentRoomRelationship(student1.Id, room.Id);
            var StudRoomRel2  = new StudentRoomRelationship(student2.Id, room.Id);
            var StudRoomRel11 = new StudentRoomRelationship(student1.Id, room.Id);

            MyUnitOfWork.StudentCourseRelationshipRepository.Add(relationship1);
            MyUnitOfWork.StudentCourseRelationshipRepository.Add(relationship2);
            MyUnitOfWork.StudentCourseRelationshipRepository.Add(relationship3);

            MyUnitOfWork.StudentRoomRelationshipRepository.Add(StudRoomRel1);
            MyUnitOfWork.StudentRoomRelationshipRepository.Add(StudRoomRel2);
            MyUnitOfWork.StudentRoomRelationshipRepository.Add(StudRoomRel11);

            MyUnitOfWork.Commit();

            var peopleModel      = new PeopleModel();
            var coursesModel     = new CoursesModel();
            var interactionModel = new InteractionModel();

            //System.Console.Write(peopleModel.GetStudent(student1.Id).FirstName);
            //System.Console.Write(peopleModel.GetProfesor(profesor.Id).FirstName);

            foreach (Student student in coursesModel.GetStudentsByCourse(course.Id))
            {
                System.Console.WriteLine("Student la CourseId " + student.FirstName);
            }
            foreach (Answer answer in interactionModel.GetAnswersByQuestionId(question2.Id))
            {
                System.Console.WriteLine(answer.Id);
            }
            foreach (Student student in coursesModel.GetStudentsByRoomId(room.Id))
            {
                System.Console.WriteLine("Student la RoomId " + student.FirstName);
            }
            System.Console.Read();
        }
Example #21
0
 private void Initialise3DModel()
 {
     tempModel = Instantiate(interactionModelPrefab);
     interactionModelParent = tempModel.GetComponentInChildren <InteractionModel>();
 }