private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { _connectionString = ConfigurationManager.ConnectionStrings["connectToTTN"].ConnectionString; var rk = Registry.CurrentUser.OpenSubKey("PostWatcher"); bool isLogined = true; if (rk == null) { rk = Registry.CurrentUser.CreateSubKey("PostWatcher"); isLogined = false; } else if (rk.GetValue("API key") == null) isLogined = false; if (!isLogined) { var newWindwowApIkey = new APIkey(); newWindwowApIkey.ShowDialog(); _apiKey = (string)rk.GetValue("API key"); OpenLoader("InternetDocument", "getDocumentList", null); } _apiKey = (string)rk.GetValue("API key"); //Bad realization //Refresh all Libraries of NovaPoshta. OpenLoader("InternetDocument", "getDocumentList", null); }
private void menuChangeAPIkey_OnClick(object sender, RoutedEventArgs e) { var newWindow = new APIkey(); newWindow.ShowDialog(); var rk = Registry.CurrentUser.OpenSubKey("PostWatcher"); _apiKey = (string)rk.GetValue("API key"); }