www.pudn.com > Fetion.rar > ImportForm.cs


namespace Imps.Client.Pc 
{ 
    using Imps.Client; 
    using Imps.Client.Core; 
    using Imps.Client.Pc.BizControls; 
    using Imps.Client.Pc.Controls; 
    using Imps.Client.Pc.UIContactList.AddBuddy; 
    using Imps.Client.Resource; 
    using Imps.Client.Utils; 
    using Imps.Common; 
    using Imps.Utils; 
    using System; 
    using System.Collections.Generic; 
    using System.ComponentModel; 
    using System.Drawing; 
    using System.IO; 
    using System.Runtime.CompilerServices; 
    using System.Text; 
    using System.Threading; 
    using System.Windows.Forms; 
    using System.Xml; 
 
    public class ImportForm : XIMDialog 
    { 
        private bool _checkByFunction; 
        private int _countFail; 
        private int _countOK; 
        private IFrameworkWindow _frameworkWin; 
        private IImportContacts _importObject; 
        private string _importXMLContent = ""; 
        private int? _initTargetGroupId; 
        private Dictionary _items = new Dictionary(); 
        private List _list; 
        private ImportExportManager _manager; 
        private int _maxStep = 5; 
        private int _step = 1; 
        private int _totalChecked; 
        private int _totalUsers; 
        private XButton btnBrowse; 
        private XButton btnCancel; 
        private XButton btnNext; 
        private XButton btnPrevious; 
        private UButton buttonNewGrp; 
        private ColumnHeader chCheckBox; 
        private CheckBox checkBoxSelAll; 
        private ColumnHeader chFetionNo; 
        private CheckBox chkInviteStartService; 
        private ColumnHeader chMobileNo; 
        private ColumnHeader chName; 
        private ColumnHeader chNickname; 
        private ColumnHeader columnHeader1; 
        private ComboBox comboBoxGroup; 
        private IContainer components; 
        private GroupBox groupBox1; 
        private int? groupID = null; 
        private int i; 
        private Label label1; 
        private Label label2; 
        private Label label3; 
        private Label label4; 
        private XLabel labelName; 
        private HtmlLabel labelRealName; 
        private XLabel lblDescription; 
        private XLabel lblImportContactName; 
        private XLabel lblSelectInfo; 
        private XLabel lblSelectPlugin; 
        private LinkLabel linkLabelHelp; 
        private ListBox listBox1; 
        private List lst; 
        private ListView lstContacts; 
        private OpenFileDialog openFileDialog; 
        private Panel panelFileSel; 
        private Panel panelOutlookDes; 
        private Panel panelOutlookRead; 
        private PictureBox pbImportExport; 
        private Panel pnlContainer; 
        private Panel pnlMainContainer; 
        private Panel pnlStep_MyInfo; 
        private Panel pnlStep_Result; 
        private Panel pnlStep_SelContact; 
        private Panel pnlStep_SelSource; 
        private ProgressBar progressBarExport; 
        private ProgressBar progressOutLook; 
        private RadioButton rbFile; 
        private RadioButton rbOutlook; 
        private XTextBox textBoxMyName; 
        private TextBox txtFilePath; 
        private XLabel xLabel2; 
        private XLabel xLabelFind; 
 
        public ImportForm(IFrameworkWindow frameworkWin, ImportExportManager manager) 
        { 
            this.InitializeComponent(); 
            this._frameworkWin = frameworkWin; 
            this._manager = manager; 
            this.initComponentRegion(); 
            this.CurrentUser.ContactList.ContactGroupChanged += new EventHandler(this.ContactList_ContactGroupChanged); 
            this.CurrentUser.StatusChanged += new EventHandler(this.CurrentUser_StatusChanged); 
        } 
 
        private void BindDatas(XmlDocument doc) 
        { 
            if ((doc != null) && ((this.lstContacts.Tag == null) || (this.lstContacts.Tag.ToString() != doc.InnerXml))) 
            { 
                this.lstContacts.Tag = doc.InnerXml; 
                this.lstContacts.Items.Clear(); 
                this._items.Clear(); 
                this._totalUsers = 0; 
                this._totalChecked = 0; 
                List list = new List(); 
                this._checkByFunction = true; 
                foreach (XmlNode node in doc.DocumentElement.ChildNodes) 
                { 
                    try 
                    { 
                        string nodeValue = this.GetNodeValue(node, "FetionId"); 
                        string str2 = this.GetNodeValue(node, "MobileNo"); 
                        string str3 = StringHelper.EncodString(this.GetNodeValue(node, "Name")); 
                        string str4 = StringHelper.EncodString(this.GetNodeValue(node, "Nickname")); 
                        if (((!string.IsNullOrEmpty(nodeValue) || !string.IsNullOrEmpty(str2)) && (this.CurrentUser.Sid.ToString() != nodeValue)) && (this.CurrentUser.MobileNo != str2)) 
                        { 
                            if (str2 == "0") 
                            { 
                                str2 = string.Empty; 
                            } 
                            long mobileNo = 0L; 
                            long result = 0L; 
                            if (string.IsNullOrEmpty(str2) || ((ImpsHelper.TryParseMobileNoExtend(str2, out mobileNo) && (this.CurrentUser.ContactList.FindContactByMsisdnEx(mobileNo.ToString()) == null)) && (!this._items.ContainsKey(mobileNo) && ImpsHelper.IsCmccMobileNo(str2)))) 
                            { 
                                if (!string.IsNullOrEmpty(nodeValue)) 
                                { 
                                    if (!long.TryParse(nodeValue, out result) || !ImpsHelper.IsSid(result)) 
                                    { 
                                        continue; 
                                    } 
                                    IicUri uri = IicUri.CreateSidUri(result); 
                                    if ((this.CurrentUser.ContactList.Contacts.FindContact(uri) != null) || this._items.ContainsKey(result)) 
                                    { 
                                        continue; 
                                    } 
                                } 
                                if (mobileNo != 0L) 
                                { 
                                    this._items.Add(mobileNo, null); 
                                } 
                                else 
                                { 
                                    if (result == 0L) 
                                    { 
                                        continue; 
                                    } 
                                    this._items.Add(result, null); 
                                } 
                                string[] items = new string[] { string.Empty, str3 ?? string.Empty, str4 ?? string.Empty, str2, nodeValue }; 
                                ListViewItem item = new ListViewItem(items); 
                                item.Tag = node; 
                                list.Add(item); 
                            } 
                        } 
                        continue; 
                    } 
                    catch (Exception exception) 
                    { 
                        ClientLogger.WriteGeneral("导入绑定单行数据时错误", exception.ToString(), 20); 
                        continue; 
                    } 
                } 
                list.Sort(new ImportDatasCompare()); 
                foreach (ListViewItem item2 in list) 
                { 
                    this.lstContacts.Items.Add(item2); 
                    this._totalUsers++; 
                } 
                this.FormatSelectInfo(); 
                this._checkByFunction = false; 
            } 
        } 
 
        private void btnBrowse_Click(object sender, EventArgs e) 
        { 
            UiErrorHelper.HandEventSafely(this._frameworkWin, delegate { 
                this.openFileDialog.Filter = "联系人数据文件 (csv,vcf,fcl)|*.csv;*.vcf;*.fcl|csv files (*.csv)|*.csv|vcf files (*.vcf)|*.vcf|" + string.Format("{0} files (*.fcl)|*.fcl", AppDictionary.ShortEnglishName); 
                if ((this.txtFilePath.Text.Length != 0) && File.Exists(this.txtFilePath.Text)) 
                { 
                    this.openFileDialog.FileName = this.txtFilePath.Text; 
                } 
                if (this.openFileDialog.ShowDialog(this) == DialogResult.OK) 
                { 
                    this.txtFilePath.Text = this.openFileDialog.FileName; 
                    this.btnNext.Enabled = this.CanImport(); 
                } 
            }); 
        } 
 
        private void btnCancel_Click(object sender, EventArgs e) 
        { 
            base.Close(); 
        } 
 
        private void btnNext_Click(object sender, EventArgs e) 
        { 
            try 
            { 
                this.DoNext(); 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._frameworkWin, exception); 
            } 
        } 
 
