private void cargarColores() { ListItem item; try { ColorLogic cl = new ColorLogic(); foreach (Color c in cl.BuscarColores()) { item = new ListItem(c.descripcion, c.id_color.ToString()); if (c.descripcion == "Gris") { item.Selected = true; } this.colorDropDownList.Items.Add(item); } } catch (Exception ex) { Session["error"] = ex; Response.Redirect("~/Errores.aspx", false); Context.ApplicationInstance.CompleteRequest(); } }
//添加数据源 public void AddData(List <KeyValuePair <string, double> > keyValuePairList) { if (keyValuePairList == null) { return; } List <System.Drawing.Color> Colors = ColorLogic.GetColors(keyValuePairList.Count); for (int i = 0; i < keyValuePairList.Count; i++) { FunnelChartModel Fmodel = new FunnelChartModel(); Fmodel.Key = keyValuePairList[i].Key; Fmodel.Value = keyValuePairList[i].Value; Fmodel.Fill = new SolidColorBrush(Color.FromRgb(Colors[i].R, Colors[i].G, Colors[i].B)); Fmodel.ToolTip = "漏斗图" + Environment.NewLine.ToString() + keyValuePairList[i].Key.ToString() + ":" + keyValuePairList[i].Value.ToString(); FunnelDataContext.Add(Fmodel); } FunnelDataContext = FunnelDataContext.OrderByDescending(m => m.Value).ToList(); }
private bool ColorSolve(int index) { var button = this.buttons[index]; var otherIndexes = this.OtherIndex(index); switch (button.Color) { case ButtonColor.Red: return(ColorLogic.IsRedConditionMet(this.buttons[otherIndexes[0]], this.buttons[otherIndexes[1]])); case ButtonColor.Blue: return(ColorLogic.IsBlueConditionMet(this.buttons[otherIndexes[0]], this.buttons[otherIndexes[1]])); case ButtonColor.Green: var nextIndex = NextIndexInClocwiseOrder(index); return(ColorLogic.IsGreenConditionMet(this.buttons[nextIndex])); case ButtonColor.Yellow: return(ColorLogic.IsYellowConditionMet(button)); case ButtonColor.Purple: return(ColorLogic.IsPurpleConditionMet(this.buttons[otherIndexes[0]], this.buttons[otherIndexes[1]])); case ButtonColor.White: return(ColorLogic.IsWhiteConditionMet(this.buttons[otherIndexes[0]], this.buttons[otherIndexes[1]])); case ButtonColor.Orange: return(ColorLogic.IsOrangeConditionMet(this.buttons[0])); case ButtonColor.Cyan: return(ColorLogic.IsCyanConditionMet(button)); case ButtonColor.Grey: return(ColorLogic.IsGreyConditionMet(button, new[] { this.buttons[otherIndexes[0]], this.buttons[otherIndexes[1]] })); default: throw new InvalidOperationException(); } }
public static bool IsLabelNoMet(int currentIndex, IList <LogicalButton> buttons) { var button = buttons[currentIndex]; var otherButtons = FilterOutIndex(currentIndex, buttons); switch (button.Color) { case ButtonColor.Red: return(!ColorLogic.IsRedConditionMet(otherButtons.First(), otherButtons.Last())); case ButtonColor.Blue: return(!ColorLogic.IsBlueConditionMet(otherButtons.First(), otherButtons.Last())); case ButtonColor.Green: var nextIndex = LogicalButtonsHelper.NextIndexInClocwiseOrder(currentIndex); return(!ColorLogic.IsGreenConditionMet(buttons[nextIndex])); case ButtonColor.Cyan: return(!ColorLogic.IsCyanConditionMet(button)); case ButtonColor.Yellow: return(!ColorLogic.IsYellowConditionMet(button)); case ButtonColor.Purple: return(!ColorLogic.IsPurpleConditionMet(otherButtons.First(), otherButtons.Last())); case ButtonColor.White: return(!ColorLogic.IsWhiteConditionMet(otherButtons.First(), otherButtons.Last())); case ButtonColor.Orange: return(!ColorLogic.IsOrangeConditionMet(buttons[0])); case ButtonColor.Grey: return(!ColorLogic.IsGreyConditionMet(button, otherButtons)); default: return(false); } }