示例#1
0
        public void AddNewFromURL(string s)
        {
            if (Uri.TryCreate(s, UriKind.Absolute, out Uri uri))
            {
                using (AddUrlDialog dd = new AddUrlDialog())
                {
                    dd.Url = uri;
                    if (dd.Run() == (int)ResponseType.Ok)
                    {
                        using (AddDownloadDialog dlg = new AddDownloadDialog())
                        {
                            dlg.DownloadLocation = dd.ResourceLocation;
                            ResponseType t = (ResponseType)dlg.Run();
                            if (t == ResponseType.Ok)
                            {
                                var d = dlg.AddDownload(false);
                                ShowProgressDialog(d);
                            }
                            else if (t == ResponseType.Apply)
                            {
                                dlg.AddDownload(true);
                            }

                            dlg.Destroy();
                        }
                    }
                }
            }
        }
示例#2
0
        public void AddNewFromURL()
        {
            using (AddUrlDialog dd = new AddUrlDialog())
            {
                if (dd.Run() == (int)ResponseType.Ok && dd.ResourceLocation != null)
                {
                    using (AddDownloadDialog dlg = new AddDownloadDialog())
                    {
                        dlg.DownloadLocation = dd.ResourceLocation;
                        ResponseType t = (ResponseType)dlg.Run();
                        if (t == ResponseType.Ok)
                        {
                            var d = dlg.AddDownload(false);
                            ShowProgressDialog(d);
                        }
                        else if (t == ResponseType.Apply)
                        {
                            dlg.AddDownload(true);
                        }

                        dlg.Destroy();
                    }
                }
            }
        }