Пример #1
0
        private void radCardView1_CardViewItemFormatting(object sender, Telerik.WinControls.UI.CardViewItemFormattingEventArgs e)
        {
            CardViewItem cardViewItem = e.Item as CardViewItem;

            if (cardViewItem != null)
            {
                if (cardViewItem.FieldName == "Notes")
                {
                    cardViewItem.EditorItem.TextWrap     = true;
                    cardViewItem.EditorItem.AutoEllipsis = true;
                }
                else
                {
                    cardViewItem.EditorItem.ResetValue(LightVisualElement.TextWrapProperty, Telerik.WinControls.ValueResetFlags.Local);
                }

                if (cardViewItem.FieldName == "TitleOfCourtesy" || cardViewItem.FieldName == "FirstName" || cardViewItem.FieldName == "LastName")
                {
                    cardViewItem.Font = new Font(cardViewItem.Font.FontFamily, 10.5f, FontStyle.Regular);
                }
                else
                {
                    Font itemFont   = new Font(cardViewItem.Font.FontFamily, cardViewItem.Font.Size, FontStyle.Bold);
                    Font editorFont = new Font(cardViewItem.Font.FontFamily, cardViewItem.Font.Size, FontStyle.Regular);

                    cardViewItem.Font            = itemFont;
                    cardViewItem.EditorItem.Font = editorFont;
                }
            }
        }
Пример #2
0
 protected internal virtual void OnCardViewItemFormatting(CardViewItemFormattingEventArgs args)
 {
     if (this.CardViewItemFormatting == null)
     {
         return;
     }
     this.CardViewItemFormatting((object)this, args);
 }
Пример #3
0
        private void radCardViewMain_CardViewItemFormatting(object sender, Telerik.WinControls.UI.CardViewItemFormattingEventArgs e)
        {
            DataRowView dr = (DataRowView)e.VisualItem.Data.DataBoundItem;

            CardViewItem cardItem = e.Item as CardViewItem;

            if (cardItem != null)
            {
                LiveClientStatus lcs = ((LiveClientStatus)dr.Row["Column 1"]);

                switch (cardItem.FieldName)
                {
                case "Column 0":

                    cardItem.EditorItem.DrawText = false;
                    Image  image;
                    string status   = "";
                    bool   isOnline = false;

                    Utility.TranslateOnlineStatus(lcs.ClientStatus, out status, out isOnline);

                    if (((bool)dr.Row["Column 0"]) == true)
                    {
                        switch (lcs.Mode)
                        {
                        case "TIMING_ON":

                            image = Resources.ComputerOnTiming.ScaleImage(100, 100);

                            break;

                        case "NO_TIMING_ON":

                            image = Resources.ComputerOnNonTiming.ScaleImage(100, 100);

                            break;

                        default:

                            if (status != "ERROR" && isOnline)
                            {
                                if (lcs.ClientStatus == Enums.LiveClientStatus.GAMEOVER_FOR_CLEANING)
                                {
                                    image = Resources.ComputerCleaning.ScaleImage(100, 100);
                                }
                                else if (lcs.ClientStatus == Enums.LiveClientStatus.ONLINE)
                                {
                                    image = Resources.ComputerOnError.ScaleImage(100, 100);
                                }
                                else
                                {
                                    image = Resources.ComputerOnReady.ScaleImage(100, 100);
                                }
                            }
                            else
                            {
                                image = Resources.ComputerOnError.ScaleImage(100, 100);
                            }

                            break;
                        }
                    }
                    else
                    {
                        image = Resources.ComputerOff.ScaleImage(100, 100);
                    }

                    cardItem.EditorItem.Image       = image;
                    cardItem.EditorItem.ImageLayout = ImageLayout.Center;
                    cardItem.EditorItem.NotifyParentOnMouseInput = false;
                    cardItem.EditorItem.ShouldHandleMouseInput   = false;
                    cardItem.Padding = new Padding(-5, -5, -5, 0);
                    return;

                case "Column 1":
                    cardItem.Text            = "Name";
                    cardItem.EditorItem.Text = lcs.ClientName;

                    break;

                case "Column 2":
                    cardItem.Text = "Mode";

                    break;

                case "Column 3":
                    cardItem.Text = "Status";
                    if (lcs.ClientStatus == Enums.LiveClientStatus.GAMEOVER_FOR_CLEANING)
                    {
                        cardItem.DrawFill   = true;
                        cardItem.BackColor  = Color.Lavender;
                        cardItem.BackColor2 = Color.MediumBlue;
                        cardItem.ForeColor  = Color.White;
                    }
                    else
                    {
                        cardItem.DrawFill  = false;
                        cardItem.ForeColor = Color.Black;
                    }
                    cardItem.BorderBoxStyle      = BorderBoxStyle.SingleBorder;
                    cardItem.BorderGradientStyle = GradientStyles.Solid;
                    cardItem.BorderColor         = Color.Blue;
                    cardItem.BorderWidth         = 1;

                    break;

                case "Column 4":
                    cardItem.Text = "Left / Pass";

                    break;

                case "Column 5":
                    cardItem.Text = "Help Needed";
                    if (cardItem.EditorItem.Text == "Yes")
                    {
                        cardItem.DrawFill   = true;
                        cardItem.BackColor  = Color.Pink;
                        cardItem.BackColor2 = Color.Red;
                        cardItem.ForeColor  = Color.White;
                    }
                    else
                    {
                        cardItem.DrawFill  = false;
                        cardItem.ForeColor = Color.Black;
                    }
                    cardItem.BorderBoxStyle      = BorderBoxStyle.SingleBorder;
                    cardItem.BorderGradientStyle = GradientStyles.Solid;
                    cardItem.BorderColor         = Color.Red;
                    cardItem.BorderWidth         = 1;

                    break;

                default:
                    break;
                }


                System.Drawing.Font editorFont = new System.Drawing.Font(cardItem.Font.FontFamily, cardItem.Font.Size, FontStyle.Regular);

                cardItem.EditorItem.Font = editorFont;
            }
        }