コード例 #1
0
ファイル: FormIterate.cs プロジェクト: ambiesoft/printurls
 protected override void OnDragDrop(DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.Html))
     {
         object o = e.Data.GetData(DataFormats.Html);
         if (o == null)
         {
             return;
         }
         string[] urls = FormIterate.GetUrlsFromHtml(o.ToString());
         foreach (string url in urls)
         {
             Items.Add(url);
         }
         return;
     }
     base.OnDragDrop(e);
 }
コード例 #2
0
        static void Main(string[] args)
        {
            Ambiesoft.CppUtils.AmbSetProcessDPIAware();

            try
            {
                string lang = string.Empty;
                for (int i = 0; i < args.Length; ++i)
                {
                    string arg = args[i];
                    if (arg == "-lang")
                    {
                        lang = args[i + 1];
                        if (string.Compare(lang, "ja", true) == 0 ||
                            string.Compare(lang, "jp", true) == 0 ||
                            string.Compare(lang, "jpn", true) == 0 ||
                            string.Compare(lang, "japanese", true) == 0)
                        {
                            lang = "ja-JP";
                        }
                        break;
                    }
                }

                if (!string.IsNullOrEmpty(lang))
                {
                    System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("ja-JP");
                    System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
                    System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
                }
            }
            catch (Exception ex)
            {
                Ambiesoft.CppUtils.Alert(ex);
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            setBrowserEmulationMode(GetIEVersion());

            FormInputUrl inputdlg = new FormInputUrl(args);

            if (DialogResult.OK != inputdlg.ShowDialog())
            {
                return;
            }

            List <string> urls;

            if (inputdlg.IsResultOpenURL)
            {
                string url = inputdlg.txtPageUrl.Text;
                if (string.IsNullOrEmpty(url))
                {
                    // showerror(printurls.Properties.Resources.NOURL);
                    url = "about:blank";
                }

                FormIterate itrdlg = new FormIterate();
                itrdlg._url = url;
                if (DialogResult.OK != itrdlg.ShowDialog())
                {
                    return;
                }

                urls = itrdlg._retresult;
            }
            else
            {
                urls = new List <string>(inputdlg.ResultURLs);
            }

            if (urls == null || urls.Count == 0)
            {
                showerror(printurls.Properties.Resources.NOURL);
                return;
            }


            FormPrint pntdlg = new FormPrint();

            pntdlg._urls = urls;
            pntdlg.ShowDialog();
        }