void Awake() { DontDestroyOnLoad(gameObject); if (FindObjectsOfType(GetType()).Length > 1) { Destroy(gameObject); } userGreeting = FindObjectOfType <UserGreeting>(); }
private void btnLogin_Click(object sender, EventArgs e) { var validationMessage = ValidateLogin(); if (!validationMessage.Equals(string.Empty)) { MessageBox.Show(validationMessage); return; } var result = new UIController().Login(txtLogin.Text.Trim(), txtPassword.Text); if (result != null) { UserGreeting userGreeting = new UserGreeting(result); LaunchMainApplication(); } else { MessageBox.Show((string)result); } }