Example #1
0
 public AddForm(ConfigureForm _main_form)
 {
     InitializeComponent();
     main_form_control = _main_form;
 }
Example #2
0
 private void ConfigureButton_Click(object sender, EventArgs e)
 {
     ConfigureForm config = new ConfigureForm();
     config.ShowDialog();
 }
Example #3
0
        private List <TaskInfo> DiffLinkAndPreTask()
        {
            task_set = new List <Task>();
            List <TaskInfo> tasks_info = new List <TaskInfo>();
            XmlDocument     xml_doc    = new XmlDocument();

            root_xml_doc = xml_doc;
            try
            {
                xml_doc.Load("../../lib/Configure.xml");
                string root_path = ConfigureForm.ReadXmlToPath();
                Dictionary <string, XmlNode> blogs = ConfigureForm.ReadXmlToBlogNode(xml_doc);
                foreach (string user_number in blogs.Keys)
                {
                    XmlNode user       = blogs[user_number];
                    string  store_path = root_path + "/" + user_number;
                    if (!Directory.Exists(store_path))
                    {
                        Directory.CreateDirectory(store_path);
                    }
                    Dictionary <string, string> now_link    = BlogsParser.UrlTitleDic(blogs[user_number].Attributes["home"].Value);
                    Dictionary <string, string> backup_link = ConfigureForm.ReadXmlToLink(blogs[user_number].Attributes["home"].Value);
                    foreach (string link_url in now_link.Keys)
                    {
                        // if the url has been backuped.
                        if (!backup_link.ContainsKey(link_url))
                        {
                            //add the task into the task_set
                            Task temp = PdfConvert.ConvertHtmlToPdfAsync(
                                new PdfDocument
                            {
                                Url          = link_url,
                                HeaderLeft   = link_url,
                                HeaderRight  = "[date] [time]",
                                FooterCenter = "Page [page] of [topage]"
                            }, new PdfOutput
                            {
                                // [title] +".pdf"
                                OutputFilePath = store_path + "/" + now_link[link_url] + ".pdf"
                            }, this);
                            //temp_task.Start();
                            tasks_info.Add(
                                new TaskInfo
                            {
                                user     = user,
                                xml_doc  = xml_doc,
                                link_url = link_url,
                                title    = now_link[link_url]
                            });
                            task_set.Add(temp);
                        }
                    }
                }
            }
            catch (System.IO.FileNotFoundException)
            {
                XmlNode node = xml_doc.CreateXmlDeclaration("1.0", "utf-8", "");
                xml_doc.AppendChild(node);
                XmlNode root_node = xml_doc.CreateElement("students");
                xml_doc.AppendChild(root_node);
                xml_doc.Save("../../lib/Configure.xml");
            }
            return(tasks_info);
        }
Example #4
0
 public AddForm(ConfigureForm _main_form)
 {
     InitializeComponent();
     main_form_control = _main_form;
 }
Example #5
0
        private void ConfigureButton_Click(object sender, EventArgs e)
        {
            ConfigureForm config = new ConfigureForm();

            config.ShowDialog();
        }