Beispiel #1
0
        protected void bt_Invoke_Click(object sender, EventArgs e)
        {
            // try
            //  {
            param = (ParameterInfo[])Session["param"];
            object[] param1 = new object[param.Length];
            myProperty = (properties)Session["myProperty"];

            for (int i = 0; i < param.Length; i++)
            {
                param1[i] = Convert.ChangeType(myProperty.MyValue[i], myProperty.TypeParameter[i]);
            }
            methodInfo = (MethodInfo[])Session["methodInfo"];
            MethodName = (string)Session["MethodName"];
            service    = (Type)Session["service"];

            foreach (MethodInfo t in methodInfo)
            {
                if (t.Name == MethodName)
                {
                    //Invoke Method
                    Object obj      = Activator.CreateInstance(service);
                    Object response = t.Invoke(obj, param1);

                    TextBox3.Text = ("Result = " + response.ToString());

                    break;
                }
            }
            // }
            // catch { }
        }
        protected void Timer1_Tick(object sender, EventArgs e)
        {
            methodInfo = (MethodInfo[])Session["methodInfo"];
            string MethodName_ajax = "monitor";
            int    indx            = 0;

            //  param = (ParameterInfo[])Session["param"];
            //  ParameterInfo[] param_ajax = new ParameterInfo[param.Length];
            listurl = (string[])Session["listurl"];
            for (int i = 0; i < listurl.Length; i++)
            {
                if (listurl[i] == MethodName_ajax)
                {
                    indx = i; break;
                }
            }
            ParameterInfo[] param_ajax      = methodInfo[indx].GetParameters();
            properties      myProperty_ajax = new properties(param_ajax.Length);// Service_Info.myProperty = new properties(Service_Info.param.Length);

            // Get the Parameters Type
            Type[] paramTypes_ajax = new Type[param_ajax.Length];

            for (int i = 0; i < paramTypes_ajax.Length; i++)
            {
                paramTypes_ajax[i] = param_ajax[i].ParameterType;
            }
            int ind = 0;

            foreach (ParameterInfo temp in param_ajax)
            {
                myProperty_ajax.TypeParameter[ind++] = temp.ParameterType;
            }
            myProperty_ajax.MyValue[0] = (string)Session["Dev_ExcelTitle"];//"Switch_Toshiba1(7/9:40/2)";
            object[] param1 = new object[param_ajax.Length];
            for (int i = 0; i < param_ajax.Length; i++)
            {
                param1[i] = Convert.ChangeType(myProperty_ajax.MyValue[i], myProperty_ajax.TypeParameter[i]);
            }
            service = (Type)Session["service"];
            foreach (MethodInfo t in methodInfo)
            {
                if (t.Name == MethodName_ajax)
                {
                    //Invoke Method
                    Object obj      = Activator.CreateInstance(service);
                    Object response = t.Invoke(obj, param1);
                    lb_Cur_State.Text = ("Current Reading Value = " + response.ToString());
                    break;
                }
            }
            //---------------------------------------------------------------
            //  Random rnd = new Random();
            //  chtCategoriesProductCount.Series["Categories"].Points.AddXY(x,rnd.Next(5, 20));
            //  x++;
            BindChart();
        }
