示例#1
0
        static void Main(string[] args)
        {
            CertificateTable table = new CertificateTable();

            Display display1 = new Display(x: 10, y: 20, width: 30);
            Grade   grade    = new Grade()
            {
                Subject = "MAT", Score = 1
            };

            display1.AddItem(new LabelItem("Hodnoceni", grade));
            display1.Refresh();

            /*ConsoleKeyInfo result;
             * do
             * {
             *  double grade;
             *  string temp;
             *  Console.Write("Předmět: ");
             *  temp = Console.ReadLine();
             *  Console.Write("Známka: ");
             *  double.TryParse(Console.ReadLine(), out grade);
             *  table.AddGrade(new Grade() { Subject = temp, Score = grade });
             *  Console.WriteLine("Chceš vložit dalšího? [A]: ");
             *  result = Console.ReadKey();
             *  Console.WriteLine();
             *
             * } while (result.Key == ConsoleKey.A || result.Key == ConsoleKey.Enter);
             *
             * Console.WriteLine(table);
             *
             * Console.ReadKey();*/
        }
示例#2
0
        static void Main(string[] args)
        {
            CertificateTable table = new CertificateTable();

            Display display1 = new Display(x: 13, y: 3, width: 30);
            Grade   grade    = new Grade()
            {
                Subject = "MAT", Score = 1
            };



            ConsoleKeyInfo result;

            do
            {
                double grade1;
                string temp;
                Console.Write("Předmět: ");
                temp = Console.ReadLine();
                Console.Write("Známka: ");
                double.TryParse(Console.ReadLine(), out grade1);
                table.AddGrade(new Grade()
                {
                    Subject = temp, Score = grade1
                });
                display1.AddItem(new LabelItem("Hodnoceni", grade));
                display1.Refresh();
                Console.WriteLine("Chcete vložit další ? [A]");
                Console.SetCursorPosition(60, 18);
                result = Console.ReadKey();
                Console.WriteLine();
                Console.BackgroundColor = ConsoleColor.Black;
            } while (result.Key == ConsoleKey.A || result.Key == ConsoleKey.Enter);
            Console.SetCursorPosition(0, 23);

            Console.WriteLine(table);

            Console.ReadKey();
        }
