|
@@ -61,6 +61,7 @@ using Comal.Classes.SecurityDescriptors;
|
|
|
using System.Threading;
|
|
|
using H.Formatters;
|
|
|
using PRSDesktop.Forms.Issues;
|
|
|
+using Brushes = System.Windows.Media.Brushes;
|
|
|
|
|
|
namespace PRSDesktop;
|
|
|
|
|
@@ -273,7 +274,7 @@ public partial class MainWindow : IPanelHostControl
|
|
|
Title = $"{(String.Equals(App.Profile?.ToUpper(), "DEFAULT") ? "PRS Desktop" : App.Profile)} (Release {CoreUtils.GetVersion()})";
|
|
|
|
|
|
Logger.Send(LogType.Information, "", "Checking for updates");
|
|
|
- CheckForUpdates();
|
|
|
+ SupportUtils.CheckForUpdates();
|
|
|
|
|
|
Exception? startupException = null;
|
|
|
ValidationStatus? loginStatus = null;
|
|
@@ -1641,6 +1642,9 @@ public partial class MainWindow : IPanelHostControl
|
|
|
/// <param name="progress">If not <see langword="null"/>, then rather than opening a new progress window, just uses that.</param>
|
|
|
private void AfterLogin(IProgress<string>? progress)
|
|
|
{
|
|
|
+ Logger.Send(LogType.Information, "", "Checking Support Ticket Status");
|
|
|
+ CheckSupportTicketStatus();
|
|
|
+
|
|
|
Logger.Send(LogType.Information, "", "Loading employee");
|
|
|
LoadCurrentEmployee();
|
|
|
if (CheckTimesheetBypass(true))
|
|
@@ -2391,6 +2395,9 @@ public partial class MainWindow : IPanelHostControl
|
|
|
//{
|
|
|
try
|
|
|
{
|
|
|
+
|
|
|
+ CheckSupportTicketStatus();
|
|
|
+
|
|
|
bool IsClockedOn = this.IsClockedOn();
|
|
|
|
|
|
if (IsClockedOn)
|
|
@@ -2429,6 +2436,17 @@ public partial class MainWindow : IPanelHostControl
|
|
|
//});
|
|
|
}
|
|
|
|
|
|
+ private void CheckSupportTicketStatus()
|
|
|
+ {
|
|
|
+ Dispatcher.BeginInvoke(() =>
|
|
|
+ {
|
|
|
+ IssuesButton.Background = IssuesWindow.Check()
|
|
|
+ ? new SolidColorBrush(Colors.Red) { Opacity = 0.5 }
|
|
|
+ : Brushes.Transparent;
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
private void Notifications_Changed(object sender)
|
|
|
{
|
|
|
if (Notifications.IsActive)
|
|
@@ -2887,64 +2905,64 @@ public partial class MainWindow : IPanelHostControl
|
|
|
[DllImport("user32.dll")]
|
|
|
private static extern IntPtr GetActiveWindow();
|
|
|
|
|
|
- #region Check For Updates
|
|
|
-
|
|
|
- private string GetUpdateLocation()
|
|
|
- {
|
|
|
- if (App.DatabaseSettings.DatabaseType == DatabaseType.Networked)
|
|
|
- {
|
|
|
- if(ClientFactory.ClientType == typeof(RestClient<>))
|
|
|
- {
|
|
|
- string url = "";
|
|
|
- //var domain = App.DatabaseSettings.URL.Split(new[] { "://" }, StringSplitOptions.RemoveEmptyEntries).Last();
|
|
|
- //var port = App.DatabaseSettings.Port;
|
|
|
- var domain = ClientFactory.Parameters?.FirstOrDefault()?.ToString() ?? "";
|
|
|
- domain = domain.Split(new[] { "://" }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault() ?? "";
|
|
|
- if (!String.IsNullOrWhiteSpace(domain))
|
|
|
- {
|
|
|
-
|
|
|
- try
|
|
|
- {
|
|
|
- var client = new HttpClient { BaseAddress = new Uri($"https://{domain}") };
|
|
|
- client.GetAsync("operations").Wait();
|
|
|
- url = $"https://{domain}";
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- url = $"http://{domain}";
|
|
|
- }
|
|
|
- }
|
|
|
- return url;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return "";
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- return Path.Combine(CoreUtils.GetCommonAppData("PRSServer"), "update");
|
|
|
- }
|
|
|
-
|
|
|
- private string GetLatestVersion(string location)
|
|
|
- {
|
|
|
- return Client.Version();
|
|
|
- }
|
|
|
- private string GetReleaseNotes(string location)
|
|
|
- {
|
|
|
- return Client.ReleaseNotes();
|
|
|
- }
|
|
|
- private byte[]? GetInstaller(string location)
|
|
|
- {
|
|
|
- return Client.Installer();
|
|
|
- }
|
|
|
-
|
|
|
- private void CheckForUpdates()
|
|
|
- {
|
|
|
- Update.CheckForUpdates(
|
|
|
- GetUpdateLocation, GetLatestVersion, GetReleaseNotes, GetInstaller, null, App.AutoUpdateSettings.Elevated, "PRSDesktopSetup.exe");
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
+ // #region Check For Updates
|
|
|
+ //
|
|
|
+ // private string GetUpdateLocation()
|
|
|
+ // {
|
|
|
+ // if (App.DatabaseSettings.DatabaseType == DatabaseType.Networked)
|
|
|
+ // {
|
|
|
+ // if(ClientFactory.ClientType == typeof(RestClient<>))
|
|
|
+ // {
|
|
|
+ // string url = "";
|
|
|
+ // //var domain = App.DatabaseSettings.URL.Split(new[] { "://" }, StringSplitOptions.RemoveEmptyEntries).Last();
|
|
|
+ // //var port = App.DatabaseSettings.Port;
|
|
|
+ // var domain = ClientFactory.Parameters?.FirstOrDefault()?.ToString() ?? "";
|
|
|
+ // domain = domain.Split(new[] { "://" }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault() ?? "";
|
|
|
+ // if (!String.IsNullOrWhiteSpace(domain))
|
|
|
+ // {
|
|
|
+ //
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // var client = new HttpClient { BaseAddress = new Uri($"https://{domain}") };
|
|
|
+ // client.GetAsync("operations").Wait();
|
|
|
+ // url = $"https://{domain}";
|
|
|
+ // }
|
|
|
+ // catch (Exception)
|
|
|
+ // {
|
|
|
+ // url = $"http://{domain}";
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return url;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return "";
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // return Path.Combine(CoreUtils.GetCommonAppData("PRSServer"), "update");
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private string GetLatestVersion(string location)
|
|
|
+ // {
|
|
|
+ // return Client.Version();
|
|
|
+ // }
|
|
|
+ // private string GetReleaseNotes(string location)
|
|
|
+ // {
|
|
|
+ // return Client.ReleaseNotes();
|
|
|
+ // }
|
|
|
+ // private byte[]? GetInstaller(string location)
|
|
|
+ // {
|
|
|
+ // return Client.Installer();
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void CheckForUpdates()
|
|
|
+ // {
|
|
|
+ // Update.CheckForUpdates(
|
|
|
+ // GetUpdateLocation, GetLatestVersion, GetReleaseNotes, GetInstaller, null, App.AutoUpdateSettings.Elevated, "PRSDesktopSetup.exe");
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // #endregion
|
|
|
|
|
|
#region Modules + Reports
|
|
|
|
|
@@ -3304,6 +3322,23 @@ public partial class MainWindow : IPanelHostControl
|
|
|
MessageBox.Show(logfile + " does not exist!");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void CheckForUpdates_OnClick(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (!SupportUtils.CheckForUpdates())
|
|
|
+ {
|
|
|
+ if (MessageWindow.ShowYesNo(
|
|
|
+ "You appear to be using the latest version already!\n\nRun the installer anyway?", "Update"))
|
|
|
+ {
|
|
|
+ SupportUtils.DownloadAndRunInstaller();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OpenSupportSession_OnClick(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ SupportUtils.OpenSupportSession();
|
|
|
+ }
|
|
|
|
|
|
private void DocumentTypeList_OnClick(object sender, RoutedEventArgs e)
|
|
|
{
|
|
@@ -3386,11 +3421,14 @@ public partial class MainWindow : IPanelHostControl
|
|
|
try
|
|
|
{
|
|
|
IssuesWindow.Execute();
|
|
|
+ CheckSupportTicketStatus();
|
|
|
}
|
|
|
catch(Exception err)
|
|
|
{
|
|
|
MessageWindow.ShowError("Could not load issues.", err);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|