Skip to content

Commit

Permalink
react to list item change, move JSON loading to separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas O'Connor committed May 31, 2016
1 parent 118f1bb commit 9a06eb3
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 90 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,4 @@ _Pvt_Extensions/
ModelManifest.xml
/Tilandis.VC.opendb
/Tilandis/links.json
/Tilandis.VC.VC.opendb
Binary file added Tilandis.VC.db
Binary file not shown.
180 changes: 91 additions & 89 deletions TilandisGUI/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion TilandisGUI/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,31 @@ public frm_tilandisgui() {
InitializeComponent();
}

JObject json_links;

private void Form1_Load(object sender, EventArgs e) {
// TODO: fix this crap
//Bitmap img_shield = new Bitmap(SystemIcons.Shield.ToBitmap(), new Size(12, 16));
//cbx_asadmin.Image = img_shield;

func_reloadjson();

lst_links.SelectedIndexChanged += clbk_linksel;
}

private void clbk_linksel(object sender, EventArgs e) {
if (lst_links.SelectedItems.Count <= 0) { // none selected
return; // do nothing
}

ListViewItem lvi_curitem = lst_links.SelectedItems[0];
MessageBox.Show(lvi_curitem.Text);
}

private void func_reloadjson() {
StreamReader r = new StreamReader("links.json");
string str_linksjson = r.ReadToEnd();
JObject json_links = JObject.Parse(str_linksjson);
json_links = JObject.Parse(str_linksjson);
r.Close();

foreach (JProperty prop_curitem in json_links.Properties()) {
Expand Down

0 comments on commit 9a06eb3

Please sign in to comment.