private void actionOnValidAuthentication(string restResult) { JSONSerialization jsonSerialization = new JSONSerialization(); var deserializeUser = jsonSerialization.DeserializeFromString <User>(restResult.ToString()); Program.CurrentUser = deserializeUser; Main frmclientMain = new Main(); this.Visible = false; frmclientMain.ShowDialog(); Close(); }