示例#1
0
        private void HandleIsDirtyChangedMessage(IsDirtyMessage message)
        {
            bool isDirty = message.IsDirty;

            if (TempContact.IsValid && isDirty)
            {
                IsEnabled = true;
            }
            else
            {
                IsEnabled = false;
            }
        }
示例#2
0
        /// <summary>
        /// Проверяет есть ли различия между временным контактом и первоночальным
        /// </summary>
        private void CheckIsDirty(string propertyName)
        {
            bool isDirty;

            //if (this.Equals(originalContact))
            //    isDirty = false;
            //else
            //    isDirty = true;
            switch (propertyName)
            {
            case "FirstName":
                if (originalContact.FirstName == FirstName)
                {
                    isDirty = false;
                }
                else
                {
                    isDirty = true;
                }
                break;

            case "LastName":
                if (originalContact.LastName == LastName)
                {
                    isDirty = false;
                }
                else
                {
                    isDirty = true;
                }
                break;

            case "PhoneNumber":
                if (PhoneNumber == "")
                {
                    PhoneNumber = null;
                }
                if (originalContact.PhoneNumber == PhoneNumber)
                {
                    isDirty = false;
                }
                else
                {
                    isDirty = true;
                }
                break;

            case "PathToImage":
                if (originalContact.PathToImage == PathToImage)
                {
                    isDirty = false;
                }
                else
                {
                    isDirty = true;
                }
                break;

            case "Email":
                if (Email == "")
                {
                    Email = null;
                }
                if (originalContact.Email == Email)
                {
                    isDirty = false;
                }
                else
                {
                    isDirty = true;
                }
                break;

            case "IsFavorite":
                if (originalContact.IsFavorite == IsFavorite)
                {
                    isDirty = false;
                }
                else
                {
                    isDirty = true;
                }
                break;

            case "GroupID":
                if (originalContact.GroupID == GroupID)
                {
                    isDirty = false;
                }
                else
                {
                    isDirty = true;
                }
                break;

            default:
                isDirty = true;
                break;
            }
            var message = new IsDirtyMessage()
            {
                IsDirty = isDirty
            };

            Messenger.Default.Send <IsDirtyMessage>(message);
        }
示例#3
0
 public void Handle(IsDirtyMessage message)
 {
     IsDirty = true;
 }