Exemplo n.º 1
0
        public static string viadatConnString = ""; //"Data Source=" + this.Properties["IPADDRESS"] + ";Initial Catalog=criterion01;User=viadat;Password=viadat1";

        #endregion Fields

        #region Methods

        protected override void OnStartup(StartupEventArgs e)
        {
            if (e.Args == null || e.Args.Count() != 2 )
            {
                throw new InvalidOperationException("Invalid command line parameters: Usage: Kiosk.exe <kioskid> <ipaddress>");
            }
            else if (e.Args.Count() == 2)
            {
                this.Properties["KIOSKID"] = parseID(e.Args[0]);
                this.Properties["IPADDRESS"] = parseIP(e.Args[1]);
            }
            else
            {
                throw new InvalidOperationException("Invalid command line parameters: (" + e.Args.Count() + ") " + e.Args.ToString());
            }

            base.OnStartup(e);

            bool restart = false;
            DateTime lastRestart = DateTime.Today;
            do
            {
                try
                {
                    restart = false;
                    var mainWnd = new MainWindow();
                    mainWnd.ShowDialog();
                    GC.Collect();
                }
                catch (Exception ex)
                {
                    AppEventLog.WriteEntry(ex.ToString());
                }
            } while (restart);
        }