Exemplo n.º 1
0
        private void Sort(Label header, Control.Player.Skill s, bool reverse)
        {
            header.BackColor            = Color.Yellow; header.Refresh();
            Control.Player.OrderSkill   = s;
            Control.Player.OrderReverse = reverse;
            Control.Player[] list = new RMO.Control.Player[panelPlayers.Controls.Count];
            for (int i = 0; i < list.Length; i++)
            {
                list[i] = (Control.Player)panelPlayers.Controls[i];
            }
            Array.Sort(list);
            panelPlayers.SuspendLayout();
            int starty = 0; int k = 0;

            for (int i = 0; i < list.Length; i++)
            {
                panelPlayers.Controls.SetChildIndex(list[i], i);
                if (list[i].Visible)
                {
                    list[i].Location = new Point(list[i].Location.X, starty);
                    starty          += list[i].Size.Height;
                    if (Properties.Settings.Default.GrayLines)
                    {
                        if ((k++ % 2) == 0)
                        {
                            list[i].BackColor = Properties.Settings.Default.LinesColor1;
                        }
                        else
                        {
                            list[i].BackColor = Properties.Settings.Default.LinesColor2;
                        }
                    }
                }
            }
            panelPlayers.ResumeLayout();
            header.BackColor = Color.Transparent;
            if (OldHeader != null)
            {
                OldHeader.Font = new Font(OldHeader.Font.FontFamily, OldHeader.Font.Size, FontStyle.Regular);
            }
            header.Font = new Font(header.Font.FontFamily, header.Font.Size, FontStyle.Bold);
            OldHeader   = header;
        }
Exemplo n.º 2
0
        public void LoadXML(System.Xml.XmlNode team)
        {
            panelPlayers.SuspendLayout();
            panelPlayers.Controls.Clear();
            Control.Player.MAXRESET();
            int y = 0;

            foreach (System.Xml.XmlNode player in team)
            {
                Control.Player p = new RMO.Control.Player();
                p.LoadXML(player);
                p.Location = new Point(0, y);
                panelPlayers.Controls.Add(p);
                p.BringToFront();
                y += p.Height;
            }
            foreach (Control.Player pl in panelPlayers.Controls)
            {
                pl.SetSize();
            }
            panelPlayers.ResumeLayout();
        }
