示例#1
0
 public Person()
 {
     this.birthday = new Birthday();
     this.contactInformation = new ContactInformation();
     this.name = new PersonalName();
     this.healthInformation = new HealthInformation();
 }
示例#2
0
 private async  void bt_add_Click(object sender, RoutedEventArgs e)
 {
     //创建一个系统通信可以读写和其他程序制度的联系人存储
     ContactStore conStore = await ContactStore.CreateOrOpenAsync(ContactStoreSystemAccessMode.ReadWrite, ContactStoreApplicationAccessMode.ReadOnly);
     //新增联系人
     ContactInformation conInfo = new ContactInformation();
     //获取ContacInformation类的属性map表
     var properties = await conInfo.GetPropertiesAsync();
     //添加电话属性
     properties.Add(KnownContactProperties.FamilyName, "test");
     properties.Add(KnownContactProperties.Telephone, "123456789");
  
     //创建联系人对象
     StoredContact storedContact = new StoredContact(conStore, conInfo);
     //获取安装包的一张图片文件用作联系人的头像
     StorageFile imagefile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("Assets/1.jpeg");
         
     
     ///设置头像,将图片数据转化成Stream对象,在转化成IInputStream对象。
     //打开文件的可读数据流
     Stream stream = await imagefile.OpenStreamForReadAsync();
     //用Stream对象转化成为IIputStream对象
     IInputStream inputStream = stream.AsInputStream();
     //用IInputStream 对象设置为联系人头像
     await storedContact.SetDisplayPictureAsync(inputStream);
     //保存联系人
     await storedContact.SaveAsync();
     
     ///获取头像,接收到的图片数据为IRandomAccessStream类型,如果要展示出来,需要创建一个BitmapImage对象,
     IRandomAccessStream raStream = await storedContact.GetDisplayPictureAsync();
     BitmapImage bi = new BitmapImage();
     bi.SetSource(raStream);
     image.Source = bi;
 }
示例#3
0
        public async Task <ContactInformation> AddContact(ContactInformation contactInformation)
        {
            var result = await _DbContext.contactInformation.AddAsync(contactInformation);

            contactInformation.Status = Enums.ContactStatus.Active.ToString();
            await _DbContext.SaveChangesAsync();

            return(result.Entity);
        }
        public void Delete(ContactInformation contactInformation)
        {
            using (var ctx = new BabySitterContext())
            {
                ctx.ContactInformation.Remove(contactInformation);

                ctx.SaveChanges();
            }
        }
示例#5
0
        public void PutContact(string id, ContactInformation contact)
        {
            contact.PersonId = id;

            if (!repository.Update(contact))
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }
        public PersonContactInformationTests()
        {
            this.phoneString = "0734-668899";
            this.emailString = "*****@*****.**";
            var phone = new PhoneNumber(this.phoneString);
            var email = new EmailAddress(this.emailString);

            this.contactInformation = new ContactInformation(phone, email);
        }
示例#7
0
 public void Create([Bind(Include = "ContactInformationType,Value")] ContactInformation contactInformation, int contactRecordId)
 {
     if (ModelState.IsValid)
     {
         db.ContactInformations.Add(contactInformation);
         AddToContactRecord(contactRecordId, contactInformation);
         db.SaveChanges();
     }
 }
示例#8
0
        public void ContactInformation_VerifyNumberOfProperties()
        {
            var obj = new ContactInformation();

            var result = obj.GetType()
                         .GetProperties()
                         .Count();

            Assert.AreEqual(9, result);
        }
        private async void GetThumbnail(ContactInformation contact)
        {
            IRandomAccessStreamWithContentType stream = await contact.GetThumbnailAsync();

            if (stream != null && stream.Size > 0)
            {
                Thumbnail = new BitmapImage();
                Thumbnail.SetSource(stream);
            }
        }
        public void ValueShouldErrorWithNoValue(string invalid)
        {
            var model = new ContactInformation()
            {
                Value = invalid
            };
            var result = _sut.TestValidate(model);

            result.ShouldHaveValidationErrorFor(x => x.Value);
        }
        public void SubTypeShouldErrorWithInvalidValue(int?val)
        {
            var model = new ContactInformation()
            {
                SubType = (SubType)val
            };
            var result = _sut.TestValidate(model);

            result.ShouldHaveValidationErrorFor(x => x.SubType);
        }
        public void SubTypeShouldNotErrorWithValidValue(SubType?valid)
        {
            var model = new ContactInformation()
            {
                SubType = valid
            };
            var result = _sut.TestValidate(model);

            result.ShouldNotHaveValidationErrorFor(x => x.SubType);
        }
        public void RetrieveAttendanceTimes_WhenCalled_ReturnsListOfAllAttendanceTimes()
        {
            ContactInformation contactInformation = null;
            Employee           employee           = null;

            Expect(() => { contactInformation = AutomatedAttendanceSystem.CreateContactInformation(CommonTestCaseSourceProvider.newContactInformationSample()); }, Throws.Nothing);
            Expect(() => { employee = AutomatedAttendanceSystem.CreateEmployee(CommonTestCaseSourceProvider.newEmployeeSample(contactInformation)); }, Throws.Nothing);
            Expect(() => { PersistenceObjectRepository <AttendanceTime> .Create(CommonTestCaseSourceProvider.newAttendanceTimeSample(employee)); }, Throws.Nothing);
            Expect(() => AutomatedAttendanceSystem.RetrieveAttendanceTimes().Count, Is.GreaterThan(0));
        }
