-using Newtonsoft.Json.Linq;
+using Microsoft.Win32;
+using Newtonsoft.Json.Linq;
using System;
using System.Linq;
using System.Security.Cryptography;
return Brushes.Transparent;
}
-
+
/**
* check for update
*/
- /*
- public static bool checkUpdate () {
+ public static bool checkUpdate (string currentVersion) {
try {
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load("https://stricted.net/version.xml");
string version = xmlDocument.DocumentElement["version"].InnerText;
- if (MainWindow.VERSION.Equals(version).Equals(false)) {
+ if (currentVersion.Equals(version).Equals(false)) {
return true;
}
}
return false;
}
- */
/**
* process login stuff
}
}
*/
+
+ public static bool checkInstalled (string c_name) {
+ string displayName = string.Empty;
+
+ string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
+ RegistryKey key = Registry.LocalMachine.OpenSubKey(registryKey);
+ if (key != null) {
+ foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName))) {
+ displayName = subkey.GetValue("DisplayName") as string;
+
+ if (string.IsNullOrWhiteSpace(displayName).Equals(false) && displayName.Equals(c_name)) {
+ return true;
+ }
+ }
+ key.Close();
+ }
+
+ registryKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
+ key = Registry.LocalMachine.OpenSubKey(registryKey);
+ if (key != null) {
+ foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName))) {
+ displayName = subkey.GetValue("DisplayName") as string;
+
+ if (string.IsNullOrWhiteSpace(displayName).Equals(false) && displayName.Equals(c_name)) {
+ return true;
+ }
+ }
+ key.Close();
+ }
+
+ return false;
+ }
}
}
using System.Threading;
using SpeedportHybridControl.Data;
using SpeedportHybridControl.Model;
+using System.Windows;
namespace SpeedportHybridControl.PageModel {
class MainWindowModel : SuperViewModel {
+ public const string VERSION = "1.0-pre9"; //TODO: change this later
+
private string _loginButtonContent = "Login";
private DelegateCommand _switchToLoginPage;
}
public MainWindowModel () {
+ if (util.checkInstalled("Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219").Equals(false)) {
+ new Thread(() => { MessageBox.Show("Bitte installiere das 'Microsoft Visual C++ 2010 Redistributable Package' aus den ordner 'vcredis' um das programm vollständig benutzen zu können.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
+ }
+
+ if (util.checkUpdate(VERSION).Equals(true)) {
+ new Thread(() => { MessageBox.Show("Ein Update ist verfügbar.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
+ }
+
+
changePage("login");
SwitchToLoginPage = new DelegateCommand(new Action(OnSwitchToLoginPageExecute));
<ItemGroup>
<SplashScreen Include="SplashScreen1.png" />
</ItemGroup>
+ <ItemGroup>
+ <Content Include="vcredist\vcredist_x86.exe">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.