public MatchView(MatchListPage pg, bool b, Match m) { InitializeComponent(); mainPage = pg; match = m; bScore = b; Admin(); }
public async void updateMatch(Match m, int tNum) { string uri = "http://71.92.131.203:7475/db/data/cypher/"; string query = "MATCH (n: Game { scoringTeam: " + tNum + ", number: \"" + m.number + "\"})" + " SET n.redDef1=\"" + m.redDef1 + "\", n.redDef2=\"" + m.redDef2 + "\", n.redDef3=\"" + m.redDef3 + "\",n.redDef4=\"" + m.redDef4 + "\", n.redDef5=\"" + m.redDef5 + "\"," + " n.blueDef1=\"" + m.blueDef1 + "\", n.blueDef2=\"" + m.blueDef2 + "\", n.blueDef3=\"" + m.blueDef3 + "\",n.blueDef4=\"" + m.blueDef4 + "\", n.blueDef5=\"" + m.blueDef5 + "\", n.BlueCol1=\"" + getHexColor(m.BlueCol1) + "\", n.BlueCol2=\"" + getHexColor(m.BlueCol2) + "\", n.BlueCol3=\"" + getHexColor(m.BlueCol3) + "\", n.BlueCol4=\"" + getHexColor(m.BlueCol4) + "\", n.BlueCol5=\"" + getHexColor(m.BlueCol5) + "\", n.RedCol1=\"" + getHexColor(m.RedCol1) + "\", n.RedCol2=\"" + getHexColor(m.RedCol2) + "\", n.RedCol3=\"" + getHexColor(m.RedCol3) + "\", n.RedCol4=\"" + getHexColor(m.RedCol4) + "\", n.RedCol5=\"" + getHexColor(m.RedCol5) + "\", n.time=timestamp() RETURN n"; // Attach sender to Entr and return all diary entries for this timeline var r = SendAndReceiveJsonRequest(uri, query); }
public async Task<ObservableCollection<Match>> getMatches(int tNum) { string uri = "http://71.92.131.203:7475/db/data/cypher/"; string query = "MATCH (a:Game {scoringTeam:" + tNum + "}) RETURN a ORDER BY a.number"; // Attach sender to Entr and return all diary entries for this timeline var r = SendAndReceiveJsonRequest(uri, query); string responseStr = await r; var results = new ObservableCollection<Match>(); try { neo4jData val = Newtonsoft.Json.JsonConvert.DeserializeObject<neo4jData>(responseStr); foreach (var kvp in val.data)// process column 'a' { foreach (var kv in kvp) { foreach (var k in kv) { if (k.Key == "data")// these are the events { string values = Newtonsoft.Json.JsonConvert.SerializeObject(k.Value); string ds = Newtonsoft.Json.JsonConvert.SerializeObject(k.Value); JToken token = JObject.Parse(ds); Match data = new Match(); try { data.number = (string)token.SelectToken("number"); data.red1 = (string)token.SelectToken("red1"); data.red2 = (string)token.SelectToken("red2"); data.red3 = (string)token.SelectToken("red3"); data.blue1 = (string)token.SelectToken("blue1"); data.blue2 = (string)token.SelectToken("blue2"); data.blue3 = (string)token.SelectToken("blue3"); data.blueDef1 = (string)token.SelectToken("blueDef1"); data.blueDef2 = (string)token.SelectToken("blueDef2"); data.blueDef3 = (string)token.SelectToken("blueDef3"); data.blueDef4 = (string)token.SelectToken("blueDef4"); data.blueDef5 = (string)token.SelectToken("blueDef5"); data.redDef1 = (string)token.SelectToken("redDef1"); data.redDef2 = (string)token.SelectToken("redDef2"); data.redDef3 = (string)token.SelectToken("redDef3"); data.redDef4 = (string)token.SelectToken("redDef4"); data.redDef5 = (string)token.SelectToken("redDef5"); data.RedCol1 = Color.FromHex((string)token.SelectToken("RedCol1")); data.RedCol2 = Color.FromHex((string)token.SelectToken("RedCol2")); data.RedCol3 = Color.FromHex((string)token.SelectToken("RedCol3")); data.RedCol4 = Color.FromHex((string)token.SelectToken("RedCol4")); data.RedCol5 = Color.FromHex((string)token.SelectToken("RedCol5")); data.BlueCol1 = Color.FromHex((string)token.SelectToken("BlueCol1")); data.BlueCol2 = Color.FromHex((string)token.SelectToken("BlueCol2")); data.BlueCol3 = Color.FromHex((string)token.SelectToken("BlueCol3")); data.BlueCol4 = Color.FromHex((string)token.SelectToken("BlueCol4")); data.BlueCol5 = Color.FromHex((string)token.SelectToken("BlueCol5")); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Bad token: " + ex.Message); } results.Add(data); //DateTime dt = DateTime.Now; //dt.AddDays(-1); } } } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } return results; }
void doDone(Object sender, EventArgs args) { REST neo = new REST(); Match m = new Match(); Team t = new Team(); int i = 0; if (mNum.Text == null || mNum.Text == "" || RedTeam1.Text==null || RedTeam1.Text=="" || RedTeam2.Text==null || RedTeam2.Text=="" || RedTeam3.Text==null || RedTeam3.Text=="" || BlueTeam1.Text==null || BlueTeam1.Text=="" || BlueTeam2.Text==null || BlueTeam2.Text=="" || BlueTeam3.Text==null || BlueTeam3.Text=="") return; if (RedTeam1.Text != null && RedTeam1.Text.Length > 0) { m.red1 = RedTeam1.Text; if (int.TryParse(RedTeam1.Text, out i)==false) { DisplayAlert ("Error", " Red Team 1 number is not a number", "Ok"); return; } t.setNum(i); neo.createTeam(t); } if (RedTeam2.Text != null && RedTeam2.Text.Length > 0) { m.red2 = RedTeam2.Text; if (int.TryParse(RedTeam2.Text, out i)==false) { DisplayAlert ("Error", "Red Team 2 number is not a number", "Ok"); return; } t.setNum(i); neo.createTeam(t); } if (RedTeam3.Text != null && RedTeam3.Text.Length > 0) { m.red3 = RedTeam3.Text; if (int.TryParse(RedTeam3.Text, out i)==false) { DisplayAlert ("Error", "Red Team 3 number is not a number", "Ok"); return; } t.setNum(i); neo.createTeam(t); } if (BlueTeam1.Text != null && BlueTeam1.Text.Length > 0) { m.blue1 = BlueTeam1.Text; if (int.TryParse(BlueTeam1.Text, out i)==false) { DisplayAlert ("Error", "Blue Team 1 number is not a number", "Ok"); return; } t.setNum(i); neo.createTeam(t); } if (BlueTeam2.Text != null && BlueTeam2.Text.Length > 0) { m.blue2 = BlueTeam2.Text; if (int.TryParse(BlueTeam2.Text, out i)==false) { DisplayAlert ("Error", "Blue Team 2 number is not a number", "Ok"); return; } t.setNum(i); neo.createTeam(t); } if (BlueTeam3.Text != null && BlueTeam3.Text.Length > 0) { m.blue3 = BlueTeam3.Text; if (int.TryParse(BlueTeam3.Text, out i)==false) { DisplayAlert ("Error", "Blue Team 3 number is not a number", "Ok"); return; } t.setNum(i); neo.createTeam(t); } if (mNum.Text != null) m.number = mNum.Text; neo.createMatch(m, MatchListPage.opt.teamNumber); Navigation.PopModalAsync(); }
// this gets called after the object is instantiated but before it is displayed // you can override the object contents here // that means each cell in the ListView can have different contents--in this case based upon index protected async override void OnBindingContextChanged() { // TODO: populate these tomnbsotmes with calculated defense images and names bool bUS = false; var temp = BindingContext as Match; if (temp == null) temp = new Match(); try { if (temp.blue1.Trim() == MatchListPage.opt.teamNumber.ToString() || temp.blue2.Trim() == MatchListPage.opt.teamNumber.ToString() || temp.blue3.Trim() == MatchListPage.opt.teamNumber.ToString() || temp.red1.Trim() == MatchListPage.opt.teamNumber.ToString() || temp.red2.Trim().Trim() == MatchListPage.opt.teamNumber.ToString() || temp.red3.Trim() == MatchListPage.opt.teamNumber.ToString()) bUS = true; } catch (Exception ex) { Debug.WriteLine(ex.Message); } Image btn1r = new Image { HeightRequest = 50, Source = "lowBar.png", WidthRequest = 50, BackgroundColor = temp.RedCol1 //TextColor = Color.Black, //HorizontalTextAlignment=TextAlignment.Center, //Text = ""// "LowBar", }; Label lab1r = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.redDef1, FontSize = 12 }; StackLayout sl1r = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl1r.Children.Add(btn1r); sl1r.Children.Add(lab1r); redStack.Add(sl1r); Image btn2r = new Image { Source = temp.redDef2 + ".png", HeightRequest = 50, WidthRequest = 50, BackgroundColor = temp.RedCol2 //TextColor = Color.Black, //HorizontalTextAlignment=TextAlignment.Center, //Text = ""// "SallyPort" }; Label lab2r = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.redDef2, FontSize = 10 }; StackLayout sl2r = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl2r.Children.Add(btn2r); sl2r.Children.Add(lab2r); redStack.Add(sl2r); Image btn3r = new Image { Source = temp.redDef3 + ".png", HeightRequest = 50, WidthRequest = 50, BackgroundColor = temp.RedCol3 //TextColor = Color.Black, //HorizontalTextAlignment=TextAlignment.Center, //Text = ""// "RoughTerrain" }; Label lab3r = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.redDef3, FontSize = 10 }; StackLayout sl3r = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl3r.Children.Add(btn3r); sl3r.Children.Add(lab3r); redStack.Add(sl3r); Image btn4r = new Image { Source = temp.redDef4 + ".png", HeightRequest = 50, WidthRequest = 50, BackgroundColor = temp.RedCol4 //TextColor = Color.Black, //HorizontalTextAlignment=TextAlignment.Center, //Text = ""// "ChevalDeFrise" }; Label lab4r = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.redDef4, FontSize = 10 }; StackLayout sl4r = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl4r.Children.Add(btn4r); sl4r.Children.Add(lab4r); redStack.Add(sl4r); Image btn5r = new Image { Source = temp.redDef5 + ".png", HeightRequest = 50, WidthRequest = 50, BackgroundColor = temp.RedCol5 //TextColor = Color.Black, //HorizontalTextAlignment=TextAlignment.Center, //Text = ""// "Drawbridge" }; Label lab5r = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.redDef5, FontSize = 10 }; StackLayout sl5r = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl5r.Children.Add(btn5r); sl5r.Children.Add(lab5r); redStack.Add(sl5r); Image btn1b = new Image { Source = "lowBar.png", HeightRequest = 50, WidthRequest = 50, BackgroundColor = temp.BlueCol1 }; Label lab1b = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.blueDef1, FontSize = 10 }; StackLayout sl1b = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl1b.Children.Add(btn1b); sl1b.Children.Add(lab1b); blueStack.Add(sl1b); Image btn2b = new Image { Source = temp.blueDef2 + ".png", HeightRequest = 50, WidthRequest = 50, BackgroundColor = temp.BlueCol2 }; Label lab2b = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.blueDef2, FontSize = 10 }; StackLayout sl2b = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl2b.Children.Add(btn2b); sl2b.Children.Add(lab2b); blueStack.Add(sl2b); Image btn3b = new Image { Source = temp.blueDef3 + ".png", HeightRequest = 50, WidthRequest = 50, BackgroundColor = temp.BlueCol3 }; Label lab3b = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.blueDef3, FontSize = 10 }; StackLayout sl3b = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl3b.Children.Add(btn3b); sl3b.Children.Add(lab3b); blueStack.Add(sl3b); Image btn4b = new Image { Source = temp.blueDef4 + ".png", HeightRequest = 50, WidthRequest = 50, BackgroundColor = temp.BlueCol4 }; Label lab4b = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.blueDef4, FontSize = 10 }; StackLayout sl4b = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl4b.Children.Add(btn4b); sl4b.Children.Add(lab4b); blueStack.Add(sl4b); Image btn5b = new Image { Source = temp.blueDef5 + ".png", HeightRequest = 50, WidthRequest = 50, BackgroundColor = temp.BlueCol5 }; Label lab5b = new Label { HeightRequest = 25, TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = temp.blueDef5, FontSize = 10 }; StackLayout sl5b = new StackLayout { Orientation = StackOrientation.Vertical, HeightRequest = 100 }; sl5b.Children.Add(btn5b); sl5b.Children.Add(lab5b); blueStack.Add(sl5b); //ImageCircle.Forms.Plugin.Abstractions.CircleImage imgSrc=null; try { StackLayout s0 = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 200 }; Label lab1 = new Label { WidthRequest = 30, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, Text = temp.number, TextColor = Color.Black, BackgroundColor = Color.FromHex("EEFFEF") }; if (bUS == true) lab1.BackgroundColor = Color.FromRgb(255, 223, 0); s0.Children.Add(lab1); StackLayout s1 = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 200 }; s0.Children.Add(s1); StackLayout s1A = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 100 }; Label labRed = new Label { HeightRequest = 25, Text = temp.red1 + " " + temp.red2 + " " + temp.red3, HorizontalTextAlignment = TextAlignment.Center, BackgroundColor = Color.Red, TextColor = Color.White }; Label labSeparator = new Label { HeightRequest = 10, BackgroundColor = Color.White }; s1.Children.Add(labSeparator); s1.Children.Add(s1A); // tombstones s1.Children.Add(labRed); // teams in this alliance StackLayout s1B = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 100 }; Label labBlue = new Label { HeightRequest = 25, HorizontalTextAlignment = TextAlignment.Center, Text = temp.blue1 + " " + temp.blue2 + " " + temp.blue3, BackgroundColor = Color.Blue, TextColor = Color.White }; s1.Children.Add(s1B); // tombstones s1.Children.Add(labBlue); // teams in this alliance StackLayout s2 = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromRgba(255, 0, 0, 66)//Red //HeightRequest = 80 }; foreach (StackLayout sl in redStack) { s2.Children.Add(sl); } /* s2.Children.Add(sl1r); s2.Children.Add(sl2r); s2.Children.Add(sl3r); s2.Children.Add(sl4r); s2.Children.Add(sl5r); */ StackLayout s3 = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromRgba(0, 0, 255, 66)//Blue //HeightRequest = 80 }; foreach (StackLayout sl in blueStack) s3.Children.Add(sl); /* s3.Children.Add(sl1b); s3.Children.Add(sl2b); s3.Children.Add(sl3b); s3.Children.Add(sl4b); s3.Children.Add(sl5b); */ s1A.Children.Add(s2); s1B.Children.Add(s3); //make this cell a particular height, based on its index this.Height = 270; this.View = s0; } catch (Exception ex) { Debug.WriteLine("Error loading story cell: " + ex.Message); } }