/// <summary> /// 命令执行 /// </summary> /// <param name="context"></param> public override void Execute(DataContext context) { byte[] cmdData = context.CmdData; if (cmdData.Length == 0) { context.Flush(RespondCode.CmdDataLack); return; } ContactsQuery query = cmdData.ProtoBufDeserialize <ContactsQuery>(); if (Compiled.Debug) { query.Debug("=== Social.GroupMembers 上行数据==="); } PageResult <UserCacheInfo> pageResult = SocialBiz.GetGroupMembers(query.TargetId, query.QueryIndex, query.QuerySize); ContactsList result = new ContactsList { RecordCount = pageResult.RecordCount, QueryIndex = pageResult.PageIndex, QuerySize = pageResult.PageSize, IndexCount = pageResult.PageCount, DataList = pageResult.Data.Select(u => u.ToUserBase()).ToList() }; context.Flush <ContactsList>(result); }
void ReleaseDesignerOutlets() { if (ContactsList != null) { ContactsList.Dispose(); ContactsList = null; } if (LoadContactsBtn != null) { LoadContactsBtn.Dispose(); LoadContactsBtn = null; } if (SummaryLbl != null) { SummaryLbl.Dispose(); SummaryLbl = null; } if (ShakeBtn != null) { ShakeBtn.Dispose(); ShakeBtn = null; } }
public ListCollectionView GetFilteredListCollectionView(string filter) { if (filter == null) { Console.WriteLine("filter = null"); return(ListCollectionView); } Console.WriteLine("filter = " + filter); IEnumerable <ContactModel> query = ContactsList.Where(x => x.Name.ToUpper().StartsWith(filter.ToUpper())); ObservableCollection <ContactModel> contactModels = new ObservableCollection <ContactModel>(); foreach (ContactModel contact in query) { contactModels.Add(contact); } ListCollectionView listCollectionView = new ListCollectionView(contactModels); listCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("Company")); if (contactModels.Count == 0) { return(ListCollectionView); } return(listCollectionView); }
private void Search() { ContactsList.Clear(); var contacts = new List <Model.Contact>(); using (var sqlCon = new SqlConnection(@"Server=localhost\SQLEXPRESS;Database=PhoneBook;Trusted_Connection=True;")) { sqlCon.Query <Model.Contact, City, Phone, PhoneType, Model.Contact>("searchContact", (contact, city, phone, phoneType) => { var contactForList = contacts.FirstOrDefault(con => con.Id == contact.Id); if (contactForList == null) { contactForList = contact; contactForList.City = new City(); contactForList.PhoneNumbers = new List <Phone>(); contacts.Add(contactForList); } contactForList.City = city; phone.PhoneType = phoneType; contactForList.PhoneNumbers.Add(phone); return(contact); }, new { SearchString = SearchString }, commandType: System.Data.CommandType.StoredProcedure).ToList(); } foreach (Model.Contact con in contacts) { var contactViewModel = new ContactViewModel(con, _cities, _phoneTypes); contactViewModel.OnCotactDeleted += SingleContactDeleted; contactViewModel.EditContactClicked += SingleContactEdit; ContactsList.Add(contactViewModel); } }
IEnumerator Startup() { ViewController.GetInstance().Initialize(ViewAnchorRef.transform); UserDataController.GetInstance().Initialize(); while (UserDataController.GetInstance().ContactsUsers == null) { yield return(null); } SoundManager.GetInstance(); yield return(new WaitForSeconds(.1f)); StartCoroutine(NetworkController.GetInstance().Connect()); SpeechController.GetInstance().Initialize(); PhotoController.GetInstance().Initialize(); CheatController.GetInstance().Initialize(ViewAnchorRef.transform); ContactsList cl = ViewController.GetInstance().CurrentView.GetComponent <ContactsList>(); cl.Initialize(); //Initiate The Singletons //Transaction<List<TcgCard>> t = new Transaction<List<TcgCard>>(); }
public async Task <byte[]> GetContactPictureAsync(string contactName, bool forceRefresh = false) { if (ContactsList.Count == 0 || forceRefresh) { await GetAllEntriesAsync(forceRefresh); } if (_contactPictures.ContainsKey(contactName)) { return(_contactPictures[contactName]); } else { var c = ContactsList.Where(it => it.DisplayName.ToLower() == contactName.ToLower()).FirstOrDefault(); if (c != null) { using (Stream pictureStream = c.GetPicture()) { if (pictureStream != null) { var picture = new byte[pictureStream.Length]; using (MemoryStream pictureMemoryStream = new MemoryStream(picture)) { if (pictureStream.CanRead) { await pictureStream.CopyToAsync(pictureMemoryStream); } } _contactPictures.Add(contactName, picture); return(picture); } } } } return(null); }
public byte[] GetContactPicture(string contactName) { if (_contactPictures.ContainsKey(contactName)) { return(_contactPictures[contactName]); } else { var c = ContactsList.Where(it => it.DisplayName.ToLower() == contactName.ToLower()).FirstOrDefault(); if (c != null) { using (Stream pictureStream = c.GetPicture()) { if (pictureStream != null) { var picture = new byte[pictureStream.Length]; using (MemoryStream pictureMemoryStream = new MemoryStream(picture)) { if (pictureStream.CanRead) { pictureStream.CopyTo(pictureMemoryStream); } } _contactPictures.Add(contactName, picture); return(picture); } } } return(null); } }
public async void DisplayElementSelect() { string Action, Title = "Choose", Cancel = "Cancel", But1 = $"Edit", But2 = "More Info", But3 = $"Call {Selected.Phone}"; Action = await App.Current.MainPage.DisplayActionSheet($"{Title}", "", $"{Cancel}", $"{But1}", $"{But2}", $"{But3}"); if (Action == But1) { ContactsList.Remove(_selected); await App.Current.MainPage.Navigation.PushAsync(new AddContactPage(ContactsList, _selected)); } else if (Action == But2) { await App.Current.MainPage.DisplayAlert("Contact", $"Name: {Selected.Name} {Selected.Last} \n " + $"Number : {Selected.Phone} \n " + $"Mail : {Selected.Email}", "OK"); } else if (Action == But3) { PlacePhoneCall(_selected.Phone); } else { return; } }
/// <summary> /// 命令执行 /// </summary> /// <param name="context"></param> public override void Execute(DataContext context) { byte[] cmdData = context.CmdData; if (cmdData.Length == 0) { context.Flush(RespondCode.CmdDataLack); return; } ContactsQuery query = cmdData.ProtoBufDeserialize <ContactsQuery>(); if (Compiled.Debug) { query.Debug("=== Social.QueryFans 上行数据==="); } int userId = query.TargetId == 0 ? context.UserId : query.TargetId; PageResult <UserFollowed> pageResult = SocialBiz.GetFollowedUserPageData(userId, query.QueryIndex, query.QuerySize); ContactsList result = new ContactsList { RecordCount = pageResult.RecordCount, QueryIndex = pageResult.PageIndex, QuerySize = pageResult.PageSize, IndexCount = pageResult.PageCount, DataList = pageResult.Data.Select(f => UserBiz.ReadUserCacheInfo(f.UserId).ToUserBase()).ToList() }; context.Flush <ContactsList>(result); }
async void OnGroupUpdates(object sender, DataChangedArgs <IEnumerable <Group> > args) { //Check specific action if (args.Action == RepositoryActions.Update) { foreach (var group in args.Data) { if (GroupInfo.Id == group.Id) { //Find differences in member list var addedUsers = group.MembersIdList.Except(GroupInfo.MembersIdList).ToList(); var deletedUsers = GroupInfo.MembersIdList.Except(group.MembersIdList).ToList(); ContactsList.AddContacts(await UnitOfWork.GetUsersInfo(addedUsers)); ContactsList.RemoveContacts(await UnitOfWork.GetUsersInfo(deletedUsers)); GroupInfo = group; //Update UI OnPropertyChanged("GroupName"); OnPropertyChanged("IsOnline"); OnPropertyChanged("AreYouAdmin"); OnPropertyChanged("IsYourGroup"); break; } } } }
public ActionResult CreateContactsList() { ContactsListManager contactsListManager = new ContactsListManager(); ContactsList newList = contactsListManager.CreateContactsList(); return(Redirect(newList.DefaultViewUrl)); }
public ContactViewModel() { _selectedPerson = new Person(); contactlist = new ContactsList(); DeleteCommand = new RelayCommand(toDeletePerson); AddCommand = new RelayCommand(toAddPerson); }
public BulgarianPhoneBook(string filePathAndName) : base() { StreamReader file = GetFileFromFilePathAndName(filePathAndName); string line; while ((line = file.ReadLine()) != null) { KeyValuePair <string, string> pair; try { pair = GetDataFromRecord(line); string normalizedName = NormalizeName(pair.Key); string value = GetValueByKey(normalizedName); if (value == null) { ContactsList.Add(normalizedName, pair.Value); OutgoingCallHistory.Add(new Tuple <int, string>(0, normalizedName)); } } catch (InvalidDataException) { continue; } } file.Close(); ChachedHasToChange = true; }
private void DisplayContactsList(ContactsList Contacts, int option) { string line = new string('-', Console.WindowWidth); string helpLine1 = "1-Add 2-Modify 3-Delete 4-Search Esc-Exit"; string helpLine2 = "7-Listados"; if (listContact.Count == 0) { SetConsoleEmpty(); Console.WriteLine("Not dates"); Console.Write("Do you want add first record(yes/no): "); string answer = Console.ReadLine().ToLower(); if (answer == "yes") { Add(); } else if (answer == "no") { Console.WriteLine("Okey. See you!"); Console.WriteLine("Press Esc to return."); } } else { SetConsole(); int x = 2; int y = 1; for (int i = 0; i < listContact.Count; i++) { config.WriteFore(x, y + i, "white"); if (i == option - 1)/// { config.WriteBack("green"); config.WriteFore(listContact.Contacts[i].Name + " (" + listContact.Contacts[i].Telephone + ")", "white", false); } else { config.WriteBack(listContact.Contacts[i].Name + " (" + listContact.Contacts[i].Telephone + ")", "blue", false); } Console.ResetColor(); } config.WriteBack("blue"); config.WriteFore("white"); config.WriteBack(0, (Console.WindowHeight - 4), line, false); config.WriteBack(Console.WindowWidth / 2 - (helpLine1.Length / 2), Console.WindowHeight - 3, helpLine1, true); config.WriteBack(Console.WindowWidth / 2 - (helpLine2.Length / 2), Console.WindowHeight - 2, helpLine2, true); //Program body ShowContactCursor(Contacts, option); } }
private void OnDeleteCommand(Contact contact) { if (ContactsList.Contains(contact)) { ContactsList.Remove(contact); } }
public HomeViewModel(ObservableCollection<Contact> contacts) { ContactsList.Add(new Contact("Maria Pi", "809232323")); ContactsList.Add(new Contact("Charlin Agramonte", "809232323")); AddCommand = new Command(OnAddContact); MoreCommand = new Command<Contact>(OnMoreCommand); DeleteCommand = new Command<Contact>(OnDeleteCommand); }
//private void save_clicked(object sender, EventArgs ea) //{ // updatebtn.IsVisible = true; // // label fields // name.IsVisible = true; // email.IsVisible = true; // mobile_No.IsVisible = true; // street.IsVisible = true; // city.IsVisible = true; // zip.IsVisible = true; // web_text.IsVisible = true; // name_label.IsVisible = false; // email_label.IsVisible = false; // mobile_No_label.IsVisible = false; // street_label.IsVisible = false; // city_label.IsVisible = false; // zip_label.IsVisible = false; // // Entry fields // name_entry.IsVisible = false; // email_entry.IsVisible = false; // mobile_No_entry.IsVisible = false; // street_entry.IsVisible = false; // city_entry.IsVisible = false; // zip_entry.IsVisible = false; // web_text_entry.IsVisible = false; // name.Text = name_entry.Text; // email.Text = email_entry.Text; // mobile_No.Text = mobile_No_entry.Text; // street.Text = street_entry.Text; // city.Text = city_entry.Text; // zip.Text = zip_entry.Text; // web_text.Text = web_text_entry.Text; //} //private void cancel_clicked(object sender, EventArgs ea) //{ // sq_editbtn.IsVisible = true; // savebtn_layout.IsVisible = false; // // label fields // name.IsVisible = true; // email.IsVisible = true; // mobile_No.IsVisible = true; // street.IsVisible = true; // city.IsVisible = true; // zip.IsVisible = true; // web_text.IsVisible = true; // name_label.IsVisible = false; // email_label.IsVisible = false; // mobile_No_label.IsVisible = false; // street_label.IsVisible = false; // city_label.IsVisible = false; // zip_label.IsVisible = false; // // Entry fields // name_entry.IsVisible = false; // email_entry.IsVisible = false; // mobile_No_entry.IsVisible = false; // street_entry.IsVisible = false; // city_entry.IsVisible = false; // zip_entry.IsVisible = false; // web_text_entry.IsVisible = false; //} protected override void OnAppearing() { base.OnAppearing(); ContactsList cont_list = null; MessagingCenter.Subscribe <string, ContactsList>("MyApp", "ContactMsg", (sender, arg) => { int contact_id = arg.id; foreach (var data in cusobj.contacts) { if (contact_id == data.id && data.id != 0) { cont_list = new ContactsList(); cont_list.name = arg.name; cont_list.id = contact_id; cont_list.mobile = arg.mobile; cont_list.phone = arg.phone; cont_list.position = arg.position; cont_list.email = arg.email; cont_list.image_small = arg.image_small; //if (arg.image_small == "") //{ // cont_list.image_small = data.image_small; //} //else //{ // cont_list.image_small = arg.image_small; //} } } int index = final_listview.FindIndex(m => m.id == contact_id); if (index >= 0) { final_listview[index] = cont_list; } CusListView.ItemsSource = null; CusListView.HeightRequest = 80 * final_listview.Count; CusListView.ItemsSource = final_listview; }); MessagingCenter.Subscribe <string, ContactsList>("MyApp", "CreateMsg", (sender, arg) => { final_listview.Add(arg); CusListView.ItemsSource = null; CusListView.HeightRequest = 80 * final_listview.Count; CusListView.ItemsSource = final_listview; }); }
private void RemoveSelectedContact(object sender, RoutedEventArgs e) { Contact contact = ContactListView.SelectedItem as Contact; if (contact == null) { return; } ContactsList.Remove(contact); }
public async void LoadData() { ContactsList.Clear(); List <ContactModel> database = await App.Database.GetContactsAsync().ConfigureAwait(false); foreach (ContactModel contact in database) { ContactsList.Add(contact); } IsLoading = false; }
public void Run() { ConfigureConsole(); listContact = new ContactsList(); int option = 1; bool exit = false; do { DisplayContactsList(listContact, option); GetChosenOption(ref listContact, ref option, ref exit); } while (!exit); }
public ContractDetailWizard(ContactsList obj) { InitializeComponent(); myobj = obj; contactImage.Source = obj.CustomerImg; name.Text = obj.name; email.Text = obj.email; mobile.Text = obj.mobile; phone.Text = obj.phone; position.Text = obj.position; contact_id = obj.id; photo = obj.CustomerImg; //if(phone.Text == "") //{ // phoneimg.IsVisible = false; //} //if (mobile.Text == "") //{ // mobileimg.IsVisible = false; //} var imageRecognizer = new TapGestureRecognizer(); imageRecognizer.Tapped += async(s, e) => { FileData fileData = new FileData(); FileData filedata = null; try { filedata = await CrossFilePicker.Current.PickFile(); if (!string.IsNullOrEmpty(filedata.FileName)) //Just the file name, it doesn't has the path { byte[] bydata = filedata.DataArray; String UploadData = Convert.ToBase64String(bydata); selectedimg = UploadData; var stream = new MemoryStream(bydata); contactImage.Source = ImageSource.FromStream(() => stream); } } catch (Exception ex) { filedata = null; System.Diagnostics.Debug.WriteLine("Warning Exception : " + ex.Message); } }; contactImage.GestureRecognizers.Add(imageRecognizer); }
public void GetChosenOption(ref ContactsList Contacts, ref int option, ref bool exit) { ConsoleKeyInfo key; do { key = Console.ReadKey(true); } while (Console.KeyAvailable); switch (key.Key) { case ConsoleKey.NumPad1: Add(); break; case ConsoleKey.NumPad2: Modify(option); break; case ConsoleKey.NumPad3: Delete(option); break; //case ConsoleKey.NumPad4: Search(); break; case ConsoleKey.Escape: exit = true; Contacts.Save(); break; case ConsoleKey.DownArrow: if (option < Contacts.Count) { option++; } else { option = 1; } break; case ConsoleKey.UpArrow: if (option > 1) { option--; } else { option = Contacts.Count; } break; default: break; } }
private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e) { var text = sender as TextBlock; if (text == null) { return; } ConnectIP = ContactsList .FirstOrDefault(x => x.Name == text.Text)?.Address?.Split(':')[0] ?? ConnectIP; ConnectPort = ContactsList .FirstOrDefault(x => x.Name == text.Text)?.Address?.Split(':')[1] ?? ConnectPort; }
private void PopulateContacts(object sender, RoutedEventArgs e) { for (int i = 0; i < 10; i++) { ContactsList.Add(new Contact() { Name = "Jan" + i, Surname = "Kowalski" + i, PhoneNumber = "12345678" + i, Sex = i % 2 == 0 ? PersonSex.Male : PersonSex.Female, BirthDate = DateTime.Now, City = "Chicago" }); } }
public void DeletePairByName(string name) { string normalizedName = NormalizeName(name); string value = GetValueByKey(normalizedName); if (value == null) { throw new KeyNotFoundException(); } ContactsList.Remove(normalizedName); OutgoingCallHistory.Remove(FindTuppleByKey(normalizedName)); ChachedHasToChange = true; }
void _phoneContacts_SearchCompleted(object sender, ContactsSearchEventArgs e) { ContactsList.Clear(); try { if (e.Results.Any()) { var items = (from r in e.Results where r.Birthdays.Any() select r); ContactsList.AddRange(items); if (GetEntriesCompleted != null) { GetEntriesCompleted(this, new GetEntriesCompletedEventArgs() { Contacts = GetBirthdayContacts().AsQueryable() }); } } else { if (GetEntriesCompleted != null) { GetEntriesCompleted(this, new GetEntriesCompletedEventArgs() { Contacts = new List <BirthdayContact>().AsQueryable() }); } } } #if DEBUG catch (InvalidOperationException iex) { DebugUtility.SaveDiagnosticException(iex); #else catch { #endif if (GetEntriesCompleted != null) { GetEntriesCompleted(this, new GetEntriesCompletedEventArgs() { Contacts = new List <BirthdayContact>().AsQueryable() }); } } }
public void OpenFile(string[] filepath) { try { foreach (var path in filepath) { var VCards = fileService.Open(path); foreach (var vCard in VCards) { ContactsList.Add(new VCardViewModel(imageDialogService, vCard)); } } } catch { throw; } }
public void Reload() { if (Settings.LstContacts != null) { ContactsList.Clear(); foreach (Contact c in Settings.LstContacts) { ContactsList.Add(new Models.Contact() { Name = $"{c.Name} {c.LastName}", Email = c.EmailsAddress.FirstOrDefault(), Number = c.PhoneNumbers.FirstOrDefault().Number, Photo = c.Photo, }); } OnPropertyChanged("ContactsList"); } }
public override void OnContactRemoved(UiInfo newContact) { try { var foundedUiInfo = ContactsList.FirstOrDefault(c => c.UniqueName == newContact.UniqueName); if (foundedUiInfo != null) { var temp = new List <UiInfo>(); temp.AddRange(ContactsList); ContactsList.Remove(foundedUiInfo); ContactsList = temp; } } catch (Exception) { } }
public ContactsViewModel(ObservableCollection <Contacts> contacts) { AddNavigationCommand = new Command(async(_selected) => { await App.Current.MainPage.Navigation.PushAsync(new AddContactPage(ContactsList)); }); DeleteCommand = new Command <Contacts>(async(_selected) => { if (ContactsList.Remove(_selected)) { await App.Current.MainPage.DisplayAlert("Deleted", "Se ha borrado un contacto", "OK"); } }); EditCommand = new Command <Contacts>(async(_selected) => { ContactsList.Remove(_selected); await App.Current.MainPage.Navigation.PushAsync(new AddContactPage(ContactsList, _selected)); }); }