コード例 #1
0
ファイル: MakerView.cs プロジェクト: cnboker/autorobo
 void Browser_BeforeNavigate2(object sender, csExWB.BeforeNavigate2EventArgs e)
 {
     //内置协议,打开在线脚本
     if (e.url.IndexOf("autorobo://") == 0)
     {
         e.Cancel = true;
         ProtocolObject   protocol   = ProtocolObject.DeserializeObject(e.url);
         ActionRepository repository = new ActionRepository((RecorderProtocol)protocol);
         var model = new ModelSet(repository);
     }
 }
コード例 #2
0
 void cEXWB1_BeforeNavigate2(object sender, csExWB.BeforeNavigate2EventArgs e)
 {
     try
     {
         m_designer.DeactivateDesigner();
     }
     catch (Exception ee)
     {
         AllForms.m_frmLog.AppendToLog(this.Name + "_cEXWB1_DocumentComplete\r\n" + ee.ToString());
     }
 }
コード例 #3
0
 private void cEXWB1_BeforeNavigate2(object sender, csExWB.BeforeNavigate2EventArgs e)
 {
     AllForms.m_frmLog.AppendToLog("frmPopup_BeforeNavigate2\r\n" + e.url);
 }
コード例 #4
0
        private void cEXWB1_BeforeNavigate2(object sender, csExWB.BeforeNavigate2EventArgs e)
        {
            if (e.postdata == null)
            {
                e.Cancel = true;
                return;
            }

            // get the using statements and code
            byte[] byteData    = e.postdata as byte[];
            string strPostData = System.Text.ASCIIEncoding.ASCII.GetString(byteData);

            strPostData = strPostData.Remove(strPostData.Length - 1);
            strPostData = strPostData.Replace("+", " ");

            string[]            arrPostData = strPostData.Split("&".ToCharArray());
            NameValueCollection nvcPost     = new NameValueCollection();

            for (int i = 0; i < arrPostData.Length; i++)
            {
                string[] pair  = arrPostData[i].Split("=".ToCharArray());
                string   value = System.Uri.UnescapeDataString(pair[1]);
                nvcPost.Add(pair[0], value);
            }

            /*
             * // add using statements
             * string[] usings = nvcPost.GetValues("Using");
             * if (usings != null)
             * {
             *  for (int i = 0; i < usings.Length; i++)
             *  {
             *      wscript.FunctionUsing.Add(usings[i]);
             *  }
             * }
             */

            // find function page to know what assemblies to add
            string[] arrfunctionnames = nvcPost.GetValues("FunctionTitle");
            if (arrfunctionnames != null)
            {
                FunctionPage page = wscript.fcnManager.GetPageFromTitle(arrfunctionnames[0]);
                if (page != null)
                {
                    for (int i = 0; i < page.scAssemblies.Count; i++)
                    {
                        wscript.FunctionAssemblies.Add(page.scAssemblies[i]);
                    }
                }
            }

            // add code, replacing %variable% with the find method
            string varprefix = wscript.DetermineFindMethod(browsername, currentelement, lbAttributes.CheckedItems);

            if (varprefix == "")
            {
                varprefix = wscript.DetermineFindMethod(browsername, currentelement);
                if (varprefix == "")
                {
                    varprefix = Properties.Resources.UnknownItem;
                }
            }

            string[] code = nvcPost.GetValues("Code");
            if (code != null)
            {
                for (int i = 0; i < code.Length; i++)
                {
                    wscript.AddScriptLine(code[i].Replace("%variable%", varprefix));
                }
            }

            this.Close();

            e.Cancel = true;
        }