using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Windows;
using Microsoft.Win32;
namespace MdispWebForm
{
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
{
MainWindow wnd;
string subKeyName = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_WEBSOCKET_MAXCONNECTIONSPERSERVER";
string valueName = Assembly.GetExecutingAssembly().GetName().Name + ".exe";
SetRegistryValue(subKeyName, valueName, 0x00000080, RegistryValueKind.DWord);
if (e.Args.Length == 1)
{
wnd = new MainWindow(e.Args[0]);
}
else
{
wnd = new MainWindow();
}
MainWindow = wnd;
wnd.Show();
}
public void SetRegistryValue(string registrySubKeyName, string valueName, object valueToSet, RegistryValueKind registryKind)
{
try
{
object currentValueInRegistry = Registry.GetValue(registrySubKeyName, valueName, null);
if (!valueToSet.Equals(currentValueInRegistry))
{
Registry.SetValue(registrySubKeyName, valueName, valueToSet, registryKind);
}
}
catch (Exception e)
{
Console.WriteLine("Exception occurred: " + e.Message);
}
}
}
}