private void IvAdd_MouseLeftButtonDown(object sender, RoutedEventArgs e) { ComboBox cb = null; if (setAttributeOperationModel.AttributeOperationModels.Count == 0) { cb = GetComboBox(new List <string> { "Time", "Position", "Color" }, null); } else { DockPanel dp = _UI[_UI.Count - 2] as DockPanel; int type = (dp.Children[0] as ComboBox).SelectedIndex; if (type == 0) { cb = GetComboBox(new List <string> { "Time", "Position", "Color" }, 1, null); } else if (type == 1) { cb = GetComboBox(new List <string> { "Time", "Position", "Color" }, 2, null); } else if (type == 2) { cb = GetComboBox(new List <string> { "Time", "Position", "Color" }, 0, null); } //if (setAttributeOperationModel.AttributeOperationModels[setAttributeOperationModel.AttributeOperationModels.Count - 1].attributeType == SetAttributeOperationModel.AttributeOperationModel.AttributeType.TIME) //{ // cb = GetComboBox(new List<string> { "Time", "Position", "Color" }, 1, null); //} //else if (setAttributeOperationModel.AttributeOperationModels[setAttributeOperationModel.AttributeOperationModels.Count - 1].attributeType == SetAttributeOperationModel.AttributeOperationModel.AttributeType.POSITION) //{ // cb = GetComboBox(new List<string> { "Time", "Position", "Color" }, 2, null); //} //else { // cb = GetComboBox(new List<string> { "Time", "Position", "Color" }, 0, null); //} } TextBox tb = GetTexeBox("+0"); tb.Width = 300; AddUIToDialog(GetDockPanel(new List <FrameworkElement> { cb, tb, ViewBusiness.GetImage("check_gray.png", 25, IvCheck_MouseLeftButtonDown) }), UICount - 1); }
public SetAttributeOperationChild(SetAttributeOperationModel setAttributeOperationModel, ScriptUserControl suc) : base(suc) { this.setAttributeOperationModel = setAttributeOperationModel; //构建对话框 foreach (var item in setAttributeOperationModel.AttributeOperationModels) { ComboBox cb = GetComboBox(new List <string> { "Time", "Position", "Color" }, null); TextBox tb = GetTexeBox(item.Value); tb.Width = 300; if (item.attributeType.Equals(SetAttributeOperationModel.AttributeOperationModel.AttributeType.TIME)) { //时间支持表达式 cb.SelectedIndex = 0; } else if (item.attributeType.Equals(SetAttributeOperationModel.AttributeOperationModel.AttributeType.POSITION)) { cb.SelectedIndex = 1; } else if (item.attributeType.Equals(SetAttributeOperationModel.AttributeOperationModel.AttributeType.COLOR)) { cb.SelectedIndex = 2; } AddUIElement(GetDockPanel(new List <FrameworkElement> { cb, tb, ViewBusiness.GetImage("check_gray.png", 25, IvCheck_MouseLeftButtonDown) })); } AddUIElement(GetDockPanel(new List <FrameworkElement> { ViewBusiness.GetButton("Add", IvAdd_MouseLeftButtonDown), ViewBusiness.GetButton("Delete", IvReduce_MouseLeftButtonDown), ViewBusiness.GetButton("Change", IvChange_Click) })); CreateDialog(); //TODO //AddTitleImage(new List<String>() { "add_white.png", "reduce.png" }, new List<System.Windows.Input.MouseButtonEventHandler>() { IvAdd_MouseLeftButtonDown, IvReduce_MouseLeftButtonDown }); }
public ConditionJudgmentOperationChild(ConditionJudgmentOperationModel conditionJudgmentOperationModel, ScriptUserControl suc) : base(suc) { this.conditionJudgmentOperationModel = conditionJudgmentOperationModel; this.suc = suc; //构建对话框 cbOperator = GetComboBox(new List <String>() { "Replace", "Remove" }, CbOperator_SelectionChanged); AddTitleAndControl("OperationColon", cbOperator); AddUIElement(GetTexeBlockNoBorder("If", true)); tbIfTime = GetTexeBox(conditionJudgmentOperationModel.IfTime.ToString()); tbIfTime.Width = 270; AddTitleAndControl("TimeColon", new List <FrameworkElement>() { tbIfTime, ViewBusiness.GetImage("calc.png", 25) }); cbAction = GetComboBox(new List <String>() { "All", "Open", "Close" }, null); cbAction.SelectedIndex = conditionJudgmentOperationModel.IfAction; AddTitleAndControl("ActionColon", cbAction); StringBuilder sbPosition = new StringBuilder(); foreach (var item in conditionJudgmentOperationModel.IfPosition) { sbPosition.Append(item).Append(StaticConstant.mw.projectUserControl.suc.StrInputFormatDelimiter); } tbIfPosition = GetTexeBox(sbPosition.ToString().Length > 0 ? sbPosition.ToString().Substring(0, sbPosition.ToString().Length - 1): ""); tbIfPosition.Width = 270; DrawRangeClass drawRangeClass = new DrawRangeClass(tbIfPosition); ShowRangeClass showRangeClassPosition = new ShowRangeClass(tbIfPosition); AddTitleAndControl("PositionColon", new List <FrameworkElement>() { tbIfPosition, ViewBusiness.GetImage("draw.png", 25, drawRangeClass.DrawRange), ViewBusiness.GetImage("more_white.png", 25, showRangeClassPosition.ShowRangeList) }); StringBuilder sbColor = new StringBuilder(); foreach (var item in conditionJudgmentOperationModel.IfColor) { sbColor.Append(item).Append(StaticConstant.mw.projectUserControl.suc.StrInputFormatDelimiter); } tbIfColor = GetTexeBox(sbColor.ToString().Length > 0 ? sbColor.ToString().Substring(0, sbColor.ToString().Length - 1) : ""); tbIfColor.Width = 270; ShowRangeClass showRangeClassColor = new ShowRangeClass(tbIfColor); AddTitleAndControl("ColorColon", new List <FrameworkElement>() { tbIfColor, ViewBusiness.GetImage("more_white.png", 25, showRangeClassColor.ShowRangeList) }); AddUIElement(GetTexeBlockNoBorder("Then", true)); tbThenTime = GetTexeBox(conditionJudgmentOperationModel.ThenTime.ToString()); AddTitleAndControl("TimeColon", tbThenTime); tbThenPosition = GetTexeBox(conditionJudgmentOperationModel.ThenPosition.ToString()); AddTitleAndControl("PositionColon", tbThenPosition); tbThenColor = GetTexeBox(conditionJudgmentOperationModel.ThenColor.ToString()); AddTitleAndControl("ColorColon", tbThenColor); AddUIElement(ViewBusiness.GetButton("Change", IvChange_Click)); cbOperator.SelectedIndex = (int)conditionJudgmentOperationModel.MyOperator - 40; CreateDialog(); }