|
@@ -21,12 +21,14 @@ namespace PDK_Concert.Pages
|
|
|
public partial class NumberPage : Page
|
|
|
{
|
|
|
Logined logined;
|
|
|
+ List<Numbers> showNumbers;
|
|
|
public NumberPage(Logined logined)
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
this.logined = logined;
|
|
|
listNumbers.ItemsSource = Classes.DataBaseClass.connect.Numbers.Where(x => x.IDUser == logined.ID).ToList();
|
|
|
- if(listNumbers==null)
|
|
|
+ showNumbers = Classes.DataBaseClass.connect.Numbers.Where(x => x.IDUser == logined.ID).ToList();
|
|
|
+ if (listNumbers==null)
|
|
|
{
|
|
|
not.Visibility = Visibility.Visible;
|
|
|
listNumbers.Visibility = Visibility.Collapsed;
|
|
@@ -37,5 +39,36 @@ namespace PDK_Concert.Pages
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ private void poisk_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
+ {
|
|
|
+ string text = poisk.Text;
|
|
|
+ UpdateList(text);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateList(string text)
|
|
|
+ {
|
|
|
+ if(!string.IsNullOrEmpty(text))
|
|
|
+ {
|
|
|
+ showNumbers = showNumbers.Where(x=>x.Title.ToLower().Contains(text.ToLower())).ToList();
|
|
|
+ if(showNumbers.Count>0)
|
|
|
+ {
|
|
|
+ listNumbers.ItemsSource = showNumbers;
|
|
|
+ not.Visibility = Visibility.Collapsed;
|
|
|
+ listNumbers.Visibility = Visibility.Visible;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ listNumbers.ItemsSource = Classes.DataBaseClass.connect.Numbers.Where(x => x.IDUser == logined.ID).ToList();
|
|
|
+ not.Visibility = Visibility.Visible;
|
|
|
+ listNumbers.Visibility = Visibility.Collapsed;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(text=="")
|
|
|
+ {
|
|
|
+ not.Visibility = Visibility.Collapsed;
|
|
|
+ listNumbers.Visibility = Visibility.Visible;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|