本文整理汇总了C#中System.Net.WebClient.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# WebClient.ToString方法的具体用法?C# WebClient.ToString怎么用?C# WebClient.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.WebClient
的用法示例。
在下文中一共展示了WebClient.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainForm
public MainForm()
{
if (pingURL("http://yesit.com.au") == true)
{
string json = new WebClient().DownloadString("http://yesit.com.au/bvsc.php");
if (json.ToString() != "1")
{
DialogResult result = MessageBox.Show("You are no longer authorized to run this diag.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
if (result == DialogResult.OK)
{
Environment.Exit(0);
}
}
}
InitializeComponent();
}
示例2: next
public ActionResult next(string n)
{
var json = new WebClient().DownloadString("https://gist.githubusercontent.com/WillemLabu/34cfb50187ec334c48ee/raw/cb46400505afd82d9e354b591ad71d97f07613be/jobs.json");
Trace.TraceError(json.ToString());
var objects = JObject.Parse(json.ToString()); // parse as array
var subject = JArray.Parse(objects.GetValue("jobs").ToString());
List<Jobs> jobs = new List<Jobs>();
foreach (var root in subject)
{
var data = JObject.Parse(root.ToString());
Jobs job = new Jobs();
job.client = data.GetValue("client").ToString();
job.jobNumber = data.GetValue("job-number").ToString();
job.jobName = data.GetValue("job-name").ToString();
job.due = data.GetValue("due").ToString();
job.status = data.GetValue("status").ToString();
jobs.Add(job);
}
if (Int32.Parse(n) >= jobs.Count() || Int32.Parse(n) < 0)
{
ViewBag.Last = 0;
return View("Index",jobs.GetRange(0, 10));
}
ViewBag.Last = Int32.Parse(n);
return View("Index",jobs.GetRange(Int32.Parse(n), 10));
}
示例3: Index
// GET: Jobs
public ActionResult Index(String SearchString)
{
var json = new WebClient().DownloadString("https://gist.githubusercontent.com/WillemLabu/34cfb50187ec334c48ee/raw/cb46400505afd82d9e354b591ad71d97f07613be/jobs.json");
Trace.TraceError(json.ToString());
var objects = JObject.Parse(json.ToString()); // parse as array
var subject = JArray.Parse(objects.GetValue("jobs").ToString());
List<Jobs> jobs = new List<Jobs>();
foreach (var root in subject)
{
var data = JObject.Parse(root.ToString());
Jobs job = new Jobs();
job.client = data.GetValue("client").ToString();
job.jobNumber = data.GetValue("job-number").ToString();
job.jobName = data.GetValue("job-name").ToString();
job.due = data.GetValue("due").ToString();
job.status = data.GetValue("status").ToString();
jobs.Add(job);
}
var joblist = from m in jobs
select m;
if (!String.IsNullOrEmpty(SearchString))
{
jobs = jobs.Where(b => b.jobName.ToUpper().Contains(SearchString.ToUpper())).ToList();
return View(jobs);
}
ViewBag.Last = 0;
list = jobs;
return View(jobs.GetRange(0,10));
}