コード例 #1
0
        public void TestMethod()
        {
            PositiveController control = new PositiveController();
            IModelPositive     model   = new ModelPositive();

            control.Model = model;

            //把view中的响应事件(一系列列表函数)通过委托加减方式注入到model中,model变化时,执行view的方法
            control += new TraceView();
            control += new EventLogView();

            Console.WriteLine("******************Positive MVC*******************");
            Console.WriteLine("please input Positive MVC model data");

            int n = 20;

            while (n > 0)
            {
                n--;
                string myinput = Console.ReadLine();
                int    index   = Convert.ToInt32(myinput) % 10;

                myinput = Console.ReadLine();
                int num = Convert.ToInt32(myinput);

                model[index] = num;
            }

            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: miaodl/DesignPattern
        public void TestMethod()
        {
            PositiveController control = new PositiveController();
            IModelPositive model = new ModelPositive();
            control.Model = model;

            //把view中的响应事件(一系列列表函数)通过委托加减方式注入到model中,model变化时,执行view的方法
            control += new TraceView();
            control += new EventLogView();

            Console.WriteLine("******************Positive MVC*******************");
            Console.WriteLine("please input Positive MVC model data");

            int n=20;

            while(n>0)
            {
                n--;
                string myinput = Console.ReadLine();
                int index = Convert.ToInt32(myinput)%10;

                myinput = Console.ReadLine();
                int num = Convert.ToInt32(myinput);

                model[index] = num;
            }

            Console.ReadLine();
        }