Exemplo n.º 3
0
 public void LoadFromWWW()
 {
     try
     {
         string content = "";
         LOADING = true;
         try
         {
             string today_file = string.Format(Internal.WORKPATH + Internal.BAR + "xml" + Internal.BAR + "{0}.nteam", RMHTML.GetDate());
             string last_file = string.Format(Internal.WORKPATH + Internal.BAR + "xml" + Internal.BAR + "last.nteam", RMHTML.GetDate());
             content = Internal.Main.DownloadNazionale(!System.IO.File.Exists(last_file));
             content = RMHTML.GetBody(content);
             if (content == "") if (System.IO.File.Exists(last_file))
                     content = System.IO.File.ReadAllText(last_file);
             if (content != "")
             {
                 if (System.IO.File.Exists(last_file))
                 {
                     string last = System.IO.File.ReadAllText(last_file);
                     if (content != last)
                     {
                         System.IO.File.WriteAllText(today_file, content, Encoding.UTF8);
                         System.IO.File.WriteAllText(last_file, content, Encoding.UTF8);
                     }
                 }
                 else
                 {
                     System.IO.File.WriteAllText(today_file, content, Encoding.UTF8);
                     System.IO.File.WriteAllText(last_file, content, Encoding.UTF8);
                 }
                 string[] players = content.Split(new string[1] { @"href='player.php?" }, StringSplitOptions.RemoveEmptyEntries);
                 System.Collections.ArrayList Giocatori = new System.Collections.ArrayList();
                 int totale_eta = 0;
                 foreach (string g in players)
                 {
                     if (g.Contains("id_player=") && g.Contains("class='squadskill'"))
                     {
                         RMO.Class.Player p = new RMO.Class.Player();
                         p.ID = (int)RMO.RMHTML.GetNumero(g, @"id_player=", @"'>");
                         string nome = RMO.RMHTML.U(RMO.RMHTML.GetStringa(g, @"id_player=" + p.ID.ToString() + "'>", @"</a>"));
                         string[] nome1 = nome.Split(' ');
                         p.NOME = nome1[0];
                         p.COGNOME = nome.Replace(nome1[0] + " ", "");
                         p.STATO = "Nazionale";
                         //p.club_id = (int)RMO.RMHTML.GetNumero(g, @"club.php?id_club=", "'>");
                         //p.club_name = RMO.RMHTML.U(RMO.RMHTML.GetStringa(g, @"id_club=" + p.club_id + "'>", @"</a>"));
                         p.ALTEZZA = (int)RMO.RMHTML.GetNumero(g, @"altezza :", @"<br>");
                         p.ETA = (int)RMO.RMHTML.GetNumero(g, @"</a>)&nbsp;&nbsp;", @"anni");
                         if (p.ETA == 0) p.ETA = (int)RMO.RMHTML.GetNumero(g, @"</a></b><br>", @"anni");
                         p.SALARIO = 0;
                         p.PESO = RMO.RMHTML.GetNumero(g, @"peso :", @"<");
                         p.ESPERIENZA = (int)RMO.RMHTML.GetNumero(g, @"esperienza : <img src = '" + skillurl, @".gif");
                         p.RESISTENZA = (int)RMO.RMHTML.GetNumero(g, @"resistenza : <img src = '" + skillurl, @".gif");
                         p.FORZA = (int)RMO.RMHTML.GetNumero(g, @"forza : <img src = '" + skillurl, @".gif");
                         p.PLACCAGGI = (int)RMO.RMHTML.GetNumero(g, @"placcaggi : <img src = '" + skillurl, @".gif");
                         p.VELOCITA = (int)RMO.RMHTML.GetNumero(g, @"velocità : <img src = '" + skillurl, @".gif");
                         p.PASSAGGI = (int)RMO.RMHTML.GetNumero(g, @"passaggi : <img src = '" + skillurl, @".gif");
                         p.RICEZIONE = (int)RMO.RMHTML.GetNumero(g, @"ricezione : <img src = '" + skillurl, @".gif");
                         p.CALCI = (int)RMO.RMHTML.GetNumero(g, @"calci : <img src = '" + skillurl, @".gif");
                         Giocatori.Add(p);
                         totale_eta += p.ETA;
                     }
                 }
                 Internal.Main.StatusBar.Value = 0;
                 Internal.Main.StatusBar.Maximum = Giocatori.Count;
                 Control.Player.MAXRESET();
                 panelPlayers.SuspendLayout();
                 panelPlayers.Controls.Clear();
                 int y = 0; int k = 0;
                 foreach (RMO.Class.Player pl in Giocatori)
                 {
                     Control.Player c = new RMO.Control.Player();
                     c.LoadData(pl);
                     c.ShowFACVT();
                     panelPlayers.Controls.Add(c);
                     if (Properties.Settings.Default.GrayLines)
                     {
                         if ((k++ % 2) == 0) c.BackColor = Properties.Settings.Default.LinesColor1;
                         else c.BackColor = Properties.Settings.Default.LinesColor2;
                     }
                     Internal.Main.StatusBar.Value++;
                 }
                 foreach (Control.Player p in panelPlayers.Controls)
                 {
                     p.SetSize();
                     p.Location = new Point(0, y);
                     y += p.Height;
                 }
                 InitHeader();
                 panelPlayers.ResumeLayout();
                 decimal media = Math.Truncate((decimal)(totale_eta * 10 / Giocatori.Count)) / 10;
                 lEta.Text = string.Format(T("Età media {0} anni"), media.ToString());
                 lTOTALE.Text = string.Format(T("{0} Giocatori"), Giocatori.Count.ToString());
             }
             else { labelLoading.Text = T("Sei sicuro di essere manager di una nazionale?"); }
         }
         catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n"+ex.Message); }
         Internal.Main.StatusBar.Value = 0;
         LOADING = (content == "");
     }
     catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n"+ex.Message); }
 }
