Beispiel #1
0
        public void Set(ScrapParameter param)
        {
            if (!FlowMap.ContainsKey(param.Code))
            {
                throw new ScraperException("Code is not defined. Please check code of parameter. Code : " + param.Code);
            }
            FlowType type = FlowMap[param.Code];

            this.flow      = Activator.CreateInstance(type.Flow, this, param, type.LoginMode) as IScrapFlow;
            this.parameter = param;
            Gecko.LauncherDialog.Download += (sender, e) =>
            {
                String       tempPath  = ConfigSystem.ReadConfig("Config", "Temp", "Path");
                String       file      = Path.Combine(tempPath, DateTime.Now.ToString("yyyyMMddHHmmss") + e.Filename);
                nsILocalFile objTarget = (nsILocalFile)Xpcom.NewNativeLocalFile(file);
                e.HelperAppLauncher.SaveToDisk(objTarget, false);
                Action <String, String> action = flow.DownloadProcedure(e.Url);
                action(e.Url, file);
            };
            timer.Interval = 10 * 1000;
            timer.Tick    += (s, e) =>
            {
                Ping(parameter.Keycode);
            };
            timer.Start();
            this.Navigate(flow.StartPage());
        }