コード例 #1
0
 public lowBorderCalc(int minCores, int maxCores, int minFrenq, int maxFrenq,
                      int minPrice, int maxPrice)
 {
     objCPU           = new CPU();
     indexFoundedCPUs = new List <int>();
     countFoundedCPUs = 0;
     for (int i = 0; i < objCPU.GetCountCPUs(); i++)
     {
         if ((objCPU.cpuList.ElementAt(i).Value.countCores_CPU >= minCores && objCPU.cpuList.ElementAt(i).Value.countCores_CPU <= maxCores) &&
             (objCPU.cpuList.ElementAt(i).Value.frequency_CPU >= minFrenq && objCPU.cpuList.ElementAt(i).Value.frequency_CPU <= maxFrenq) &&
             (objCPU.cpuList.ElementAt(i).Value.price_CPU >= minPrice && objCPU.cpuList.ElementAt(i).Value.price_CPU <= maxPrice
             ))
         {
             countFoundedCPUs++;
             indexFoundedCPUs.Add(i);
         }
     }
 }
コード例 #2
0
ファイル: obsCalcClass.cs プロジェクト: AdvoXS/Shop-Keeper
        private void calc(float cor, float takt, float prices)
        {
            float max = int.MinValue;

            indexFounded = 0;
            weightsCPU   = new int[objCPU.GetCountCPUs()];
            for (int i = 0; i < weightsCPU.Length; i++)
            {
                if ((objCPU.cpuList.ElementAt(i).Value.countCores_CPU *cor +
                     objCPU.cpuList.ElementAt(i).Value.frequency_CPU *takt +
                     objCPU.cpuList.ElementAt(i).Value.price_CPU *prices) > max)
                {
                    max = objCPU.cpuList.ElementAt(i).Value.countCores_CPU *cor +
                          objCPU.cpuList.ElementAt(i).Value.frequency_CPU *takt +
                          objCPU.cpuList.ElementAt(i).Value.price_CPU *prices;
                    indexFounded = i;
                }
            }
        }
コード例 #3
0
        private void calcBorder(string main, int min1, int max1, int min2, int max2)
        {
            int nowCPUs = 0;

            for (int i = 0; i < cpu.GetCountCPUs(); i++)
            {
                if (main == "Количество ядер" && cpu.cpuList.ElementAt(i).Value.frequency_CPU >= min1 && cpu.cpuList.ElementAt(i).Value.frequency_CPU <= max1 &&
                    cpu.cpuList.ElementAt(i).Value.price_CPU >= min2 && cpu.cpuList.ElementAt(i).Value.price_CPU <= max2)
                {
                    foundedIndexCpus.Add(i); nowCPUs++;
                }

                else if (main == "Тактовая частота" && cpu.cpuList.ElementAt(i).Value.countCores_CPU >= min1 && cpu.cpuList.ElementAt(i).Value.countCores_CPU <= max1 &&
                         cpu.cpuList.ElementAt(i).Value.price_CPU >= min2 && cpu.cpuList.ElementAt(i).Value.price_CPU <= max2)
                {
                    foundedIndexCpus.Add(i); nowCPUs++;
                }
                else if (main == "Цена" && cpu.cpuList.ElementAt(i).Value.countCores_CPU >= min1 && cpu.cpuList.ElementAt(i).Value.countCores_CPU <= max1 &&
                         cpu.cpuList.ElementAt(i).Value.frequency_CPU >= min2 && cpu.cpuList.ElementAt(i).Value.frequency_CPU <= max2)
                {
                    foundedIndexCpus.Add(i); nowCPUs++;
                }
            }
        }
