init commit
This commit is contained in:
parent
9e30e876e5
commit
a585d10741
@ -19,7 +19,7 @@
|
|||||||
<ComboBoxItem Content="IT"/>
|
<ComboBoxItem Content="IT"/>
|
||||||
<ComboBoxItem Content="Чет еще"/>
|
<ComboBoxItem Content="Чет еще"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<ComboBox Width="150" x:Name="Дата" Margin="5">
|
<ComboBox Width="150" x:Name="DateComboBox" SelectionChanged="DateComboBox_SelectionChanged" Margin="5">
|
||||||
<ComboBoxItem Content="Возрастание"/>
|
<ComboBoxItem Content="Возрастание"/>
|
||||||
<ComboBoxItem Content="Убывание"/>
|
<ComboBoxItem Content="Убывание"/>
|
||||||
<ComboBoxItem Content="Все диапазоны"/>
|
<ComboBoxItem Content="Все диапазоны"/>
|
||||||
|
@ -12,16 +12,18 @@ namespace demo_2023
|
|||||||
{
|
{
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
private ObservableCollection<EventPresenter> events = new ObservableCollection<EventPresenter>();
|
private ObservableCollection<EventPresenter> events = new ObservableCollection<EventPresenter>();
|
||||||
|
private List<EventPresenter> dataSourceEvent;
|
||||||
|
private bool isAscending = true; // Флаг для сортировки
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
using var context = new User15Context();
|
using var context = new User15Context();
|
||||||
|
|
||||||
var dataSourceEvent = context.Events.Select(it => new EventPresenter
|
|
||||||
|
dataSourceEvent = context.Events.Select(it => new EventPresenter
|
||||||
{
|
{
|
||||||
Sobitie = it.Sobitie,
|
Sobitie = it.Sobitie,
|
||||||
Date = it.Date,
|
Date = it.Date,
|
||||||
@ -31,16 +33,32 @@ namespace demo_2023
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
foreach (var eventItem in dataSourceEvent)
|
EventListBox.ItemsSource = events;
|
||||||
|
|
||||||
|
ApplySortingAndFiltering();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplySortingAndFiltering()
|
||||||
|
{
|
||||||
|
var temp = dataSourceEvent;
|
||||||
|
|
||||||
|
|
||||||
|
if (DateComboBox.SelectedItem is DateTime selectedDateTime)
|
||||||
{
|
{
|
||||||
events.Add(eventItem);
|
temp = temp.Where(it => it.Date.Date == selectedDateTime.Date).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EventListBox.ItemsSource = events;
|
temp = isAscending ? temp.OrderBy(it => it.Date).ToList() : temp.OrderByDescending(it => it.Date).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
events.Clear();
|
||||||
|
foreach (var item in temp)
|
||||||
|
{
|
||||||
|
events.Add(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class EventPresenter : Event
|
public class EventPresenter : Event
|
||||||
{
|
{
|
||||||
public Bitmap? Image
|
public Bitmap? Image
|
||||||
@ -49,25 +67,25 @@ namespace demo_2023
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
string absolutePath = Path.Combine(AppContext.BaseDirectory, Photo);
|
string absolutePath = Path.Combine(AppContext.BaseDirectory, Photo);
|
||||||
|
return File.Exists(absolutePath) ? new Bitmap(absolutePath) : null;
|
||||||
if (File.Exists(absolutePath))
|
|
||||||
{
|
|
||||||
return new Bitmap(absolutePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void DateComboBox_SelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
isAscending = !isAscending;
|
||||||
|
ApplySortingAndFiltering();
|
||||||
|
}
|
||||||
|
|
||||||
private void Jury_reg(object? sender, RoutedEventArgs e)
|
private void Jury_reg(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
new Additem().ShowDialog(this);
|
new Additem().ShowDialog(this);
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_2023")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_2023")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d38f832f0f4284353be6ed8b83b5daeff3682e53")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9e30e876e51b1e136cbd4b751c48573cc2771d37")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("demo_2023")]
|
[assembly: System.Reflection.AssemblyProductAttribute("demo_2023")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo_2023")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("demo_2023")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
2ae409290fa8af1bf43909ade41f704793ba565a70d5881dd04bc0df6eec2e92
|
e3c78da2cdc6980fa77b2a133556306f70f364175f9f08b29318cf6e73502801
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user