示例#3
0
        static void Main(string[] args)
        {
            Display displayGrading = new Display(20, 5, 5, 5);

            displayGrading.AddItem(new Item("-- Vysvědčení --", ""));
            displayGrading.AddItem(new Item("", ""));
            Display displayInput = new Display(20, 5, 5, 5);

            displayInput.AddItem(new Item("---- zadávání předmětu ----", ""));
            displayInput.AddItem(new Item("Předmět", ""));
            Display displayInput2 = new Display(20, 5, 5, 5);

            displayInput2.AddItem(new Item("---- zadávání známky ----", ""));
            displayInput2.AddItem(new Item("Známka", ""));
            Display displayConfirm = new Display(20, 5, 5, 5);

            displayConfirm.AddItem(new Item("Chceš vložit dalšího? [A]", ""));



            Grade[] grades = new Grade[9];
            grades[0] = new Grade()
            {
                Subject = "MAT", Score = 1
            };
            grades[1] = new Grade()
            {
                Subject = "CJL", Score = 4
            };
            grades[2] = new Grade()
            {
                Subject = "PRG", Score = 1
            };
            grades[3] = new Grade()
            {
                Subject = "MAT", Score = 2
            };
            grades[4] = new Grade()
            {
                Subject = "CJL", Score = 5
            };
            grades[5] = new Grade()
            {
                Subject = "CJL", Score = 3
            };
            grades[6] = new Grade()
            {
                Subject = "PRG", Score = 1
            };
            grades[7] = new Grade()
            {
                Subject = "MAT", Score = 2
            };
            grades[8] = new Grade()
            {
                Subject = "MAT", Score = 2
            };

            ConsoleKeyInfo result;

            do
            {
                int    grade;
                string temp;
                displayInput.Repaint();
                temp = Console.ReadLine();
                displayInput2.Repaint();
                int.TryParse(Console.ReadLine(), out grade);
                if (temp.Length == 3 && grade < 6 && grade > 0)
                {
                    table.AddGrade(new Grade()
                    {
                        Score = grade, Subject = temp
                    });
                }

                displayConfirm.Repaint();
                result = Console.ReadKey();
                Console.Clear();
            } while (result.Key == ConsoleKey.A || result.Key == ConsoleKey.Enter);

            foreach (var grade in grades)
            {
                GradeAvg ga = table.AddGrade(grade);
            }

            foreach (var item in table.GetAllGrades())
            {
                displayGrading.AddItem(new Item(item.Subject, item.GetAverage()));
            }

            Console.Clear();
            displayGrading.Repaint();


            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            CertificateTable table = new CertificateTable();
            //string temp;
            //string temp_2;
            //Display displayGrading = new Display(new Proportion() { Width = 40, TopLeft = new System.Drawing.Point(20, 3) });
            //displayGrading.AddItem(new LabelItem("-- Vysvědčení --"));
            //displayGrading.AddItem(new LabelItem(""));
            //Display displayInput = new Display(new Proportion() { Width = 30, TopLeft = new System.Drawing.Point(3, 3) });
            //displayInput.AddItem(new LabelItem("---- zadávání předmětu ----"));
            //displayInput.AddItem(new LabelItem("Předmět", ""));
            //Display displayInput2 = new Display(new Proportion() { Width = 30, TopLeft = new System.Drawing.Point(38, 3) });
            //displayInput2.AddItem(new LabelItem("---- zadávání známky ----"));
            //displayInput2.AddItem(new LabelItem("Známka", ""));
            //Display displayConfirm = new Display(new Proportion() { Width = 30, TopLeft = new System.Drawing.Point(25, 12) });
            //displayConfirm.AddItem(new LabelItem("Chceš vložit dalšího? [A]", ""));
            Display d1 = new Display(20, 10);
            //d1.frame();
            //d1.print();
            //d1.back();
            //temp = Console.ReadLine();
            Display d2 = new Display(50, 10);
            //d2.frame();
            //d2.print();
            //d2.back();
            //temp_2 = Console.ReadLine();
            Display d3 = new Display(35, 20);

            //d3.frame();
            //d3.print();


            //Display d2 = new Display("Zadej známku:" + " ", 1, 50, 10);
            //d2.frame();
            //d2.print();
            Grade[] grades = new Grade[9];
            grades[0] = new Grade()
            {
                Subject = "MAT", Score = 1
            };
            grades[1] = new Grade()
            {
                Subject = "CJL", Score = 4
            };
            grades[2] = new Grade()
            {
                Subject = "PRG", Score = 1
            };
            grades[3] = new Grade()
            {
                Subject = "MAT", Score = 2
            };
            grades[4] = new Grade()
            {
                Subject = "CJL", Score = 5
            };
            grades[5] = new Grade()
            {
                Subject = "CJL", Score = 3
            };
            grades[6] = new Grade()
            {
                Subject = "PRG", Score = 1
            };
            grades[7] = new Grade()
            {
                Subject = "MAT", Score = 2
            };
            grades[8] = new Grade()
            {
                Subject = "MAT", Score = 2
            };
            d1.AddItem("-------PŘEDMĚT-------");
            d1.AddItem("Zadej předmět: ");

            d2.AddItem("-------ZNÁMKA-------");
            d2.AddItem("Zadej známku: ");

            d3.AddItem("Chceš zadat další známku [A]?");

            ConsoleKeyInfo result;

            do
            {
                int    grade;
                string temp, temp_2;
                d1.frame();
                //d1.back(2);
                temp = Console.ReadLine();


                d2.frame();
                temp_2 = Console.ReadLine();
                int.TryParse(temp_2, out grade);
                if (temp.Length == 3 && grade < 6 && grade > 0)
                {
                    table.AddGrade(new Grade()
                    {
                        Score = grade, Subject = temp
                    });
                }

                d3.frame();
                result = Console.ReadKey();
                Console.Clear();
            } while (result.Key == ConsoleKey.A || result.Key == ConsoleKey.Enter);

            //foreach (var grade in grades)
            //{
            //    GradeAvg ga = table.AddGrade(grade);
            //}

            //foreach (var item in table.GetAllGrades())
            //{
            //    displayGrading.AddItem(new LabelItem(item.Subject, item.GetAverage()));
            //}

            //Console.Clear();
            //displayGrading.Refresh();


            Console.ReadKey();
        }
