コード例 #1
0
        void aci_KeyDown(object sender, KeyEventArgs e)
        {
            AddContactItem aci = (AddContactItem)sender;

            if (e.Key == Key.Enter)
            {
                Contact t = new Contact();
                t.Value = aci.XContactValue.Text;
                t.Type  = aci.XContactName.Text;
                DataBaseInterface.AddContact(DataSaver.UId, DataSaver.PasswordHash, t);
                this.XPersonalListBox.Items.Remove(aci);
                this.XPersonalListBox.Items.Insert(this.XPersonalListBox.Items.Count - 1,
                                                   new PersonalProperyShower(
                                                       new PersonalProperty(t.Type, t.Value, PropertyType.Contact), this));
            }
            else if (e.Key == Key.Escape)
            {
                this.XPersonalListBox.Items.Remove(aci);
            }
        }