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


namespace Imps.Client.Pc 
{ 
    using Imps.Client.Core; 
    using Imps.Client.Pc.BizControls; 
    using Imps.Client.Pc.Controls; 
    using Imps.Client.Utils; 
    using Imps.Common; 
    using Imps.Utils; 
    using System; 
    using System.Collections.Generic; 
    using System.ComponentModel; 
    using System.Diagnostics; 
    using System.Drawing; 
    using System.IO; 
    using System.Text; 
    using System.Windows.Forms; 
 
    public class ExportForm : XIMDialog 
    { 
        private bool _finished; 
        private IFrameworkWindow _frameworkWin; 
        private ImportExportManager _manager; 
        private int _maxStep = 2; 
        private int _step = 1; 
        private XButton btnBrowse; 
        private XButton btnCancel; 
        private XButton btnNext; 
        private XButton btnPrevious; 
        private bool bUsed; 
        private IContainer components; 
        private GroupBox groupBox1; 
        private Label labelOK; 
        private XLabel lblDescription; 
        private XLabel lblSelectControls; 
        private XLabel lblSelectPlugin; 
        private XLabel lblSelectSavePath; 
        private LinkLabel linkLabel1; 
        private ListBox lstPlugins; 
        private Panel panelOK; 
        private PictureBox pbExportImport; 
        private PictureBox pbOK; 
        private Panel pnlContainer; 
        private Panel pnlMain; 
        private Panel pnlStep1; 
        private Panel pnlStep2; 
        private Panel pnlStep4; 
        private ProgressBar progressBarExport; 
        private SaveFileDialog saveFileDialog; 
        private TreeView treeContacts; 
        private TextBox txtFilePath; 
        private XLabel xLabel1; 
 
        public ExportForm(IFrameworkWindow frameworkWin, ImportExportManager manager) 
        { 
            this.InitializeComponent(); 
            this._frameworkWin = frameworkWin; 
            this._manager = manager; 
            this.initComponentRegion(); 
            this.lstPlugins.DoubleClick += new EventHandler(this.lstPlugins_DoubleClick); 
        } 
 
        private void BindGroupContacts() 
        { 
            lock (this._frameworkWin.AccountManager.CurrentUser.ContactList.Groups.SyncRoot) 
            { 
                foreach (ContactGroup group in this._frameworkWin.AccountManager.CurrentUser.ContactList.Groups) 
                { 
                    if (group.Id != -1) 
                    { 
                        TreeNode node = new TreeNode(group.Name); 
                        node.Name = group.Id.ToString(); 
                        node.Checked = true; 
                        node.Tag = group; 
                        this.treeContacts.Nodes.Add(node); 
                        List listContacts = group.Contacts.ListContacts; 
                        listContacts.Sort(new ContactCompare()); 
                        foreach (Contact contact in listContacts) 
                        { 
                            if (!(contact is ChatFriend)) 
                            { 
                                TreeNode node2 = new TreeNode(contact.DisplayName); 
                                node2.Name = contact.Uri.Raw; 
                                node2.Checked = true; 
                                node2.Tag = contact; 
                                node.Nodes.Add(node2); 
                            } 
                        } 
                        continue; 
                    } 
                } 
            } 
        } 
 
        private void BindNoneGroupContacts() 
        { 
            lock (this._frameworkWin.AccountManager.CurrentUser.ContactList.Contacts.SyncRoot) 
            { 
                foreach (Contact contact in this._frameworkWin.AccountManager.CurrentUser.ContactList.Contacts) 
                { 
                    if (contact.BelongToGroups.Count == 0) 
                    { 
                        TreeNode node = new TreeNode(contact.DisplayName); 
                        node.Name = contact.Uri.Raw; 
                        node.Checked = true; 
                        node.Tag = contact; 
                        this.treeContacts.Nodes.Add(node); 
                    } 
                } 
            } 
        } 
 
