diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index c30111b75..74f8eebcc 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -667,12 +667,16 @@ namespace BeWo //url = String.Format("http://localhost:3777/Host"); var condition_base = !string.IsNullOrWhiteSpace(DebugConfig.ServerUrl); var condition1 = DebugConfig.CurrentConfig is null; - var condition2 = DebugConfig.CurrentConfig is DebugConfig current && string.IsNullOrWhiteSpace(current.Profilename); + var condition2 = DebugConfig.CurrentConfig is DebugConfig current && string.IsNullOrWhiteSpace(current.DefaultProfilename); if (condition_base && (condition1 || condition2)) { url = DebugConfig.ServerUrl; } + else if(ServerAddress.ToLower().IndexOf("localhost") >= 0) + { + url = "http://localhost:3777/Host"; + } //return new Uri("https://app5.bewoplaner.de/service"); //url = String.Format("app1.bewoplaner.de/service"); diff --git a/BeWo/DebugConfig.cs b/BeWo/DebugConfig.cs index 25bbea25c..bedc0340d 100644 --- a/BeWo/DebugConfig.cs +++ b/BeWo/DebugConfig.cs @@ -18,13 +18,16 @@ namespace BeWo private static readonly string config_file_name = "DebugConfig.txt"; public static DebugConfig CurrentConfig { get; } = LoadCurrentDebugConfig(); + /// + /// Wird verwendet, wenn keine DebugConfig geladen wurde oder DefaultProfilename empty ist + /// public static string ServerUrl { get; set; } = "http://localhost:3777/Host"; public DebugConfigMode DebugConfigMode { get; set; } - public string Username { get; set; } - public string Password { get; set; } - public string Profilename { get; set; } + public string DefaultLoginUsername { get; set; } + public string DefaultLoginPassword { get; set; } + public string DefaultProfilename { get; set; } public bool AutoLogin { get; set; } public UIContext? SelectView { get; set; } @@ -124,12 +127,12 @@ namespace BeWo new DebugConfig() { DebugConfigMode = DebugConfigMode.FeatureDakota, - AutoLogin = true, + AutoLogin = false, SelectView = UIContext.Finance, SelectIndex = 8, - Username = "m1", - Password = "bewobewo", - Profilename = "5000000000", + DefaultLoginUsername = "m1", + DefaultLoginPassword = "bewobewo", + DefaultProfilename = "5000000000", EnableAutoRemoteDebugging = true }); diff --git a/BeWo/LoginControl.xaml.cs b/BeWo/LoginControl.xaml.cs index 1b1a214fb..b896fcefd 100644 --- a/BeWo/LoginControl.xaml.cs +++ b/BeWo/LoginControl.xaml.cs @@ -121,15 +121,16 @@ namespace BeWo paramDic.TryGetValue("s", out v2); BeWoApp.Tenant = v1; BeWoApp.ServerName = v2; - if (ProfileList.Count > 0) - ProfileList.Insert(0, new BeWoProfile(v1, v2, BeWoApp.Tenant)); - else - ProfileList.Add(new BeWoProfile(v1, v2, BeWoApp.Tenant)); - SaveProfileListToFile(); - - + if(!ProfileList.Any(x => x.Tenant == v1)) + { + if (ProfileList.Count > 0) + ProfileList.Insert(0, new BeWoProfile(v1, v2, v1)); + else + ProfileList.Add(new BeWoProfile(v1, v2, v1)); + SaveProfileListToFile(); + } #else if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.ActivationUri != null) { @@ -200,9 +201,9 @@ namespace BeWo #if DEBUG //selectedProfile = ReadSelectedProfile(); - if (DebugConfig.CurrentConfig is DebugConfig current && !string.IsNullOrWhiteSpace(current.Profilename)) + if (DebugConfig.CurrentConfig is DebugConfig current && !string.IsNullOrWhiteSpace(current.DefaultProfilename)) { - selectedProfile = ProfileList.FirstOrDefault(x => x.Name == current.Profilename); + selectedProfile = ProfileList.FirstOrDefault(x => x.Name == current.DefaultProfilename); } #else selectedProfile = ReadSelectedProfile(); @@ -721,11 +722,11 @@ namespace BeWo if (DebugConfig.CurrentConfig is DebugConfig current) { - if (!string.IsNullOrWhiteSpace(current.Username)) - TextBox_Username.Text = current.Username; + if (!string.IsNullOrWhiteSpace(current.DefaultLoginUsername)) + TextBox_Username.Text = current.DefaultLoginUsername; - if (!string.IsNullOrWhiteSpace(current.Password)) - PasswordBox_Password.Password = current.Password; + if (!string.IsNullOrWhiteSpace(current.DefaultLoginPassword)) + PasswordBox_Password.Password = current.DefaultLoginPassword; if (current.AutoLogin) button_login_Click(this, new RoutedEventArgs()); @@ -1328,11 +1329,15 @@ namespace BeWo //} var server = GetServerFromTenant(profile.Tenant); + +#if !DEBUG if (!String.IsNullOrEmpty(server) && server != profile.Server) { profile.Server = server; SaveProfileListToFile(); } +#endif + BeWoApp.Tenant = profile.Tenant; BeWoApp.ServerName = GetNumericServerName(profile.Server); diff --git a/BeWo/ServiceProxy/ServiceFacade.cs b/BeWo/ServiceProxy/ServiceFacade.cs index de1cfe6d2..cbd8a3d3a 100644 --- a/BeWo/ServiceProxy/ServiceFacade.cs +++ b/BeWo/ServiceProxy/ServiceFacade.cs @@ -850,7 +850,7 @@ namespace BeWo.ServiceProxy { if (lClient.Endpoint.Binding is BasicHttpBinding binding) { - if(_ServerName.StartsWith("https")) + if(_ServerName?.StartsWith("https") ?? true) { binding.Security.Mode = BasicHttpSecurityMode.Transport; } @@ -860,7 +860,6 @@ namespace BeWo.ServiceProxy } } } - #endif lClient.Endpoint.Behaviors.Add(new SecurityHeaderEndpointBehavior());