Basic Implemetation of all needed function to take Books and create Students etc.

Missing is the automatic Server Identification and Signing Stuff
This commit is contained in:
2017-05-18 12:57:50 +02:00
parent 90b097f73d
commit 129e0679cd
60 changed files with 1799 additions and 44069 deletions

View File

@ -1,19 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BuechermarktClient.Models;
using System.Threading;
using MongoDB.Driver;
using System.Collections.Generic;
namespace BuechermarktClient
{
@ -25,8 +18,32 @@ namespace BuechermarktClient
public Thread RefreshThread = null;
private bool ThreadRunning = true;
public BookTypes()
public bool Chooser = false;
private string _SearchField;
public string SearchField {
get
{
return _SearchField;
}
set
{
if(value != _SearchField)
{
_SearchField = value;
LoadList();
}
}
}
public BookType SelectedItem { get; private set; }
public BookTypes() : this(false) { }
public BookTypes(bool select)
{
DataContext = this;
Chooser = select;
InitializeComponent();
RefreshThread = new Thread(RefreshThreadS);
RefreshThread.Start();
@ -51,8 +68,21 @@ namespace BuechermarktClient
public void LoadList()
{
var list = MainWindow.BookTypeCollection.FindSync((b)=>true).ToList();
var show = new List<BookType>();
if(SearchField != null && SearchField != String.Empty)
{
foreach(var e in list)
{
if (e.ISBN.ToLower().Contains(SearchField.ToLower()) || e.Name.ToLower().Contains(SearchField.ToLower()))
{
show.Add(e);
}
}
} else {
show = list;
}
Dispatcher.BeginInvoke(new Action(delegate (){
BookTypesList.ItemsSource = list;
BookTypesList.ItemsSource = show;
}));
}
@ -67,13 +97,22 @@ namespace BuechermarktClient
private void ListViewItem_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
var item = sender as ListViewItem;
if (item != null && item.IsSelected)
if (sender is ListViewItem item && item.IsSelected)
{
var editWindow = new BookTypesEdit(item.DataContext as BookType) {
Owner = this
};
editWindow.Show();
SelectedItem = item.DataContext as BookType;
if (Chooser)
{
DialogResult = true;
Close();
}
else
{
var editWindow = new BookTypesEdit(item.DataContext as BookType)
{
Owner = this
};
editWindow.Show();
}
}
}
}