        private void btnBrowse_Click(object sender, EventArgs e) 
        { 
            UiErrorHelper.HandEventSafely(this._frameworkWin, delegate { 
                this.saveFileDialog.Filter = ((this.lstPlugins.SelectedItem as ImportExportManager.ImportExportPlugin).ImportExportObject as IExportContacts).Filter; 
                this.saveFileDialog.FileName = string.Empty; 
                if ((this.txtFilePath.Text != "") && File.Exists(this.txtFilePath.Text)) 
                { 
                    this.saveFileDialog.FileName = this.txtFilePath.Text; 
                } 
                if (this.saveFileDialog.ShowDialog(this) == DialogResult.OK) 
                { 
                    this.txtFilePath.Text = this.saveFileDialog.FileName; 
                } 
            }); 
        } 
 
        private void btnCancel_Click(object sender, EventArgs e) 
        { 
            base.Close(); 
        } 
 
        private void btnNext_Click(object sender, EventArgs e) 
        { 
            this.DoNext(); 
        } 
 
        private void btnPrevious_Click(object sender, EventArgs e) 
        { 
            UiErrorHelper.HandEventSafely(this._frameworkWin, delegate { 
                this._step--; 
                this.FormatForm(); 
            }); 
        } 
 
        private bool CanExport() 
        { 
            string text = this.txtFilePath.Text; 
            if (text == "") 
            { 
                return false; 
            } 
            if (text.IndexOf(@"\") == -1) 
            { 
                return false; 
            } 
            if (!text.ToUpper().EndsWith(".CSV") && !text.ToUpper().EndsWith(".FCL")) 
            { 
                return false; 
            } 
            if (Directory.Exists(text)) 
            { 
                return false; 
            } 
            return Directory.Exists(text.Substring(0, text.LastIndexOf(@"\"))); 
        } 
 
        protected override void Dispose(bool disposing) 
        { 
            if (disposing && (this.components != null)) 
            { 
                this.components.Dispose(); 
            } 
            base.Dispose(disposing); 
        } 
 
        private void DoNext() 
        { 
            UiErrorHelper.HandEventSafely(this._frameworkWin, delegate { 
                if (this._step != this._maxStep) 
                { 
                    if ((this._step == 1) && (this.GetSelectedContacts().Count == 0)) 
                    { 
                        this._frameworkWin.UnifiedMessageBox.ShowInfo(this, "至少选择一个联系人!"); 
                    } 
                    else 
                    { 
                        this._step++; 
                        this.FormatForm(); 
                    } 
                } 
                else if (this._finished) 
                { 
                    base.Close(); 
                } 
                else 
                { 
                    this.Export(); 
                } 
            }); 
        } 
 
        private void Export() 
        { 
            try 
            { 
                List selectedContacts = this.GetSelectedContacts(); 
                this.progressBarExport.Maximum = selectedContacts.Count; 
                if (this.CanExport()) 
                { 
                    this.progressBarExport.Visible = true; 
                    StringBuilder builder = new StringBuilder(); 
                    builder.Append("\r\n"); 
                    foreach (Contact contact in selectedContacts) 
                    { 
                        builder.Append(""); 
                        if ((contact.Type & ContactType.NonFederation) != ContactType.None) 
                        { 
                            builder.Append(string.Format("{0}", (contact.Type == ContactType.MobileBuddy) ? string.Empty : contact.Uri.Sid.ToString())); 
                            string mobileNo = contact.PersonalInfo.MobileNo; 
                            if (string.IsNullOrEmpty(mobileNo)) 
                            { 
                                mobileNo = contact.PersonalInfo.MobileNoUserSet; 
                            } 
                            builder.Append(string.Format("{0}", mobileNo)); 
                        } 
                        builder.Append(string.Format("{0}", StringHelper.EncodString((string) contact.PersonalInfo.Name))); 
                        builder.Append(string.Format("{0}", StringHelper.EncodString((string) contact.PersonalInfo.Nickname))); 
                        builder.Append("\r\n"); 
                        this.progressBarExport.Value++; 
                    } 
                    builder.Append(""); 
                    ((this.lstPlugins.SelectedItem as ImportExportManager.ImportExportPlugin).ImportExportObject as IExportContacts).ExportContacts(this, this.txtFilePath.Text, builder.ToString()); 
                    this.progressBarExport.Value = this.progressBarExport.Maximum; 
                    this.panelOK.Dock = DockStyle.Fill; 
                    this.panelOK.BringToFront(); 
                    this.labelOK.Text = string.Format("成功导出{0}人", selectedContacts.Count); 
                    this.btnNext.Text = "完成(&F)"; 
                    this.btnPrevious.Enabled = false; 
                    this.btnCancel.Enabled = false; 
                    this._finished = true; 
                } 
                else 
                { 
                    this._frameworkWin.UnifiedMessageBox.ShowInfo(this, "不能导出,文件路径错误!"); 
                } 
            } 
            catch (IOException exception) 
            { 
                this._frameworkWin.UnifiedMessageBox.ShowInfo(this, "导出失败,确认文件是否正在被使用!"); 
                ClientLogger.WriteException(exception); 
            } 
            catch (Exception exception2) 
            { 
                this._frameworkWin.UnifiedMessageBox.ShowInfo(this, "导出失败!"); 
                ClientLogger.WriteException(exception2); 
            } 
        } 
 
        private void ExportForm_Load(object sender, EventArgs e) 
        { 
        } 
 
        private void FormatForm() 
        { 
            this.btnPrevious.Visible = this._step != 1; 
            if (this._step == this._maxStep) 
            { 
                this.btnNext.Text = "导出(&E)"; 
                this.btnNext.Enabled = this.CanExport(); 
            } 
            else 
            { 
                this.btnNext.Enabled = true; 
                this.btnNext.Text = "下一步(&N)"; 
            } 
            for (int i = 1; i <= this._maxStep; i++) 
            { 
                Panel panel = this.pnlContainer.Controls.Find("pnlStep" + i, false)[0] as Panel; 
                panel.Visible = this._step == i; 
                if (panel.Dock != DockStyle.Fill) 
                { 
                    panel.Dock = DockStyle.Fill; 
                    panel.BringToFront(); 
                } 
            } 
        } 
 
        private List GetSelectedContacts() 
        { 
            List list = new List(); 
            foreach (TreeNode node in this.treeContacts.Nodes) 
            { 
                if (node.Tag is Contact) 
                { 
                    if (node.Checked) 
                    { 
                        Contact tag = node.Tag as Contact; 
                        if (!list.Contains(tag)) 
                        { 
                            list.Add(tag); 
                        } 
                    } 
                } 
                else 
                { 
                    foreach (TreeNode node2 in node.Nodes) 
                    { 
                        if (node2.Checked) 
                        { 
                            Contact item = node2.Tag as Contact; 
                            if (!list.Contains(item)) 
                            { 
                                list.Add(item); 
                            } 
                        } 
                    } 
                    continue; 
                } 
            } 
            return list; 
        } 
 
        private void InitData() 
        { 
            this.BindGroupContacts(); 
            this.BindNoneGroupContacts(); 
        } 
 
        private void InitializeComponent() 
        { 
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ExportForm)); 
            this.btnPrevious = new XButton(); 
            this.btnNext = new XButton(); 
            this.btnCancel = new XButton(); 
            this.pnlContainer = new Panel(); 
            this.pnlStep1 = new Panel(); 
            this.treeContacts = new TreeView(); 
            this.lblSelectControls = new XLabel(); 
            this.pnlStep2 = new Panel(); 
            this.groupBox1 = new GroupBox(); 
            this.txtFilePath = new TextBox(); 
            this.btnBrowse = new XButton(); 
            this.lblSelectPlugin = new XLabel(); 
            this.lblDescription = new XLabel(); 
            this.lstPlugins = new ListBox(); 
            this.pnlStep4 = new Panel(); 
            this.progressBarExport = new ProgressBar(); 
            this.lblSelectSavePath = new XLabel(); 
            this.panelOK = new Panel(); 
            this.xLabel1 = new XLabel(); 
            this.linkLabel1 = new LinkLabel(); 
            this.labelOK = new Label(); 
            this.pbOK = new PictureBox(); 
            this.saveFileDialog = new SaveFileDialog(); 
            this.pbExportImport = new PictureBox(); 
            this.pnlMain = new Panel(); 
            this.pnlContainer.SuspendLayout(); 
            this.pnlStep1.SuspendLayout(); 
            this.pnlStep2.SuspendLayout(); 
            this.groupBox1.SuspendLayout(); 
            this.pnlStep4.SuspendLayout(); 
            this.panelOK.SuspendLayout(); 
            ((ISupportInitialize) this.pbOK).BeginInit(); 
            ((ISupportInitialize) this.pbExportImport).BeginInit(); 
            this.pnlMain.SuspendLayout(); 
            base.SuspendLayout(); 
            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(0xf7, 360); 
            this.btnPrevious.Name = "btnPrevious"; 
            this.btnPrevious.Size = new Size(0x4b, 0x17); 
            this.btnPrevious.TabIndex = 2; 
            this.btnPrevious.Text = "上一步(&B)"; 
            this.btnPrevious.UseVisualStyleBackColor = false; 
            this.btnPrevious.Click += new EventHandler(this.btnPrevious_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(0x148, 360); 
            this.btnNext.Name = "btnNext"; 
            this.btnNext.Size = new Size(0x4b, 0x17); 
            this.btnNext.TabIndex = 3; 
            this.btnNext.Text = "下一步(&N)"; 
            this.btnNext.UseVisualStyleBackColor = false; 
            this.btnNext.Click += new EventHandler(this.btnNext_Click); 
            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(0x199, 360); 
            this.btnCancel.Name = "btnCancel"; 
            this.btnCancel.Size = new Size(0x4b, 0x17); 
            this.btnCancel.TabIndex = 4; 
            this.btnCancel.Text = "取消(&C)"; 
            this.btnCancel.UseVisualStyleBackColor = false; 
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click); 
            this.pnlContainer.Controls.Add(this.pnlStep1); 
            this.pnlContainer.Controls.Add(this.pnlStep2); 
            this.pnlContainer.Controls.Add(this.pnlStep4); 
            this.pnlContainer.Controls.Add(this.panelOK); 
            this.pnlContainer.Location = new System.Drawing.Point(0x97, 0); 
            this.pnlContainer.Name = "pnlContainer"; 
            this.pnlContainer.Size = new Size(0x157, 0x13c); 
            this.pnlContainer.TabIndex = 0; 
            this.pnlStep1.Controls.Add(this.treeContacts); 
            this.pnlStep1.Controls.Add(this.lblSelectControls); 
            this.pnlStep1.Location = new System.Drawing.Point(0xc0, 8); 
            this.pnlStep1.Name = "pnlStep1"; 
            this.pnlStep1.Size = new Size(0x97, 0xb8); 
            this.pnlStep1.TabIndex = 2; 
            this.pnlStep1.Paint += new PaintEventHandler(this.pnlStep1_Paint); 
            this.treeContacts.CheckBoxes = true; 
            this.treeContacts.Location = new System.Drawing.Point(10, 0x20); 
            this.treeContacts.Name = "treeContacts"; 
            this.treeContacts.Size = new Size(0x143, 0x112); 
            this.treeContacts.TabIndex = 1; 
            this.treeContacts.AfterCheck += new TreeViewEventHandler(this.treeContacts_AfterCheck); 
            this.lblSelectControls.AutoSize = true; 
            this.lblSelectControls.BorderColor = Color.Empty; 
            this.lblSelectControls.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.lblSelectControls.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0x86); 
            this.lblSelectControls.Location = new System.Drawing.Point(6, 8); 
            this.lblSelectControls.Name = "lblSelectControls"; 
            this.lblSelectControls.Size = new Size(0x6f, 13); 
            this.lblSelectControls.TabIndex = 0; 
            this.lblSelectControls.Text = "选择导出的联系人"; 
            this.pnlStep2.Controls.Add(this.groupBox1); 
            this.pnlStep2.Controls.Add(this.lblSelectPlugin); 
            this.pnlStep2.Controls.Add(this.lblDescription); 
            this.pnlStep2.Controls.Add(this.lstPlugins); 
            this.pnlStep2.Location = new System.Drawing.Point(7, 8); 
            this.pnlStep2.Name = "pnlStep2"; 
            this.pnlStep2.Size = new Size(0x99, 0x12d); 
            this.pnlStep2.TabIndex = 0; 
            this.groupBox1.Controls.Add(this.txtFilePath); 
            this.groupBox1.Controls.Add(this.btnBrowse); 
            this.groupBox1.Location = new System.Drawing.Point(0x12, 0xad); 
            this.groupBox1.Name = "groupBox1"; 
            this.groupBox1.Size = new Size(0x130, 100); 
            this.groupBox1.TabIndex = 5; 
            this.groupBox1.TabStop = false; 
            this.groupBox1.Text = "选择文件位置"; 
            this.txtFilePath.Location = new System.Drawing.Point(12, 0x2b); 
            this.txtFilePath.Name = "txtFilePath"; 
            this.txtFilePath.Size = new Size(0xca, 20); 
            this.txtFilePath.TabIndex = 3; 
            this.txtFilePath.TextChanged += new EventHandler(this.txtFilePath_TextChanged); 
            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(220, 0x2b); 
            this.btnBrowse.Name = "btnBrowse"; 
            this.btnBrowse.Size = new Size(0x4b, 0x15); 
            this.btnBrowse.TabIndex = 4; 
            this.btnBrowse.Text = "浏览..."; 
            this.btnBrowse.UseVisualStyleBackColor = false; 
            this.btnBrowse.Click += new EventHandler(this.btnBrowse_Click); 
            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, 0x86); 
            this.lblSelectPlugin.Location = new System.Drawing.Point(6, 8); 
            this.lblSelectPlugin.Name = "lblSelectPlugin"; 
            this.lblSelectPlugin.Size = new Size(0x62, 13); 
            this.lblSelectPlugin.TabIndex = 0; 
            this.lblSelectPlugin.Text = "选择导出的格式"; 
            this.lblDescription.BorderColor = Color.Empty; 
            this.lblDescription.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.lblDescription.Location = new System.Drawing.Point(0x12, 0x77); 
            this.lblDescription.Name = "lblDescription"; 
            this.lblDescription.Size = new Size(0x12f, 0x33); 
            this.lblDescription.TabIndex = 2; 
            this.lblDescription.Text = "lblPluginDescription"; 
            this.lblDescription.Visible = false; 
            this.lblDescription.Click += new EventHandler(this.lblDescription_Click); 
            this.lstPlugins.FormattingEnabled = true; 
            this.lstPlugins.Location = new System.Drawing.Point(0x12, 0x22); 
            this.lstPlugins.Name = "lstPlugins"; 
            this.lstPlugins.Size = new Size(0x12f, 0x52); 
            this.lstPlugins.TabIndex = 1; 
            this.lstPlugins.SelectedIndexChanged += new EventHandler(this.lstPlugins_SelectedIndexChanged); 
            this.pnlStep4.Controls.Add(this.progressBarExport); 
            this.pnlStep4.Controls.Add(this.lblSelectSavePath); 
            this.pnlStep4.Location = new System.Drawing.Point(0xe7, 0xc6); 
            this.pnlStep4.Name = "pnlStep4"; 
            this.pnlStep4.Size = new Size(0x6f, 0x49); 
            this.pnlStep4.TabIndex = 3; 
            this.pnlStep4.Visible = false; 
            this.pnlStep4.Paint += new PaintEventHandler(this.pnlStep4_Paint); 
            this.progressBarExport.Location = new System.Drawing.Point(7, 0x27); 
            this.progressBarExport.Name = "progressBarExport"; 
            this.progressBarExport.Size = new Size(0x116, 20); 
            this.progressBarExport.TabIndex = 3; 
            this.progressBarExport.Visible = false; 
            this.lblSelectSavePath.AutoSize = true; 
            this.lblSelectSavePath.BorderColor = Color.Empty; 
            this.lblSelectSavePath.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.lblSelectSavePath.Location = new System.Drawing.Point(10, 9); 
            this.lblSelectSavePath.Name = "lblSelectSavePath"; 
            this.lblSelectSavePath.Size = new Size(0xb2, 13); 
            this.lblSelectSavePath.TabIndex = 0; 
            this.lblSelectSavePath.Text = "第三步:选择导出文件的保存位置"; 
            this.panelOK.Controls.Add(this.xLabel1); 
            this.panelOK.Controls.Add(this.linkLabel1); 
            this.panelOK.Controls.Add(this.labelOK); 
            this.panelOK.Controls.Add(this.pbOK); 
            this.panelOK.Location = new System.Drawing.Point(0xc0, 0xdf); 
            this.panelOK.Name = "panelOK"; 
            this.panelOK.Size = new Size(200, 100); 
            this.panelOK.TabIndex = 0; 
            this.xLabel1.AutoSize = true; 
            this.xLabel1.BorderColor = Color.Empty; 
            this.xLabel1.ButtonBorderStyle = ButtonBorderStyle.None; 
            this.xLabel1.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0x86); 
            this.xLabel1.Location = new System.Drawing.Point(6, 8); 
            this.xLabel1.Name = "xLabel1"; 
            this.xLabel1.Size = new Size(0x3b, 13); 
            this.xLabel1.TabIndex = 3; 
            this.xLabel1.Text = "导出完成"; 
            this.linkLabel1.AutoSize = true; 
            this.linkLabel1.LinkColor = Color.Green; 
            this.linkLabel1.Location = new System.Drawing.Point(0x7b, 0x98); 
            this.linkLabel1.Name = "linkLabel1"; 
            this.linkLabel1.Size = new Size(0x5b, 13); 
            this.linkLabel1.TabIndex = 2; 
            this.linkLabel1.TabStop = true; 
            this.linkLabel1.Text = "打开所在文件夹"; 
            this.linkLabel1.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); 
            this.labelOK.AutoSize = true; 
            this.labelOK.Location = new System.Drawing.Point(0x7b, 0x7c); 
            this.labelOK.Name = "labelOK"; 
            this.labelOK.Size = new Size(0x37, 13); 
            this.labelOK.TabIndex = 1; 
            this.labelOK.Text = "成功导出"; 
            this.pbOK.Image = (Image) manager.GetObject("pbOK.Image"); 
            this.pbOK.Location = new System.Drawing.Point(50, 0x73); 
            this.pbOK.Name = "pbOK"; 
            this.pbOK.Size = new Size(0x43, 0x3f); 
            this.pbOK.TabIndex = 0; 
            this.pbOK.TabStop = false; 
            this.pbExportImport.Image = (Image) manager.GetObject("pbExportImport.Image"); 
            this.pbExportImport.Location = new System.Drawing.Point(0, 0); 
            this.pbExportImport.Name = "pbExportImport"; 
            this.pbExportImport.Size = new Size(0x97, 0x13c); 
            this.pbExportImport.TabIndex = 4; 
            this.pbExportImport.TabStop = false; 
            this.pnlMain.BackColor = Color.Transparent; 
            this.pnlMain.Controls.Add(this.pbExportImport); 
            this.pnlMain.Controls.Add(this.pnlContainer); 
            this.pnlMain.Location = new System.Drawing.Point(6, 0x1f); 
            this.pnlMain.Name = "pnlMain"; 
            this.pnlMain.Size = new Size(0x1ee, 0x13c); 
            this.pnlMain.TabIndex = 0; 
            this.pnlMain.Paint += new PaintEventHandler(this.pnlMain_Paint); 
            base.AutoScaleDimensions = new SizeF(6f, 13f); 
            base.AutoScaleMode = AutoScaleMode.Font; 
            base.BaseHeight = 420; 
            base.BaseWidth = 0x1f9; 
            base.ClientSize = new Size(0x1f3, 0x184); 
            base.KeyPreview = true; 
            base.Controls.Add(this.pnlMain); 
            base.Controls.Add(this.btnCancel); 
            base.Controls.Add(this.btnNext); 
            base.Controls.Add(this.btnPrevious); 
            base.DisplayLocation = new System.Drawing.Point(0x12, -29); 
            base.MinimizeBox = false; 
            base.Name = "ExportForm"; 
            base.Padding = new Padding(6, 0x1f, 0x13, 8); 
            base.StartPosition = FormStartPosition.CenterScreen; 
            base.Text = "导出联系人"; 
            base.Load += new EventHandler(this.ExportForm_Load); 
            this.pnlContainer.ResumeLayout(false); 
            this.pnlStep1.ResumeLayout(false); 
            this.pnlStep1.PerformLayout(); 
            this.pnlStep2.ResumeLayout(false); 
            this.pnlStep2.PerformLayout(); 
            this.groupBox1.ResumeLayout(false); 
            this.groupBox1.PerformLayout(); 
            this.pnlStep4.ResumeLayout(false); 
            this.pnlStep4.PerformLayout(); 
            this.panelOK.ResumeLayout(false); 
            this.panelOK.PerformLayout(); 
            ((ISupportInitialize) this.pbOK).EndInit(); 
            ((ISupportInitialize) this.pbExportImport).EndInit(); 
            this.pnlMain.ResumeLayout(false); 
            base.ResumeLayout(false); 
        } 
 
