Exemplo n.º 1
0
		/// <summary>
		/// Loads installed components from configuration file
		/// </summary>
		private void LoadInstalledComponents(ScopeNode node)
		{
			Log.WriteStart("Loading installed components");
			node.Nodes.Clear();

			foreach (ComponentConfigElement componentConfig in AppConfigManager.AppConfiguration.Components)
			{
				string instance = string.Empty;
				if (componentConfig.Settings["Instance"] != null &&
					!string.IsNullOrEmpty(componentConfig.Settings["Instance"].Value))
				{
					instance = "(" + componentConfig.Settings["Instance"].Value + ")";
				}
				string title = string.Format("{0} {1} {2} {3}",
					componentConfig.Settings["ApplicationName"].Value,
					componentConfig.Settings["ComponentName"].Value,
					componentConfig.Settings["Release"].Value,
					instance);

				AddComponentNode(node, title, componentConfig);
			}
			node.Populated = true;
			Log.WriteEnd(string.Format("{0} installed component(s) loaded", AppConfigManager.AppConfiguration.Components.Count));
		}
Exemplo n.º 2
0
		/// <summary>
		/// Initializes application
		/// </summary>
		internal void InitializeApplication()
		{
			CheckForIllegalCrossThreadCalls = false;
			LifetimeServices.LeaseTime = TimeSpan.Zero;

			this.splitContainer.Panel2MinSize = 380;
			this.splitContainer.Panel1MinSize = 150;
			this.progressManager = new ProgressManager(this, this.statusBarLabel);
			instance = this;

			AddDefaultNodes();

		}
Exemplo n.º 3
0
		/// <summary>
		/// Check whether application is up-to-date
		/// </summary>
		private static bool CheckForUpdate(ApplicationForm mainForm)
		{
			if (!mainForm.AppConfiguration.GetBooleanSetting(ConfigKeys.Web_AutoCheck))
				return false;

			string appName = mainForm.Text;
			string fileName;
			bool updateAvailable;
			try
			{
				updateAvailable = mainForm.CheckForUpdate(out fileName);
			}
			catch (Exception ex)
			{
				Log.WriteError("Update error", ex);
				mainForm.ShowServerError();
				return false;
			}

			if (updateAvailable)
			{
				string message = string.Format("An updated version of {0} is available now.\nWould you like to download and install the latest version?", appName);
				if (MessageBox.Show(message, appName, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
				{
					return mainForm.StartUpdateProcess(fileName);
				}
			}
			return false;
		}
Exemplo n.º 4
0
		static void Main()
		{
			//check security permissions
			if (!Utils.CheckSecurity())
			{
				ShowSecurityError();
				return;
			}

			//check administrator permissions
			if (!Utils.IsAdministrator())
			{
				ShowSecurityError(); 
				return;
			}

			//check for running instance
			if ( !Utils.IsNewInstance())
			{
				Utils.ShowRunningInstance();
				return;
			}

			Log.WriteApplicationStart();
			//AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException);
			Application.ApplicationExit += new EventHandler(OnApplicationExit);
			Application.ThreadException += new ThreadExceptionEventHandler(OnThreadException);
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);

			//check OS version
			OS.WindowsVersion version = OS.GetVersion();
			Global.OSVersion = version;
			Log.WriteInfo(string.Format("{0} detected", version));

			//check IIS version
			Version iisVersion = RegistryUtils.GetIISVersion();
			if (iisVersion.Major == 0)
				Log.WriteError("IIS not found.");
			else
				Log.WriteInfo(string.Format("IIS {0} detected", iisVersion));

			Global.IISVersion = iisVersion;

			ApplicationForm mainForm = new ApplicationForm();

			if (!CheckCommandLineArgument("/nocheck"))
			{
				//Check for new versions
				if (CheckForUpdate(mainForm))
				{
					return;
				}
				////x64 support
				//try
				//{
				//    Utils.CheckWin64(mainForm);
				//}
				//catch (Exception ex)
				//{
				//    Log.WriteError("IIS x64 error", ex);
				//}
			}

			LoadSetupXmlFile();

			//start application
			mainForm.InitializeApplication();
			Application.Run(mainForm);
			Utils.SaveMutex();
		}
Exemplo n.º 5
0
		static void Main()
		{
			//
			Utils.FixConfigurationSectionDefinition();

			//check security permissions
			if (!Utils.CheckSecurity())
			{
				ShowSecurityError();
				return;
			}

			//check administrator permissions
			if (!Utils.IsAdministrator())
			{
				ShowSecurityError(); 
				return;
			}

			//check for running instance
			if ( !Utils.IsNewInstance())
			{
				UiUtils.ShowRunningInstance();
				return;
			}

			Log.WriteApplicationStart();
			//AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException);
			Application.ApplicationExit += new EventHandler(OnApplicationExit);
			Application.ThreadException += new ThreadExceptionEventHandler(OnThreadException);
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);

			//check OS version
			Log.WriteInfo("{0} detected", Global.OSVersion);

			//check IIS version
			if (Global.IISVersion.Major == 0)
				Log.WriteError("IIS not found.");
			else
				Log.WriteInfo("IIS {0} detected", Global.IISVersion);

			ApplicationForm mainForm = new ApplicationForm();

			if (!CheckCommandLineArgument("/nocheck"))
			{
				//Check for new versions
				if (CheckForUpdate(mainForm))
				{
					return;
				}
			}
			// Load setup parameters from an XML file
			LoadSetupXmlFile();
			//start application
			mainForm.InitializeApplication();
			Application.Run(mainForm);
			//
			Utils.SaveMutex();
		}