Exemplo n.º 4
0
 private void Sort(Label header, Control.Player.Skill s,bool reverse)
 {
     header.BackColor = Color.Yellow; header.Refresh();
     Control.Player.OrderSkill = s;
     Control.Player.OrderReverse = reverse;
     Control.Player[] list = new RMO.Control.Player[panelPlayers.Controls.Count];
     for (int i = 0; i < list.Length; i++) list[i] = (Control.Player)panelPlayers.Controls[i];
     Array.Sort(list);
     panelPlayers.SuspendLayout();
     int starty = 0; int k = 0;
     for (int i = 0; i < list.Length; i++)
     {
         panelPlayers.Controls.SetChildIndex(list[i], i);
         if (list[i].Visible)
         {
             list[i].Location = new Point(list[i].Location.X, starty);
             starty += list[i].Size.Height;
             if (Properties.Settings.Default.GrayLines)
             {
                 if ((k++ % 2) == 0) list[i].BackColor = Properties.Settings.Default.LinesColor1;
                 else list[i].BackColor = Properties.Settings.Default.LinesColor2;
             }
         }
     }
     panelPlayers.ResumeLayout();
     header.BackColor = Color.Transparent;
     if (OldHeader != null) OldHeader.Font = new Font(OldHeader.Font.FontFamily, OldHeader.Font.Size, FontStyle.Regular);
     header.Font = new Font(header.Font.FontFamily, header.Font.Size, FontStyle.Bold);
     OldHeader = header;
 }
