static void Main(string[] args)
        {
            AppDomain.CurrentDomain.AssemblyResolve           += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            System.Windows.Forms.Application.ThreadException  += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            InstallUtils = new ConfigurationUtilities();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Dictionary <string, string> commandLineValues = new Dictionary <string, string>();

            foreach (string arg in args)
            {
                string[] tempSetting = arg.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);

                if (tempSetting.Length == 2)
                {
                    commandLineValues[tempSetting[0]] = tempSetting[1];
                }
            }

            if (commandLineValues.ContainsKey(Constants.AdapterType))
            {
                InstallUtils.SetAdapter(commandLineValues[Constants.AdapterType]);
            }

            if (commandLineValues.ContainsKey(Constants.DiscoveryServiceAddress))
            {
                InstallUtils.InstallAdapter.DiscoveryServiceAddress = new Uri(commandLineValues[Constants.DiscoveryServiceAddress]);
            }

            if (commandLineValues.ContainsKey(Constants.UserName))
            {
                InstallUtils.InstallAdapter.UserName = commandLineValues[Constants.UserName];
            }

            if (commandLineValues.ContainsKey(Constants.Password))
            {
                InstallUtils.InstallAdapter.UserPassword = commandLineValues[Constants.Password];
            }

            if (commandLineValues.ContainsKey(Constants.Organization))
            {
                InstallUtils.InstallAdapter.OrganizationName = commandLineValues[Constants.Organization];
            }

            Application.Run(new MainForm());
            TraceArguments();
        }