...
 
Commits (2)
......@@ -95,7 +95,7 @@ namespace Main
Auth0APIClientSecret = Functions.XML.ReadString(ConfigFile, "Auth0APIClientSecret");
}
if (Functions.XML.ReadList(ConfigFile, "SiteTitle").Length != 0 && Functions.XML.ReadList(ConfigFile, "SitePath").Length != 0)
if (Functions.XML.ReadList(ConfigFile, "SitePath").Length == Functions.XML.ReadList(ConfigFile, "SiteTitle").Length && Functions.XML.ReadList(ConfigFile, "SitePathArgument").Length == Functions.XML.ReadList(ConfigFile, "SiteTitle").Length && Functions.XML.ReadList(ConfigFile, "SiteIcon").Length == Functions.XML.ReadList(ConfigFile, "SiteTitle").Length)
{
SiteTitle = Functions.XML.ReadList(ConfigFile, "SiteTitle");
SitePath = Functions.XML.ReadList(ConfigFile, "SitePath");
......
......@@ -107,72 +107,80 @@ namespace Main
private async void Menu_Selected(object sender, RoutedEventArgs e)
{
ListViewItem Menu = (ListViewItem)sender;
try
{
ListViewItem Menu = (ListViewItem)sender;
int menuItem = Int32.Parse(Menu.Name.Replace("MenuItem_", ""));
int menuItem = Int32.Parse(Menu.Name.Replace("MenuItem_", ""));
Uri uriResult;
if (Uri.TryCreate(App.SitePath[menuItem], UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps) || App.SitePath[menuItem] == "account.exe")
{
if (App.SitePath[menuItem] == "account.exe")
Uri uriResult;
if (Uri.TryCreate(App.SitePath[menuItem], UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps) || App.SitePath[menuItem] == "account.exe")
{
if (Properties.Settings.Default.Login)
if (App.SitePath[menuItem] == "account.exe")
{
await Functions.Account.client.LogoutAsync();
if (Properties.Settings.Default.Login)
{
await Functions.Account.client.LogoutAsync();
ProcessStartInfo ps = new ProcessStartInfo(System.Reflection.Assembly.GetEntryAssembly().Location)
ProcessStartInfo ps = new ProcessStartInfo(System.Reflection.Assembly.GetEntryAssembly().Location)
{
Arguments = "-FirstPage -Config \"" + App.ConfigFile + "\"",
};
Process p = Process.Start(ps);
Application.Current.Shutdown();
}
else
{
Arguments = "-FirstPage -Config \"" + App.ConfigFile + "\"",
};
Process p = Process.Start(ps);
ProcessStartInfo ps = new ProcessStartInfo(System.Reflection.Assembly.GetEntryAssembly().Location)
{
Arguments = "-Login -Config \"" + App.ConfigFile + "\"",
};
Process p = Process.Start(ps);
Application.Current.Shutdown();
Application.Current.Shutdown();
}
}
else
{
ProcessStartInfo ps = new ProcessStartInfo(System.Reflection.Assembly.GetEntryAssembly().Location)
{
Arguments = "-Login -Config \"" + App.ConfigFile + "\"",
};
Process p = Process.Start(ps);
Application.Current.Shutdown();
Process.Start(uriResult.ToString());
}
Menu.IsSelected = false;
lastSelected.IsSelected = true;
return;
}
else
{
Process.Start(uriResult.ToString());
}
Menu.IsSelected = false;
lastSelected.IsSelected = true;
if (Menu == lastSelected)
{
return;
}
return;
}
if (lastSelected != null)
{
MoveCursorMenu(menuItem);
if (Menu == lastSelected)
{
return;
}
lastSelected.IsSelected = false;
}
if (lastSelected != null)
{
MoveCursorMenu(menuItem);
Functions.Index.SetEXE(App.SitePath[menuItem], App.SitePathArgument[menuItem]);
lastSelected.IsSelected = false;
}
if (Application.Current.MainWindow is MainWindow MW)
{
MW.Title = App.SiteTitle[menuItem] + " - " + App.Name;
}
Functions.Index.SetEXE(App.SitePath[menuItem], App.SitePathArgument[menuItem]);
if (Application.Current.MainWindow is MainWindow MW)
lastSelected = Menu;
}
catch (Exception ex)
{
MW.Title = App.SiteTitle[menuItem] + " - " + App.Name;
Functions.Index.SetError(ex.ToString(), "Fehler beim Auswählen des Navigationsmenüs");
}
lastSelected = Menu;
}
private void MoveCursorMenu(int index)
......