示例#1
0
        private void OnValidate()
        {
            if (ExecuteType.Equals(_executeType))
            {
                return;
            }

            ExecuteFactory.Replace(ExecuteType, this);
        }
示例#2
0
        static void Main(string[] args)
        {
            string[] numbers = ConfigurationManager.AppSettings.AllKeys;
            Dictionary <string, string> dicCache = new Dictionary <string, string>();

            for (int i = 0; i < numbers.Length; i++)
            {
                dicCache.Add(numbers[i], ConfigurationManager.AppSettings[numbers[i]].ToString());
            }
            Console.ForegroundColor = ConsoleColor.White;
            while (true)
            {
                Console.WriteLine("请选择设计模式:");
                foreach (var item in dicCache)
                {
                    //Console.WriteLine(Convert.ToInt32(item.Key)<0?"":item.Key+"."+item.Value);
                    string id = Convert.ToInt32(item.Key) < 0 ? "" : item.Key + ".";
                    Console.WriteLine(id + item.Value);
                }
                string selPattern = "";
                while (true)
                {
                    selPattern = Console.ReadLine();
                    if (dicCache.Keys.Contains(selPattern))
                    {
                        break;
                    }
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("没有此选项,请从新选择!");
                    Console.ForegroundColor = ConsoleColor.White;
                }
                while (true)
                {
                    Console.WriteLine("设计模式:" + dicCache[selPattern]);
                    ExecuteFactory.ExecPorxy(dicCache[selPattern].Substring(0, dicCache[selPattern].IndexOf("-")));
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("是否重新执行此模式:y/n");
                    Console.ForegroundColor = ConsoleColor.White;
                    string b = "";
                    while (true)
                    {
                        b = Console.ReadLine().ToLower();
                        if (b == "y" || b == "n")
                        {
                            break;
                        }
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("输入错误,请从新输入:");
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    if (b == "y")
                    {
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
示例#3
0
 /// <summary>
 /// CreateExecuteService
 /// </summary>
 /// <returns></returns>
 protected IExecuteService ExecuteService()
 {
     return(ExecuteFactory.CreateExecuteService(ExecuteServiceEnum.RestSharp));
 }