Compare commits
16 Commits
78050de03f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b0703f25e | |||
| 1b07d0e2ab | |||
| 6a08694753 | |||
| fabefabe0f | |||
| a572fdf72b | |||
| a855f0664a | |||
| f8f5140d47 | |||
| e9c7b61ced | |||
| e27a6b88d4 | |||
| 70c028aee7 | |||
| bbfe6299b5 | |||
| d5ff2aeee0 | |||
| 60c8a19a58 | |||
| dd30ebd516 | |||
| 186a77eacc | |||
| a7c2b7e5d1 |
@@ -3,7 +3,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="spplus.MainWindow"
|
x:Class="spplus.MainWindow" WindowState="Maximized"
|
||||||
Title="SP+">
|
Title="SP+">
|
||||||
<Border>
|
<Border>
|
||||||
<Grid RowDefinitions="30,*">
|
<Grid RowDefinitions="30,*">
|
||||||
@@ -11,13 +11,13 @@
|
|||||||
<MenuItem Header="Datei">
|
<MenuItem Header="Datei">
|
||||||
<!-- <MenuItem Click="MnuSettings_OnClick" x:Name="MnuSettings" Header="Einstellungen" /> -->
|
<!-- <MenuItem Click="MnuSettings_OnClick" x:Name="MnuSettings" Header="Einstellungen" /> -->
|
||||||
<!-- <Separator /> -->
|
<!-- <Separator /> -->
|
||||||
<MenuItem x:Name="MnuExpSettings" Header="Einstellungen exportieren" />
|
<MenuItem x:Name="MnuExpSettings" Header="Einstellungen exportieren" Click="MnuExpSettings_OnClick" />
|
||||||
<MenuItem x:Name="MnuExit" Header="Beenden" />
|
<MenuItem x:Name="MnuExit" Header="Beenden" Click="MnuExit_OnClick"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Hilfe">
|
<MenuItem Header="Hilfe">
|
||||||
<MenuItem Header="Onlinehilfe" x:Name="MnuHelp" />
|
<MenuItem Header="Onlinehilfe" x:Name="MnuHelp" Click="MnuHelp_OnClick"/>
|
||||||
<MenuItem Header="Git" x:Name="MnuGit" />
|
<MenuItem Header="Git" x:Name="MnuGit" Click="MnuGit_OnClick"/>
|
||||||
<MenuItem Header="Über" x:Name="MnuAbout" />
|
<MenuItem Header="Über" x:Name="MnuAbout" Click="MnuAbout_OnClick" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<TabControl Grid.Row="1">
|
<TabControl Grid.Row="1">
|
||||||
@@ -28,7 +28,67 @@
|
|||||||
<Label FontSize="20" Content="Planung" VerticalContentAlignment="Center" />
|
<Label FontSize="20" Content="Planung" VerticalContentAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
<Grid RowDefinitions="2*,*,*">
|
<Grid ColumnDefinitions="*,2*" RowDefinitions="*,*">
|
||||||
|
<Button Grid.RowSpan="2" Margin="0,10,0,0" x:Name="BtnImport" VerticalAlignment="Top" Height="50" HorizontalAlignment="Stretch" Click="BtnImport_OnClick" HorizontalContentAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="Import" Width="36" Height="36" />
|
||||||
|
<Label Content="Importieren..." VerticalContentAlignment="Center" FontSize="15"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Grid.RowSpan="2" Margin="0,00,0,10" x:Name="BtnCraftCourses" VerticalAlignment="Bottom" Height="50" HorizontalAlignment="Stretch" Click="BtnCraftCourses_OnClick" HorizontalContentAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="Pickaxe" Width="36" Height="36" />
|
||||||
|
<Label Content="Kurse basteln" VerticalContentAlignment="Center" FontSize="15"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<ListBox Grid.RowSpan="2" x:Name="LbStudentsImported" SelectionChanged="LbStudentsImported_OnSelectionChanged" Margin="0,70,0,70" Background="MintCream" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"></ListBox>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="0" Margin="10,10,10,10" Orientation="Vertical" Spacing="10">
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="ID"></Label>
|
||||||
|
<TextBox Grid.Column="1" x:Name="TbStudentID" TextChanged="TbStudentID_OnTextChanged"></TextBox>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Name"></Label>
|
||||||
|
<TextBox Grid.Column="1" x:Name="TbStudentName" TextChanged="TbStudentName_OnTextChanged"></TextBox>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Sport 1"></Label>
|
||||||
|
<Label Grid.Column="1" x:Name="LblSport1"></Label>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Sport 2"></Label>
|
||||||
|
<Label Grid.Column="1" x:Name="LblSport2"></Label>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Sport 3"></Label>
|
||||||
|
<Label Grid.Column="1" x:Name="LblSport3"></Label>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Sport 4"></Label>
|
||||||
|
<Label Grid.Column="1" x:Name="LblSport4"></Label>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="1" Margin="10,10,10,10" Orientation="Vertical" Spacing="10">
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Anzahl Einträge"></Label>
|
||||||
|
<Label Grid.Column="1" x:Name="LblStudentAmount"></Label>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Anzahl gewählte Kurse"></Label>
|
||||||
|
<Label Grid.Column="1" x:Name="LblSelectedAmount"></Label>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
|
|
||||||
namespace spplus;
|
namespace spplus;
|
||||||
|
|
||||||
@@ -8,4 +13,185 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MnuExpSettings_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var res = MessageBox.Show(this, "Dieses Feature ist noch nicht implementiert", "Fehlend");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MnuExit_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MnuHelp_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://git.mypapercloud.de/fierke/spplus/wiki",
|
||||||
|
UseShellExecute = true // Wichtig für Plattformübergreifendes Öffnen
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Fehler beim Öffnen des Links: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MnuGit_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://git.mypapercloud.de/fierke/spplus",
|
||||||
|
UseShellExecute = true // Wichtig für Plattformübergreifendes Öffnen
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Fehler beim Öffnen des Links: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MnuAbout_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Window w = new();
|
||||||
|
w.WindowState = WindowState.Normal;
|
||||||
|
w.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
w.Width = 300;
|
||||||
|
w.Height = 120;
|
||||||
|
Grid g = new();
|
||||||
|
TextBlock tb = new()
|
||||||
|
{
|
||||||
|
Text = "spplus v1.0.0\n(c)2026 MyPapertown, Elias Fierke"
|
||||||
|
};
|
||||||
|
g.Children.Add(tb);
|
||||||
|
w.Content = g;
|
||||||
|
w.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void BtnImport_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var topLevel = GetTopLevel(this);
|
||||||
|
var file = await topLevel!.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||||
|
{
|
||||||
|
Title = "CSV-Datei auswählen",
|
||||||
|
AllowMultiple = false,
|
||||||
|
FileTypeFilter = new[]
|
||||||
|
{
|
||||||
|
new FilePickerFileType(".csv-Datei")
|
||||||
|
{
|
||||||
|
Patterns = new[] { "*.csv" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (file == null) return;
|
||||||
|
|
||||||
|
var imported_students = import.ImportStudentsFromFile(file[0].Path.LocalPath.ToString());
|
||||||
|
foreach (var s in imported_students)
|
||||||
|
{
|
||||||
|
Settings.Instance.Students.Add(s);
|
||||||
|
}
|
||||||
|
RefreshImportedStudentList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshImportedStudentList()
|
||||||
|
{
|
||||||
|
LbStudentsImported.Items.Clear();
|
||||||
|
int count_selected = 0;
|
||||||
|
foreach (var s in Settings.Instance.Students)
|
||||||
|
{
|
||||||
|
LbStudentsImported.Items.Add(s);
|
||||||
|
count_selected += s.SelectedCourseNames.Count;
|
||||||
|
}
|
||||||
|
LblStudentAmount.Content = Settings.Instance.Students.Count.ToString();
|
||||||
|
LblSelectedAmount.Content = count_selected.ToString();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnCraftCourses_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// Craft courses here / call course-crafter
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LbStudentsImported_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Prepare();
|
||||||
|
var stud = (Student)LbStudentsImported.SelectedItem;
|
||||||
|
if (stud == null)
|
||||||
|
{
|
||||||
|
TbStudentName.Text = string.Empty;
|
||||||
|
TbStudentID.Text = string.Empty;
|
||||||
|
SetEmpty();
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TbStudentName.Text = stud.Name;
|
||||||
|
TbStudentID.Text = stud.ID;
|
||||||
|
LblSport1.Content = stud.SelectedCourseNames[0];
|
||||||
|
LblSport2.Content = stud.SelectedCourseNames[1];
|
||||||
|
LblSport3.Content = stud.SelectedCourseNames[2];
|
||||||
|
LblSport4.Content = stud.SelectedCourseNames[3];
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
SetEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
void SetEmpty()
|
||||||
|
{
|
||||||
|
if(LblSport1.Content == "null") LblSport1.Content = "ungewählt";
|
||||||
|
if(LblSport2.Content == "null") LblSport2.Content = "ungewählt";
|
||||||
|
if(LblSport3.Content == "null") LblSport3.Content = "ungewählt";
|
||||||
|
if(LblSport4.Content == "null") LblSport4.Content = "ungewählt";
|
||||||
|
}
|
||||||
|
|
||||||
|
void Prepare()
|
||||||
|
{
|
||||||
|
LblSport1.Content = "null";
|
||||||
|
LblSport2.Content = "null";
|
||||||
|
LblSport3.Content = "null";
|
||||||
|
LblSport4.Content = "null";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TbStudentName_OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
((Student)LbStudentsImported.SelectedItem).Name = TbStudentName.Text;
|
||||||
|
//int current = LbStudentsImported.SelectedIndex;
|
||||||
|
//RefreshImportedStudentList();
|
||||||
|
//LbStudentsImported.SelectedIndex = current;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TbStudentID_OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
((Student)LbStudentsImported.SelectedItem).Name = TbStudentID.Text;
|
||||||
|
//int current = LbStudentsImported.SelectedIndex;
|
||||||
|
//RefreshImportedStudentList();
|
||||||
|
//LbStudentsImported.SelectedIndex = current;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
22
README.md
22
README.md
@@ -1,3 +1,21 @@
|
|||||||
# spplus
|
# SP+
|
||||||
|
|
||||||
|
Interaktiver Sportkursplaner für Oberstufen auf Basis einer Sportkurswahl durch SuS.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
* \+ Import von CSV-Dateien mit Kurswahl
|
||||||
|
* ~ Wahlansicht
|
||||||
|
* \+ Statistiken
|
||||||
|
* ~ Pflege von Sportkursen (inkl. Kürzel/ alternativen Bezeichnungen)
|
||||||
|
* ~ Fehleransicht für nicht-existente, aber gewählte Kurse
|
||||||
|
|
||||||
|
\+ Vorhanden, ~ Pending
|
||||||
|
|
||||||
|
## Nutzung
|
||||||
|
* Build from source:
|
||||||
|
* Benötigt .NET-SDK 9.0
|
||||||
|
* Im Projektordner: `dotnet run`
|
||||||
|
* Release:
|
||||||
|
* Suche `spplus` bzw. `spplus.exe` und führe aus
|
||||||
|
* Linux/MacOS evl.: `chmod +x spplus`
|
||||||
|
|
||||||
Interaktiver Sportkursplaner für Oberstufen auf Basis einer Sportkurswahl durch SuS.
|
|
||||||
50
import.cs
Normal file
50
import.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace spplus;
|
||||||
|
|
||||||
|
public static class import
|
||||||
|
{
|
||||||
|
public static List<Student> ImportStudentsFromFile(string path)
|
||||||
|
{
|
||||||
|
var dict = new Dictionary<string, (string Name, List<string> Courses)>();
|
||||||
|
|
||||||
|
foreach (var line in File.ReadLines(path).Skip(1)) // Header überspringen
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(line))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var parts = line.Split(',');
|
||||||
|
if (parts.Length < 3)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string nameWithId = parts[0].Trim();
|
||||||
|
string course = parts[2].Replace("(2)", "").Replace("(3)", "").Replace("(4)", "").Trim();
|
||||||
|
|
||||||
|
int open = nameWithId.LastIndexOf('(');
|
||||||
|
int close = nameWithId.LastIndexOf(')');
|
||||||
|
if (open < 0 || close < 0 || close <= open)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string name = nameWithId[..open].Trim();
|
||||||
|
string id = nameWithId[(open + 1)..close].Trim();
|
||||||
|
|
||||||
|
if (!dict.ContainsKey(id))
|
||||||
|
dict[id] = (name, new List<string>());
|
||||||
|
|
||||||
|
dict[id].Courses.Add(course);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = new List<Student>();
|
||||||
|
|
||||||
|
foreach (var (id, data) in dict)
|
||||||
|
{
|
||||||
|
var student = new Student(id, data.Name, data.Courses);
|
||||||
|
result.Add(student);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
22
structs.cs
22
structs.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace spplus;
|
namespace spplus;
|
||||||
|
|
||||||
public abstract class Sport
|
public class Sport
|
||||||
{
|
{
|
||||||
public string Name { get; set; } = "Neuer Kurs"; // Kursname
|
public string Name { get; set; } = "Neuer Kurs"; // Kursname
|
||||||
public int MaxCoursesPerSemester { get; set; } = 1; // Maximale Anzahl an Kursen pro Semester
|
public int MaxCoursesPerSemester { get; set; } = 1; // Maximale Anzahl an Kursen pro Semester
|
||||||
@@ -30,21 +30,29 @@ public abstract class Sport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class Student
|
public class Student
|
||||||
{
|
{
|
||||||
public string Name { get; set; } = ""; // Name des Schülers
|
public string ID { get; set; } = ""; // ID des Schüler (z.B. NolteSeb)
|
||||||
|
public string Name { get; set; } = ""; // Name des Schülers
|
||||||
public Sport[] SelectedCourses { get; set; } = new Sport[4]; // Kurswahl
|
public Sport[] SelectedCourses { get; set; } = new Sport[4]; // Kurswahl
|
||||||
|
public List<string> SelectedCourseNames { get; set; } = new();
|
||||||
public List<string>? Result { get; set; } = null;
|
public List<string>? Result { get; set; } = null;
|
||||||
|
|
||||||
protected Student()
|
public Student()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Student(string name, Sport[] selectedCourses)
|
public override string ToString()
|
||||||
{
|
{
|
||||||
|
return $"{Name} ({ID})";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Student(string id, string name, List<string> selectedCoursesNames)
|
||||||
|
{
|
||||||
|
ID = id;
|
||||||
Name = name;
|
Name = name;
|
||||||
SelectedCourses = selectedCourses;
|
SelectedCourseNames = selectedCoursesNames;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user