本文整理汇总了C#中Flag.Do方法的典型用法代码示例。如果您正苦于以下问题:C# Flag.Do方法的具体用法?C# Flag.Do怎么用?C# Flag.Do使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flag
的用法示例。
在下文中一共展示了Flag.Do方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getRssData
private string[,] getRssData(string channel)
{
Console.WriteLine("LOADING FEED... Please wait.");
XmlNodeList items;
try
{
WebRequest request = WebRequest.Create(channel);
WebResponse responce = request.GetResponse();
Stream rssStream = responce.GetResponseStream();
XmlDocument rssDoc = new XmlDocument();
rssDoc.Load(rssStream);
items = rssDoc.SelectNodes("rss/channel/item");
}
catch (UriFormatException)
{
Console.Clear();
Console.WriteLine("\n");
Console.WriteLine($"Error: {channel} doesn't seem to be a valid feed URL. Exiting.");
Thread.Sleep(1500);
Console.Clear();
Flag flag = new Flag("-help");
flag.Do();
return null;
}
catch (Exception ex)
{
Console.Clear();
Console.WriteLine("\n");
Console.WriteLine($"Cannot load feed. Why? {ex.Message}");
Thread.Sleep(1500);
Console.Clear();
Flag flag = new Flag("-help");
flag.Do();
return null;
}
string[,] tempRssData = new string[items.Count, 3];
for (int i = 0; i < items.Count; i++)
{
XmlNode rssNode;
rssNode = items.Item(i).SelectSingleNode("title");
if (rssNode != null) tempRssData[i, 0] = rssNode.InnerText;
else tempRssData[i, 0] = "";
rssNode = items.Item(i).SelectSingleNode("description");
if (rssNode != null) tempRssData[i, 1] = rssNode.InnerText;
else tempRssData[i, 1] = "";
rssNode = items.Item(i).SelectSingleNode("link");
if (rssNode != null) tempRssData[i, 2] = rssNode.InnerText;
else tempRssData[i, 2] = "";
}
return tempRssData;
}
示例2: Menu
private void Menu()
{
Console.WriteLine("[R: refresh (back to the issues list)] [<number>: load issue] [X: quit]");
string responce = Console.ReadLine();
if (!ShowIssue(responce))
{
switch (responce)
{
case "R":
Refresh();
break;
case "X":
Console.Clear();
Flag flag = new Flag("-help");
flag.Do();
return;
default:
Console.WriteLine($"Unknown command <{responce}> for RSS Reader.\n" +
"If you need any base command, exit RSS Reader first.");
Thread.Sleep(1500);
Refresh();
break;
}
}
}