Files
desktop-edge-win/DesktopEdge/Models/ViewState.cs
T

51 lines
1.6 KiB
C#

using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace Ziti.Desktop.Edge.Models {
public class ZDEWViewState {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private bool automaticUpdatesDisabled = false;
private string updateUrl = "not set yet";
public bool AutomaticUpdatesDisabled {
get {
return automaticUpdatesDisabled;
}
set {
automaticUpdatesDisabled = value;
}
}
public string AutomaticUpdateURL {
get {
return updateUrl;
}
set {
updateUrl = value;
}
}
public bool UpdateAvailable { get; set; }
public UpdateInfo PendingUpdate { get; set; } = new UpdateInfo();
internal void AutomaticUpdatesEnabledFromString(string automaticUpgradeDisabled) {
bool disabled = bool.TrueString.ToLower() == automaticUpgradeDisabled?.ToLower().Trim();
this.AutomaticUpdatesDisabled = disabled;
}
}
public class UpdateInfo {
public DateTime InstallTime { get; set; } = DateTime.MinValue;
public string Version { get; set; } = "0.0.0.0";
public double TimeLeft {
get {
double timeLeft = (InstallTime - DateTime.Now).TotalSeconds;
return timeLeft;
}
}
}
}