Exemplo n.º 5
0
 public void LoadFromWWW()
 {
     try
     {
         string content = "";
         LOADING = true;
         try
         {
             string today_file = string.Format(Internal.WORKPATH + Internal.BAR + "xml" + Internal.BAR + "{0}.nteam", RMHTML.GetDate());
             string last_file  = string.Format(Internal.WORKPATH + Internal.BAR + "xml" + Internal.BAR + "last.nteam", RMHTML.GetDate());
             content = Internal.Main.DownloadNazionale(!System.IO.File.Exists(last_file));
             content = RMHTML.GetBody(content);
             if (content == "")
             {
                 if (System.IO.File.Exists(last_file))
                 {
                     content = System.IO.File.ReadAllText(last_file);
                 }
             }
             if (content != "")
             {
                 if (System.IO.File.Exists(last_file))
                 {
                     string last = System.IO.File.ReadAllText(last_file);
                     if (content != last)
                     {
                         System.IO.File.WriteAllText(today_file, content, Encoding.UTF8);
                         System.IO.File.WriteAllText(last_file, content, Encoding.UTF8);
                     }
                 }
                 else
                 {
                     System.IO.File.WriteAllText(today_file, content, Encoding.UTF8);
                     System.IO.File.WriteAllText(last_file, content, Encoding.UTF8);
                 }
                 string[] players = content.Split(new string[1] {
                     @"href='player.php?"
                 }, StringSplitOptions.RemoveEmptyEntries);
                 System.Collections.ArrayList Giocatori = new System.Collections.ArrayList();
                 int totale_eta = 0;
                 foreach (string g in players)
                 {
                     if (g.Contains("id_player=") && g.Contains("class='squadskill'"))
                     {
                         RMO.Class.Player p = new RMO.Class.Player();
                         p.ID = (int)RMO.RMHTML.GetNumero(g, @"id_player=", @"'>");
                         string   nome  = RMO.RMHTML.U(RMO.RMHTML.GetStringa(g, @"id_player=" + p.ID.ToString() + "'>", @"</a>"));
                         string[] nome1 = nome.Split(' ');
                         p.NOME    = nome1[0];
                         p.COGNOME = nome.Replace(nome1[0] + " ", "");
                         p.STATO   = "Nazionale";
                         //p.club_id = (int)RMO.RMHTML.GetNumero(g, @"club.php?id_club=", "'>");
                         //p.club_name = RMO.RMHTML.U(RMO.RMHTML.GetStringa(g, @"id_club=" + p.club_id + "'>", @"</a>"));
                         p.ALTEZZA = (int)RMO.RMHTML.GetNumero(g, @"altezza :", @"<br>");
                         p.ETA     = (int)RMO.RMHTML.GetNumero(g, @"</a>)&nbsp;&nbsp;", @"anni");
                         if (p.ETA == 0)
                         {
                             p.ETA = (int)RMO.RMHTML.GetNumero(g, @"</a></b><br>", @"anni");
                         }
                         p.SALARIO    = 0;
                         p.PESO       = RMO.RMHTML.GetNumero(g, @"peso :", @"<");
                         p.ESPERIENZA = (int)RMO.RMHTML.GetNumero(g, @"esperienza : <img src = '" + skillurl, @".gif");
                         p.RESISTENZA = (int)RMO.RMHTML.GetNumero(g, @"resistenza : <img src = '" + skillurl, @".gif");
                         p.FORZA      = (int)RMO.RMHTML.GetNumero(g, @"forza : <img src = '" + skillurl, @".gif");
                         p.PLACCAGGI  = (int)RMO.RMHTML.GetNumero(g, @"placcaggi : <img src = '" + skillurl, @".gif");
                         p.VELOCITA   = (int)RMO.RMHTML.GetNumero(g, @"velocità : <img src = '" + skillurl, @".gif");
                         p.PASSAGGI   = (int)RMO.RMHTML.GetNumero(g, @"passaggi : <img src = '" + skillurl, @".gif");
                         p.RICEZIONE  = (int)RMO.RMHTML.GetNumero(g, @"ricezione : <img src = '" + skillurl, @".gif");
                         p.CALCI      = (int)RMO.RMHTML.GetNumero(g, @"calci : <img src = '" + skillurl, @".gif");
                         Giocatori.Add(p);
                         totale_eta += p.ETA;
                     }
                 }
                 Internal.Main.StatusBar.Value   = 0;
                 Internal.Main.StatusBar.Maximum = Giocatori.Count;
                 Control.Player.MAXRESET();
                 panelPlayers.SuspendLayout();
                 panelPlayers.Controls.Clear();
                 int y = 0; int k = 0;
                 foreach (RMO.Class.Player pl in Giocatori)
                 {
                     Control.Player c = new RMO.Control.Player();
                     c.LoadData(pl);
                     c.ShowFACVT();
                     panelPlayers.Controls.Add(c);
                     if (Properties.Settings.Default.GrayLines)
                     {
                         if ((k++ % 2) == 0)
                         {
                             c.BackColor = Properties.Settings.Default.LinesColor1;
                         }
                         else
                         {
                             c.BackColor = Properties.Settings.Default.LinesColor2;
                         }
                     }
                     Internal.Main.StatusBar.Value++;
                 }
                 foreach (Control.Player p in panelPlayers.Controls)
                 {
                     p.SetSize();
                     p.Location = new Point(0, y);
                     y         += p.Height;
                 }
                 InitHeader();
                 panelPlayers.ResumeLayout();
                 decimal media = Math.Truncate((decimal)(totale_eta * 10 / Giocatori.Count)) / 10;
                 lEta.Text    = string.Format(T("Età media {0} anni"), media.ToString());
                 lTOTALE.Text = string.Format(T("{0} Giocatori"), Giocatori.Count.ToString());
             }
             else
             {
                 labelLoading.Text = T("Sei sicuro di essere manager di una nazionale?");
             }
         }
         catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n" + ex.Message); }
         Internal.Main.StatusBar.Value = 0;
         LOADING = (content == "");
     }
     catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n" + ex.Message); }
 }
