Ejemplo n.º 1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public MapgisToolSubMenu()
 {
     MapDocEditor = new MapDocEditor(catalog)
     {
         IsPopup = true
     };
     mapDocDataViewer = new MapDocDataViewer()
     {
         IsPopup = true
     };
     mapDocConditionInput = new ConditionInput(mapDocDataViewer)
     {
         IsPopup = true
     };
     this.Loaded += new RoutedEventHandler(OnLoaded);
     LayerEditor  = new LayerEditor(catalog)
     {
         IsPopup = true
     };
     layerDataViewer = new LayerDataViewer()
     {
         IsPopup = true
     };
     layerConditionInput = new LayerConditionInput(layerDataViewer)
     {
         IsPopup = true
     };
 }
        /// <summary>
        /// 构造函数
        /// </summary>
        public MapgisToolSubMenu()
        {
            InitializeComponent();
            fishMenu = new FishEyeMenuH();
            this.ResizeControl();
            this.LayoutRoot.Children.Add(fishMenu);
            this.Loaded += new RoutedEventHandler(OnLoaded);
            MapDocEditor = new MapDocEditor(catalog)
            {
                IsPopup = true
            };
            mapDocDataViewer = new MapDocDataViewer()
            {
                IsPopup = true
            };                                                           //, MapDocEditorObj = MapDocEditor };
            mapDocConditionInput = new ConditionInput(mapDocDataViewer)
            {
                IsPopup = true
            };
            this.BorderThickness = new Thickness(0);

            LayerEditor = new LayerEditor(catalog)
            {
                IsPopup = true
            };
            layerDataViewer = new LayerDataViewer()
            {
                IsPopup = true
            };                                                         //, LayerEditorObj = LayerEditor };
            layerConditionInput = new LayerConditionInput(layerDataViewer)
            {
                IsPopup = true
            };
        }
Ejemplo n.º 3
0
        //[TestMethod]
        public void TestConditionCallback()
        {
            List <ACondition>    cdts = new List <ACondition>();
            ConditionInput <int> i    = 128;

            var intCdt = new ConditionEvaluator
            {
                Condition = ConditionEvaluator.CONDITION.MORE,
                Input     = 127
            };

            intCdt.SetRefOutput(i);
            //intCdt.Callback = () => intCdt.Input++;

            //cdts.Add(intCdt);

            Assert.IsTrue(ACondition.EvaluateSet(cdts), "1 Conditions are not satisfied");
            //intCdt.Callback();
            Assert.IsFalse(ACondition.EvaluateSet(cdts), "2 Conditions are not satisfied");
        }
Ejemplo n.º 4
0
        //[TestMethod]
        public void TestConditions()
        {
            List <ACondition>    cdts = new List <ACondition>();
            ConditionInput <int> i    = new ConditionInput <int>
            {
                Value = 42
            };

            var intCdt = new ConditionEvaluator
            {
                Condition = ConditionEvaluator.CONDITION.EQUAL,
                Input     = 42
            };

            intCdt.SetRefOutput(i);
            //cdts.Add(intCdt);

            Assert.IsTrue(ACondition.EvaluateSet(cdts), "1 Conditions are not satisfied");

            i.Value = 0;
            Assert.IsFalse(ACondition.EvaluateSet(cdts), "2 Conditions are not satisfied");
        }
        public static Data.Inputs.MethodParamPair GenerateMethodFromArgs(string method, string[] param, string[] paths)
        {
            MethodParamPair output = null;

            ExitPathGroup methodPaths = new ExitPathGroup();

            for (int i = 0; i < paths.Length; i++)
            {
                var temp = paths[i].Split(';');
                if (temp.Length != 2)
                {
                    throw new EngineException("Invalid path size", true);
                }
                int          rawResult = int.Parse(temp[i]), nextMethod;
                MethodResult result = (MethodResult)rawResult;
                nextMethod          = int.Parse(temp[1]);
                methodPaths[result] = nextMethod;
            }
            switch (method.ToLower())
            {
            case "addgold":
            {
                break;
            }

            case "conditional":
            {
                ConditionInput conditionInput = new ConditionInput();
                break;
            }

            case "addexp":
            {
                break;
            }

            case "toggleswitch":
            {
                break;
            }

            case "activateswitch":
            {
                break;
            }

            case "deactivateswitch":
            {
                break;
            }

            case "showmessagebox":
            {
                string messageBoxInput = "";
                for (int i = 0; i < param.Length; i++)
                {
                    messageBoxInput += param[i] + "\n";
                }
                StringInput methodInput = new StringInput()
                {
                    Input = messageBoxInput
                };

                output = new MethodParamPair(ShowMessageBox, methodInput, methodPaths);
                break;
            }

            default:
                throw new EngineException("Method name Not Found", false);
            }
            return(output);
        }