private void btnLogin_Click(object sender, EventArgs e) { #if DEBUG SkipAuth(); #else if (txUsername.Text == $"{entUs}x") { SkipAuth(); } #endif if (txUsername.NotEmpty() && txPassword.NotEmpty()) { var u = new LoggedUser { Password = txPassword.Text, UserName = txUsername.Text }; if (DbController.ValidateUser(ref u)) { GlobalAppData.SetUser(u); using (var frm = new Form1()) { this.Hide(); frm.ShowDialog(); } } else { MessageBox.Show("Invalid User Name Or Password"); } } }
static void Main() { try { var str = SynnCore.Generics.XmlHelper.ToXml(new AppConfiguration { MediaPlayerPath = " ", ProdConnectionString = " ", SyncDirectories = new System.Collections.Generic.List <string> { "dir2", "dir1" }, TempMusicListPath = " ", TestConnectionString = " ", YoutubeDataFolder = " ", RequireAuthentication = false }); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var appcfg = LoadStationConfigurations(); HandleDbMigration(); #if DEBUG GlobalAppData.SetUser(new LoggedUser { Id = 0, Password = "", UserName = "******" }); Application.Run(new Form1()); #else if (appcfg.RequireAuthentication) { Application.Run(new LoginForm()); } else { GlobalAppData.SetUser(new LoggedUser { Id = 0, Password = "", UserName = "******" }); Application.Run(new Form1()); } #endif } catch (Exception ex) { var logP = @"C:\temp\musictemp\log.txt"; var msg = string.Format("{0} - {1} Trace = {2}", DateTime.Now, ex.Message, ex.StackTrace); File.AppendAllLines(logP, new string[] { msg }); } }