Example #1
0
        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);
        }
Example #2
0
        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 });
        }
Example #3
0
 public BaseStyle GetButton(String textName, RoutedEventHandler routedEventHandler, out Button btn)
 {
     btn = ViewBusiness.GetButton(textName, routedEventHandler);
     return(this);
 }
Example #4
0
 /// <summary>
 /// 添加文本框(输入框)
 /// </summary>
 public void AddTextBox()
 {
     _UI.Add(ViewBusiness.GetTextBox());
 }
Example #5
0
        public ShapeColorOperationChild(ShapeColorOperationModel shapeColorOperationModel, ScriptUserControl suc) : base(suc)
        {
            this.shapeColorOperationModel = shapeColorOperationModel;

            ComboBox cb = GetComboBox(new List <string>()
            {
                "Square", "Vertical", "Horizontal"
            }, null);

            cb.IsEnabled = false;
            AddTitleAndControl("TypeColon", cb);

            mLaunchpad.SetLaunchpadBackground(new SolidColorBrush(Color.FromRgb(43, 43, 43)));
            mLaunchpad.Size = 300;

            textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[0] + ""));
            textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[1] + ""));
            textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[2] + ""));
            textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[3] + ""));
            textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[4] + ""));

            if (shapeColorOperationModel.MyShapeType == ShapeColorOperationModel.ShapeType.SQUARE)
            {
                cb.SelectedIndex = 0;
            }
            else if (shapeColorOperationModel.MyShapeType == ShapeColorOperationModel.ShapeType.RADIALVERTICAL)
            {
                cb.SelectedIndex = 1;

                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[5] + ""));
                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[6] + ""));
                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[7] + ""));
                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[8] + ""));
                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[9] + ""));
            }
            else if (shapeColorOperationModel.MyShapeType == ShapeColorOperationModel.ShapeType.RADIALVERTICAL)
            {
                cb.SelectedIndex = 2;

                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[5] + ""));
                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[6] + ""));
                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[7] + ""));
                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[8] + ""));
                textBoxs.Add(GetTexeBox(shapeColorOperationModel.Colors[9] + ""));
            }
            GetTexeBlock(shapeColorOperationModel.TopString);

            List <FrameworkElement> frameworkElements = new List <FrameworkElement>();

            frameworkElements.Add(GetTexeBlock(shapeColorOperationModel.TopString));
            frameworkElements.AddRange(textBoxs.ToArray());
            frameworkElements.Add(GetTexeBlock(shapeColorOperationModel.BottomString));

            AddUIElement(GetDockPanel(mLaunchpad, GetVerticalStackPanel(frameworkElements))).
            AddUIElement(GetHorizontalStackPanel(new List <FrameworkElement>()
            {
                ViewBusiness.GetButton("Preview", Preview), ViewBusiness.GetButton("PasteValue", PasteRangeListContent)
            }));
            GetButton("Save", ToSave, out Button btn);
            AddUIElement(btn);

            CreateDialog();
        }
Example #6
0
        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();
        }