示例#5
0
        static void Main(string[] args)

        {
            CertificateTable table = new CertificateTable();

            Display displayGrading = new Display(new Proportion()
            {
                Width = 40, TopLeft = new System.Drawing.Point(20, 3)
            });

            displayGrading.AddItem(new LabelItem("-- Vysvědčení --"));
            displayGrading.AddItem(new LabelItem(""));
            Display displayInput = new Display(new Proportion()
            {
                Width = 30, TopLeft = new System.Drawing.Point(3, 3)
            });

            displayInput.AddItem(new LabelItem("---- zadávání předmětu ----"));
            displayInput.AddItem(new LabelItem("Předmět", ""));
            Display displayInput2 = new Display(new Proportion()
            {
                Width = 30, TopLeft = new System.Drawing.Point(38, 3)
            });

            displayInput2.AddItem(new LabelItem("---- zadávání známky ----"));
            displayInput2.AddItem(new LabelItem("Známka", ""));
            Display displayConfirm = new Display(new Proportion()
            {
                Width = 30, TopLeft = new System.Drawing.Point(25, 12)
            });

            displayConfirm.AddItem(new LabelItem("Chceš vložit dalšího? [A]", ""));

            Grade[] grades = new Grade[9];
            grades[0] = new Grade()
            {
                Subject = "MAT", Score = 1
            };
            grades[1] = new Grade()
            {
                Subject = "CJL", Score = 4
            };
            grades[2] = new Grade()
            {
                Subject = "PRG", Score = 1
            };
            grades[3] = new Grade()
            {
                Subject = "MAT", Score = 2
            };
            grades[4] = new Grade()
            {
                Subject = "CJL", Score = 5
            };
            grades[5] = new Grade()
            {
                Subject = "CJL", Score = 3
            };
            grades[6] = new Grade()
            {
                Subject = "PRG", Score = 1
            };
            grades[7] = new Grade()
            {
                Subject = "MAT", Score = 2
            };
            grades[8] = new Grade()
            {
                Subject = "MAT", Score = 2
            };

            GradeAvg mat = new GradeAvg("MAT");
            GradeAvg cjl = new GradeAvg("CJL");
            GradeAvg prg = new GradeAvg("PRG");

            mat.GetAverage();
            cjl.GetAverage();
            prg.GetAverage();
            ConsoleKeyInfo result;

            do
            {
                int    grade;
                string temp;
                displayInput.Refresh();
                temp = Console.ReadLine();
                displayInput2.Refresh();
                int.TryParse(Console.ReadLine(), out grade);
                if (temp.Length == 5 && grade < 5 && grade > 0)
                {
                    table.AddGrade(new Grade()
                    {
                        Score = grade, Subject = temp
                    });
                }

                displayConfirm.Refresh();
                result = Console.ReadKey();
                Console.Clear();
            } while (result.Key == ConsoleKey.A || result.Key == ConsoleKey.Enter);

            foreach (var grade in grades)
            {
                GradeAvg ga = table.AddGrade(grade);
            }

            foreach (var item in table.GetAllGrades())
            {
                displayGrading.AddItem(new LabelItem(item.Subject, item.GetAverage()));
            }

            Console.Clear();
            displayGrading.Refresh();


            Console.ReadKey();
        }
