private void lbSuggestion_SelectionChanged(object sender, SelectionChangedEventArgs e) { DataAutoComplete data = lbSuggestion.SelectedItem as DataAutoComplete; this.SelectedItem = data; lbSuggestion.Visibility = Visibility.Collapsed; }
private void AutoSearchFuntion(object sender, TextChangedEventArgs e) { string typedString = this.UISearch.Text; this._select = null; if (typedString.Length > _min) { List <DataAutoComplete> autoList = new List <DataAutoComplete>(); autoList = SearchAction(this.UISearch.Text); if (autoList != null && autoList.Count > 0) { if (!string.IsNullOrEmpty(this._icon)) { foreach (DataAutoComplete item in autoList) { if (string.IsNullOrEmpty(item.icon)) { item.icon = this._icon; } } } lbSuggestion.ItemsSource = autoList; lbSuggestion.Visibility = Visibility.Visible; } else { lbSuggestion.ItemsSource = null; lbSuggestion.Visibility = Visibility.Collapsed; } } else { lbSuggestion.ItemsSource = null; lbSuggestion.Visibility = Visibility.Collapsed; } }
private List<DataAutoComplete> ConvertToDataComplete(List<Code.Media.MediaData> list) { if (list == null) return null; List<DataAutoComplete> result = new List<DataAutoComplete>(); foreach (Code.Media.MediaData d in list) { DataAutoComplete tmp = new DataAutoComplete() { key = d.ID.ToString(), label = d.Name }; tmp.icon = d.TypeMedia.Icon; result.Add(tmp); } return result; }
private void AutoSearchFuntion(object sender, TextChangedEventArgs e) { string typedString = this.UISearch.Text; this._select = null; if (typedString.Length > _min) { List<DataAutoComplete> autoList = new List<DataAutoComplete>(); autoList = SearchAction(this.UISearch.Text); if (autoList != null && autoList.Count > 0) { if (!string.IsNullOrEmpty(this._icon)) { foreach (DataAutoComplete item in autoList) { if (string.IsNullOrEmpty(item.icon)) item.icon = this._icon; } } lbSuggestion.ItemsSource = autoList; lbSuggestion.Visibility = Visibility.Visible; } else { lbSuggestion.ItemsSource = null; lbSuggestion.Visibility = Visibility.Collapsed; } } else { lbSuggestion.ItemsSource = null; lbSuggestion.Visibility = Visibility.Collapsed; } }
private void AutoComplete_SelectItemEvent(object sender, DataAutoComplete e) { preset = new Code.Camera_Preset(); preset.camera_id = int.Parse(e.key); for (int i = 0; i < App.DataCamera.Count; i++) { if (App.DataCamera[i].id == preset.camera_id) { this.Camera = App.DataCamera[i]; if (this.Camera.m_lUserID == -1) this.Camera.Login(); if (this.Camera.m_lUserID != -1) { this.Preview(); } else { MessageBox.Show("Không thể đăng nhập camera"); } break; } } }