Ejemplo n.º 1
0
        public void reader(out string p)
        {
            String dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            dir += "\\ArslanSoftware\\";
            string path = string.Format("{0}Reports\\", dir);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }


            username u = new username();


            XmlSerializer deserializer = new XmlSerializer(typeof(username));

            using (TextReader textReader = new StreamReader(path + "username.xml"))
            {
                u = (username)deserializer.Deserialize(textReader);
            }

            user_name = u.user_name;
            p         = user_name;
        }
Ejemplo n.º 2
0
        public UserWindow(string un)
        {
            InitializeComponent();
            username u = new username();

            u.setname(un);
            u.writer();
            words w = new words();

            w.initialize();
        }
Ejemplo n.º 3
0
        private void guide_header()
        {
            username u = new username();
            string   name;

            u.reader(out name);
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(String.Format("<!DOCTYPE html>\n<html lang=\"en\">\n"));
            sb.AppendLine(String.Format("<head>\n<title>Report for {0}</title>\n<meta charset=\"utf-8\">\n<link rel=\"icon\" href=\"img/icon.ico\" type=\"image/x-icon\">\n<link rel=\"shortcut icon\" href=\"img/icon.ico\" type=\"image/x-icon\" />", name));

            string img  = string.Format("{0}Images", AppDomain.CurrentDomain.BaseDirectory);
            string path = string.Format("{0}Reports\\html\\img", AppDomain.CurrentDomain.BaseDirectory);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            var fileName    = "icon.ico";
            var source      = Path.Combine(img, fileName);
            var destination = Path.Combine(path, fileName);

            File.Copy(source, destination, true);
            string description = "This page has been created for " + name + " to see report of success in the tests.";
            string keywords    = "report,test,dictionary,success,course work, semester project";

            sb.AppendLine(String.Format("<meta name=\"description\" content=\"{0}\">\n<meta name=\"keywords\" content=\"{1}\">\n<meta name=\"author\" content=\"Berk Arslan\">", description, keywords));
            sb.AppendLine(String.Format("<link rel=\"stylesheet\" href=\"css/bootstrap.css\" type=\"text/css\" media=\"screen\">\n<link rel=\"stylesheet\" href=\"css/responsive.css\" type=\"text/css\" media=\"screen\">\n<link rel=\"stylesheet\" href=\"css/style.css\" type=\"text/css\" media=\"screen\">\n<link rel=\"stylesheet\" href=\"css/touchTouch.css\" type=\"text/css\" media=\"screen\">\n<link rel=\"stylesheet\" href=\"css/kwicks-slider.css\" type=\"text/css\" media=\"screen\">\n<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>"));
            sb.AppendLine(String.Format("<script type=\"text/javascript\" src=\"js/jquery.js\"></script>"));
            sb.AppendLine(String.Format("<script type=\"text/javascript\" src=\"js/superfish.js\"></script>"));
            sb.AppendLine(String.Format("<script type=\"text/javascript\" src=\"js/jquery.flexslider-min.js\"></script>"));
            sb.AppendLine(String.Format("<script type=\"text/javascript\" src=\"js/jquery.kwicks-1.5.1.js\"></script>"));
            sb.AppendLine(String.Format("<script type=\"text/javascript\" src=\"js/jquery.easing.1.3.js\"></script>"));
            sb.AppendLine(String.Format("<script type=\"text/javascript\" src=\"js/touchTouch.jquery.js\"></script>"));
            sb.AppendLine(String.Format("<script type=\"text/javascript\" src=\"js/preload.js\"></script>"));
            sb.AppendLine(String.Format("<script type=\"text/javascript\" src=\"js/jvs.js\"></script>"));
            sb.AppendLine("</head>");

            html3 += sb.ToString();
        }
Ejemplo n.º 4
0
        public void writer()
        {
            String dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            dir += "\\ArslanSoftware\\";
            username uu = new username();

            uu.user_name = user_name;

            string path = string.Format("{0}Reports\\", dir);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            XmlSerializer serializer = new XmlSerializer(typeof(username));

            using (TextWriter textWriter = new StreamWriter(path + "username.xml"))
            {
                serializer.Serialize(textWriter, uu);
            }
        }