コード例 #4
0
        public void Calc()
        {
            foundedIndexCpus.Add(0);
            if (pubStatus.ElementAt(0).Value.Name == "multiGrid")
            {
                int max = int.MinValue;
                for (int i = 0; i < cpu.GetCountCPUs(); i++)
                {
                    if (cpu.cpuList.ElementAt(i).Value.countCores_CPU > max)
                    {
                        max          = cpu.cpuList.ElementAt(i).Value.countCores_CPU;
                        countFounded = 1;
                        indexFounded = i;
                        if (foundedIndexCpus.Count != 0)
                        {
                            foundedIndexCpus.Clear();
                            foundedIndexCpus.Add(0);
                        }
                        foundedIndexCpus[0] = i;
                    }
                    else if (cpu.cpuList.ElementAt(i).Value.countCores_CPU == max)
                    {
                        countFounded++;
                        foundedIndexCpus.Add(i);
                    }
                }
                if (countFounded > 1 && pubStatus.ElementAt(1).Value.Name == "speedGrid")
                {
                    int   newcount = countFounded;
                    int[] newIndex = foundedIndexCpus.ToArray();
                    max = int.MinValue;
                    for (int i = 0; i < newcount; i++)
                    {
                        if (cpu.cpuList.ElementAt(newIndex[i]).Value.frequency_CPU > max)
                        {
                            max          = cpu.cpuList.ElementAt(newIndex[i]).Value.frequency_CPU;
                            countFounded = 1;
                            indexFounded = foundedIndexCpus[i];
                            if (foundedIndexCpus.Count != 0)
                            {
                                foundedIndexCpus.Clear();
                                foundedIndexCpus.Add(0);
                            }
                            foundedIndexCpus[0] = i;
                        }
                        else if (cpu.cpuList.ElementAt(newIndex[i]).Value.frequency_CPU == max)
                        {
                            countFounded++;
                            foundedIndexCpus.Add(i);
                        }
                    }
                }
                else if (countFounded > 1 && pubStatus.ElementAt(1).Value.Name == "gameGrid")
                {
                    int   newcount = countFounded;
                    int[] newIndex = foundedIndexCpus.ToArray();
                    max = int.MaxValue;
                    for (int i = 0; i < newcount; i++)
                    {
                        if (cpu.cpuList.ElementAt(newIndex[i]).Value.price_CPU < max)
                        {
                            max          = cpu.cpuList.ElementAt(newIndex[i]).Value.price_CPU;
                            countFounded = 1;
                            indexFounded = newIndex[i];
                            if (foundedIndexCpus.Count != 0)
                            {
                                foundedIndexCpus.Clear();
                                foundedIndexCpus.Add(0);
                            }
                            foundedIndexCpus[0] = i;
                        }
                        else if (cpu.cpuList.ElementAt(newIndex[i]).Value.price_CPU == max)
                        {
                            countFounded++;
                            foundedIndexCpus.Add(i);
                        }
                    }
                }
            }


            if (pubStatus.ElementAt(0).Value.Name == "speedGrid")
            {
                int max = int.MinValue;
                for (int i = 0; i < cpu.GetCountCPUs(); i++)
                {
                    if (cpu.cpuList.ElementAt(i).Value.frequency_CPU > max)
                    {
                        max          = cpu.cpuList.ElementAt(i).Value.frequency_CPU;
                        countFounded = 1;
                        indexFounded = i;
                        if (foundedIndexCpus.Count != 0)
                        {
                            foundedIndexCpus.Clear();
                            foundedIndexCpus.Add(0);
                        }
                        foundedIndexCpus[0] = i;
                    }
                    else if (cpu.cpuList.ElementAt(i).Value.frequency_CPU == max)
                    {
                        countFounded++;
                        foundedIndexCpus.Add(i);
                    }
                }

                if (countFounded > 1 && pubStatus.ElementAt(1).Value.Name == "multiGrid")
                {
                    int   newcount = countFounded;
                    int[] newIndex = foundedIndexCpus.ToArray();
                    max = int.MinValue;
                    for (int i = 0; i < newcount; i++)
                    {
                        if (cpu.cpuList.ElementAt(newIndex[i]).Value.countCores_CPU > max)
                        {
                            max          = cpu.cpuList.ElementAt(newIndex[i]).Value.countCores_CPU;
                            countFounded = 1;
                            indexFounded = newIndex[i];
                            if (foundedIndexCpus.Count != 0)
                            {
                                foundedIndexCpus.Clear();
                                foundedIndexCpus.Add(0);
                            }
                            foundedIndexCpus[0] = i;
                        }
                        else if (cpu.cpuList.ElementAt(foundedIndexCpus[i]).Value.countCores_CPU == max)
                        {
                            countFounded++;
                            foundedIndexCpus.Add(i);
                        }
                    }
                }
                else if (countFounded > 1 && pubStatus.ElementAt(1).Value.Name == "gameGrid")
                {
                    int   newcount = countFounded;
                    int[] newIndex = foundedIndexCpus.ToArray();
                    max = int.MaxValue;
                    for (int i = 0; i < newcount; i++)
                    {
                        if (cpu.cpuList.ElementAt(newIndex[i]).Value.price_CPU < max)
                        {
                            max          = cpu.cpuList.ElementAt(newIndex[i]).Value.price_CPU;
                            countFounded = 1;
                            indexFounded = newIndex[i];
                            if (foundedIndexCpus.Count != 0)
                            {
                                foundedIndexCpus.Clear();
                                foundedIndexCpus.Add(0);
                            }
                            foundedIndexCpus[0] = i;
                        }
                        else if (cpu.cpuList.ElementAt(i).Value.price_CPU == max)
                        {
                            countFounded++;
                            foundedIndexCpus.Add(i);
                        }
                    }
                }
            }


            if (pubStatus.ElementAt(0).Value.Name == "gameGrid")
            {
                int max = int.MaxValue;
                for (int i = 0; i < cpu.GetCountCPUs(); i++)
                {
                    if (cpu.cpuList.ElementAt(i).Value.price_CPU < max)
                    {
                        max          = cpu.cpuList.ElementAt(i).Value.price_CPU;
                        countFounded = 1;
                        indexFounded = i;
                        if (foundedIndexCpus.Count != 0)
                        {
                            foundedIndexCpus.Clear();
                            foundedIndexCpus.Add(0);
                        }
                        foundedIndexCpus[0] = i;
                    }
                    else if (cpu.cpuList.ElementAt(i).Value.price_CPU == max)
                    {
                        countFounded++;
                        foundedIndexCpus.Add(i);
                    }
                }
                if (countFounded > 1 && pubStatus.ElementAt(1).Value.Name == "speedGrid")
                {
                    int   newcount = countFounded;
                    int[] newIndex = foundedIndexCpus.ToArray();
                    max = int.MinValue;
                    for (int i = 0; i < newcount; i++)
                    {
                        if (cpu.cpuList.ElementAt(newIndex[i]).Value.frequency_CPU > max)
                        {
                            max          = cpu.cpuList.ElementAt(newIndex[i]).Value.frequency_CPU;
                            countFounded = 1;
                            indexFounded = newIndex[i];
                            if (foundedIndexCpus.Count != 0)
                            {
                                foundedIndexCpus.Clear();
                                foundedIndexCpus.Add(0);
                            }
                            foundedIndexCpus[0] = i;
                        }
                        else if (cpu.cpuList.ElementAt(newIndex[i]).Value.countCores_CPU == max)
                        {
                            countFounded++;
                            foundedIndexCpus.Add(i);
                        }
                    }
                }
                else if (countFounded > 1 && pubStatus.ElementAt(1).Value.Name == "multiGrid")
                {
                    int   newcount = countFounded;
                    int[] newIndex = foundedIndexCpus.ToArray();
                    max = int.MinValue;
                    for (int i = 0; i < newcount; i++)
                    {
                        if (cpu.cpuList.ElementAt(newIndex[i]).Value.countCores_CPU > max)
                        {
                            max          = cpu.cpuList.ElementAt(newIndex[i]).Value.countCores_CPU;
                            countFounded = 1;
                            indexFounded = newIndex[i];
                            if (foundedIndexCpus.Count != 0)
                            {
                                foundedIndexCpus.Clear();
                                foundedIndexCpus.Add(0);
                            }
                            foundedIndexCpus[0] = i;
                        }
                        else if (cpu.cpuList.ElementAt(newIndex[i]).Value.countCores_CPU == max)
                        {
                            countFounded++;
                            foundedIndexCpus.Add(i);
                        }
                    }
                }
            }
        }