Exemplo n.º 6
0
        public void LoadFromDB()
        {
            try
            {
                LOADING         = true;
                comboDa.Enabled = false;
                comboA.Enabled  = false;
                try
                {
                    if (RELOADDATA)
                    {
                        comboDa.Items.Clear();
                        comboA.Items.Clear();
                        comboDa.Items.AddRange(Internal.DB.GetDates());
                        comboA.Items.AddRange(Internal.DB.GetDates());
                        if (comboDa.Items.Count > 1)
                        {
                            comboDa.SelectedIndex = 1;
                        }
                        else if (comboDa.Items.Count == 1)
                        {
                            comboDa.SelectedIndex = 0;
                        }
                        if (comboA.Items.Count > 0)
                        {
                            comboA.SelectedIndex = 0;
                        }
                    }
                    if (comboDa.SelectedIndex < 0)
                    {
                        return;
                    }
                    if (comboA.SelectedIndex < 0)
                    {
                        return;
                    }
                    DataTable DT_NEW = Internal.DB.GetPlayers(comboA.Items[comboA.SelectedIndex].ToString());
                    string    da = comboDa.Items[comboDa.SelectedIndex].ToString();
                    int       y = 0; int j = 0;
                    Internal.Main.StatusBar.Value   = 0;
                    Internal.Main.StatusBar.Maximum = DT_NEW.Rows.Count * 2;
                    Control.Player[] list = new RMO.Control.Player[DT_NEW.Rows.Count];
                    foreach (DataRow dr in DT_NEW.Rows)
                    {
                        Control.Player p = new RMO.Control.Player();
                        p.LoadData(dr, da);
                        list[j] = p; j++;
                        switch (comboVT.SelectedIndex)
                        {
                        case 1: p.ShowFACVT(); break;

                        case 2: p.ShowFCDVT(); break;
                        }
                        Internal.Main.StatusBar.Value++;
                    }
                    int totale_stipendi = 0;
                    int totale_eta      = 0;
                    Array.Sort(list);
                    panelPlayers.SuspendLayout();
                    panelPlayers.Controls.Clear();
                    int k = 0;
                    foreach (Control.Player pl in list)
                    {
                        pl.SetSize();
                        totale_stipendi += pl.SALARIO;
                        totale_eta      += pl.ETA;
                        pl.Location      = new Point(0, y);
                        y += pl.Height;
                        panelPlayers.Controls.Add(pl);
                        if (Properties.Settings.Default.GrayLines)
                        {
                            if ((k++ % 2) == 0)
                            {
                                pl.BackColor = Properties.Settings.Default.LinesColor1;
                            }
                            else
                            {
                                pl.BackColor = Properties.Settings.Default.LinesColor2;
                            }
                        }
                        Internal.Main.StatusBar.Value++;
                    }
                    lStipendi.Text = string.Format(T("Totale stipendi: {0} €"), totale_stipendi.ToString());
                    decimal media = Math.Truncate((decimal)(totale_eta * 10 / list.Length)) / 10;
                    lEta.Text    = string.Format(T("Età media {0} anni"), media.ToString());
                    lTOTALE.Text = string.Format(T("{0} Giocatori"), list.Length.ToString());
                    InitHeader();
                    panelPlayers.ResumeLayout();
                }
                catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n" + ex.Message); }
                Internal.Main.StatusBar.Value = 0;
                comboDa.Enabled = true;
                comboA.Enabled  = true;
                LOADING         = false;
                CheckBlockedMarket();
            }
            catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n" + ex.Message); }
        }