示例#14
0
        public void User_SaveUser_SaveToDB()
        {
            ContactInformation info = new ContactInformation("950 W.Burnside, Portland", "*****@*****.**", "(123)456-7890");
            User controlUser        = new User("Anna", "anna123", "123", info);

            controlUser.Save();
            User testUser = User.GetAll()[0];

            Assert.Equal(controlUser, testUser);
        }
 private void AddContactInformationOnClick(object sender, RoutedEventArgs e)
 {
     if (_activeAddress != null)
     {
         var newContactInformation = new ContactInformation();
         _contactInformations.Add(newContactInformation);
         _activeContactInformation = newContactInformation;
         CurrentContactInformationsGridControl.SelectedItem = _activeContactInformation;
     }
 }
示例#16
0
 public ActionResult Edit([Bind(Include = "id,ContactName,PrimaryEmail,SecondaryEmail,GitHubLink,LinkedInLink,FacebookLink")] ContactInformation contactInformation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contactInformation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contactInformation));
 }
示例#17
0
 public ActionResult Edit([Bind(Include = "Id,Type,Value")] ContactInformation contactInformation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contactInformation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contactInformation));
 }
        void ListDistrictCompleted(List <District> districtList)
        {
            cbbDistrict.ItemsSource = districtList;
            ContactInformation saveContact = this.DataContext as ContactInformation;

            if (saveContact != null)
            {
                cbbDistrict.SelectedValue = saveContact.DistrictId;
            }
        }
        void ListCityCompleted(List <City> cityList)
        {
            cbbCity.ItemsSource = cityList;
            ContactInformation saveContact = this.DataContext as ContactInformation;

            if (saveContact != null)
            {
                cbbCity.SelectedValue = saveContact.CityId;
            }
        }
        void ContactInformation_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            ContactInformation item = sender as ContactInformation;

            if (item != null && e.PropertyName != "IsChanged")
            {
                item.IsChanged = true;
                item.UpdatedBy = Globals.UserLogin.UserName;
            }
        }
示例#21
0
 public PersonCreated(
     string personId,
     string nfcId,
     string lastname,
     string firstname,
     string displayName,
     ContactInformation contactInformation,
     string info) : base(personId, nfcId, lastname, firstname, displayName, contactInformation, info)
 {
 }
示例#22
0
        public void ContactInformationClass_ShouldImplement_IDbModelInterface()
        {
            var obj = new ContactInformation();

            var result = obj.GetType()
                         .GetInterfaces()
                         .Any(x => x == typeof(IDbModel));

            Assert.IsTrue(result);
        }
示例#23
0
        public JsonResult AddContactInformation(ContactInformation contactInfo)
        {
            int cmd = -1;

            cmd = _contactInfoService.AddContactInformation(contactInfo);

            string result = (cmd > 0) ? "Added" : "Add Failed";

            return(new JsonResult(result));
        }
示例#24
0
 public Physician(int identifier,
                  FullName fullName,
                  PractitionerLicenseNumber licenseNumber,
                  SocialSecurityNumber socialSecurityNumber = null,
                  ContactInformation contactInformation     = null,
                  string speciality  = null,
                  string displayName = null)
     : base(identifier, fullName, licenseNumber, socialSecurityNumber, contactInformation, speciality, displayName)
 {
 }
        public void Equals_IsNotEqual_Fails()
        {
            ContactInformation A = new ContactInformation();

            A.ID = Guid.NewGuid();
            ContactInformation B = new ContactInformation();

            B.ID = Guid.NewGuid();
            Expect(A.Equals(B), Is.False);
        }
        public void DescriptionShouldNotErrorValidValue(string valid)
        {
            var model = new ContactInformation()
            {
                Description = valid
            };
            var result = _sut.TestValidate(model);

            result.ShouldNotHaveValidationErrorFor(x => x.Description);
        }
