private void FlipAssistantRow()
        {
            try
            {
                IEnumerable <RadElement> raditem = radCardViewMain.CardViewElement.ViewElement.GetChildren(ChildrenListOptions.Normal).FirstOrDefault().GetChildren(ChildrenListOptions.Normal);

                foreach (RadElement re in raditem)
                {
                    CardListViewVisualItem clvvi = (CardListViewVisualItem)re;

                    List <RadElement> re2 = clvvi.CardContainer.GetChildren(ChildrenListOptions.Normal).ToList();

                    CardViewItem cvi = (CardViewItem)re2.Where(x => ((CardViewItem)x).FieldName == "Assist").FirstOrDefault();

                    LiveClientStatus lcs = (LiveClientStatus)clvvi.Data.Value;

                    if (cvi != null && lcs.IsAssistanceRequested)
                    {
                        cvi.DrawBorder = _flipStatus;
                    }
                }

                _flipStatus = !_flipStatus;
            }
            catch { }
        }
Exemple #2
0
        protected void NewCard(object parameter)
        {
            string    templateName = parameter as string;
            ITemplate template     = _Workspace.Game.GetTemplateByName(templateName);

            if (template == null)
            {
                MessageBox.Show("There was an error trying to obtain the template '" + templateName + "'.");
                return;
            }
            ICardSetViewItem cardSet = treeviewSets.SelectedItem as ICardSetViewItem;

            if (cardSet != null)
            {
                ICardViewItem card = new CardViewItem(template);
                cardSet.RegisterCard(card);
                NotifyPropertyChanged("ObservableSets");
                ActiveCard = card; //this will redraw the canvas.
                double x = (canvasWorkspace.ActualWidth / 2) - (ActiveCard.Template.Width / 2);
                double y = (canvasWorkspace.ActualHeight / 2) - (ActiveCard.Template.Height / 2);
                ActiveCard.Template.XPos = x;
                ActiveCard.Template.YPos = y;
                cardSet.IsExpanded       = true;
            }
            else
            {
                MessageBox.Show("You must select a set before you can add a card to it.");
            }
        }
Exemple #3
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;
                }
            }
        }
        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;
            }
        }