Exemplo n.º 7
0
 public void LoadFromDB()
 {
     try
     {
         LOADING = true;
         comboDa.Enabled = false;
         comboA.Enabled = false;
         try
         {
             if (RELOADDATA)
             {
                 comboDa.Items.Clear();
                 comboA.Items.Clear();
                 comboDa.Items.AddRange(Internal.DB.GetDates());
                 comboA.Items.AddRange(Internal.DB.GetDates());
                 if (comboDa.Items.Count > 1) comboDa.SelectedIndex = 1;
                 else if (comboDa.Items.Count == 1) comboDa.SelectedIndex = 0;
                 if (comboA.Items.Count > 0) comboA.SelectedIndex = 0;
             }
             if (comboDa.SelectedIndex < 0) return;
             if (comboA.SelectedIndex < 0) return;
             DataTable DT_NEW = Internal.DB.GetPlayers(comboA.Items[comboA.SelectedIndex].ToString());
             string da = comboDa.Items[comboDa.SelectedIndex].ToString();
             int y = 0; int j = 0;
             Internal.Main.StatusBar.Value = 0;
             Internal.Main.StatusBar.Maximum = DT_NEW.Rows.Count * 2;
             Control.Player[] list = new RMO.Control.Player[DT_NEW.Rows.Count];
             foreach (DataRow dr in DT_NEW.Rows)
             {
                 Control.Player p = new RMO.Control.Player();
                 p.LoadData(dr, da);
                 list[j] = p; j++;
                 switch (comboVT.SelectedIndex)
                 {
                     case 1: p.ShowFACVT(); break;
                     case 2: p.ShowFCDVT(); break;
                 }
                 Internal.Main.StatusBar.Value++;
             }
             int totale_stipendi = 0;
             int totale_eta = 0;
             Array.Sort(list);
             panelPlayers.SuspendLayout();
             panelPlayers.Controls.Clear();
             int k = 0;
             foreach (Control.Player pl in list)
             {
                 pl.SetSize();
                 totale_stipendi += pl.SALARIO;
                 totale_eta += pl.ETA;
                 pl.Location = new Point(0, y);
                 y += pl.Height;
                 panelPlayers.Controls.Add(pl);
                 if (Properties.Settings.Default.GrayLines)
                 {
                     if ((k++ % 2) == 0) pl.BackColor = Properties.Settings.Default.LinesColor1;
                     else pl.BackColor = Properties.Settings.Default.LinesColor2;
                 }
                 Internal.Main.StatusBar.Value++;
             }
             lStipendi.Text = string.Format(T("Totale stipendi: {0} €"), totale_stipendi.ToString());
             decimal media = Math.Truncate((decimal)(totale_eta * 10 / list.Length)) / 10;
             lEta.Text = string.Format(T("Età media {0} anni"), media.ToString());
             lTOTALE.Text = string.Format(T("{0} Giocatori"), list.Length.ToString());
             InitHeader();
             panelPlayers.ResumeLayout();
         }
         catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n"+ex.Message); }
         Internal.Main.StatusBar.Value = 0;
         comboDa.Enabled = true;
         comboA.Enabled = true;
         LOADING = false;
         CheckBlockedMarket();
     }
     catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n"+ex.Message); }
 }
Exemplo n.º 8
0
 public void LoadXML(System.Xml.XmlNode team)
 {
     panelPlayers.SuspendLayout();
     panelPlayers.Controls.Clear();
     Control.Player.MAXRESET();
     int y = 0;
     foreach (System.Xml.XmlNode player in team)
     {
         Control.Player p = new RMO.Control.Player();
         p.LoadXML(player);
         p.Location = new Point(0, y);
         panelPlayers.Controls.Add(p);
         p.BringToFront();
         y += p.Height;
     }
     foreach (Control.Player pl in panelPlayers.Controls)
     {
         pl.SetSize();
     }
     panelPlayers.ResumeLayout();
 }