示例#6
0
        static void Main(string[] args)
        {
            Display displayGreet = new Display("Jaké je vaše přání?", 6, 3);

            displayGreet.AddItem(new LabelItem("[A] Vrtání"));
            displayGreet.AddItem(new LabelItem("[B] Přesun"));
            displayGreet.AddItem(new LabelItem("[C] Řezání"));
            Display displayChange   = new Display("Chceš změnit činnost? [Y]", 33, 20);
            Display displayContinue = new Display("Dokončeno. Chceš pokračovat ve stávající činnosti? [Y]", 33, 20);
            Display displayEnd      = new Display("Ukončuji proces.", 6, 3);

            displayEnd.AddItem(new LabelItem(""));
            ConsoleKeyInfo result;

            displayGreet.Refresh();
            result = Console.ReadKey();
            while (result.Key == ConsoleKey.A || result.Key == ConsoleKey.B || result.Key == ConsoleKey.C)
            {
                if (result.Key == ConsoleKey.A)
                {
                    do
                    {
                        Console.Clear();
                        displayContinue.Refresh();
                        result = Console.ReadKey();
                    } while (result.Key == ConsoleKey.Y || result.Key == ConsoleKey.Enter);
                    Console.Clear();
                    displayChange.Refresh();
                    result = Console.ReadKey();
                    if (result.Key == ConsoleKey.Y || result.Key == ConsoleKey.Enter)
                    {
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                if (result.Key == ConsoleKey.B)
                {
                    do
                    {
                        Console.Clear();
                        displayContinue.Refresh();
                        result = Console.ReadKey();
                    } while (result.Key == ConsoleKey.Y || result.Key == ConsoleKey.Enter);
                    Console.Clear();
                    displayChange.Refresh();
                    result = Console.ReadKey();
                    if (result.Key != ConsoleKey.Y || result.Key != ConsoleKey.Enter)
                    {
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                if (result.Key == ConsoleKey.C)
                {
                    do
                    {
                        Console.Clear();
                        displayContinue.Refresh();
                        result = Console.ReadKey();
                    } while (result.Key == ConsoleKey.Y || result.Key == ConsoleKey.Enter);
                    Console.Clear();
                    displayChange.Refresh();
                    result = Console.ReadKey();
                    if (result.Key != ConsoleKey.Y || result.Key != ConsoleKey.Enter)
                    {
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            Console.Clear();
            displayEnd.Refresh();
            Console.ReadKey();
        }
示例#7
0
        static void Main(string[] args)
        {
            CertificateTable table = new CertificateTable();

            Display displayConfirm = new Display(35, 15, 10, 10);
            Display displayInput   = new Display(35, 15, 10, 10);
            Display displayInput2  = new Display(35, 15, 10, 10);
            Display displayGrading = new Display(35, 15, 10, 10);

            Grade[] grades = new Grade[9];
            grades[0] = new Grade()
            {
                Subject = "MAT", Score = 1
            };
            grades[1] = new Grade()
            {
                Subject = "CJL", Score = 4
            };
            grades[2] = new Grade()
            {
                Subject = "PRG", Score = 1
            };
            grades[3] = new Grade()
            {
                Subject = "MAT", Score = 2
            };
            grades[4] = new Grade()
            {
                Subject = "CJL", Score = 5
            };
            grades[5] = new Grade()
            {
                Subject = "CJL", Score = 3
            };
            grades[6] = new Grade()
            {
                Subject = "PRG", Score = 1
            };
            grades[7] = new Grade()
            {
                Subject = "MAT", Score = 2
            };
            grades[8] = new Grade()
            {
                Subject = "MAT", Score = 2
            };

            displayInput.AddItem(new Item("---- zadávání předmětu ----", ""));
            displayInput.AddItem(new Item("Zadejte předmět: ", ""));
            displayInput2.AddItem(new Item("---- zadávání známky ----", ""));
            displayInput2.AddItem(new Item("Zadejte známku: ", ""));
            displayConfirm.AddItem(new Item("Chceš vložit dalšího? [A/N]", ""));
            string pokracovat = "A";

            while (true)
            {
                if (pokracovat != "A")
                {
                    break;
                }
                else
                {
                    Grade[] grades1 = new Grade[grades.Length + 1];
                    for (int i = 0; i < grades.Length; i++)
                    {
                        grades1[i] = grades[i];
                    }
                    grades = grades1;
                    displayInput.Repaint();
                    string subject = Console.ReadLine();
                    while ((subject != "PRG") && (subject != "MAT") && (subject != "CJL"))
                    {
                        Console.WriteLine("Nevalidní předmět. Zadejte znovu: ");
                        subject = Console.ReadLine();
                        if (subject == "PRG" || subject == "MAT" || subject == "CJL")
                        {
                            break;
                        }
                    }
                    displayInput2.Repaint();
                    string znamčička = Console.ReadLine();
                    while (true)
                    {
                        while (!(int.TryParse(znamčička, out int result)))
                        {
                            Console.WriteLine("Zadej číslo: ");
                            znamčička = Console.ReadLine();
                        }
                        int znamka = int.Parse(znamčička);
                        if (znamka > 5 || znamka < 1)
                        {
                            Console.WriteLine("Zadej číslo v rozmezí 1-5: ");
                            znamčička = Console.ReadLine();
                            continue;
                        }
                        else
                        {
                            break;
                        }
                    }
                    grades[grades.Length - 1] = new Grade()
                    {
                        Subject = subject, Score = Convert.ToDouble(znamčička)
                    };

                    displayConfirm.Repaint();
                    pokracovat = Console.ReadLine();
                }
            }

            displayGrading.AddItem(new Item("-- Vysvědčení --", ""));
            displayGrading.AddItem(new Item("", ""));
            foreach (var grade in grades)
            {
                GradeAvg ga = table.AddGrade(grade);
            }

            foreach (var item in table.GetAllGrades())
            {
                displayGrading.AddItem(new Item(item.Subject, item.GetAverage()));
            }
            displayGrading.Repaint();
            Console.ReadKey();
        }