Пример #1
0
		/// <summary>
		/// Handles the InformUser event of the Extensions control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="MLifter.BusinessLayer.ExtensionEventArgs"/> instance containing the event data.</param>
		/// <remarks>Documented by Dev02, 2009-07-09</remarks>
		void Extensions_InformUser(object sender, ExtensionEventArgs e)
		{
			string userMessage = Resources.EXTENSION_INFORMUSER_MESSAGE_INSTALLED;
			foreach (ExtensionAction action in e.Extension.Actions)
			{
				if (action.Execution == ExtensionActionExecution.Never)
					continue;

				if (action.Kind == ExtensionActionKind.Force)
					userMessage = Resources.EXTENSION_INFORMUSER_MESSAGE_SELECTED;
			}

			string localizedType = string.Empty;
			switch (e.Extension.Type)
			{
				case ExtensionType.Skin:
					localizedType = Resources.EXTENSION_INFORMUSER_MESSAGE_TYPE_SKIN;
					break;
				case ExtensionType.Unknown:
				default:
					localizedType = Resources.EXTENSION_INFORMUSER_MESSAGE_TYPE_UNKNOWN;
					break;
			}

			MessageBox.Show(string.Format(userMessage, localizedType, e.Extension.Name), Resources.EXTENSION_INFORMUSER_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
		}
Пример #2
0
		/// <summary>
		/// Handles the ExecuteExtension event of the Extensions control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="MLifter.BusinessLayer.ExtensionEventArgs"/> instance containing the event data.</param>
		/// <remarks>Documented by Dev02, 2009-07-03</remarks>
		void Extensions_ExecuteExtension(object sender, ExtensionEventArgs e)
		{
			IExtension extension = e.Extension;
			if (extension.Type == ExtensionType.Skin)
			{
				styleHandler.AddStyle(extension.StartFile);
				styleHandler.CurrentStyleName = Path.GetFileNameWithoutExtension(extension.StartFile);
				SetStyle();
				RefreshStyleMenu();

				if (e.Action.Execution == ExtensionActionExecution.Once)
					Settings.Default.CurrentStyle = styleHandler.CurrentStyleName;
				else if (e.Action.Execution == ExtensionActionExecution.Always)
					foreach (ToolStripMenuItem item in switchSkinToolStripMenuItem.DropDownItems)
						item.Enabled = false;
			}
		}