Esempio n. 1
0
 public static List<Pair> Words(string seed)
 {
     string r = Get("http://api.bing.net/json.aspx?Appid=C6467D0B252B151049716633B53DF47C0533A2DD&sources=web&query=" + seed);
     List<string> w = parseBing(r);
     List<Pair> words = new List<Pair>();
     foreach (string word in w)
     {
         Pair pair = new Pair(word, 1);
         words.Add(pair);
     }
     return words;
 }
Esempio n. 2
0
 public void AddWord(Pair pair)
 {
     lock (this)
     {
         if (_KeyList.Contains(pair.Key))
         {
             int i = _KeyList.IndexOf(pair.Key);
             _WordList[i].Value += pair.Value;
         }
         else
         {
             _KeyList.Add(pair.Key);
             _WordList.Add(pair);
         }
     }
 }
Esempio n. 3
0
 public void UpdateAll()
 {
     List<Pair<String, int>> temp = new List<Pair<String, int>>();
     List<String> ownNames = new List<string>();
     List<List<Oprava>> oprs = new List<List<Oprava>>();
     foreach (Predmet p in vybavaList)
     {
         Pair<String, int> pair = new Pair<String,int>();
         pair.first = p.predmet;
         pair.second = p.pocet;
         ownNames.Add(p.ownName);
         temp.Add(pair);
         oprs.Add(new List<Oprava>(p.opravy));
     }
     flowPanel.Controls.Clear();
     Clear();
     for (int i = 0; i < temp.Count; i++)
     {
         Predmet x = new Predmet(this, flowPanel, temp[i].first, temp[i].second, ownNames[i], oprs[i]);
         x.Calculate();
         vybavaList.Add(x);
     }
 }
Esempio n. 4
0
 public void UpdateAll()
 {
     {
         List<Pair<String, int>> temp = new List<Pair<String, int>>();
         foreach (Dovednost p in fyzList)
         {
             Pair<String, int> pair = new Pair<string, int>();
             pair.first = p.dovednost;
             pair.second = p.stupen;
             temp.Add(pair);
         }
         temp = temp.OrderBy(d => d.first).ToList();
         p1.Controls.Clear();
         fyzList.Clear();
         foreach (Pair<String, int> pair in temp)
         {
             Dovednost x = new Dovednost(this, p1, pair.first, pair.second);
             x.Calculate();
             fyzList.Add(x);
         }
     }
     {
         List<Pair<String, int>> temp = new List<Pair<String, int>>();
         foreach (Dovednost p in psyList)
         {
             Pair<String, int> pair = new Pair<string, int>();
             pair.first = p.dovednost;
             pair.second = p.stupen;
             temp.Add(pair);
         }
         temp = temp.OrderBy(d => d.first).ToList();
         p2.Controls.Clear();
         psyList.Clear();
         foreach (Pair<String, int> pair in temp)
         {
             Dovednost x = new Dovednost(this, p2, pair.first, pair.second);
             x.Calculate();
             psyList.Add(x);
         }
     }
     {
         List<Pair<String, int>> temp = new List<Pair<String, int>>();
         foreach (Dovednost p in kombList)
         {
             Pair<String, int> pair = new Pair<string, int>();
             pair.first = p.dovednost;
             pair.second = p.stupen;
             temp.Add(pair);
         }
         temp = temp.OrderBy(d => d.first).ToList();
         p3.Controls.Clear();
         kombList.Clear();
         foreach (Pair<String, int> pair in temp)
         {
             Dovednost x = new Dovednost(this, p3, pair.first, pair.second);
             x.Calculate();
             kombList.Add(x);
         }
     }
     details.Hide();
 }
Esempio n. 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     switch (tree.SelectedNode.Parent.Text)
     {
         case "Fyzické":
             if (int.Parse(fyzL.Text) == 0)
             {
                 return;
             }
             break;
         case "Psychické":
             if (int.Parse(psyL.Text) == 0)
             {
                 return;
             }
             break;
         case "Kombinované":
             if (int.Parse(kombL.Text) == 0)
             {
                 return;
             }
             break;
     }
     for (int i = 0; i < stupne.Count; i++)
     {
         if (stupne[i].first == tree.SelectedNode.Parent.Index && stupne[i].second.first == tree.SelectedNode.Index)
         {
             if (stupne[i].second.second != 3)
             {
                 stupne[i].second.second++;
                 switch (tree.SelectedNode.Parent.Text)
                 {
                     case "Fyzické": fyzL.Text = (int.Parse(fyzL.Text)-1).ToString(); break;
                     case "Psychické": psyL.Text = (int.Parse(psyL.Text)-1).ToString(); break;
                     case "Kombinované": kombL.Text = (int.Parse(kombL.Text)-1).ToString(); break;
                 }
             }
             tree.SelectedNode.Text = tree.SelectedNode.Tag.ToString() + " (";
             for (int j = 0; j < stupne[i].second.second; j++)
             {
                 tree.SelectedNode.Text += "I";
             }
             tree.SelectedNode.Text += ")";
             setStupen(tree.SelectedNode);
             return;
         }
     }
     Pair<int, Pair<int, int>> pair = new Pair<int, Pair<int, int>>();
     pair.first = tree.SelectedNode.Parent.Index;
     pair.second = new Pair<int, int>();
     pair.second.first = tree.SelectedNode.Index;
     pair.second.second = 1;
     stupne.Add(pair);
     tree.SelectedNode.Text = tree.SelectedNode.Tag.ToString() + " (I)";
     switch (tree.SelectedNode.Parent.Text)
     {
         case "Fyzické": fyzL.Text = (int.Parse(fyzL.Text) - 1).ToString(); break;
         case "Psychické": psyL.Text = (int.Parse(psyL.Text) - 1).ToString(); break;
         case "Kombinované": kombL.Text = (int.Parse(kombL.Text) - 1).ToString(); break;
     }
     setStupen(tree.SelectedNode);
 }