ServerUrl wird verwendet, wenn kein DebugConfig geladen wurde oder DebugConfig.DefaultProfilename empty ist.

This commit is contained in:
2025-01-29 15:26:40 +01:00
parent a06f4f47fe
commit 742e21e69a
4 changed files with 34 additions and 23 deletions

View File

@@ -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");

View File

@@ -18,13 +18,16 @@ namespace BeWo
private static readonly string config_file_name = "DebugConfig.txt";
public static DebugConfig CurrentConfig { get; } = LoadCurrentDebugConfig();
/// <summary>
/// Wird verwendet, wenn keine DebugConfig geladen wurde oder DefaultProfilename empty ist
/// </summary>
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
});

View File

@@ -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);

View File

@@ -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());