        private void btnPrevious_Click(object sender, EventArgs e) 
        { 
            try 
            { 
                this.DoPrevious(); 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._frameworkWin, exception); 
            } 
        } 
 
        private void buttonNewGrp_Click(object sender, EventArgs e) 
        { 
            try 
            { 
                this._frameworkWin.ContactManager.ShowGroupCreateWindow(this); 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteException(exception); 
            } 
        } 
 
        private bool CanImport() 
        { 
            if (this.ImportObject.Type == ImportContactType.Outlook) 
            { 
                return true; 
            } 
            string text = this.txtFilePath.Text; 
            if (text == "") 
            { 
                return false; 
            } 
            if (text.IndexOf(@"\") == -1) 
            { 
                return false; 
            } 
            return File.Exists(text); 
        } 
 
        private void changeType() 
        { 
            if (this.rbOutlook.Checked) 
            { 
                this.panelOutlookDes.Dock = DockStyle.Fill; 
                this.panelOutlookDes.BringToFront(); 
                this._importObject = this._list[3].ImportExportObject as ImportContactsFromOutlook; 
            } 
            else 
            { 
                this.panelFileSel.Dock = DockStyle.Fill; 
                this.panelFileSel.BringToFront(); 
            } 
            this.FormatForm(); 
        } 
 
        private void checkBoxSelAll_CheckedChanged(object sender, EventArgs e) 
        { 
            try 
            { 
            } 
            catch 
            { 
            } 
        } 
 
        private void checkBoxSelAll_CheckStateChanged(object sender, EventArgs e) 
        { 
            this._checkByFunction = true; 
            if (this.checkBoxSelAll.CheckState == CheckState.Checked) 
            { 
                foreach (ListViewItem item in this.lstContacts.Items) 
                { 
                    if (!item.Checked) 
                    { 
                        if (this.AllowChecked > this._totalChecked) 
                        { 
                            this._totalChecked++; 
                            item.Checked = true; 
                        } 
                        else 
                        { 
                            this._frameworkWin.UnifiedMessageBox.ShowInfo(this, string.Format("您最多只能选择{0}个联系人", this.AllowChecked)); 
                            break; 
                        } 
                    } 
                    item.Checked = true; 
                } 
            } 
            else if (this.checkBoxSelAll.CheckState == CheckState.Unchecked) 
            { 
                foreach (ListViewItem item2 in this.lstContacts.Items) 
                { 
                    item2.Checked = false; 
                } 
                this._totalChecked = 0; 
            } 
            this._checkByFunction = false; 
            this.FormatSelectInfo(); 
            this.btnNext.Enabled = this._totalChecked > 0; 
        } 
 
        private void ContactList_ContactGroupChanged(object sender, ContactGroupChangedEventArgs e) 
        { 
            if (e.Type == ContactGroupEventType.Added) 
            { 
                this._initTargetGroupId = new int?(e.ContactGroup.Id); 
            } 
            else if ((e.Type == ContactGroupEventType.Deleted) && (e.ContactGroup.Id == this._initTargetGroupId)) 
            { 
                this._initTargetGroupId = null; 
            } 
            this.initGroup(); 
        } 
 
        private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e) 
        { 
            if (e.NewStatus != UserAccountStatus.Logon) 
            { 
                base.Close(); 
            } 
        } 
 
        protected override void Dispose(bool disposing) 
        { 
            if (disposing && (this.components != null)) 
            { 
                this.components.Dispose(); 
            } 
            base.Dispose(disposing); 
        } 
 
        private void DoImportContactFinish(Info info) 
        { 
            if (!base.IsDisposed) 
            { 
                base.Invoke(new ImportContactDelegate(this.DoImportContactFinishUI), new object[] { info }); 
            } 
        } 
 
        private void DoImportContactFinishUI(Info info) 
        { 
            try 
            { 
                if (!base.IsDisposed) 
                { 
                    string id = string.Empty; 
                    if (info.DispalyName.Length == 0) 
                    { 
                        id = info.Id; 
                    } 
                    else if (info.IsMobileNo) 
                    { 
                        id = string.Format("{0}(手机号:{1})", info.DispalyName, info.Id); 
                    } 
                    else 
                    { 
                        id = string.Format("{0}(Fetion号:{1})", info.DispalyName, info.Id); 
                    } 
                    string str2 = string.Empty; 
                    if (info.IsSuccessed) 
                    { 
                        str2 = "导入成功..."; 
                        this._countOK++; 
                    } 
                    else 
                    { 
                        str2 = string.Format("导入失败({0})...", info.FailedInfo); 
                        this._countFail++; 
                    } 
                    this.listBox1.Items.Add(id + str2); 
                    this.i++; 
                    this.lblImportContactName.Text = string.Format("正在导入 {0} ({1}/{2})", id, this.i, this.lst.Count); 
                    if (this.progressBarExport.Value <= this.progressBarExport.Maximum) 
                    { 
                        this.progressBarExport.Value++; 
                    } 
                    if (this.i < this.lst.Count) 
                    { 
                        this.ImportContact(this.lst[this.i]); 
                    } 
                    else 
                    { 
                        this.progressBarExport.Value = this.progressBarExport.Maximum; 
                        this.lblImportContactName.Text = string.Format("导入联系人完成,成功导入{0}人,失败{1}人。", this._countOK, this._countFail); 
                        this.btnPrevious.Enabled = false; 
                        this.btnNext.Enabled = false; 
                        this.btnCancel.Text = "关闭"; 
                    } 
                } 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteException(exception); 
            } 
        } 
 
        private void DoNext() 
        { 
            if (!base.IsDisposed) 
            { 
                this.progressOutLook.Visible = false; 
                if (this._step == this._maxStep) 
                { 
                    return; 
                } 
                this._step++; 
                if (this._step == 2) 
                { 
                    if (this.rbOutlook.Checked && (this.ImportObject.Type == ImportContactType.Outlook)) 
                    { 
                        this.panelOutlookRead.Dock = DockStyle.Fill; 
                        this.panelOutlookRead.BringToFront(); 
                        this.btnNext.Enabled = false; 
                        this.rbFile.Enabled = false; 
                        this.progressOutLook.Visible = true; 
                        ThreadPool.QueueUserWorkItem(new WaitCallback(this.ImportOutLook), this.ImportObject); 
                        return; 
                    } 
                    this._step++; 
                } 
                if (this._step != 3) 
                { 
                    if (this._step == 4) 
                    { 
                        List list = new List(); 
                        foreach (ListViewItem item in this.lstContacts.Items) 
                        { 
                            if (item.Checked) 
                            { 
                                list.Add(item.Tag as XmlNode); 
                            } 
                        } 
                        if (list.Count == 0) 
                        { 
                            this._frameworkWin.UnifiedMessageBox.ShowInfo(this, "没有数据导入!"); 
                            this.DoPrevious(); 
                            return; 
                        } 
                    } 
                    else if (this._step == 5) 
                    { 
                        if (this.textBoxMyName.Text.Trim().Length == 0) 
                        { 
                            this._frameworkWin.UnifiedMessageBox.ShowInfo(this, "请输入您的姓名!"); 
                            this.DoPrevious(); 
                            return; 
                        } 
                        if (Encoding.GetEncoding(0x3a8).GetByteCount(this.textBoxMyName.Text) > 10) 
                        { 
                            this._frameworkWin.UnifiedMessageBox.ShowInfo(this, StringTable.Contact.AddBuddy_MyNameTooLong + "。"); 
                            this.textBoxMyName.Focus(); 
                            this.DoPrevious(); 
                            return; 
                        } 
                        FormConfirm form = new FormConfirm(this._totalChecked); 
                        if (ControlHelper.ShowDialogCenterOnParent(form, this, true) != DialogResult.OK) 
                        { 
                            this.DoPrevious(); 
                            return; 
                        } 
                    } 
                    goto Label_03B4; 
                } 
                if (this.CanImport()) 
                { 
                    if (this.rbFile.Checked) 
                    { 
                        FileInfo info = new FileInfo(this.txtFilePath.Text); 
                        if (info.Extension.ToUpper() != ".CSV") 
                        { 
                            if (info.Extension.ToUpper() != ".VCF") 
                            { 
                                if (info.Extension.ToUpper() != ".FCL") 
                                { 
                                    this.DoNextError("文件格式不正确,请检查后缀名是否正确!"); 
                                    return; 
                                } 
                                this._importObject = this._list[1].ImportExportObject as ImportContactsFromXML; 
                            } 
                            else 
                            { 
                                this._importObject = this._list[2].ImportExportObject as ImportContactsFromVcard; 
                            } 
                        } 
                        else 
                        { 
                            this._importObject = this._list[0].ImportExportObject as ImportContactsFromCSV; 
                        } 
                    } 
                    if (this.ImportObject.Type != ImportContactType.Outlook) 
                    { 
                        try 
                        { 
                            this._importXMLContent = this.ImportObject.GetContactsXML(this, this.txtFilePath.Text); 
                        } 
                        catch (IOException exception) 
                        { 
                            ClientLogger.WriteException("导入失败", exception); 
                            this.DoNextError("导入失败,请确认文件是否正在被使用!"); 
                            return; 
                        } 
                        catch (Exception exception2) 
                        { 
                            ClientLogger.WriteException("导入失败", exception2); 
                            this.DoNextError("导入失败,请检查文件格式是否正确!"); 
                            return; 
                        } 
                    } 
                    if (this._importXMLContent.Length == 0) 
                    { 
                        this.DoNextError("没有联系人可以导入。"); 
                        return; 
                    } 
                    try 
                    { 
                        XmlDocument doc = new XmlDocument(); 
                        doc.LoadXml(this._importXMLContent); 
                        this.BindDatas(doc); 
                        goto Label_03B4; 
                    } 
                    catch (Exception exception3) 
                    { 
                        this.lstContacts.Tag = null; 
                        ClientLogger.WriteException("导入失败", exception3); 
                        this.DoNextError("导入失败,请检查文件格式是否正确。"); 
                        return; 
                    } 
                } 
                this.DoNextError("确认文件路径是否正确。"); 
            } 
            return; 
        Label_03B4: 
            this.FormatForm(); 
            if (this._step == 2) 
            { 
                this.btnNext.Enabled = this.CanImport(); 
            } 
            else if ((this._step != 3) && (this._step == this._maxStep)) 
            { 
                this.Import(); 
            } 
        } 
 
        private void DoNextError(string message) 
        { 
            if (!base.IsDisposed) 
            { 
                this.progressOutLook.Visible = false; 
                this._step--; 
                if (this.ImportObject.Type == ImportContactType.Outlook) 
                { 
                    this._step = 1; 
                } 
                this._frameworkWin.UnifiedMessageBox.ShowInfo(this, message); 
            } 
        } 
 
        private void DoPrevious() 
        { 
            if (this._step > 1) 
            { 
                this._step--; 
                if (this._step == 2) 
                { 
                    this._step--; 
                } 
            } 
            this.FormatForm(); 
        } 
 
        private void FormatForm() 
        { 
            this.btnPrevious.Enabled = this._step > 1; 
            if (this._step == this._maxStep) 
            { 
                this.btnNext.Enabled = false; 
                this.btnPrevious.Enabled = false; 
            } 
            else 
            { 
                this.btnNext.Text = "下一步(&N)"; 
                if (this._step == 1) 
                { 
                    this.checkBoxSelAll.Checked = false; 
                    this.txtFilePath.Text = string.Empty; 
                    this.btnNext.Enabled = true; 
                    this.rbFile.Enabled = true; 
                    if (this.rbFile.Checked) 
                    { 
                        this.btnNext.Enabled = false; 
                    } 
                    if (this.rbOutlook.Checked) 
                    { 
                        this.panelOutlookDes.Dock = DockStyle.Fill; 
                        this.panelOutlookDes.BringToFront(); 
                    } 
                } 
                else if (this._step == 3) 
                { 
                    this.btnNext.Enabled = this._totalChecked > 0; 
                } 
                else if (this._step == (this._maxStep - 1)) 
                { 
                    this.btnNext.Text = "导入(&I)"; 
                } 
            } 
            if (this._step == 1) 
            { 
                this.pnlStep_SelSource.Dock = DockStyle.Fill; 
                this.pnlStep_SelSource.BringToFront(); 
            } 
            else if (this._step != 2) 
            { 
                if (this._step == 3) 
                { 
                    this.pnlStep_SelContact.Dock = DockStyle.Fill; 
                    this.pnlStep_SelContact.BringToFront(); 
                } 
                else if (this._step == 4) 
                { 
                    this.pnlStep_MyInfo.Dock = DockStyle.Fill; 
                    this.pnlStep_MyInfo.BringToFront(); 
                } 
                else if (this._step == 5) 
                { 
                    this.pnlStep_Result.Dock = DockStyle.Fill; 
                    this.pnlStep_Result.BringToFront(); 
                } 
            } 
        } 
 
        private void FormatSelectInfo() 
        { 
            this.lblSelectInfo.Text = string.Format("{0} / {1}", this._totalChecked, this._totalUsers); 
            if (this._totalUsers == 0) 
            { 
                this.checkBoxSelAll.CheckState = CheckState.Unchecked; 
            } 
            else if (this._totalChecked == this._totalUsers) 
            { 
                this.checkBoxSelAll.CheckState = CheckState.Checked; 
            } 
            else if (this._totalChecked == 0) 
            { 
                this.checkBoxSelAll.CheckState = CheckState.Unchecked; 
            } 
            else 
            { 
                this.checkBoxSelAll.CheckState = CheckState.Indeterminate; 
            } 
        } 
 
        private string GetNodeValue(XmlNode node, string name) 
        { 
            XmlNode node2 = node.SelectSingleNode(name); 
            if (node2 != null) 
            { 
                return node2.InnerText; 
            } 
            return null; 
        } 
 
        private void Import() 
        { 
            try 
            { 
                if (this.lstContacts.Items.Count != 0) 
                { 
                    this.lst = new List(); 
                    foreach (ListViewItem item in this.lstContacts.Items) 
                    { 
                        if (item.Checked) 
                        { 
                            this.lst.Add(item.Tag as XmlNode); 
                        } 
                    } 
                    this.progressBarExport.Maximum = this.lst.Count; 
                    this.progressBarExport.Minimum = 0; 
                    if (this.comboBoxGroup.SelectedItem != null) 
                    { 
                        this.groupID = new int?(Convert.ToInt32((this.comboBoxGroup.SelectedItem as ComboBoxItem).Value.ToString())); 
                    } 
                    ThreadPool.QueueUserWorkItem(new WaitCallback(this.ImportContactsInThread)); 
                } 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteException(exception); 
            } 
        } 
 
        private void ImportContact(XmlNode node) 
        { 
            string nodeValue = this.GetNodeValue(node, "FetionId"); 
            string str2 = this.GetNodeValue(node, "MobileNo"); 
            string str3 = this.GetNodeValue(node, "Name"); 
            string str4 = this.GetNodeValue(node, "Nickname"); 
            string localName = string.IsNullOrEmpty(str3) ? (str4 ?? string.Empty) : str3; 
            Info contextForUi = new Info(); 
            AsyncBizOperation op = new AsyncBizOperation(contextForUi); 
            op.IsImpsErrorHandled = true; 
            op.ImpsError += new EventHandler(this.op_ImpsError); 
            op.Successed += new EventHandler(this.op_Successed); 
            if (!string.IsNullOrEmpty(str2)) 
            { 
                contextForUi.IsMobileNo = true; 
                contextForUi.DispalyName = localName; 
                contextForUi.Id = str2; 
                this._frameworkWin.ContactManager.AddBuddyByMobileNo(str2, string.Empty, this.groupID, localName, this.textBoxMyName.Text, false, true, new bool?(this.chkInviteStartService.Checked), op); 
            } 
            else 
            { 
                long num; 
                if (!string.IsNullOrEmpty(nodeValue) && long.TryParse(nodeValue, out num)) 
                { 
                    contextForUi.IsMobileNo = false; 
                    contextForUi.DispalyName = localName; 
                    contextForUi.Id = num.ToString(); 
                    this._frameworkWin.ContactManager.AddBuddyBySid(num, string.Empty, this.groupID, localName, this.textBoxMyName.Text, false, true, op); 
                } 
            } 
        } 
 
        private void ImportContactsInThread(object state) 
        { 
            if ((this.lst != null) && (this.lst.Count > 0)) 
            { 
                try 
                { 
                    if (!base.IsDisposed) 
                    { 
                        XmlNode node = this.lst[this.i]; 
                        this.ImportContact(node); 
                    } 
                } 
                catch (Exception exception) 
                { 
                    ClientLogger.WriteException(exception); 
                } 
            } 
        } 
 
        private void ImportForm_Load(object sender, EventArgs e) 
        { 
            try 
            { 
                this._list = this._manager.GetImportPlugins(); 
                this.rbOutlook.Checked = true; 
                this.labelRealName.Text = "您的姓名将出现在对方收到的手机短信/邀请函中,为了便于对方识别,建议您填写真实姓名。"; 
                this.FormatForm(); 
                this.initGroup(); 
                this.textBoxMyName.MaxLength = Imps.Client.Core.FixedClientSetting.Instance.MaxInviteRequestNameLength; 
                string str = (this.CurrentUser.PersonalInfo.Name.Value.Trim().Length != 0) ? this.CurrentUser.PersonalInfo.Name.Value.Trim() : this.CurrentUser.PersonalInfo.Nickname.Value.Trim(); 
                if (str.Length > Imps.Client.Core.FixedClientSetting.Instance.MaxInviteRequestNameLength) 
                { 
                    str = str.Substring(0, Imps.Client.Core.FixedClientSetting.Instance.MaxInviteRequestNameLength); 
                } 
                this.textBoxMyName.Text = str; 
                this.lblImportContactName.Text = string.Empty; 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteException(exception); 
            } 
        } 
 
        private void ImportOutLook(object context) 
        { 
            try 
            { 
                this._importXMLContent = (context as IImportContacts).GetContactsXML(this, null); 
                if (this._importXMLContent.Length != 0) 
                { 
                    if (!base.IsDisposed) 
                    { 
                        base.Invoke(new ImportOutlookSuccess(this.DoNext)); 
                    } 
                } 
                else if (!base.IsDisposed) 
                { 
                    base.Invoke(new ImportOutLookFailed(this.DoNextError), new object[] { "Microsoft Outlook 中没有联系人导入!" }); 
                } 
            } 
            catch (Exception exception) 
            { 
                if (!base.IsDisposed) 
                { 
                    base.Invoke(new ImportOutLookFailed(this.DoNextError), new object[] { "确认是否安装Microsoft Outlook!" }); 
                    base.Invoke(new SetButtonEnabled(this.setButton), new object[] { this.btnNext, true }); 
                    base.Invoke(new InitOutlook(this.initOutlookPanelWhenError)); 
                    base.Invoke(new DoPre(this.DoPrevious)); 
                } 
                ClientLogger.WriteException("导入Outlook失败", exception); 
            } 
        } 
 
        private void initGroup() 
        { 
            this.comboBoxGroup.DropDownStyle = ComboBoxStyle.DropDownList; 
            this.comboBoxGroup.Items.Clear(); 
            lock (this.CurrentUser.ContactList.Groups.SyncRoot) 
            { 
                foreach (Imps.Client.Core.ContactGroup group in this.CurrentUser.ContactList.Groups) 
                { 
                    if (group.Id != -1) 
                    { 
                        ComboBoxItem item = new ComboBoxItem(group.Name, group.Id); 
                        this.comboBoxGroup.Items.Add(item); 
                        if (this._initTargetGroupId.HasValue && (this._initTargetGroupId == group.Id)) 
                        { 
                            this.comboBoxGroup.SelectedItem = item; 
                        } 
                    } 
                } 
            } 
            if ((!this._initTargetGroupId.HasValue || (this._initTargetGroupId == -1)) && (this.comboBoxGroup.Items.Count > 0)) 
            { 
                this.comboBoxGroup.SelectedIndex = 0; 
            } 
        } 
 
        private void InitializeComponent() 
        { 
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ImportForm)); 
            this.lblDescription = new XLabel(); 
            this.lblSelectPlugin = new XLabel(); 
            this.pnlStep_SelSource = new Panel(); 
            this.groupBox1 = new GroupBox(); 
            this.panelOutlookRead = new Panel(); 
            this.label3 = new Label(); 
            this.progressOutLook = new ProgressBar(); 
            this.panelFileSel = new Panel(); 
            this.btnBrowse = new XButton(); 
            this.label2 = new Label(); 
            this.txtFilePath = new TextBox(); 
            this.panelOutlookDes = new Panel(); 
            this.rbFile = new RadioButton(); 
            this.rbOutlook = new RadioButton(); 
            this.linkLabelHelp = new LinkLabel(); 
            this.xLabel2 = new XLabel(); 
            this.btnCancel = new XButton(); 
            this.btnNext = new XButton(); 
            this.btnPrevious = new XButton(); 
            this.pnlContainer = new Panel(); 
            this.pnlStep_SelContact = new Panel(); 
            this.checkBoxSelAll = new CheckBox(); 
            this.xLabelFind = new XLabel(); 
            this.lblSelectInfo = new XLabel(); 
            this.lstContacts = new ListView(); 
            this.chCheckBox = new ColumnHeader(); 
            this.chName = new ColumnHeader(); 
            this.chNickname = new ColumnHeader(); 
            this.chMobileNo = new ColumnHeader(); 
            this.chFetionNo = new ColumnHeader(); 
            this.pnlStep_Result = new Panel(); 
            this.label4 = new Label(); 
            this.lblImportContactName = new XLabel(); 
            this.progressBarExport = new ProgressBar(); 
            this.listBox1 = new ListBox(); 
            this.columnHeader1 = new ColumnHeader(); 
            this.pnlStep_MyInfo = new Panel(); 
            this.buttonNewGrp = new UButton(); 
            this.label1 = new Label(); 
            this.chkInviteStartService = new CheckBox(); 
            this.comboBoxGroup = new ComboBox(); 
            this.textBoxMyName = new XTextBox(); 
            this.labelName = new XLabel(); 
            this.labelRealName = new HtmlLabel(); 
            this.openFileDialog = new OpenFileDialog(); 
            this.pbImportExport = new PictureBox(); 
            this.pnlMainContainer = new Panel(); 
            XLabel label = new XLabel(); 
            this.pnlStep_SelSource.SuspendLayout(); 
            this.groupBox1.SuspendLayout(); 
            this.panelOutlookRead.SuspendLayout(); 
            this.panelFileSel.SuspendLayout(); 
            this.panelOutlookDes.SuspendLayout(); 
            this.pnlContainer.SuspendLayout(); 
            this.pnlStep_SelContact.SuspendLayout(); 
            this.pnlStep_Result.SuspendLayout(); 
            this.pnlStep_MyInfo.SuspendLayout(); 
            ((ISupportInitialize) this.pbImportExport).BeginInit(); 
            this.pnlMainContainer.SuspendLayout(); 
            base.SuspendLayout(); 
            label.AutoSize = true; 
            label.BackColor = Color.Transparent; 
            label.BorderColor = Color.Empty; 
            label.ButtonBorderStyle = ButtonBorderStyle.None; 
            label.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); 
            label.ForeColor = SystemColors.ControlText; 
            label.Location = new System.Drawing.Point(15, 0xb3); 
            label.Name = "label6"; 
            label.Size = new Size(0x5b, 15); 
            label.TabIndex = 11; 
            label.Text = "将联系人添加到"; 
            this.lblDescription.BorderColor = Color.Empty; 
            this.lblDescription.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.lblDescription.Location = new System.Drawing.Point(0x10, 0x17); 
            this.lblDescription.Name = "lblDescription"; 
            this.lblDescription.Size = new Size(0x11f, 0x36); 
            this.lblDescription.TabIndex = 0; 
            this.lblDescription.Text = "  使用导入功能可以方便的导入Outlook等联系人列表中的联系人。"; 
            this.lblSelectPlugin.AutoSize = true; 
            this.lblSelectPlugin.BorderColor = Color.Empty; 
            this.lblSelectPlugin.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.lblSelectPlugin.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0); 
            this.lblSelectPlugin.Location = new System.Drawing.Point(6, 8); 
            this.lblSelectPlugin.Name = "lblSelectPlugin"; 
            this.lblSelectPlugin.Size = new Size(0x48, 13); 
            this.lblSelectPlugin.TabIndex = 0; 
            this.lblSelectPlugin.Text = "选择导入源"; 
            this.pnlStep_SelSource.Controls.Add(this.groupBox1); 
            this.pnlStep_SelSource.Controls.Add(this.rbFile); 
            this.pnlStep_SelSource.Controls.Add(this.rbOutlook); 
            this.pnlStep_SelSource.Controls.Add(this.linkLabelHelp); 
            this.pnlStep_SelSource.Controls.Add(this.xLabel2); 
            this.pnlStep_SelSource.Controls.Add(this.lblSelectPlugin); 
            this.pnlStep_SelSource.Location = new System.Drawing.Point(10, 10); 
            this.pnlStep_SelSource.Name = "pnlStep_SelSource"; 
            this.pnlStep_SelSource.Size = new Size(0xb0, 0x91); 
            this.pnlStep_SelSource.TabIndex = 0; 
            this.groupBox1.Controls.Add(this.panelOutlookRead); 
            this.groupBox1.Controls.Add(this.panelFileSel); 
            this.groupBox1.Controls.Add(this.panelOutlookDes); 
            this.groupBox1.Location = new System.Drawing.Point(10, 0x67); 
            this.groupBox1.Name = "groupBox1"; 
            this.groupBox1.Size = new Size(0x148, 0x77); 
            this.groupBox1.TabIndex = 7; 
            this.groupBox1.TabStop = false; 
            this.groupBox1.Text = "说明"; 
            this.panelOutlookRead.Controls.Add(this.label3); 
            this.panelOutlookRead.Controls.Add(this.progressOutLook); 
            this.panelOutlookRead.Location = new System.Drawing.Point(90, 0x10); 
            this.panelOutlookRead.Name = "panelOutlookRead"; 
            this.panelOutlookRead.Size = new Size(0x52, 100); 
            this.panelOutlookRead.TabIndex = 2; 
            this.label3.AutoSize = true; 
            this.label3.Location = new System.Drawing.Point(0x13, 0x17); 
            this.label3.Name = "label3"; 
            this.label3.Size = new Size(0xa4, 13); 
            this.label3.TabIndex = 12; 
            this.label3.Text = "正从Outlook中读取联系人信息"; 
            this.progressOutLook.Anchor = AnchorStyles.Left | AnchorStyles.Bottom; 
            this.progressOutLook.Location = new System.Drawing.Point(0x16, 50); 
            this.progressOutLook.Name = "progressOutLook"; 
            this.progressOutLook.Size = new Size(0x11b, 0x17); 
            this.progressOutLook.Style = ProgressBarStyle.Marquee; 
            this.progressOutLook.TabIndex = 11; 
            this.progressOutLook.Visible = false; 
            this.panelFileSel.Controls.Add(this.btnBrowse); 
            this.panelFileSel.Controls.Add(this.label2); 
            this.panelFileSel.Controls.Add(this.txtFilePath); 
            this.panelFileSel.Location = new System.Drawing.Point(0xc0, 12); 
            this.panelFileSel.Name = "panelFileSel"; 
            this.panelFileSel.Size = new Size(0x72, 100); 
            this.panelFileSel.TabIndex = 1; 
            this.btnBrowse.AutoSizeToImage = false; 
            this.btnBrowse.BackColor = Color.Transparent; 
            this.btnBrowse.BackgroundImage = (Image) manager.GetObject("btnBrowse.BackgroundImage"); 
            this.btnBrowse.BackgroundImageDisable = (Image) manager.GetObject("btnBrowse.BackgroundImageDisable"); 
            this.btnBrowse.BackgroundImageDown = (Image) manager.GetObject("btnBrowse.BackgroundImageDown"); 
            this.btnBrowse.BackgroundImageHover = (Image) manager.GetObject("btnBrowse.BackgroundImageHover"); 
            this.btnBrowse.ChangeSkin = false; 
            this.btnBrowse.Location = new System.Drawing.Point(0xea, 0x3d); 
            this.btnBrowse.Name = "btnBrowse"; 
            this.btnBrowse.Size = new Size(0x4b, 0x15); 
            this.btnBrowse.TabIndex = 2; 
            this.btnBrowse.Text = "浏览..."; 
            this.btnBrowse.UseVisualStyleBackColor = false; 
            this.btnBrowse.Click += new EventHandler(this.btnBrowse_Click); 
            this.label2.Location = new System.Drawing.Point(7, 0x12); 
            this.label2.Name = "label2"; 
            this.label2.Size = new Size(0x12e, 0x1f); 
            this.label2.TabIndex = 0; 
            this.label2.Text = "  支持csv,vCard,Fetion联系人格式文件导入联系人,请选择包含联系人信息的文件。"; 
            this.txtFilePath.Location = new System.Drawing.Point(10, 0x3e); 
            this.txtFilePath.Name = "txtFilePath"; 
            this.txtFilePath.Size = new Size(0xda, 20); 
            this.txtFilePath.TabIndex = 1; 
            this.txtFilePath.TextChanged += new EventHandler(this.txtFilePath_TextChanged); 
            this.panelOutlookDes.Controls.Add(this.lblDescription); 
            this.panelOutlookDes.Location = new System.Drawing.Point(9, 0x13); 
            this.panelOutlookDes.Name = "panelOutlookDes"; 
            this.panelOutlookDes.Size = new Size(0x4b, 0x60); 
            this.panelOutlookDes.TabIndex = 0; 
            this.rbFile.AutoSize = true; 
            this.rbFile.Location = new System.Drawing.Point(0x23, 0x47); 
            this.rbFile.Name = "rbFile"; 
            this.rbFile.Size = new Size(0xb5, 0x11); 
            this.rbFile.TabIndex = 6; 
            this.rbFile.TabStop = true; 
            this.rbFile.Text = "从包含联系人信息的文件导入"; 
            this.rbFile.UseVisualStyleBackColor = true; 
            this.rbOutlook.AutoSize = true; 
            this.rbOutlook.Location = new System.Drawing.Point(0x23, 40); 
            this.rbOutlook.Name = "rbOutlook"; 
            this.rbOutlook.Size = new Size(0x9e, 0x11); 
            this.rbOutlook.TabIndex = 6; 
            this.rbOutlook.TabStop = true; 
            this.rbOutlook.Text = "从Outlook联系人信息导入"; 
            this.rbOutlook.UseVisualStyleBackColor = true; 
            this.rbOutlook.CheckedChanged += new EventHandler(this.rbOutlook_CheckedChanged); 
            this.linkLabelHelp.AutoSize = true; 
            this.linkLabelHelp.LinkColor = Color.Green; 
            this.linkLabelHelp.Location = new System.Drawing.Point(20, 280); 
            this.linkLabelHelp.Name = "linkLabelHelp"; 
            this.linkLabelHelp.Size = new Size(0x73, 13); 
            this.linkLabelHelp.TabIndex = 5; 
            this.linkLabelHelp.TabStop = true; 
            this.linkLabelHelp.Text = "相关资费及更多说明"; 
            this.linkLabelHelp.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabelHelp_LinkClicked); 
            this.xLabel2.BorderColor = Color.Empty; 
            this.xLabel2.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.xLabel2.ForeColor = Color.Red; 
            this.xLabel2.Location = new System.Drawing.Point(20, 0xed); 
            this.xLabel2.Name = "xLabel2"; 
            this.xLabel2.Size = new Size(0x13b, 0x22); 
            this.xLabel2.TabIndex = 3; 
            this.xLabel2.Text = "  如果对方不在线或未开通飞信,将通过手机短信收到您的添加邀请。"; 
            this.btnCancel.AutoSizeToImage = false; 
            this.btnCancel.BackColor = Color.Transparent; 
            this.btnCancel.BackgroundImageDisable = null; 
            this.btnCancel.BackgroundImageDown = null; 
            this.btnCancel.BackgroundImageHover = null; 
            this.btnCancel.ChangeSkin = true; 
            this.btnCancel.DialogResult = DialogResult.Cancel; 
            this.btnCancel.Location = new System.Drawing.Point(0x19d, 0x147); 
            this.btnCancel.Name = "btnCancel"; 
            this.btnCancel.Size = new Size(0x4b, 0x17); 
            this.btnCancel.TabIndex = 3; 
            this.btnCancel.Text = "取消(&C)"; 
            this.btnCancel.UseVisualStyleBackColor = false; 
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click); 
            this.btnNext.AutoSizeToImage = false; 
            this.btnNext.BackColor = Color.Transparent; 
            this.btnNext.BackgroundImageDisable = null; 
            this.btnNext.BackgroundImageDown = null; 
            this.btnNext.BackgroundImageHover = null; 
            this.btnNext.ChangeSkin = true; 
            this.btnNext.Location = new System.Drawing.Point(0x14c, 0x147); 
            this.btnNext.Name = "btnNext"; 
            this.btnNext.Size = new Size(0x4b, 0x17); 
            this.btnNext.TabIndex = 2; 
            this.btnNext.Text = "下一步(&N)"; 
            this.btnNext.UseVisualStyleBackColor = false; 
            this.btnNext.Click += new EventHandler(this.btnNext_Click); 
            this.btnPrevious.AutoSizeToImage = false; 
            this.btnPrevious.BackColor = Color.Transparent; 
            this.btnPrevious.BackgroundImageDisable = null; 
            this.btnPrevious.BackgroundImageDown = null; 
            this.btnPrevious.BackgroundImageHover = null; 
            this.btnPrevious.ChangeSkin = true; 
            this.btnPrevious.Location = new System.Drawing.Point(0xfb, 0x147); 
            this.btnPrevious.Name = "btnPrevious"; 
            this.btnPrevious.Size = new Size(0x4b, 0x17); 
            this.btnPrevious.TabIndex = 1; 
            this.btnPrevious.Text = "上一步(&B)"; 
            this.btnPrevious.UseVisualStyleBackColor = false; 
            this.btnPrevious.Click += new EventHandler(this.btnPrevious_Click); 
            this.pnlContainer.BackColor = Color.Transparent; 
            this.pnlContainer.Controls.Add(this.pnlStep_SelContact); 
            this.pnlContainer.Controls.Add(this.pnlStep_Result); 
            this.pnlContainer.Controls.Add(this.pnlStep_MyInfo); 
            this.pnlContainer.Controls.Add(this.pnlStep_SelSource); 
            this.pnlContainer.Location = new System.Drawing.Point(0x97, 0); 
            this.pnlContainer.Name = "pnlContainer"; 
            this.pnlContainer.Size = new Size(0x157, 0x13c); 
            this.pnlContainer.TabIndex = 5; 
            this.pnlContainer.Paint += new PaintEventHandler(this.pnlContainer_Paint); 
            this.pnlStep_SelContact.BackColor = Color.Transparent; 
            this.pnlStep_SelContact.Controls.Add(this.checkBoxSelAll); 
            this.pnlStep_SelContact.Controls.Add(this.xLabelFind); 
            this.pnlStep_SelContact.Controls.Add(this.lblSelectInfo); 
            this.pnlStep_SelContact.Controls.Add(this.lstContacts); 
            this.pnlStep_SelContact.Location = new System.Drawing.Point(0xd4, 13); 
            this.pnlStep_SelContact.Name = "pnlStep_SelContact"; 
            this.pnlStep_SelContact.Size = new Size(200, 0x98); 
            this.pnlStep_SelContact.TabIndex = 0; 
            this.checkBoxSelAll.AutoSize = true; 
            this.checkBoxSelAll.Location = new System.Drawing.Point(13, 0x125); 
            this.checkBoxSelAll.Name = "checkBoxSelAll"; 
            this.checkBoxSelAll.Size = new Size(50, 0x11); 
            this.checkBoxSelAll.TabIndex = 0x18; 
            this.checkBoxSelAll.Text = "全选"; 
            this.checkBoxSelAll.UseVisualStyleBackColor = true; 
            this.checkBoxSelAll.CheckedChanged += new EventHandler(this.checkBoxSelAll_CheckedChanged); 
            this.checkBoxSelAll.CheckStateChanged += new EventHandler(this.checkBoxSelAll_CheckStateChanged); 
            this.xLabelFind.AutoSize = true; 
            this.xLabelFind.BorderColor = Color.Empty; 
            this.xLabelFind.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.xLabelFind.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0); 
            this.xLabelFind.Location = new System.Drawing.Point(6, 8); 
            this.xLabelFind.Name = "xLabelFind"; 
            this.xLabelFind.Size = new Size(0xbd, 13); 
            this.xLabelFind.TabIndex = 0x17; 
            this.xLabelFind.Text = "请选择你想添加为好友的联系人"; 
            this.lblSelectInfo.Anchor = AnchorStyles.Right | AnchorStyles.Bottom; 
            this.lblSelectInfo.AutoSize = true; 
            this.lblSelectInfo.BackColor = Color.Transparent; 
            this.lblSelectInfo.BorderColor = Color.Empty; 
            this.lblSelectInfo.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.lblSelectInfo.Location = new System.Drawing.Point(140, 0x81); 
            this.lblSelectInfo.Name = "lblSelectInfo"; 
            this.lblSelectInfo.Size = new Size(40, 13); 
            this.lblSelectInfo.TabIndex = 0x16; 
            this.lblSelectInfo.Text = "{0}/{1}"; 
            this.lstContacts.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top; 
            this.lstContacts.BackColor = Color.White; 
            this.lstContacts.CheckBoxes = true; 
            this.lstContacts.Columns.AddRange(new ColumnHeader[] { this.chCheckBox, this.chName, this.chNickname, this.chMobileNo, this.chFetionNo }); 
            this.lstContacts.FullRowSelect = true; 
            this.lstContacts.Location = new System.Drawing.Point(10, 0x22); 
            this.lstContacts.MultiSelect = false; 
            this.lstContacts.Name = "lstContacts"; 
            this.lstContacts.Size = new Size(0xb7, 0x58); 
            this.lstContacts.Sorting = SortOrder.Ascending; 
            this.lstContacts.TabIndex = 1; 
            this.lstContacts.UseCompatibleStateImageBehavior = false; 
            this.lstContacts.View = View.Details; 
            this.lstContacts.ItemChecked += new ItemCheckedEventHandler(this.lstContacts_ItemChecked); 
            this.chCheckBox.Text = "选中"; 
            this.chCheckBox.Width = 0x2f; 
            this.chName.Text = "姓名"; 
            this.chName.TextAlign = HorizontalAlignment.Center; 
            this.chName.Width = 0x3d; 
            this.chNickname.Text = "昵称"; 
            this.chNickname.TextAlign = HorizontalAlignment.Center; 
            this.chNickname.Width = 80; 
            this.chMobileNo.Text = "手机号码"; 
            this.chMobileNo.TextAlign = HorizontalAlignment.Center; 
            this.chMobileNo.Width = 100; 
            this.chFetionNo.Text = "飞信号"; 
            this.chFetionNo.TextAlign = HorizontalAlignment.Center; 
            this.chFetionNo.Width = 70; 
            this.pnlStep_Result.Controls.Add(this.label4); 
            this.pnlStep_Result.Controls.Add(this.lblImportContactName); 
            this.pnlStep_Result.Controls.Add(this.progressBarExport); 
            this.pnlStep_Result.Controls.Add(this.listBox1); 
            this.pnlStep_Result.Location = new System.Drawing.Point(0xc6, 0xc6); 
            this.pnlStep_Result.Name = "pnlStep_Result"; 
            this.pnlStep_Result.Size = new Size(0x97, 0x80); 
            this.pnlStep_Result.TabIndex = 2; 
            this.pnlStep_Result.Paint += new PaintEventHandler(this.pnlStep5_Paint); 
            this.label4.AutoSize = true; 
            this.label4.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0); 
            this.label4.Location = new System.Drawing.Point(6, 8); 
            this.label4.Name = "label4"; 
            this.label4.Size = new Size(0x3b, 13); 
            this.label4.TabIndex = 9; 
            this.label4.Text = "导入结果"; 
            this.lblImportContactName.AutoSize = true; 
            this.lblImportContactName.BorderColor = Color.Empty; 
            this.lblImportContactName.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.lblImportContactName.Location = new System.Drawing.Point(9, 0x126); 
            this.lblImportContactName.Name = "lblImportContactName"; 
            this.lblImportContactName.Size = new Size(0x37, 13); 
            this.lblImportContactName.TabIndex = 7; 
            this.lblImportContactName.Text = "正在导入"; 
            this.progressBarExport.Location = new System.Drawing.Point(10, 0x10b); 
            this.progressBarExport.Name = "progressBarExport"; 
            this.progressBarExport.Size = new Size(0x144, 20); 
            this.progressBarExport.TabIndex = 6; 
            this.listBox1.FormattingEnabled = true; 
            this.listBox1.Location = new System.Drawing.Point(10, 0x22); 
            this.listBox1.Name = "listBox1"; 
            this.listBox1.Size = new Size(0x144, 0xdf); 
            this.listBox1.HorizontalScrollbar = true; 
            this.listBox1.TabIndex = 11; 
            this.columnHeader1.Width = 500; 
            this.pnlStep_MyInfo.Controls.Add(this.buttonNewGrp); 
            this.pnlStep_MyInfo.Controls.Add(this.label1); 
            this.pnlStep_MyInfo.Controls.Add(this.chkInviteStartService); 
            this.pnlStep_MyInfo.Controls.Add(this.comboBoxGroup); 
            this.pnlStep_MyInfo.Controls.Add(label); 
            this.pnlStep_MyInfo.Controls.Add(this.textBoxMyName); 
            this.pnlStep_MyInfo.Controls.Add(this.labelName); 
            this.pnlStep_MyInfo.Controls.Add(this.labelRealName); 
            this.pnlStep_MyInfo.Location = new System.Drawing.Point(10, 190); 
            this.pnlStep_MyInfo.Name = "pnlStep_MyInfo"; 
            this.pnlStep_MyInfo.Size = new Size(0x9f, 0x7e); 
            this.pnlStep_MyInfo.TabIndex = 3; 
            this.buttonNewGrp.BackgroundImage = (Image) manager.GetObject("buttonNewGrp.BackgroundImage"); 
            this.buttonNewGrp.DisabledBackgroundImage = null; 
            this.buttonNewGrp.HoverBackgroundImage = (Image) manager.GetObject("buttonNewGrp.HoverBackgroundImage"); 
            this.buttonNewGrp.Location = new System.Drawing.Point(0xc6, 0xc9); 
            this.buttonNewGrp.Name = "buttonNewGrp"; 
            this.buttonNewGrp.NormalBackgroundImage = (Image) manager.GetObject("buttonNewGrp.NormalBackgroundImage"); 
            this.buttonNewGrp.PushedBackgroundImage = (Image) manager.GetObject("buttonNewGrp.PushedBackgroundImage"); 
            this.buttonNewGrp.Size = new Size(0x53, 0x15); 
            this.buttonNewGrp.TabIndex = 0x1c; 
            this.buttonNewGrp.Text = "    添加新组"; 
            this.buttonNewGrp.UseVisualStyleBackColor = true; 
            this.buttonNewGrp.Click += new EventHandler(this.buttonNewGrp_Click); 
            this.label1.AutoSize = true; 
            this.label1.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0); 
            this.label1.Location = new System.Drawing.Point(6, 8); 
            this.label1.Name = "label1"; 
            this.label1.Size = new Size(0x6f, 13); 
            this.label1.TabIndex = 0x1b; 
            this.label1.Text = "发送添加好友申请"; 
            this.chkInviteStartService.AutoSize = true; 
            this.chkInviteStartService.Location = new System.Drawing.Point(15, 0x11c); 
            this.chkInviteStartService.Name = "chkInviteStartService"; 
            this.chkInviteStartService.Size = new Size(0x88, 0x11); 
            this.chkInviteStartService.TabIndex = 14; 
            this.chkInviteStartService.Text = "邀请对方开通Fetion..."; 
            this.chkInviteStartService.UseVisualStyleBackColor = true; 
            this.chkInviteStartService.Visible = false; 
            this.comboBoxGroup.DropDownStyle = ComboBoxStyle.DropDownList; 
            this.comboBoxGroup.FormattingEnabled = true; 
            this.comboBoxGroup.Location = new System.Drawing.Point(15, 0xc9); 
            this.comboBoxGroup.Name = "comboBoxGroup"; 
            this.comboBoxGroup.Size = new Size(0xaf, 0x15); 
            this.comboBoxGroup.TabIndex = 12; 
            this.textBoxMyName.Location = new System.Drawing.Point(15, 0x49); 
            this.textBoxMyName.Name = "textBoxMyName"; 
            this.textBoxMyName.Size = new Size(0xb1, 20); 
            this.textBoxMyName.TabIndex = 10; 
            this.textBoxMyName.KeyPress += new KeyPressEventHandler(this.textBoxMyName_KeyPress); 
            this.labelName.AutoSize = true; 
            this.labelName.BackColor = Color.Transparent; 
            this.labelName.BorderColor = Color.Empty; 
            this.labelName.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.labelName.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); 
            this.labelName.ForeColor = SystemColors.ControlText; 
            this.labelName.Location = new System.Drawing.Point(15, 0x34); 
            this.labelName.Name = "labelName"; 
            this.labelName.Size = new Size(0xf3, 15); 
            this.labelName.TabIndex = 9; 
            this.labelName.Text = "请输入您的姓名(限5个汉字或10个英文/数字)"; 
            this.labelRealName.LinkColor = Color.Blue; 
            this.labelRealName.Location = new System.Drawing.Point(15, 100); 
            this.labelRealName.Name = "labelRealName"; 
            this.labelRealName.ShowBackgroundImage = false; 
            this.labelRealName.Size = new Size(0x13b, 0x27); 
            this.labelRealName.TabIndex = 0x1a; 
            this.labelRealName.Text = "建议"; 
            this.pbImportExport.BackColor = Color.Transparent; 
            this.pbImportExport.Image = (Image) manager.GetObject("pbImportExport.Image"); 
            this.pbImportExport.Location = new System.Drawing.Point(0, 0); 
            this.pbImportExport.Name = "pbImportExport"; 
            this.pbImportExport.Size = new Size(0x97, 0x13c); 
            this.pbImportExport.TabIndex = 10; 
            this.pbImportExport.TabStop = false; 
            this.pnlMainContainer.BackColor = Color.Transparent; 
            this.pnlMainContainer.Controls.Add(this.pbImportExport); 
            this.pnlMainContainer.Controls.Add(this.pnlContainer); 
            this.pnlMainContainer.Location = new System.Drawing.Point(3, 3); 
            this.pnlMainContainer.Name = "pnlMainContainer"; 
            this.pnlMainContainer.Size = new Size(500, 0x13c); 
            this.pnlMainContainer.TabIndex = 0; 
            base.AutoScaleDimensions = new SizeF(6f, 13f); 
            base.AutoScaleMode = AutoScaleMode.Font; 
            base.BaseHeight = 0x185; 
            base.BaseWidth = 0x20b; 
            base.ClientSize = new Size(0x205, 0x165); 
            base.Controls.Add(this.pnlMainContainer); 
            base.Controls.Add(this.btnCancel); 
            base.Controls.Add(this.btnNext); 
            base.Controls.Add(this.btnPrevious); 
            base.DisplayLocation = new System.Drawing.Point(0x12, 2); 
            base.MinimizeBox = false; 
            base.Name = "ImportForm"; 
            base.Padding = new Padding(6, 0x1f, 0x13, 8); 
            base.StartPosition = FormStartPosition.CenterScreen; 
            base.Text = "导入联系人"; 
            base.Load += new EventHandler(this.ImportForm_Load); 
            this.pnlStep_SelSource.ResumeLayout(false); 
            this.pnlStep_SelSource.PerformLayout(); 
            this.groupBox1.ResumeLayout(false); 
            this.panelOutlookRead.ResumeLayout(false); 
            this.panelOutlookRead.PerformLayout(); 
            this.panelFileSel.ResumeLayout(false); 
            this.panelFileSel.PerformLayout(); 
            this.panelOutlookDes.ResumeLayout(false); 
            this.pnlContainer.ResumeLayout(false); 
            this.pnlStep_SelContact.ResumeLayout(false); 
            this.pnlStep_SelContact.PerformLayout(); 
            this.pnlStep_Result.ResumeLayout(false); 
            this.pnlStep_Result.PerformLayout(); 
            this.pnlStep_MyInfo.ResumeLayout(false); 
            this.pnlStep_MyInfo.PerformLayout(); 
            ((ISupportInitialize) this.pbImportExport).EndInit(); 
            this.pnlMainContainer.ResumeLayout(false); 
            base.ResumeLayout(false); 
        } 
 
        private void initOutlookPanelWhenError() 
        { 
            this.panelOutlookDes.Dock = DockStyle.Fill; 
            this.panelOutlookDes.BringToFront(); 
        } 
 
        private void linkLabelHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 
        { 
            FunctionHelper.StartFunc(WebFunction.Charge, string.Empty); 
        } 
 
        private void lstContacts_ItemChecked(object sender, ItemCheckedEventArgs e) 
        { 
            if (!this._checkByFunction) 
            { 
                if (e.Item.Checked) 
                { 
                    if (this.AllowChecked > this._totalChecked) 
                    { 
                        this._totalChecked++; 
                    } 
                    else 
                    { 
                        this._checkByFunction = true; 
                        e.Item.Checked = false; 
                        this._checkByFunction = false; 
                        this._frameworkWin.UnifiedMessageBox.ShowInfo(this, string.Format("您最多只能选择{0}个联系人", this.AllowChecked)); 
                    } 
                } 
                else 
                { 
                    this._totalChecked--; 
                } 
                this.FormatSelectInfo(); 
                this.btnNext.Enabled = this._totalChecked > 0; 
            } 
        } 
 
        protected override void OnFormClosed(FormClosedEventArgs e) 
        { 
            try 
            { 
                this.CurrentUser.ContactList.ContactGroupChanged -= new EventHandler(this.ContactList_ContactGroupChanged); 
                this.CurrentUser.StatusChanged -= new EventHandler(this.CurrentUser_StatusChanged); 
                this._importXMLContent = null; 
                this.lstContacts.Tag = null; 
                this.lstContacts.Items.Clear(); 
                base.OnFormClosed(e); 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteGeneral("导入窗口关闭失败!", exception.ToString()); 
            } 
        } 
 
        private void op_ImpsError(object sender, ImpsErrorEventArgs e) 
        { 
            if (!base.IsDisposed) 
            { 
                AsyncBizOperation operation = sender as AsyncBizOperation; 
                operation.Successed -= new EventHandler(this.op_Successed); 
                operation.ImpsError -= new EventHandler(this.op_ImpsError); 
                e.Handled = true; 
                Info contextForUi = (Info) operation.ContextForUi; 
                contextForUi.IsSuccessed = false; 
                contextForUi.FailedInfo = e.Summary; 
                if (string.IsNullOrEmpty(contextForUi.FailedInfo)) 
                { 
                    contextForUi.FailedInfo = "未知错误"; 
                } 
                this.DoImportContactFinish(contextForUi); 
            } 
        } 
 
        private void op_Successed(object sender, EventArgs e) 
        { 
            if (!base.IsDisposed) 
            { 
                AsyncBizOperation operation = sender as AsyncBizOperation; 
                operation.Successed -= new EventHandler(this.op_Successed); 
                operation.ImpsError -= new EventHandler(this.op_ImpsError); 
                Info contextForUi = (Info) operation.ContextForUi; 
                contextForUi.IsSuccessed = true; 
                this.DoImportContactFinish(contextForUi); 
            } 
        } 
 
        private void pnlContainer_Paint(object sender, PaintEventArgs e) 
        { 
        } 
 
        private void pnlStep5_Paint(object sender, PaintEventArgs e) 
        { 
        } 
 
        private void rbOutlook_CheckedChanged(object sender, EventArgs e) 
        { 
            try 
            { 
                this.changeType(); 
            } 
            catch (Exception exception) 
            { 
                UiErrorHelper.HandExceptionSafely(this._frameworkWin, exception); 
            } 
        } 
 
        private void setButton(Button button, bool enabled) 
        { 
            button.Enabled = enabled; 
        } 
 
        private void textBoxMyName_KeyPress(object sender, KeyPressEventArgs e) 
        { 
            try 
            { 
                if ((e.KeyChar >= ' ') && (Encoding.GetEncoding(0x3a8).GetByteCount(this.textBoxMyName.Text + e.KeyChar) > 10)) 
                { 
                    e.Handled = true; 
                } 
            } 
            catch 
            { 
            } 
        } 
 
        private void txtFilePath_TextChanged(object sender, EventArgs e) 
        { 
            UiErrorHelper.HandEventSafely(this._frameworkWin, delegate { 
                this.btnNext.Enabled = this.CanImport(); 
            }); 
        } 
 
        public int AllowChecked 
        { 
            get 
            { 
                return (this.CurrentUser.Configuration.SystemSetting.BuddyListSetting.MaxBuddyNum - (this.CurrentUser.ContactList.Contacts.Count - this.CurrentUser.ContactList.ChatFriends.Count)); 
            } 
        } 
 
        private Imps.Client.Core.User CurrentUser 
        { 
            get 
            { 
                return this._frameworkWin.AccountManager.CurrentUser; 
            } 
        } 
 
        private IImportContacts ImportObject 
        { 
            get 
            { 
                return this._importObject; 
            } 
            set 
            { 
                this._importObject = value; 
            } 
        } 
 
        private delegate void DoPre(); 
 
        private delegate void ImportContactDelegate(ImportForm.Info info); 
 
        private class ImportDatasCompare : IComparer 
        { 
            public int Compare(ListViewItem x, ListViewItem y) 
            { 
                try 
                { 
                    int num = x.SubItems[0].Text.CompareTo(y.SubItems[0].Text); 
                    if (num == 0) 
                    { 
                        num = x.SubItems[1].Text.CompareTo(y.SubItems[1].Text); 
                        if (num == 0) 
                        { 
                            num = x.SubItems[2].Text.CompareTo(y.SubItems[2].Text); 
                            if (num == 0) 
                            { 
                                num = x.SubItems[3].Text.CompareTo(y.SubItems[3].Text); 
                            } 
                        } 
                    } 
                    return num; 
                } 
                catch 
                { 
                    return 0; 
                } 
            } 
        } 
 
        private delegate void ImportOutLookFailed(string message); 
 
        private delegate void ImportOutlookSuccess(); 
 
        private class Info 
        { 
            private string _dispalyName; 
            private string _failedInfo; 
            private string _id; 
            private bool _isMobileNo; 
            private bool _isSuccessed; 
 
            public string DispalyName 
            { 
                get 
                { 
                    return this._dispalyName; 
                } 
                set 
                { 
                    this._dispalyName = value; 
                } 
            } 
 
            public string FailedInfo 
            { 
                get 
                { 
                    return this._failedInfo; 
                } 
                set 
                { 
                    this._failedInfo = value; 
                } 
            } 
 
            public string Id 
            { 
                get 
                { 
                    return this._id; 
                } 
                set 
                { 
                    this._id = value; 
                } 
            } 
 
            public bool IsMobileNo 
            { 
                get 
                { 
                    return this._isMobileNo; 
                } 
                set 
                { 
                    this._isMobileNo = value; 
                } 
            } 
 
            public bool IsSuccessed 
            { 
                get 
                { 
                    return this._isSuccessed; 
                } 
                set 
                { 
                    this._isSuccessed = value; 
                } 
            } 
        } 
 
        private delegate void InitOutlook(); 
 
        private delegate void SetButtonEnabled(Button button, bool enabled); 
    } 
}