Beispiel #1
0
        internal async void AddButton_Click(object sender, RoutedEventArgs e)
        {
            if (UIEnabled)
            {
                UIEnabled = false;
                Debug.WriteLine("creating contact {0} ({1})", ContactName, ContactNumber);
                SignalContact contact = new SignalContact()
                {
                    ThreadDisplayName   = ContactName,
                    ThreadId            = ContactNumber,
                    CanReceive          = true,
                    AvatarFile          = null,
                    LastActiveTimestamp = 0,
                    Draft       = null,
                    Color       = "red",
                    UnreadCount = 0
                };
                ContactName   = "";
                ContactNumber = "";
                await Task.Run(() =>
                {
                    SignalDBContext.InsertOrUpdateContactLocked(contact, MainPageVM);
                });

                UIEnabled = true;
            }
        }
 private async Task AddContact(string name, string number)
 {
     Debug.WriteLine("creating contact {0} ({1})", name, number);
     SignalContact contact = new SignalContact()
     {
         ThreadDisplayName   = name,
         ThreadId            = number,
         CanReceive          = true,
         AvatarFile          = null,
         LastActiveTimestamp = 0,
         Draft       = null,
         Color       = Utils.CalculateDefaultColor(name),
         UnreadCount = 0
     };
     await Task.Run(() =>
     {
         SignalDBContext.InsertOrUpdateContactLocked(contact, MainPageVM);
     });
 }