public UpdateAltTeamNames(MainWindow MainF, string Team1, string Team2)
        {
            InitializeComponent();

            this.MainF        = MainF;
            TextBoxTeam1.Text = XMLData.ReturnAltTeamName(Team1);
            TextBoxTeam2.Text = XMLData.ReturnAltTeamName(Team2);

            LabelTeamName1.Text = Team1;
            LabelTeamName2.Text = Team2;
        }
        public void UpLay(List <FData> FootData, List <ParsedDataFromPage> PD, int id)
        {
            double MLimit = FootballHedge.Properties.Settings.Default.MailplLimit;

            foreach (ParsedDataFromPage item in PD)
            {
                int i;
                for (i = FootData.Count - 1; i >= 0; i--)
                {
                    if (FootData[i].Team1 == item.Team1 && FootData[i].Team2 == item.Team2)
                    {
                        if (item.delete)
                        {
                            FootData.RemoveAt(i);
                        }
                        else
                        {
                            FootData[i].SizeX[0] = item.Size[0];
                            FootData[i].SizeX[1] = item.Size[1];
                            FootData[i].SizeX[2] = item.Size[2];
                            MainF.LastMatchbookUpdate();
                            foreach (KeyValuePair <int, X> it in FootData[i].XKoef)
                            {
                                if (MainF.Bookmakers[it.Key].Type != BrokerType.BACK)
                                {
                                    continue;
                                }

                                for (int q = 0; q < 3; q++)
                                {
                                    if (it.Value.Koef[q] >= MainF.Bookmakers[it.Key].Limit && FootData[i].Lay[q] > item.Lay[q])
                                    {
                                        double p0 = CalcLayPL(it.Value.Koef[q], item.Lay[q]);
                                        if (p0 >= 1 && MainF.Bookmakers[it.Key].InUse)
                                        {
                                            WriteBreakToFile.LogSave("Lay  " + MainF.Bookmakers[it.Key].Name + " | " + item.Team1 + "-" + item.Team2 + "  [" + q.ToString() + "] " + FootData[i].Lay[q].ToString() + " -> " + item.Lay[q].ToString());
                                            changecolor = true;
                                        }

                                        if (p0 >= MLimit && p0 >= MainF.Bookmakers[it.Key].PLlimit && MainF.Bookmakers[it.Key].EMailing)
                                        {
                                            StringBuilder selection = new StringBuilder();
                                            switch (q)
                                            {
                                            case 0: selection.Append("Draw"); break;

                                            case 1: selection.Append(item.Team1); break;

                                            case 2: selection.Append(item.Team2); break;

                                            default: selection.Append("uknown"); break;
                                            }
                                            PrepareMessage(item.Team1 + "-" + item.Team2, selection.ToString(), it.Value.Koef[q], item.Lay[q], MainF.Bookmakers[it.Key].Name, it.Value.LastUpdate, FootData[i].time);
                                        }
                                    }
                                }
                            }

                            FootData[i].XKoef[id].Koef[0] = item.X[0];
                            FootData[i].XKoef[id].Koef[1] = item.X[1];
                            FootData[i].XKoef[id].Koef[2] = item.X[2];

                            FootData[i].Lay[0] = item.Lay[0];
                            FootData[i].Lay[1] = item.Lay[1];
                            FootData[i].Lay[2] = item.Lay[2];
                        }
                        break;
                    }
                }
                if (i < 0)
                {
                    if (item.delete)
                    {
                        continue;
                    }

                    if (MainF.SuspendedMatches.Count > 0 && MainF.SuspendedMatches.FindIndex(str => str == item.Team1 + " - " + item.Team2) != -1)
                    {
                        continue;
                    }
                    string RepPatter = FootballHedge.Properties.Settings.Default.RepPattern;

                    DateTime dt = DateTime.Parse(item.time, System.Globalization.CultureInfo.CurrentCulture);


                    FData NI = new FData(id);
                    NI.Team1  = item.Team1;
                    NI.Team2  = item.Team2;
                    NI.Match  = Regex.Replace(XMLData.ReturnAltTeamName(item.Team1) + "|" + XMLData.ReturnAltTeamName(item.Team2), RepPatter, "").ToUpper();
                    NI.League = item.League;
                    NI.SizeX  = item.Size;
                    //NI.Koef[id, 0] = item.X[0];
                    //NI.Koef[id, 1] = item.X[1];
                    //NI.Koef[id, 2] = item.X[2];
                    NI.XKoef[id].Koef[0] = item.X[0];
                    NI.XKoef[id].Koef[1] = item.X[1];
                    NI.XKoef[id].Koef[2] = item.X[2];
                    NI.Lay[0]            = item.Lay[0];
                    NI.Lay[1]            = item.Lay[1];
                    NI.Lay[2]            = item.Lay[2];
                    NI.time = dt;
                    FootData.Add(NI);
                    MainF.LastMatchbookUpdate();
                    if (item.League != null)
                    {
                        MainF.CheckAndUpdateEventsCombobox(item.League);
                    }
                }
            }
        }