//Гол private void button1_Click(object sender, EventArgs e) { Task.Factory.StartNew(() => { try { import_process = true; UpdateUI(); ShowStatus("Send GOAL to instatfootball.com...", 0); var mk = new Game.Marker(game, 8, 1, game.Half, -1) { Player1 = player_goal, TimeActualSrv = game.Time }; Web.SaveMarker(game, mk); game.Insert(mk); game.SaveLocal(); ShowStatus("Success", 0); } catch (Exception ex) { ShowStatus(ex.Message, 1); } finally { import_process = false; ReloadDataGridView(); UpdateUI(); } }); }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { var lst = new List <ListViewItem>(); foreach (ListViewItem item in dataGridView1.SelectedItems) { lst.Add(item); } if (lst.Count > 0) { var row = lst[0]; if (row.Tag is Marker) { var mk = (Game.Marker)row.Tag; if (mk.Compare(1, 1) && mk.Player1 == null && mk.Player2 == null) { mainForm.ProcessingMarker(mk); return; } if (mk.Compare(6, 1) && mk.Player1 == null && mk.Player2 == null) { mainForm.ProcessingMarker(mk); return; } if (mk.Compare(8, 1) && mk.Point1.IsEmpty) { mk.Point2 = Point.Empty; mainForm.ProcessingMarker(mk); return; } if (mk.ActionId == 5 && mk.ActionType > 1 && mk.Num == 0 && HockeyIce.Role != HockeyIce.RoleEnum.Ttd) { lock (game.Markers) { if (!game.Markers.Any(o => !o.FlagDel && o.Half.Index == mk.Half.Index && o.TimeVideo > mk.TimeVideo - 100 && o.TimeVideo < mk.TimeVideo + 100 && o.ActionId == 14 && o.player2_id == mk.player1_id)) { mk.FlagUpdate = true; var placemk = mk.Player1.Team.Tactics[0].GetPlace(mk.Player1); if (placemk == null) { foreach (var t in mk.Player1.Team.Tactics.Values) { placemk = t.GetPlace(mk.Player1); if (placemk != null) { break; } } } if (placemk != null) { if (MessageBox.Show("Установить маркер выхода с площадки для игрока " + mk.Player1, "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { return; } var mkc = new Game.Marker(game, 14, placemk.GetCode(), mk.Half, mk.TimeVideo) { Player1 = null, Player2 = mk.Player1 }; Log.Write((string)("INSERT FINE " + mkc.Player1)); game.Insert(mkc); ReloadDataGridView(false); return; } } } return; } mainForm.Second = mk.TimeVideo - 1500; } } }
private void PrepareTactics(Team tm) { //Удаление старых расстановок var ami_removed = game.GetTacticsTime((Uniso.InStat.Game.Team)tm, game.HalfList[0], 0); foreach (var id in ami_removed.Keys) { var t = tm.Tactics[id]; var tt = ami_removed[id]; foreach (Marker mk in tt) { if (mk.FlagSaved) { mk.FlagDel = true; } else { game.Markers.Remove(mk); } } } var rem14 = game.Markers.Where(o => o.ActionId == 14 && o.Half.Index == game.HalfList[0].Index && o.TimeVideo == 0).ToList <Marker>(); foreach (var mk in rem14) { if (mk.FlagSaved) { mk.FlagDel = true; } else { game.Markers.Remove(mk); } } var tint = new List <int>(); foreach (var i in tm.Tactics.Keys) { if (i > 0 && !tm.Tactics[i].IsEmpty) { tint.Add(i); } } var ami = ((Uniso.InStat.Game.Team)tm).GetCurrentTacticsMarker(game, game.HalfList[0], 0, tint); foreach (Marker mk in ami) { game.Insert(mk); } /*ami = ((Uniso.InStat.Game.Team)tm).GetCurrentTacticsMarker(game.HalfList[0], 0, new List<int>() { 0 }); * foreach (Marker mk in ami) * { * Marker mki = new Game.Marker(14, mk.ActionType, game.HalfList[0], 0); * mki.Player1 = mk.Player1; * game.Insert(mki); * }*/ }