More clear UI for simulation window
This commit is contained in:
@ -137,18 +137,38 @@ namespace HFUTCourseSimulation {
|
||||
uiWeek7.Text = $"{pointer.Month}/{pointer.Day}";
|
||||
|
||||
//create grid
|
||||
var query = from item in itemDict.Keys
|
||||
where item.teachingweek == currentWeek
|
||||
select item;
|
||||
var query = (from item in itemDict.Keys
|
||||
where item.teachingweek == currentWeek
|
||||
select item).ToList();
|
||||
|
||||
foreach (var item in query) {
|
||||
//get data
|
||||
var data = itemDict[item];
|
||||
while (query.Count != 0) {
|
||||
var core = query[0];
|
||||
var data = itemDict[core];
|
||||
|
||||
int length = 1;
|
||||
//check below
|
||||
if (core.index != 1 && query.Contains(core + new Vector3(0, 0, -1))) {
|
||||
if (itemDict[core + new Vector3(0, 0, -1)].Name == data.Name) {
|
||||
//if below have. jump this->move this to the end
|
||||
query.RemoveAt(0);
|
||||
query.Add(core);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//check follow
|
||||
while (true) {
|
||||
if (query.Contains(core + new Vector3(0, 0, length)) && itemDict[core + new Vector3(0, 0, length)].Name == data.Name) {
|
||||
query.Remove(core + new Vector3(0, 0, length));
|
||||
length++;
|
||||
} else break;
|
||||
}
|
||||
|
||||
//create
|
||||
var warp = new Border();
|
||||
warp.Background = new SolidColorBrush(Colors.LightBlue);
|
||||
warp.CornerRadius = new CornerRadius(5);
|
||||
Grid.SetRowSpan(warp, length);
|
||||
var nGrid = new Grid();
|
||||
nGrid.ToolTip = data.Desc;
|
||||
var courseName = new TextBlock();
|
||||
@ -157,10 +177,17 @@ namespace HFUTCourseSimulation {
|
||||
nGrid.Children.Add(courseName);
|
||||
warp.Child = nGrid;
|
||||
|
||||
Grid.SetRow(warp, item.index - 1);
|
||||
Grid.SetColumn(warp, item.week - 1);
|
||||
Grid.SetRow(warp, core.index - 1);
|
||||
Grid.SetColumn(warp, core.week - 1);
|
||||
|
||||
this.uiArrangeGrid.Children.Add(warp);
|
||||
|
||||
//remove first item
|
||||
query.RemoveAt(0);
|
||||
}
|
||||
|
||||
foreach (var item in query) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ namespace HFUTCourseSimulation {
|
||||
public int week;
|
||||
public int index;
|
||||
|
||||
public static Vector3 operator+(Vector3 a, Vector3 b) {
|
||||
return new Vector3(a.teachingweek + b.teachingweek,
|
||||
a.week + b.week, a.index + b.index);
|
||||
}
|
||||
|
||||
public static bool operator ==(Vector3 a, Vector3 b) {
|
||||
return (a.teachingweek == b.teachingweek && a.week == b.week && a.index == b.index);
|
||||
}
|
||||
|
Reference in New Issue
Block a user