This repository has been archived by the owner on Jul 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RotorWindow.cs
55 lines (51 loc) · 1.52 KB
/
RotorWindow.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using Gtk;
using Newtonsoft.Json.Linq;
using Task = System.Threading.Tasks.Task;
using YandexMusicApi;
using UI = Gtk.Builder.ObjectAttribute;
using Window = Gtk.Window;
namespace Yamux;
public class RotorWindow : Window
{
[UI] private Spinner spinnerProgress = null;
[UI] private Box ResultBox = null;
public RotorWindow() : this(YamuxWindow.YamuxWindowBuilder)
{
}
private RotorWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow"))
{
builder.Autoconnect(this);
GenerateUI();
}
private async void GenerateUI()
{
spinnerProgress.Active = true;
Grid sdasd = new Grid();
sdasd.RowSpacing = 100;
sdasd.ColumnSpacing = 100;
JToken stationList = "";
await Task.Run(() => { stationList = Rotor.StationList()["result"]; });
int labelPositionHeight = 1;
bool labelPositonWidth = false;
foreach (var i in stationList)
{
Label k = new Label(i["station"]["name"].ToString());
k.MarginStart = 9;
if (labelPositonWidth)
{
sdasd.Attach(k, 0, 0, 6, labelPositionHeight);
labelPositonWidth = false;
labelPositionHeight++;
}
else
{
sdasd.Attach(k, 0, 0, 1, labelPositionHeight);
labelPositonWidth = true;
}
}
ResultBox.Add(sdasd);
ResultBox.ShowAll();
spinnerProgress.Active = false;
}
}