Ejemplo n.º 1
0
 private void Top(string path, Label[] labelsName, Label[] labelsClock)
 {
     int sizeV = File.ReadAllLines(path).Where(x => x != "").Count();
     byte sizeG = 2;
     int sizeR = sizeV / sizeG;
     string[] name = new string[0];
     int[] clock = new int[0];
     Array.Resize(ref name, sizeR);
     Array.Resize(ref clock, sizeR);
     string[] full = File.ReadAllLines(path, Encoding.Default).Take(sizeV).ToArray();
     for (int i = 0; i < sizeV / sizeG; i++)
     {
         for (byte j = 0; j < sizeG; j++)
         {
             switch (j)
             {
                 case 0:
                     name[i] = full[i * sizeG + j];
                     break;
                 case 1:
                     clock[i] = int.Parse(full[i * sizeG + j]);
                     break;
             }
         }
     }
     //ЗДЕСЬ НУЖНО ОТСОРТИРОВАТЬ, ЧТОБЫ НАЗВАНИЯ БЫЛИ ОДИНАКОВЫЕ
     //ТОГДА МОЖНО ПРОДОЛЖАТЬ ВСЁ ДАЛЬШЕ ПО СПИСКУ
     //===================================================================================
     string[] nameAssorted = new string[0];
     int[] clockAssorted = new int[0];
     for (int i = 0; i < name.Length; i++)
     {
         if (!nameAssorted.Contains(name[i]))
         {
             Array.Resize(ref nameAssorted, nameAssorted.Length + 1);
             Array.Resize(ref clockAssorted, clockAssorted.Length + 1);
             for (int j = i; j < name.Length; j++)
             {
                 if (name[i] == name[j])
                 {
                     clockAssorted[clockAssorted.Length-1] += clock[j];
                     nameAssorted[nameAssorted.Length-1] = name[i];
                 }
             }
         }               
     }
     //===================================================================================УСПЕШНО
     var myTuple = WindowKnowMore.Corteg(clockAssorted, nameAssorted);
     int masSize = labelsName.Length;
     if (labelsName.Length > nameAssorted.Length) masSize = nameAssorted.Length;
     for (byte i = 0; i < masSize; i++)
     {
         labelsName[i].Content = myTuple.Item2[i] + ": ";
         labelsClock[i].Content = myTuple.Item1[i];
     }
 }
Ejemplo n.º 2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     WindowKnowMore windowKnowMore = new WindowKnowMore(Path.currentWeek);
     windowKnowMore.Show();
 }