        private void lblDescription_Click(object sender, EventArgs e) 
        { 
        } 
 
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 
        { 
            try 
            { 
                FileInfo info = new FileInfo(this.txtFilePath.Text); 
                Process.Start(info.DirectoryName); 
            } 
            catch (Exception exception) 
            { 
                ClientLogger.WriteException(exception); 
            } 
        } 
 
        private void lstPlugins_DoubleClick(object sender, EventArgs e) 
        { 
            this.DoNext(); 
        } 
 
        private void lstPlugins_SelectedIndexChanged(object sender, EventArgs e) 
        { 
            this.txtFilePath.Text = string.Empty; 
        } 
 
        protected override void OnKeyDown(KeyEventArgs e) 
        { 
            if (e.KeyCode == Keys.Escape) 
            { 
                base.Close(); 
            } 
            else 
            { 
                base.OnKeyDown(e); 
            } 
        } 
 
        protected override void OnLoad(EventArgs e) 
        { 
            base.OnLoad(e); 
            UiErrorHelper.HandEventSafely(this._frameworkWin, delegate { 
                this.lstPlugins.DisplayMember = "Name"; 
                this.lstPlugins.DataSource = this._manager.GetExportPlugins(); 
                this.FormatForm(); 
                this.InitData(); 
            }); 
        } 
 
