private void SaveButton_Click(object sender, RoutedEventArgs e) { try { var appDao = new AppDao(); appDao.DeleteApp(); Helper.App.Id = this.AppId.Text; Helper.App.BaseUrl = this.BaseUrl.Text; Helper.App.UseWebView = this.UseWebView.SelectedIndex == 0; appDao.InsertApp(Helper.App); Helper.ReInit(); Helper.ShowMessageDialog("Message", "Save ok."); } catch (Exception ex) { Helper.LogException(ex); } }
static Helper() { var appDao = new AppDao(); App = appDao.GetApp(); if (App == null) { App = new Application { Id = Guid.NewGuid().ToString() }; appDao.InsertApp(App); } _httpClient.DefaultRequestHeaders.Add("appid", App.Id); NiologManager.DefaultWriters = new ILogWriter[] { new ConsoleLogWriter(), new FileLogWriter(Path.Combine(ApplicationData.Current.LocalFolder.Path, "logs"), 10) }; }