示例#27
0
        public IParticipant CreateParticipant(Guid eventId, ContactInformation contact)
        {
            var participant = new Infrastructure.Entities.Participant
            {
                ContactInformation = contact,
                EventId            = eventId
            };

            return(participant);
        }
        public void Address_GetAndSetShould_WorkProperly()
        {
            var mockedAddress = new Mock <Address>();

            var obj = new ContactInformation();

            obj.Address = mockedAddress.Object;

            Assert.AreSame(mockedAddress.Object, obj.Address);
        }
示例#29
0
            public void SetSenderEmail(string value)
            {
                if (String.IsNullOrEmpty(value))
                {
                    return;
                }

                ContactInformation contactInformation = this.GetContactInformationObject();

                contactInformation.Name = value;
            }
示例#30
0
        public ActionResult Create([Bind(Include = "Id,Type,Value")] ContactInformation contactInformation)
        {
            if (ModelState.IsValid)
            {
                db.ContactInformationSet.Add(contactInformation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(contactInformation));
        }
示例#31
0
        public PenaltyTests()
        {
            var contactInformation = new ContactInformation(new PhoneNumber("0739-246788"),
                                                            new EmailAddress("*****@*****.**"));
            var player = new Player(new Name("John", "Doe"), new DateOfBirth("1988-05-22"),
                                    PlayerPosition.Goalkeeper, PlayerStatus.Available);
            var series = new DummySeries();

            this.penaltyOne = new Penalty(new MatchMinute(36), player.Id, true, series.DummyGames.GameTwo, series.DummyGames.GameTwo.AwayTeamId);
            this.penaltyTwo = new Penalty(new MatchMinute(36), player.Id, true, series.DummyGames.GameTwo, series.DummyGames.GameTwo.AwayTeamId);
        }
示例#32
0
        /// <summary>
        /// Create a new NdefVcardRecord based on an already supplied contact information
        /// from Windows Phone 8 ContactInformation data. The ContactInformation type is able
        /// to convert data into the vCard format.
        /// </summary>
        /// <param name="contactInfo">ContactInformation to be used for creating this record.</param>
        /// <param name="vCardFormat">Optionally specify the VCardFormat to use for creating
        /// the textual payload data.</param>
        /// <returns>A new instance of an NdefVcardRecord that uses the supplied contact information.</returns>
        public async static Task <NdefVcardRecord> CreateFromContactInformation(ContactInformation contactInfo, VCardFormat vCardFormat = VCardFormat.Version2_1)
        {
            var vcardRecord = new NdefVcardRecord
            {
                VCardFormatToWrite = vCardFormat,
                ContactData        = contactInfo
            };
            await vcardRecord.AssemblePayload();

            return(vcardRecord);
        }
 public ActionResult Add(ContactInformationRegisterModel modelContactInformation)
 {
     var myContactInformation = new ContactInformation
                                {
                                    Type = modelContactInformation.Type,
                                    Value = modelContactInformation.Value,
                                    People = _peopleRepository.GetById(modelContactInformation.Id)
                                };
     ContactInformation contactInformation = _contactInformationRepository.Create(myContactInformation);
     const string title = "Informacion Agregada";
     _viewMessageLogic.SetNewMessage(title, "", ViewMessageType.SuccessMessage);
     return RedirectToAction("Details/" + contactInformation.People.Id, modelContactInformation.Controller);
 }
示例#34
0
 private async void Button_Click_1(object sender, RoutedEventArgs e)
 {
     ContactStore contactStore = await ContactStore.CreateOrOpenAsync(ContactStoreSystemAccessMode.ReadWrite, ContactStoreApplicationAccessMode.ReadOnly);
     ContactInformation contactInformation=new ContactInformation();
     var properties = await contactInformation.GetPropertiesAsync();
     properties.Add(KnownContactProperties.FamilyName, name.Text);
     properties.Add(KnownContactProperties.Telephone, tel.Text);
     
     StoredContact storedContact = new StoredContact(contactStore, contactInformation);
     if (stream != null)
     {
         await storedContact.SetDisplayPictureAsync(stream);
     }
     await storedContact.SaveAsync();
     NavigationService.GoBack();
 }
示例#35
0
        protected internal override void GetContactInformation(int index, out ContactInformation info)
        {
            info.Contact = ContactManifold.contacts.Elements[index];
            //Find the contact's normal force.
            float totalNormalImpulse = 0;
            info.NormalImpulse = 0;
            for (int i = 0; i < contactConstraint.penetrationConstraints.Count; i++)
            {
                totalNormalImpulse += contactConstraint.penetrationConstraints.Elements[i].accumulatedImpulse;
                if (contactConstraint.penetrationConstraints.Elements[i].contact == info.Contact)
                {
                    info.NormalImpulse = contactConstraint.penetrationConstraints.Elements[i].accumulatedImpulse;
                }
            }
            //Compute friction force.  Since we are using central friction, this is 'faked.'
            float radius;
            Vector3.Distance(ref contactConstraint.slidingFriction.manifoldCenter, ref info.Contact.Position, out radius);
            if (totalNormalImpulse > 0)
                info.FrictionImpulse = (info.NormalImpulse / totalNormalImpulse) * (contactConstraint.slidingFriction.accumulatedImpulse.Length() + contactConstraint.twistFriction.accumulatedImpulse * radius);
            else
                info.FrictionImpulse = 0;
            //Compute relative velocity
            Vector3 velocity;
            //If the pair is handling some type of query and does not actually have supporting entities, then consider the velocity contribution to be zero.
            if (EntityA != null)
            {
                Vector3.Subtract(ref info.Contact.Position, ref EntityA.position, out velocity);
                Vector3.Cross(ref EntityA.angularVelocity, ref velocity, out velocity);
                Vector3.Add(ref velocity, ref EntityA.linearVelocity, out info.RelativeVelocity);
            }
            else
                info.RelativeVelocity = new Vector3();

            if (EntityB != null)
            {
                Vector3.Subtract(ref info.Contact.Position, ref EntityB.position, out velocity);
                Vector3.Cross(ref EntityB.angularVelocity, ref velocity, out velocity);
                Vector3.Add(ref velocity, ref EntityB.linearVelocity, out velocity);
                Vector3.Subtract(ref info.RelativeVelocity, ref velocity, out info.RelativeVelocity);
            }


            info.Pair = this;

        }
示例#36
0
 /// <summary>
 /// Create settlement service contract ContactInformation from eagle business ContactInformation model
 /// </summary>
 /// <param name="contactInformation">eagle business ContactInformation</param>
 /// <returns>settlement service contract ContactInformation</returns>
 private static SettlementServiceContract.ContactInformation CreateServiceContractContactInformation(
     ContactInformation contactInformation)
 {
     return new SettlementServiceContract.ContactInformation()
                {
                    AddressLineOne = contactInformation.AddressLineOne,
                    AddressLineTwo = contactInformation.AddressLineTwo,
                    AddressLineThree = contactInformation.AddressLineThree,
                    City = contactInformation.City,
                    EmailAddressInfo = contactInformation.EmailAddressInfo,
                    EmailAddressCorrespondance = contactInformation.EmailAddressCorrespondance,
                    Fax = contactInformation.Fax,
                    Phone = contactInformation.Phone,
                    PostCode = contactInformation.PostCode,
                    StateCounty = contactInformation.StateCounty
                };
 }
示例#37
0
        public ActionResult ContactInformation(ContactInformation ContactHostelsInfoDTO)
        {
            if (Session["UserId"] != null)
            {
                if (ModelState.IsValid)
                {
                    UserDetail userDetails = new UserDetail()
                    {
                        Id = Convert.ToInt32(Session["UserId"].ToString()),
                        AlternateEmailId = ContactHostelsInfoDTO.AlternateEmail,
                        PhoneNumber = ContactHostelsInfoDTO.Mobile,
                        PermanentAddress = ContactHostelsInfoDTO.PermanentAddress,
                        //HomeCityId = ContactHostelsInfoDTO.CityId,
                        //LivesInCityId = ContactHostelsInfoDTO.PermanentCityId,
                        Address = ContactHostelsInfoDTO.PresentAddress,
                        CountryCode = ContactHostelsInfoDTO.CountryCodes,
                        HomePhoneNumber = ContactHostelsInfoDTO.AlternameMobile,
                        //ProfileInfoPercentage = (int)CustomStatus.ProfileInfoPercentage.ContactInformation,

                    };

                    UserInfoService.UpdateContactInfo(userDetails);
                    TempData["Success"] = UtilitiesClass.SuccessMessage;
                    return RedirectToAction("Profile", "Profile", new { area = "Alumini" });

                }
            }
            return RedirectToAction("Login", "Account", new { area = "" });
        }
示例#38
0
 public ActionResult UpdateContactDetails()
 {
     if (Session["UserId"] != null)
     {
         UserDetailsDTO Userdata = UserInfoService.GetUserContactInformation(Convert.ToInt32(Session["UserId"].ToString()));
         ContactInformation Info = new ContactInformation()
         {
             PresentAddress = Userdata.PermanentAddress,
             PermanentAddress = Userdata.Address,
             Countrys = GenericMethods.GetAllCountries(),
             CountryId = Userdata.CountryId.Value,
             PermanentCountryid = Userdata.PermanentCountryId.Value,
             Mobile = Userdata.PhoneNumber,
             StateId = Convert.ToInt32(Userdata.StateId),
             PermanentStateId = Convert.ToInt32(Userdata.StateId),
             Districtid = Userdata.PresentDistid.Value,
             PermenantDistrictId = Userdata.Permanentdistid,
             AlternateEmail = Userdata.AlternateEmailId,
             AlternameMobile = Userdata.HomePhoneNumber,
             cityName = Userdata.PresentCity,
             AlternatecityName = Userdata.PermanentCity
         };
         return View(Info);
     }
     return RedirectToAction("Login", "Account", new { area = "" });
 }
示例#39
0
 public ActionResult UpdateContactDetails(ContactInformation ContactHostelsInfoDTO)
 {
     if (Session["UserId"] != null)
     {
         UserDetail userDetails = new UserDetail()
         {
             Id = Convert.ToInt32(Session["UserId"].ToString()),
             AlternateEmailId = ContactHostelsInfoDTO.AlternateEmail,
             PhoneNumber = ContactHostelsInfoDTO.Mobile,
             PermanentAddress = ContactHostelsInfoDTO.PermanentAddress,
             PermanentCity = ContactHostelsInfoDTO.AlternatecityName,
             PresentCity = ContactHostelsInfoDTO.cityName,
             PermanentDistid = ContactHostelsInfoDTO.Districtid,
             PresentDistid = ContactHostelsInfoDTO.PermenantDistrictId,
             Address = ContactHostelsInfoDTO.PresentAddress,
             HomePhoneNumber = ContactHostelsInfoDTO.AlternameMobile,
         };
         UserInfoService.UpdateContactInfo(userDetails);
         TempData["Success"] = UtilitiesClass.SuccessMessage;
         return RedirectToAction("Profile", "Profile", new { area = "Alumini" });
     }
     return RedirectToAction("Login", "Account", new { area = "" });
 }
示例#40
0
 /// <summary>
 /// Parse the supplied byte array containing UTF-8 encoded vCard information (= vcf data) into a
 /// Windows Phone ContactInformation class (the ContactData property).
 /// </summary>
 /// <param name="vCardByte">UTF-8 encoded byte array that contains the vCard data to parse.</param>
 /// <returns>Task to await completion of the operation.</returns>
 public async Task ParseDataToContact(byte[] vCardByte)
 {
     var ms = new System.IO.MemoryStream(vCardByte);
     var input = System.IO.WindowsRuntimeStreamExtensions.AsInputStream(ms);
     // Find out vCard version (not done automatically)
     var vCardVersionPattern = new Regex(@"^VERSION:(?<vcvers>.+)$", RegexOptions.Multiline);
     var vCardVersionMatch = vCardVersionPattern.Match(Encoding.UTF8.GetString(vCardByte, 0, vCardByte.Length));
     if (vCardVersionMatch.Success)
     {
         var vCardVersion = vCardVersionMatch.Groups["vcvers"].Value;
         VCardFormatToWrite = vCardVersion.Trim().Equals("2.1") ? VCardFormat.Version2_1 : VCardFormat.Version3;
     }
     // Parse vCard
     ContactData = await ContactInformation.ParseVcardAsync(input);
 }
        protected internal override void GetContactInformation(int index, out ContactInformation info)
        {
            info.Contact = MeshManifold.contacts.Elements[index];
            //Find the contact's normal and friction forces.
            info.FrictionForce = 0;
            info.NormalForce = 0;
            for (int i = 0; i < contactConstraint.frictionConstraints.count; i++)
            {
                if (contactConstraint.frictionConstraints.Elements[i].PenetrationConstraint.contact == info.Contact)
                {
                    info.FrictionForce = contactConstraint.frictionConstraints.Elements[i].accumulatedImpulse;
                    info.NormalForce = contactConstraint.frictionConstraints.Elements[i].PenetrationConstraint.accumulatedImpulse;
                    break;
                }
            }

            //Compute relative velocity
            Vector3 velocity;
            if (convex.entity != null)
            {
                Vector3.Subtract(ref info.Contact.Position, ref convex.entity.position, out velocity);
                Vector3.Cross(ref convex.entity.angularVelocity, ref velocity, out velocity);
                Vector3.Add(ref velocity, ref convex.entity.linearVelocity, out info.RelativeVelocity);
            }
            else
                info.RelativeVelocity = new Vector3();

            if (mobileMesh.entity != null)
            {
                Vector3.Subtract(ref info.Contact.Position, ref mobileMesh.entity.position, out velocity);
                Vector3.Cross(ref mobileMesh.entity.angularVelocity, ref velocity, out velocity);
                Vector3.Add(ref velocity, ref mobileMesh.entity.linearVelocity, out velocity);
                Vector3.Subtract(ref info.RelativeVelocity, ref velocity, out info.RelativeVelocity);
            }

            info.Pair = this;
        }
示例#42
0
        public ActionResult ContactInformation()
        {
            if (Session["UserId"] != null)
            {
                UserDetailsDTO Userdata = UserInfoService.GetUserContactInformation(Convert.ToInt32(Session["UserId"].ToString()));
                ContactInformation Info = new ContactInformation()
                {
                    //CountryCodes = Convert.ToInt32(Userdata.CountryCode),
                    //Mobile = Userdata.PhoneNumber,
                    //AlternateEmail = Userdata.AlternateEmailId,

                    //CountryId = Userdata.CountryId.Value,
                    ////States = StatecitydistrictService.GetAllStates(),
                    //PresentAddress = Userdata.Address,
                    //PermanentAddress = Userdata.PermanentAddress,
                    //PermenantDistrictId = Convert.ToInt32(Userdata.DistrictId),
                    ////PermanentCityId = Userdata.HomeCityId,
                    ////CityId = Userdata.LivesInCityId,
                    //StateId = Convert.ToInt32(Userdata.StateId),
                    //PermanentStateId = Convert.ToInt32(Userdata.StateId),
                    //PermanentCountryid = Userdata.PermanentCountryId.Value
                    Countrys = GenericMethods.GetAllCountries(),

                };
                return View(Info);
            }
            return RedirectToAction("Login", "Account", new { area = "" });
        }
示例#43
0
		protected override void GetContactInformation( int index, out ContactInformation info )
		{
			info.Contact = contactManifold.Contacts[index];
			//Find the contact's normal and friction forces.
			info.FrictionImpulse = 0;
			info.NormalImpulse = 0;

			for( int i = 0; i < constraint.ContactFrictionConstraints.Count; i++ )
			{
				if( constraint.ContactFrictionConstraints[i].PenetrationConstraint.Contact == info.Contact )
				{
					info.FrictionImpulse = constraint.ContactFrictionConstraints[i].TotalImpulse;
					info.NormalImpulse = constraint.ContactFrictionConstraints[i].PenetrationConstraint.NormalImpulse;
					break;
				}
			}

			//Compute relative velocity
			if( convex.Entity != null )
			{
				info.RelativeVelocity = Toolbox.GetVelocityOfPoint( ref info.Contact.Position, ref convex.Entity.position, ref convex.Entity.linearVelocity, ref convex.Entity.angularVelocity );
			}
			else
				info.RelativeVelocity = new Vector3();


			info.Pair = this;
		}
 protected internal abstract void GetContactInformation(int index, out ContactInformation info);
示例#45
0
 /// <summary>
 /// Create a new NdefVcardRecord based on an already supplied contact information
 /// from Windows Phone 8 ContactInformation data. The ContactInformation type is able
 /// to convert data into the vCard format.
 /// </summary>
 /// <param name="contactInfo">ContactInformation to be used for creating this record.</param>
 /// <param name="vCardFormat">Optionally specify the VCardFormat to use for creating
 /// the textual payload data.</param>
 /// <returns>A new instance of an NdefVcardRecord that uses the supplied contact information.</returns>
 public async static Task<NdefVcardRecord> CreateFromContactInformation(ContactInformation contactInfo, VCardFormat vCardFormat = VCardFormat.Version2_1)
 {
     var vcardRecord = new NdefVcardRecord
     {
         VCardFormatToWrite = vCardFormat,
         ContactData = contactInfo
     };
     await vcardRecord.AssemblePayload();
     return vcardRecord;
 }
示例#46
0
 public void ContactInfo(int index, out ContactInformation info)
 {
     GetContactInformation(index, out info);
 }
示例#47
0
        protected internal override void GetContactInformation(int index, out ContactInformation info)
        {
            info.Contact = ContactManifold.contacts.Elements[index];
            //Find the contact's force.
            info.FrictionImpulse = 0;
            info.NormalImpulse = 0;
            for (int i = 0; i < contactConstraint.frictionConstraints.Count; i++)
            {
                if (contactConstraint.frictionConstraints.Elements[i].PenetrationConstraint.contact == info.Contact)
                {
                    info.FrictionImpulse = contactConstraint.frictionConstraints.Elements[i].accumulatedImpulse;
                    info.NormalImpulse = contactConstraint.frictionConstraints.Elements[i].PenetrationConstraint.accumulatedImpulse;
                    break;
                }
            }
            //Compute relative velocity
            Vector3 velocity;
            if (EntityA != null)
            {
                Vector3.Subtract(ref info.Contact.Position, ref EntityA.position, out velocity);
                Vector3.Cross(ref EntityA.angularVelocity, ref velocity, out velocity);
                Vector3.Add(ref velocity, ref EntityA.linearVelocity, out info.RelativeVelocity);
            }
            else
                info.RelativeVelocity = new Vector3();

            if (EntityB != null)
            {
                Vector3.Subtract(ref info.Contact.Position, ref EntityB.position, out velocity);
                Vector3.Cross(ref EntityB.angularVelocity, ref velocity, out velocity);
                Vector3.Add(ref velocity, ref EntityB.linearVelocity, out velocity);
                Vector3.Subtract(ref info.RelativeVelocity, ref velocity, out info.RelativeVelocity);
            }


            info.Pair = this;
        }
示例#48
0
        private async void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
        {
            ContactInformation contactInfo;
            if (!e.Results.Any())
            {
                // No contacts in the address book
                // Create demo contact
                contactInfo = new ContactInformation
                {
                    FamilyName = "Jakl",
                    GivenName = "Andreas"
                };
                var contactProps = await contactInfo.GetPropertiesAsync();
                contactProps.Add(KnownContactProperties.Url, "http://www.nfcinteractor.com/");
            }
            else
            {
                // Found a contact in the address book?
                // Use first contact from the address book
                var contact = e.Results.First();
                // Use library utility class to convert the Contact class from the WP address book
                // to the WP ContactInformation class that can convert to vCard format.
                contactInfo = await NdefVcardRecord.ConvertContactToInformation(contact);
            }

            // Create new NDEF record based on selected contact
            var vcardRecord = await NdefVcardRecord.CreateFromContactInformation(contactInfo);

            PublishRecord(vcardRecord, true);
        }
示例#49
0
        protected internal override void GetContactInformation(int index, out ContactInformation info)
        {
            foreach (CollidablePairHandler pair in subPairs.Values)
            {
                int count = pair.Contacts.Count;
                if (index - count < 0)
                {
                    pair.GetContactInformation(index, out info);
                    return;
                }
                index -= count;
            }
            throw new IndexOutOfRangeException("Contact index is not present in the pair.");

        }
示例#50
0
        /// <summary>
        /// Called when reading a contact from the address book (Contact instance) 
        /// and we need to convert it to a ContactInformation instance that
        /// supports conversion to a vCard.
        /// </summary>
        /// <remarks>
        /// Note that there is no 1:1 conversion possible between those two formats,
        /// as they have a very different structure. This method does its best to
        /// map and retain as much information as possible.
        /// 
        /// Currently, this method is only working with KnownContactProperties of
        /// the ContactInformation object, and doesn't define custom properties.
        /// </remarks>
        /// <param name="contact">the contact from the address book to convert.</param>
        /// <returns>Converted contact information.</returns>
        public static async Task<ContactInformation> ConvertContactToInformation(Contact contact)
        {
            var contactInfo = new ContactInformation();
            var contactProps = await contactInfo.GetPropertiesAsync();

            contactProps.Add(KnownContactProperties.DisplayName, contact.DisplayName);

            // CompleteName
            var completeName = contact.CompleteName;
            AddContactPropertyIfPossible(KnownContactProperties.GivenName, completeName.FirstName, contactProps);
            AddContactPropertyIfPossible(KnownContactProperties.FamilyName, completeName.LastName, contactProps);
            AddContactPropertyIfPossible(KnownContactProperties.AdditionalName, completeName.MiddleName, contactProps);
            AddContactPropertyIfPossible(KnownContactProperties.Nickname, completeName.Nickname, contactProps);
            AddContactPropertyIfPossible(KnownContactProperties.HonorificPrefix, completeName.Title, contactProps);
            AddContactPropertyIfPossible(KnownContactProperties.HonorificSuffix, completeName.Suffix, contactProps);
            AddContactPropertyIfPossible(KnownContactProperties.YomiFamilyName, completeName.YomiLastName, contactProps);
            AddContactPropertyIfPossible(KnownContactProperties.YomiGivenName, completeName.YomiFirstName, contactProps);

            // Addresses
            foreach (var curAddress in contact.Addresses)
            {
                switch (curAddress.Kind)
                {
                    case AddressKind.Home:
                        AddAddressPropertyIfPossible(KnownContactProperties.Address, curAddress.PhysicalAddress, contactProps);
                        break;
                    case AddressKind.Work:
                        AddAddressPropertyIfPossible(KnownContactProperties.WorkAddress, curAddress.PhysicalAddress, contactProps);
                        break;
                    case AddressKind.Other:
                        AddAddressPropertyIfPossible(KnownContactProperties.OtherAddress, curAddress.PhysicalAddress, contactProps);
                        break;
                }
            }

            // Birthdays
            foreach (var curBirthday in contact.Birthdays)
            {
                AddContactPropertyIfPossible(KnownContactProperties.Birthdate, new DateTimeOffset(curBirthday), contactProps);
            }

            // Children
            AddStringContactProperties(contact.Children, KnownContactProperties.Children, contactProps);

            // Companies
            foreach (var curCompany in contact.Companies)
            {
                AddContactPropertyIfPossible(KnownContactProperties.CompanyName, curCompany.CompanyName, contactProps);
                AddContactPropertyIfPossible(KnownContactProperties.JobTitle, curCompany.JobTitle, contactProps);
                AddContactPropertyIfPossible(KnownContactProperties.OfficeLocation, curCompany.OfficeLocation, contactProps);
                AddContactPropertyIfPossible(KnownContactProperties.YomiCompanyName, curCompany.YomiCompanyName, contactProps);
            }

            // EmailAddresses
            foreach (var curEmail in contact.EmailAddresses)
            {
                switch (curEmail.Kind)
                {
                    case EmailAddressKind.Personal:
                        AddContactPropertyIfPossible(KnownContactProperties.Email, curEmail.EmailAddress, contactProps);
                        break;
                    case EmailAddressKind.Work:
                        AddContactPropertyIfPossible(KnownContactProperties.WorkEmail, curEmail.EmailAddress, contactProps);
                        break;
                    case EmailAddressKind.Other:
                        AddContactPropertyIfPossible(KnownContactProperties.OtherEmail, curEmail.EmailAddress, contactProps);
                        break;
                }
            }

            // Notes
            AddStringContactProperties(contact.Notes, KnownContactProperties.Notes, contactProps);

            // PhoneNumbers
            foreach (var curNumber in contact.PhoneNumbers)
            {
                switch (curNumber.Kind)
                {
                    case PhoneNumberKind.Mobile:
                        AddContactPropertyIfPossible(KnownContactProperties.MobileTelephone, curNumber.PhoneNumber, contactProps);
                        break;
                    case PhoneNumberKind.Home:
                        AddContactPropertyIfPossible(KnownContactProperties.Telephone, curNumber.PhoneNumber, contactProps);
                        break;
                    case PhoneNumberKind.Work:
                        AddContactPropertyIfPossible(KnownContactProperties.WorkTelephone, curNumber.PhoneNumber, contactProps);
                        break;
                    case PhoneNumberKind.Company:
                        AddContactPropertyIfPossible(KnownContactProperties.CompanyTelephone, curNumber.PhoneNumber, contactProps);
                        break;
                    case PhoneNumberKind.Pager:
                        // N/A
                        break;
                    case PhoneNumberKind.HomeFax:
                        AddContactPropertyIfPossible(KnownContactProperties.HomeFax, curNumber.PhoneNumber, contactProps);
                        break;
                    case PhoneNumberKind.WorkFax:
                        AddContactPropertyIfPossible(KnownContactProperties.WorkFax, curNumber.PhoneNumber, contactProps);
                        break;
                }
            }

            // SignificantOthers
            AddStringContactProperties(contact.SignificantOthers, KnownContactProperties.SignificantOther, contactProps);

            // Websites
            AddStringContactProperties(contact.Websites, KnownContactProperties.Url, contactProps);

            // Display name
            contactInfo.DisplayName = contact.DisplayName;

            return contactInfo;

        }