        private void pnlMain_Paint(object sender, PaintEventArgs e) 
        { 
        } 
 
        private void pnlStep1_Paint(object sender, PaintEventArgs e) 
        { 
        } 
 
        private void pnlStep4_Paint(object sender, PaintEventArgs e) 
        { 
        } 
 
        private void treeContacts_AfterCheck(object sender, TreeViewEventArgs e) 
        { 
            UiErrorHelper.HandEventSafely(this._frameworkWin, delegate { 
                if (!this.bUsed) 
                { 
                    if (e.Node.Tag is ContactGroup) 
                    { 
                        foreach (TreeNode node in e.Node.Nodes) 
                        { 
                            this.bUsed = true; 
                            node.Checked = e.Node.Checked; 
                            this.bUsed = false; 
                        } 
                    } 
                    else if (e.Node.Parent != null) 
                    { 
                        if (!e.Node.Checked) 
                        { 
                            this.bUsed = true; 
                            e.Node.Parent.Checked = false; 
                            this.bUsed = false; 
                        } 
                        else 
                        { 
                            bool flag = true; 
                            foreach (TreeNode node2 in e.Node.Parent.Nodes) 
                            { 
                                if (!node2.Checked) 
                                { 
                                    flag = false; 
                                    break; 
                                } 
                            } 
                            if (flag) 
                            { 
                                this.bUsed = true; 
                                e.Node.Parent.Checked = true; 
                                this.bUsed = false; 
                            } 
                        } 
                    } 
                } 
            }); 
        } 
 
        private void txtFilePath_TextChanged(object sender, EventArgs e) 
        { 
            UiErrorHelper.HandEventSafely(this._frameworkWin, delegate { 
                this.btnNext.Enabled = this.CanExport(); 
            }); 
        } 
 
        private class ContactCompare : IComparer 
        { 
            public int Compare(Contact x, Contact y) 
            { 
                return x.DisplayName.CompareTo(y.DisplayName); 
            } 
        } 
    } 
}