Ejemplo n.º 5
0
        public void pdf()
        {
            try
            {
                String dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                dir += "\\ArslanSoftware\\";
                string path = string.Format("{0}Reports\\pdf\\", dir);

                string path_img = string.Format("{0}Images\\graph.png", dir);


                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                Document doc = new Document(PageSize.A4);
                PdfWriter.GetInstance(doc, new FileStream((path + "report.pdf"), FileMode.Create));
                doc.Open();

                lock (doc)
                {
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(new Paragraph("MINISTRY OF EDUCATION AND SCIENCE OF UKRAINE NATIONAL TECHNICAL"));
                    doc.Add(new Paragraph("       UNIVERSITY «KHARKIV POLITECNIC INSTITUTE» DEPARTMENT OF"));
                    doc.Add(new Paragraph("                            COMPUTER-AIDED MANAGMENT SYSTEMS"));
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(new Paragraph("                                                     Course Work "));
                    doc.Add(new Paragraph("                         on course: << Object Oriented Programming>> "));
                    doc.Add(new Paragraph("                          entitled: << Wpf Applications \"Dictionary\">> "));
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(new Paragraph("                                                                                                          Performer:"));
                    doc.Add(new Paragraph("                                                                                                          Berk Arslan"));
                    doc.Add(new Paragraph("                                                                                                          If-32 J"));
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);

                    doc.Add(new Paragraph("                                                              Kharkiv 2014                                "));



                    //title1
                    doc.Add(new Paragraph("1.Graph Results"));
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(new Paragraph("    Graph 1.1 shows results according to stored data \"Results\".   "));

                    //creating image

                    iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(path_img);


                    doc.Add(pic);

                    doc.Add(Chunk.NEWLINE);
                    doc.Add(new Paragraph("                                                                     graph 1.1 - Results"));
                    doc.Add(Chunk.NEWLINE);

                    username u = new username();
                    string   name;
                    u.reader(out name);
                    doc.Add(new Paragraph(String.Format("    According to these result you can see the progress day by day. This graph is directly created by dictionary program to provide feedbacks due to test has been done by {0}.", name)));
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(new Paragraph("2.Result Details"));
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(new Paragraph("  Here there is shown detailed results due to questions and their answers. This comparison will help you to understand exactly which questions were wrong. "));
                    doc.Add(Chunk.NEWLINE);

                    string   path_rslt = string.Format("{0}Results\\", dir);
                    string[] files     = Directory.GetFiles(path_rslt);
                    result   r;
                    for (int i = 0; i < files.Count(); i++)
                    {
                        lock (files)
                        {
                            r = new result();
                            XmlSerializer deserializer = new XmlSerializer(typeof(result));
                            using (TextReader textReader = new StreamReader(files[i]))
                            {
                                r = (result)deserializer.Deserialize(textReader);
                            }
                            string p = Path.GetFileNameWithoutExtension(files[i]);
                            doc.Add(new Paragraph(String.Format("{0}, success:{1}%", p, r.success)));
                            lock (r)
                            {
                                for (int j = 0; j < 10; j++)
                                {
                                    doc.Add(new Paragraph(String.Format("{0}. word was \"{1}\" ,its translation was \"{2}\" , and you answered \"{3}\".", (j + 1), r.questions[j], r.trues[j], r.answers[j])));

                                    Thread.Sleep(1000);
                                }
                            }
                            doc.Add(Chunk.NEWLINE);
                        }
                    }



                    doc.Add(Chunk.NEWLINE);
                    doc.Add(Chunk.NEWLINE);
                    doc.Add(new Paragraph("3.Conclusion"));

                    doc.Add(Chunk.NEWLINE);

                    string text = "    Dictionary program presented graphical presentation of results and detailed results which include questions and their answers with user answers.If success rate is less than 50% then it means result is bad, and average result is between 50-80 %, if success is greater than 80% then it means the result is very good.";
                    doc.Add(new Paragraph(text));
                    doc.Close();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }