示例#1
0
    private void SetIcon(IconMode mode)
    {
        if (_iconMode == mode)
        {
            return;
        }                                  // no work to do
        // set new mode
        _iconMode = mode;
        if (_mouseIcon)   // destroy old icon
        {
            Destroy(_mouseIcon);
            _mouseIcon = null;
        }
        // instantiate new icon
        switch (mode)
        {
        case IconMode.None:
            break;

        case IconMode.Walk:
            _mouseIcon = (GameObject)GameObject.Instantiate(WalkIcon);
            break;

        case IconMode.Melee:
            _mouseIcon = (GameObject)GameObject.Instantiate(MeleeIcon);
            break;

        case IconMode.Ranged:
            _mouseIcon = (GameObject)GameObject.Instantiate(RangedIcon);
            break;

        default:
            break;
        }
    }
示例#2
0
        public AlertBox(string alertMessage, string alertTitle, IconMode alertIcon)
        {
            try
            {
                InitializeComponent();

                Text = alertTitle;
                txtAlertMessage.Text = alertMessage;

                if (alertMessage.Contains("\n"))
                {
                    txtAlertMessage.Location = new Point(78, 20);
                    txtAlertMessage.Size     = new Size(294, 104);
                }

                switch (alertIcon)
                {
                case IconMode.Success:
                    pcbAlertIcon.Image = Properties.Resources.success;
                    break;

                case IconMode.Error:
                    pcbAlertIcon.Image = Properties.Resources.error;
                    break;

                case IconMode.Information:
                    pcbAlertIcon.Image = Properties.Resources.information;
                    break;

                case IconMode.Question:
                    pcbAlertIcon.Image = Properties.Resources.question;
                    btnOK.Visible      = false;
                    btnYes.Visible     = true;
                    btnNo.Visible      = true;
                    break;

                case IconMode.Dude:
                    pcbAlertIcon.Image = Properties.Resources.dude;
                    break;
                }

                this.Focus();
            }
            catch (Exception ex)
            {
                var alertBox = new AlertBox(ex.Message, "An Error occured", IconMode.Error);
                alertBox.ShowDialog();
            }
        }
		public static string RenderUserSet(SPWeb spWeb, object value, string formattedDate, IconMode iconMode, string deleteLinkControlId)
		{
			if (!(value is string))
				return "";

			string s = (string)value;

			if (s.Trim().Length == 0)
				return "";

			int hashStart = s.IndexOf("(");
			if (hashStart == -1)
				hashStart = s.Length + 1;

			string[] contentItems = s.Substring(0, hashStart - 1).Split(',');

			StringBuilder sb = new StringBuilder();
			sb.Append("<table>");
			bool first = true;
			foreach (string contentItem in contentItems)
			{
				string login = contentItem;
				string reason = null;

				int separatorIndex = contentItem.IndexOf(':');
				if (separatorIndex != -1)
				{
					login = contentItem.Substring(0, separatorIndex);
					reason = contentItem.Substring(separatorIndex + 1);
				}

				sb.Append("<tr><td class=\"ms-vb\">");
				if (first)
				{
					sb.Append(RenderIcon(iconMode));
					first = false;
				}
				sb.Append("</td><td class=\"ms-vb\"><span><nobr>");

				try
				{
					SPUser spUser = spWeb.SiteUsers[login.Trim()];
					if (spUser != null)
						sb.Append(RenderUser(spUser));
					else
						throw new Exception();	// Render in catch
				}
				catch
				{
					sb.Append(login.Trim());
				}

				if (formattedDate != null)
					sb.Append(" " + formattedDate);

				if (reason != null)
					sb.Append(": " + reason);

				if (deleteLinkControlId != null)
				{
					string escapedLoginName = contentItem.Trim().Replace("\\", "\\\\");
					sb.Append(" (<a href=\"javascript:__doPostBack('" + deleteLinkControlId + "','-" + escapedLoginName + "');\">undo</a>)");
				}

				sb.Append("</span></nobr></td></tr>");
			}
			sb.Append("</table>");

			return sb.ToString();
		}
		public static string RenderIcon(IconMode iconMode)
		{
			if ((iconMode & IconMode.SignedHidden) == IconMode.SignedHidden)
				return "";

			if ((iconMode & IconMode.SignedNew) == IconMode.SignedNew)
			{
				return String.Format("<img src=\"/_layouts/images/zmeng/DigitalSignature/{0}\" alt=\"{1}\" title=\"{1}\" />"
					+ "<img src=\"/_layouts/images/zmeng/DigitalSignature/{2}\" alt=\"{1}\" title=\"{1}\" />",
				"signed.gif",
				"New signature",
				"new.gif");
			}

			string s = "";

			if ((iconMode & IconMode.Invalid) == IconMode.Invalid)
			{
				s += String.Format("<img src=\"/_layouts/images/zmeng/DigitalSignature/{0}\" alt=\"{1}\" title=\"{1}\" />",
					"invalid.gif",
					"The checksum of this signature is invalid");
			}

			string icon = "signed.gif";
			string toolTip = "Signed";

			if ((iconMode & IconMode.SignedCurrent) == IconMode.SignedCurrent)
				toolTip = "Current version signed";
			else if ((iconMode & IconMode.SignedPrevious) == IconMode.SignedPrevious)
			{
				icon = "signed-previous.gif";
				toolTip = "Previous version signed";
			}

			s += String.Format("<img src=\"/_layouts/images/zmeng/DigitalSignature/{0}\" alt=\"{1}\" title=\"{1}\" />",
				icon, toolTip);

			return s;
		}
示例#5
0
        public Panel LegendItem(string I, System.Drawing.Color C, IconMode iconMode, bool IsLight)
        {
            StackPanel panel  = new StackPanel();
            Canvas     canvas = new Canvas();
            Label      text   = new Label();
            Canvas     spacer = new Canvas();

            spacer.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            spacer.Width      = 20;
            spacer.Height     = 10;

            canvas.Width  = 12;
            canvas.Height = 12;
            Path X = new Path();

            switch (iconMode)
            {
            case IconMode.Box:
                X.Data = new RectangleGeometry(new Rect(1, 1, 10, 10));
                break;

            case IconMode.Dot:
                X.Data = new EllipseGeometry(new Rect(1, 1, 10, 10));
                break;

            case IconMode.Bar:
                X.Data        = new RectangleGeometry(new Rect(0, 0, 4, 16));
                canvas.Width  = 4;
                canvas.Height = 16;
                spacer.Width  = 4;
                break;

            case IconMode.Underline:
                canvas.Width         = 0;
                spacer.Width         = 4;
                text.BorderBrush     = new SolidColorBrush(new wColor(C).ToMediaColor());
                text.BorderThickness = new Thickness(0, 0, 0, 4);
                break;

            case IconMode.Fill:
                canvas.Width    = 0;
                spacer.Width    = 0;
                text.Background = new SolidColorBrush(new wColor(C).ToMediaColor());
                text.Margin     = new Thickness(1);
                text.FontWeight = FontWeights.SemiBold;
                break;
            }

            if (IsLight)
            {
                text.Foreground = new SolidColorBrush(Color.FromArgb(255, 250, 250, 250));
            }

            X.Fill = new SolidColorBrush(new wColor(C).ToMediaColor());
            canvas.Children.Add(X);

            text.Content = I;

            panel.Orientation = Orientation.Horizontal;
            panel.Children.Add(canvas);
            panel.Children.Add(text);
            panel.Children.Add(spacer);

            return(panel);
        }
示例#6
0
 public void SetItems(List <String> items, List <System.Drawing.Color> colors, IconMode iconMode, bool IsLight)
 {
     Element.Children.Clear();
     for (int i = 0; i < items.Count; i++)
     {
         Element.Children.Add(LegendItem(items[i], colors[i], (IconMode)iconMode, IsLight));
     }
 }
 private void SetIcon(IconMode mode)
 {
     if (_iconMode == mode) { return; } // no work to do
     // set new mode
     _iconMode = mode;
     if (_mouseIcon) { // destroy old icon
         Destroy(_mouseIcon);
         _mouseIcon = null;
     }
     // instantiate new icon
     switch (mode) {
         case IconMode.None:
             break;
         case IconMode.Walk:
             _mouseIcon = (GameObject) GameObject.Instantiate(WalkIcon);
             break;
         case IconMode.Melee:
             _mouseIcon = (GameObject) GameObject.Instantiate(MeleeIcon);
             break;
         case IconMode.Ranged:
             _mouseIcon = (GameObject) GameObject.Instantiate(RangedIcon);
             break;
         default:
             break;
     }
 }