Beispiel #3
0
 protected void bt_Param_Value_Click(object sender, EventArgs e)
 {
     try
     {
         ListBox1.Items.Add(DropDownList2.Text + "=" + TextBox2.Text);
         myProperty = (properties)Session["myProperty"];
         myProperty.MyValue[DropDownList2.SelectedIndex] = TextBox2.Text;
         Session["myProperty"] = myProperty;
         TextBox2.Text         = "";
     }
     catch { }
 }
        protected void Bt_Parameters_Click(object sender, EventArgs e)
        {
            MethodName            = DropDownList1.Text;//    Service_Info.MethodName = DropDownList1.Text;
            Session["MethodName"] = MethodName;

            //----
            methodInfo = (MethodInfo[])Session["methodInfo"];
            //----

            param            = methodInfo[DropDownList1.SelectedIndex].GetParameters(); //Service_Info.param = Service_Info.methodInfo[DropDownList1.SelectedIndex].GetParameters();
            Session["param"] = param;

            myProperty = new properties(param.Length);// Service_Info.myProperty = new properties(Service_Info.param.Length);

            // Get the Parameters Type
            paramTypes = new Type[param.Length];

            for (int i = 0; i < paramTypes.Length; i++)
            {
                paramTypes[i] = param[i].ParameterType;
            }
            Session["paramTypes"] = paramTypes;

            //  ListBox1.Items.Clear();
            DropDownList2.Items.Clear();
            TextBox2.Text = "";
            int ind = 0;

            foreach (ParameterInfo temp in param)
            {
                // ListBox1.Items.Add(temp.ParameterType.Name + "  " + temp.Name);
                DropDownList2.Items.Add(temp.ParameterType.Name + "  " + temp.Name);
                //ListBox2.Items.Add(temp.ParameterType.Name + "  " + temp.Name);
                myProperty.TypeParameter[ind++] = temp.ParameterType;
            }
            Session["myProperty"] = myProperty;
        }
        protected void bt_Invoke_Click(object sender, EventArgs e)
        {
            param = (ParameterInfo[])Session["param"];
            object[] param1 = new object[param.Length];
            myProperty = (properties)Session["myProperty"];

            for (int i = 0; i < param.Length; i++)
            {
                param1[i] = Convert.ChangeType(myProperty.MyValue[i], myProperty.TypeParameter[i]);
            }
            methodInfo = (MethodInfo[])Session["methodInfo"];
            MethodName = (string)Session["MethodName"];
            service = (Type)Session["service"];

            foreach (MethodInfo t in methodInfo)
                if (t.Name == MethodName)
                {
                    //Invoke Method
                    Object obj = Activator.CreateInstance(service);
                    Object response = t.Invoke(obj, param1);

                    TextBox3.Text = ("Result = " + response.ToString());

                    break;
                }
        }
 protected void bt_Param_Value_Click(object sender, EventArgs e)
 {
     try
     {
         ListBox1.Items.Add(DropDownList2.Text + "=" + TextBox2.Text);
         myProperty = (properties)Session["myProperty"];
         myProperty.MyValue[DropDownList2.SelectedIndex] = TextBox2.Text;
         Session["myProperty"] = myProperty;
         TextBox2.Text = "";
     }
     catch { }
 }
        protected void Bt_Parameters_Click(object sender, EventArgs e)
        {
            MethodName = DropDownList1.Text;//    Service_Info.MethodName = DropDownList1.Text;
            Session["MethodName"] = MethodName;

            //----
            methodInfo = (MethodInfo[])Session["methodInfo"];
            //----

            param = methodInfo[DropDownList1.SelectedIndex].GetParameters(); //Service_Info.param = Service_Info.methodInfo[DropDownList1.SelectedIndex].GetParameters();
            Session["param"] = param;

            myProperty = new properties(param.Length);// Service_Info.myProperty = new properties(Service_Info.param.Length);

            // Get the Parameters Type
            paramTypes = new Type[param.Length];

            for (int i = 0; i < paramTypes.Length; i++)
            {
                paramTypes[i] = param[i].ParameterType;
            }
            Session["paramTypes"] = paramTypes;

            //  ListBox1.Items.Clear();
            DropDownList2.Items.Clear();
            TextBox2.Text = "";
            int ind = 0;
            foreach (ParameterInfo temp in param)
            {
                // ListBox1.Items.Add(temp.ParameterType.Name + "  " + temp.Name);
                DropDownList2.Items.Add(temp.ParameterType.Name + "  " + temp.Name);
                //ListBox2.Items.Add(temp.ParameterType.Name + "  " + temp.Name);
                myProperty.TypeParameter[ind++] = temp.ParameterType;
            }
            Session["myProperty"] = myProperty;
        }
        protected void Timer1_Tick(object sender, EventArgs e)
        {
            methodInfo = (MethodInfo[])Session["methodInfo"];
            string MethodName_ajax = "monitor";
            int indx = 0;
            //  param = (ParameterInfo[])Session["param"];
            //  ParameterInfo[] param_ajax = new ParameterInfo[param.Length];
            listurl = (string[])Session["listurl"];
            for (int i = 0; i < listurl.Length; i++)
                if (listurl[i] == MethodName_ajax)
                { indx = i; break; }
            ParameterInfo[] param_ajax = methodInfo[indx].GetParameters();
            properties myProperty_ajax = new properties(param_ajax.Length);// Service_Info.myProperty = new properties(Service_Info.param.Length);

            // Get the Parameters Type
            Type[] paramTypes_ajax = new Type[param_ajax.Length];

            for (int i = 0; i < paramTypes_ajax.Length; i++)
            {
                paramTypes_ajax[i] = param_ajax[i].ParameterType;
            }
            int ind = 0;
            foreach (ParameterInfo temp in param_ajax)
            {
                myProperty_ajax.TypeParameter[ind++] = temp.ParameterType;
            }
            myProperty_ajax.MyValue[0] = (string)Session["Dev_ExcelTitle"];//"Switch_Toshiba1(7/9:40/2)";
            object[] param1 = new object[param_ajax.Length];
            for (int i = 0; i < param_ajax.Length; i++)
            {
                param1[i] = Convert.ChangeType(myProperty_ajax.MyValue[i], myProperty_ajax.TypeParameter[i]);
            }
            service = (Type)Session["service"];
            foreach (MethodInfo t in methodInfo)
                if (t.Name == MethodName_ajax)
                {
                    //Invoke Method
                    Object obj = Activator.CreateInstance(service);
                    Object response = t.Invoke(obj, param1);
                    lb_Cur_State.Text = ("Current Reading Value = " + response.ToString());
                    break;
                }
            //---------------------------------------------------------------
            //  Random rnd = new Random();
            //  chtCategoriesProductCount.Series["Categories"].Points.AddXY(x,rnd.Next(5, 20));
            //  x++;
            BindChart();
        }