コード例 #5
0
        public void Show_Cpus(int minCores, int maxCores, int minFrenq, int maxFrenq, int minPrice, int maxPrice, int a = 13)
        {
            deleteStartScreen();
            WindowStyle              = WindowStyle.SingleBorderWindow;
            scrViewerCPUs.IsEnabled  = true;
            scrViewerCPUs.Visibility = Visibility.Visible;
            panel.IsEnabled          = true;
            panel.Height             = a * 108;
            int ots = 108;
            int tek = 0;

            objCPU                   = new CPU();
            imageCPU.Opacity         = 100;
            imageCPU.IsEnabled       = false;
            labelCPU.IsEnabled       = false;
            labelQuestion1.IsEnabled = false;
            GroupBox[] arrGroupBoxsCPUs = new GroupBox[objCPU.GetCountCPUs()];
            Grid[]     arrGridCPUs      = new Grid[objCPU.GetCountCPUs()];
            Label[]    socketCPULabels  = new Label[objCPU.GetCountCPUs()];
            Label[]    coreCPULabels    = new Label[objCPU.GetCountCPUs()];
            Label[]    frenqCPULabels   = new Label[objCPU.GetCountCPUs()];
            Label[]    integrCPULabels  = new Label[objCPU.GetCountCPUs()];
            Label[]    SOCPULabels      = new Label[objCPU.GetCountCPUs()];
            Image[]    CPUImages        = new Image[objCPU.GetCountCPUs()];
            Grid       viewCPUs         = new Grid();

            Label[]      priceCPULabels  = new Label[objCPU.GetCountCPUs()];
            string[]     namesOfImageCPU = { "Pictures_CPU/AMD_SEPRON_2650.jpg", "Pictures_CPU/AMD_ATHLON_200GE.jpg",
                                             "Pictures_CPU/INTEL_CELERON_G3930.jpg", "Pictures_CPU/INTEL_CELERON_G4900.jpg", "Pictures_CPU/AMD_FX_6300.jpg",
                                             "Pictures_CPU/INTEL_PENTIUM_G5400.jpg", "Pictures_CPU/INTEL_CELERON_G4920.jpg", "Pictures_CPU/AMD_FX_8300.jpg",
                                             "Pictures_CPU/AMD_RYZEN_2300X.jpg",     "Pictures_CPU/INTEL_CORE_I3_8100.jpg", "Pictures_CPU/INTEL_XEON_E3_1230.jpg", "Pictures_CPU/INTEL_XEON_E3_1245.jpg",
                                             "Pictures_CPU/AMD_Ryzen_Threadripper_1900X.jpg" };
            ScrollViewer ScrViewerCPUs = new ScrollViewer();

            // panel.Children.Add(ScrViewerCPUs);
            for (int i = 0; i < arrGroupBoxsCPUs.Length; i++)
            {
                if ((objCPU.cpuList.ElementAt(i).Value.countCores_CPU >= minCores && objCPU.cpuList.ElementAt(i).Value.countCores_CPU <= maxCores) &&
                    (objCPU.cpuList.ElementAt(i).Value.frequency_CPU >= minFrenq && objCPU.cpuList.ElementAt(i).Value.frequency_CPU <= maxFrenq) &&
                    (objCPU.cpuList.ElementAt(i).Value.price_CPU >= minPrice && objCPU.cpuList.ElementAt(i).Value.price_CPU <= maxPrice)
                    )
                {
                    arrGroupBoxsCPUs[i] = new GroupBox();
                    arrGridCPUs[i]      = new Grid();
                    //create GroupBoxes for CPU view
                    arrGroupBoxsCPUs[i].Content             = arrGridCPUs[i];
                    arrGroupBoxsCPUs[i].Margin              = new Thickness(2, tek, 0, 0);
                    arrGroupBoxsCPUs[i].HorizontalAlignment = HorizontalAlignment.Left;
                    arrGroupBoxsCPUs[i].Height              = 103;
                    arrGroupBoxsCPUs[i].Width             = 311;
                    arrGroupBoxsCPUs[i].Visibility        = mainWindow.Visibility;
                    arrGroupBoxsCPUs[i].Header            = objCPU.cpuList.ElementAt(i).Key;
                    arrGroupBoxsCPUs[i].VerticalAlignment = VerticalAlignment.Top;
                    panel.Children.Add(arrGroupBoxsCPUs[i]);
                    tek = tek + ots;

                    //create Images for CPU view
                    CPUImages[i]        = new Image();
                    CPUImages[i].Margin = CPUImage.Margin;
                    CPUImages[i].HorizontalAlignment = HorizontalAlignment.Left;
                    CPUImages[i].VerticalAlignment   = VerticalAlignment.Top;

                    CPUImages[i].Source = new BitmapImage(new Uri(namesOfImageCPU[i], UriKind.Relative));
                    //Create Labels for CPU view
                    socketCPULabels[i]         = new Label();
                    coreCPULabels[i]           = new Label();
                    frenqCPULabels[i]          = new Label();
                    integrCPULabels[i]         = new Label();
                    SOCPULabels[i]             = new Label();
                    priceCPULabels[i]          = new Label();
                    socketCPULabels[i].Content = "Сокет: " + objCPU.cpuList.ElementAt(i).Value.socket_CPU;
                    coreCPULabels[i].Content   = "Ядер: " + objCPU.cpuList.ElementAt(i).Value.countCores_CPU;
                    frenqCPULabels[i].Content  = "Тактовая частота: " + objCPU.cpuList.ElementAt(i).Value.frequency_CPU + " MHz";
                    if (objCPU.cpuList.ElementAt(i).Value.integratedVideo_CPU == false)
                    {
                        integrCPULabels[i].Content = "Интегрированное видео: " + "Есть";
                    }
                    else if (objCPU.cpuList.ElementAt(i).Value.integratedVideo_CPU == true)
                    {
                        integrCPULabels[i].Content = "Интегрированное видео: " + "Нет";
                    }
                    if (objCPU.cpuList.ElementAt(i).Value.includedCS_CPU == false)
                    {
                        SOCPULabels[i].Content = "Система охлаждения: " + "Есть";
                    }
                    else if (objCPU.cpuList.ElementAt(i).Value.includedCS_CPU == true)
                    {
                        SOCPULabels[i].Content = "Система охлаждения: " + "Нет";
                    }
                    priceCPULabels[i].Content = objCPU.cpuList.ElementAt(i).Value.price_CPU + " ₽";

                    //set view of Labels of CPU

                    arrGridCPUs[i].Children.Add(socketCPULabels[i]);
                    arrGridCPUs[i].Children.Add(coreCPULabels[i]);
                    arrGridCPUs[i].Children.Add(frenqCPULabels[i]);
                    arrGridCPUs[i].Children.Add(integrCPULabels[i]);
                    arrGridCPUs[i].Children.Add(SOCPULabels[i]);
                    arrGridCPUs[i].Children.Add(priceCPULabels[i]);
                    arrGridCPUs[i].Children.Add(CPUImages[i]);


                    //styling Labels of CPU view
                    socketCPULabels[i].FontSize  = socketCPULabel.FontSize;
                    socketCPULabels[i].FontStyle = socketCPULabel.FontStyle;
                    socketCPULabels[i].Margin    = socketCPULabel.Margin;

                    coreCPULabels[i].FontSize  = coreCPULabel.FontSize;
                    coreCPULabels[i].FontStyle = coreCPULabel.FontStyle;
                    coreCPULabels[i].Margin    = coreCPULabel.Margin;

                    frenqCPULabels[i].FontSize  = frencCpuLabel.FontSize;
                    frenqCPULabels[i].FontStyle = frencCpuLabel.FontStyle;
                    frenqCPULabels[i].Margin    = frencCpuLabel.Margin;

                    integrCPULabels[i].FontSize  = IntegrCPULabel.FontSize;
                    integrCPULabels[i].FontStyle = IntegrCPULabel.FontStyle;
                    integrCPULabels[i].Margin    = IntegrCPULabel.Margin;

                    SOCPULabels[i].FontSize  = SOCPULabel.FontSize;
                    SOCPULabels[i].FontStyle = SOCPULabel.FontStyle;
                    SOCPULabels[i].Margin    = SOCPULabel.Margin;

                    priceCPULabels[i].FontSize   = price_Label.FontSize;
                    priceCPULabels[i].FontStyle  = price_Label.FontStyle;
                    priceCPULabels[i].Margin     = price_Label.Margin;
                    priceCPULabels[i].FontWeight = price_Label.FontWeight;
                }
            }
        }