Exemple #1
0
 /// <summary>
 /// 清理所有正在使用的资源。
 /// </summary>
 /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
 protected override void Dispose(bool disposing)
 {
     if (webBrowser1 != null)
     {
         webBrowser1.Navigated         -= WebBrowser_Navigated;
         webBrowser1.NewWindow3        -= WebBrowser_NewWindow3;
         webBrowser1.DocumentCompleted -= WebBrowser_DocumentCompleted;
         if (isModalDialog)
         {
             this.DialogResult = WebBrowser2.InvokeScript(webBrowser1.Document.DomDocument as IHTMLDocument, "getDialogResult");
         }
     }
     if (disposing)
     {
         if (webBrowser1 != null)
         {
             webBrowser1.Dispose();
             if (_fillManager != null)
             {
                 _fillManager.DetachWebBrowser(webBrowser1);
             }
         }
         if (components != null)
         {
             components.Dispose();
         }
     }
     base.Dispose(disposing);
     _fillManager = null;
     webBrowser1  = null;
 }
Exemple #2
0
        private void FillTableValue(Hashtable data)
        {
            if (data == null)
            {
                base.Browser.Invoke((Action)(() =>
                {
                    WebBrowser2.InvokeScript(base.Document.DomDocument as IHTMLDocument, "goBack");
                }));
                return;
            }
            int           count     = 0;
            List <string> valueList = null;
            List <KeyValuePair <FillParameterKey, object> > fillList = new List <KeyValuePair <FillParameterKey, object> >();
            int fillIndex = 0, rowIndex = 0;

            foreach (DictionaryEntry entry in data)
            {
                rowIndex = 0;
                DataTable table = entry.Value as DataTable;
                bool      canAdd;
                while (table.Rows.Count > rowIndex)
                {
                    formIndexes.Clear();
                    valueList = GetValueList(table, fillList, out fillIndex, ref rowIndex, out canAdd);
                    for (int i = 0; i < fillIndex; i++)
                    {
                        if (_parameters[i].Key.Type == Matcher.TYPE_FORM)
                        {
                            FillParameter parameter = _parameters[i].Value as FillParameter;
                            if (parameter != null)
                            {
                                string key = parameter.FrameId;
                                if (string.IsNullOrEmpty(key))
                                {
                                    key = "@";
                                }
                                if (formIndexes.ContainsKey(key))
                                {
                                    formIndexes[key] = formIndexes[key] + 1;
                                }
                                else
                                {
                                    formIndexes[key] = 0;
                                }
                            }
                        }
                    }
                    FillListElement(fillList, valueList, canAdd);
                    count = Math.Max(count, fillIndex);
                    fillList.Clear();
                }
            }

            for (int index = count; index < _parameters.Count; index++)
            {
                this.FillElement(_parameters[index].Key, _parameters[index].Value, null);
            }
        }