Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            GetBookTask task  = new GetBookTask();
            var         book  = task.Get("https://www.qisuu.com/du/36/36885/");
            BookMerge   merge = new BookMerge();

            merge.Merge(book, "test.txt");
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Task t = new Task(() =>
            {
                GetBookTask task = new GetBookTask();
                Log("开始下载");
                string text = null;
                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => {
                    text = this.TbUrl.Text;
                }));
                task.Logger     = new Logger1(Log);
                var book        = task.Get(text);
                BookMerge merge = new BookMerge();
                Log("开始合并");
                Directory.CreateDirectory("txt");
                var fileName = "txt\\" + System.IO.Path.GetRandomFileName() + ".txt";
                merge.Merge(book, fileName);
                Log($"下载完成 {fileName}");
            });

            t.Start();
        }