static void Main(string[] args)
        {
            ServiceStackRedisUtils.Init();

            _t.AutoReset = false;
            _t.Interval  = 1000;
            _t.Elapsed  += _t_Elapsed;



            while (true)
            {
                string line = Console.ReadLine();
                if (line != null)
                {
                    if (line.Equals("exit", StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                    else
                    {
                        if (line.Equals("start", StringComparison.OrdinalIgnoreCase))
                        {
                            _t.Start();
                        }
                    }
                }
                else
                {
                    break;
                }
            }
        }
Esempio n. 2
0
        static void Main()
        {
            log4net.Config.XmlConfigurator.Configure(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));
            ConsoleHelper.WriteLine(ELogCategory.Info, string.Format("ServiceStack.Redis.Demo.WinForm1 Startup..."), true);

            JsonConvert.DefaultSettings = () =>
            {
                JsonSerializerSettings jss = new JsonSerializerSettings();
                jss.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
                jss.DateFormatString   = "yyyy-MM-dd HH:mm:ss";

                return(jss);
            };

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += Application_ThreadException;

            ServiceStackRedisUtils.Init();
            MyRedisService.Instance.Init();

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

            Application.Run(new Form1());
        }