Updates to logging and v1.0.3 release.
This commit is contained in:
@@ -51,7 +51,7 @@ using System.Windows;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.1")]
|
[assembly: AssemblyVersion("1.0.4")]
|
||||||
[assembly: AssemblyFileVersion("1.0.1")]
|
[assembly: AssemblyFileVersion("1.0.3")]
|
||||||
//Setting Squirrel Aware Version.
|
//Setting Squirrel Aware Version.
|
||||||
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
||||||
@@ -1,3 +1 @@
|
|||||||
2170C39D054590A1CEFFBB68922BB3FBFF82A625 ImEXOnlinePartner-1.0.0-full.nupkg 4987861
|
27267F96DE441041026E9EE4292798734572912A ImEXOnlinePartner-1.0.3-full.nupkg 4989160
|
||||||
6AC5040BEFF741735A2A6497D5BA5C0E1DB247C9 ImEXOnlinePartner-1.0.1-delta.nupkg 32948
|
|
||||||
59F79A6A3C31AB03C297E40648B468F62424C03B ImEXOnlinePartner-1.0.1-full.nupkg 4988035
|
|
||||||
@@ -9,6 +9,7 @@ using Newtonsoft;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using BodyshopPartner.Models;
|
using BodyshopPartner.Models;
|
||||||
|
using ToastNotifications.Messages;
|
||||||
|
|
||||||
namespace BodyshopPartner.Utils
|
namespace BodyshopPartner.Utils
|
||||||
{
|
{
|
||||||
@@ -33,9 +34,31 @@ namespace BodyshopPartner.Utils
|
|||||||
|
|
||||||
logger.Trace("Starting HTTP server...");
|
logger.Trace("Starting HTTP server...");
|
||||||
hlog = HttpLogger;
|
hlog = HttpLogger;
|
||||||
hlog("Starting HTTP server...");
|
|
||||||
//TODO As a part of the installer, add netsh http add urlacl url=http://+:1337/ user="Everyone
|
//TODO As a part of the installer, add netsh http add urlacl url=http://+:1337/ user="Everyone
|
||||||
HttpServer.ListenAsync(1337, System.Threading.CancellationToken.None, Route.OnHttpRequestAsync).Wait();
|
try
|
||||||
|
{
|
||||||
|
HttpServer.ListenAsync(1337, System.Threading.CancellationToken.None, Route.OnHttpRequestAsync).Wait();
|
||||||
|
hlog("ImEX Online connection server started...");
|
||||||
|
}
|
||||||
|
catch (Exception Ex)
|
||||||
|
{
|
||||||
|
logger.Fatal("Unable to start HTTP server. " + Ex.ToString());
|
||||||
|
App.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
string msg = "Unable to connect to ImEX Online Web App. Please ensure your firewall allows the connection.";
|
||||||
|
hlog("ImEX Online connection server could not start. Please restart the partner to try again.");
|
||||||
|
Utils.Notifications.notifier.ShowError(msg);
|
||||||
|
bool AddedException = Utils.SquirrelAwareHelper.AddHttpExcetion();
|
||||||
|
|
||||||
|
//Growler.AddNotification(new Notification()
|
||||||
|
//{
|
||||||
|
// Title = Properties.Resources.Msg_NewJobUploaded,
|
||||||
|
// Subtitle = item.Job?.ownr_fn?.Value + " " + item.Job?.ownr_ln?.Value + " | " + item.Job?.clm_no?.Value,
|
||||||
|
// //Message = item.Job?.vehicle?.data?.v_model_yr?.Value + " " + item.Job?.vehicle?.data?.v_make_desc?.Value + " " + item.Job?.vehicle?.data?.v_model_desc?.Value
|
||||||
|
//});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleQbPost(System.Net.HttpListenerRequest req, System.Net.HttpListenerResponse res)
|
private static void HandleQbPost(System.Net.HttpListenerRequest req, System.Net.HttpListenerResponse res)
|
||||||
|
|||||||
@@ -10,6 +10,19 @@ namespace BodyshopPartner.Utils
|
|||||||
{
|
{
|
||||||
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
public static bool AddHttpExcetion()
|
||||||
|
{
|
||||||
|
logger.Debug("Attempting to add HTTP Exclusion for web-server");
|
||||||
|
System.Diagnostics.Process process = new System.Diagnostics.Process();
|
||||||
|
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
|
||||||
|
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
|
||||||
|
startInfo.FileName = "cmd.exe";
|
||||||
|
startInfo.Arguments = "netsh http add urlacl url=http://+:1337/ user=\"Everyone\"";
|
||||||
|
startInfo.Verb = "runas";
|
||||||
|
process.StartInfo = startInfo;
|
||||||
|
return process.Start();
|
||||||
|
}
|
||||||
|
|
||||||
public static void InitializeSquirrelAware()
|
public static void InitializeSquirrelAware()
|
||||||
{
|
{
|
||||||
using (var mgr = new UpdateManager(Utils.UpdateHandler.UpdatePath))
|
using (var mgr = new UpdateManager(Utils.UpdateHandler.UpdatePath))
|
||||||
@@ -22,15 +35,8 @@ namespace BodyshopPartner.Utils
|
|||||||
logger.Debug("Installing via Squirrel Aware Helper. ", v);
|
logger.Debug("Installing via Squirrel Aware Helper. ", v);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.Debug("Attempting to add HTTP Exclusion for web-server");
|
|
||||||
System.Diagnostics.Process process = new System.Diagnostics.Process();
|
bool successful = AddHttpExcetion();
|
||||||
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
|
|
||||||
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
|
|
||||||
startInfo.FileName = "cmd.exe";
|
|
||||||
startInfo.Arguments = "add netsh http add urlacl url=http://+:1337/ user=\"Everyone\"";
|
|
||||||
startInfo.Verb = "runas";
|
|
||||||
process.StartInfo = startInfo;
|
|
||||||
bool successful = process.Start();
|
|
||||||
|
|
||||||
if (successful)
|
if (successful)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ namespace BodyshopPartner.Utils
|
|||||||
logger.Debug("No releases to apply.");
|
logger.Debug("No releases to apply.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateInfo.ReleasesToApply.ForEach(release => logger.Debug("Release to apply " + release.Version));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,11 +56,23 @@ namespace BodyshopPartner.Utils
|
|||||||
|
|
||||||
using (var updateManager = new UpdateManager(UpdatePath))
|
using (var updateManager = new UpdateManager(UpdatePath))
|
||||||
{
|
{
|
||||||
var updateInfo = await updateManager.CheckForUpdate();
|
try
|
||||||
var releases = updateInfo.ReleasesToApply;
|
{
|
||||||
logger.Debug("Applying releases", releases.ToString());
|
var updateInfo = await updateManager.CheckForUpdate();
|
||||||
await updateManager.DownloadReleases(releases, _ => { DownloadProgress = _; });
|
var releases = updateInfo.ReleasesToApply;
|
||||||
await updateManager.ApplyReleases(updateInfo, _ => { InstallProgress = _; });
|
logger.Debug("Applying releases", releases.ToString());
|
||||||
|
await updateManager.DownloadReleases(releases, _ => {
|
||||||
|
logger.Debug("Download Release Progress " + _.ToString());
|
||||||
|
DownloadProgress = _; });
|
||||||
|
await updateManager.ApplyReleases(updateInfo, _ => {
|
||||||
|
logger.Debug("Install Progress " + _.ToString());
|
||||||
|
InstallProgress = _; });
|
||||||
|
}
|
||||||
|
catch (Exception Ex)
|
||||||
|
{
|
||||||
|
logger.Error("Error updating Partner App. " + Ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,6 +135,26 @@ namespace BodyshopPartner.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ICommand _installUpdatesCommand;
|
||||||
|
public ICommand InstallUpdatesCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_installUpdatesCommand == null)
|
||||||
|
{
|
||||||
|
_installUpdatesCommand = new RelayCommand(
|
||||||
|
p => UpdateAvailable,
|
||||||
|
async p =>
|
||||||
|
{
|
||||||
|
await InstallUpdates();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return _installUpdatesCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private ICommand _quitCommand;
|
private ICommand _quitCommand;
|
||||||
public ICommand QuitCommand
|
public ICommand QuitCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,13 +91,20 @@ namespace BodyshopPartner.ViewModels
|
|||||||
private async Task updateCheck()
|
private async Task updateCheck()
|
||||||
{
|
{
|
||||||
logger.Debug("Checking if updates are available.");
|
logger.Debug("Checking if updates are available.");
|
||||||
if (await Utils.UpdateHandler.AreUpdatesAvailable())
|
UpdateAvailable = await Utils.UpdateHandler.AreUpdatesAvailable();
|
||||||
|
if (UpdateAvailable)
|
||||||
{
|
{
|
||||||
logger.Debug("Updates are available! Installing.");
|
string msg = "An update to ImEX Online Partner is Available";
|
||||||
await Utils.UpdateHandler.ApplyUpdates(Progress, Progress);
|
Utils.Notifications.notifier.ShowInformation(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task InstallUpdates()
|
||||||
|
{
|
||||||
|
logger.Debug("Updates are available! Installing.");
|
||||||
|
await Utils.UpdateHandler.ApplyUpdates(UpdateProgress, UpdateProgress);
|
||||||
|
}
|
||||||
|
|
||||||
private async void _updateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
private async void _updateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
await updateCheck();
|
await updateCheck();
|
||||||
|
|||||||
@@ -63,5 +63,19 @@ namespace BodyshopPartner.ViewModels
|
|||||||
get { return _appVersion; }
|
get { return _appVersion; }
|
||||||
set { SetProperty(ref _appVersion, value); }
|
set { SetProperty(ref _appVersion, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _updateAvailable = false;
|
||||||
|
public bool UpdateAvailable
|
||||||
|
{
|
||||||
|
get { return _updateAvailable; }
|
||||||
|
set { SetProperty(ref _updateAvailable, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _updateProgress;
|
||||||
|
public int UpdateProgress
|
||||||
|
{
|
||||||
|
get { return _updateProgress; }
|
||||||
|
set { SetProperty(ref _updateProgress, value); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
xmlns:vm="clr-namespace:BodyshopPartner.ViewModels"
|
xmlns:vm="clr-namespace:BodyshopPartner.ViewModels"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="{x:Static p:Resources.Title_Main}"
|
Title="{x:Static p:Resources.Title_Main}"
|
||||||
Height="489.819"
|
Height="600"
|
||||||
Width="800"
|
Width="800"
|
||||||
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||||
TextElement.FontWeight="Regular"
|
TextElement.FontWeight="Regular"
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<util:OpenMainWindowCommand x:Key="OpenMainWindowCommand" />
|
<util:OpenMainWindowCommand x:Key="OpenMainWindowCommand" />
|
||||||
<util:MonitorStatusConverter x:Key="MonitorStatusConverter" />
|
<util:MonitorStatusConverter x:Key="MonitorStatusConverter" />
|
||||||
|
<util:BoolVisibilityConverter x:Key="BoolVisibilityConverter" />
|
||||||
<Style TargetType="StackPanel">
|
<Style TargetType="StackPanel">
|
||||||
<Setter Property="Margin"
|
<Setter Property="Margin"
|
||||||
Value="8" />
|
Value="8" />
|
||||||
@@ -152,7 +153,10 @@
|
|||||||
<Label DockPanel.Dock="Top"
|
<Label DockPanel.Dock="Top"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
Content="{Binding AppVersion}" />
|
Content="{Binding AppVersion}" />
|
||||||
|
<StackPanel Visibility="{Binding UpdateAvailable, Converter={StaticResource BoolVisibilityConverter}}">
|
||||||
|
<Button Content="Update" Command="{Binding InstallUpdatesCommand}" />
|
||||||
|
<ProgressBar Margin="8" Value="{Binding UpdateProgress}"/>
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|||||||
Reference in New Issue
Block a user