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


namespace Imps.Client.Pc 
{ 
    using Imps.Client.Core; 
    using Imps.Client.Pc.Provsion2; 
    using Imps.Client.Resource; 
    using Imps.Client.Utils; 
    using System; 
    using System.Windows.Forms; 
 
    public class ImpsBasicService : IExService 
    { 
        private IFrameworkWindow _fwnd; 
 
        private void op_ImpsError(object sender, ImpsErrorEventArgs e) 
        { 
            UiErrorHelper.HandEventSafely(this._fwnd, delegate { 
                this._fwnd.UnifiedMessageBox.ShowInfo(this._fwnd.MainWindow, e.Summary); 
            }); 
        } 
 
        private void op_Successed(object sender, EventArgs e) 
        { 
            UiErrorHelper.HandEventSafely(this._fwnd, delegate { 
                this._fwnd.UnifiedMessageBox.ShowInfo(this._fwnd.MainWindow, StringTable.User.MsgUnsubscribedSuccess); 
            }); 
        } 
 
        public void Subscribe(IFrameworkWindow fwnd) 
        { 
            this._fwnd = fwnd; 
        } 
 
        public void UnSubscribe(IFrameworkWindow fwnd) 
        { 
            this._fwnd = fwnd; 
            UiErrorHelper.HandEventSafely(fwnd, delegate { 
                UnRegisterDialog form = new UnRegisterDialog(fwnd); 
                if (ControlHelper.ShowDialogCenterOnParent(form, fwnd.MainWindow, true) == DialogResult.OK) 
                { 
                    AsyncBizOperation op = new AsyncBizOperation(); 
                    op.Successed += new EventHandler(this.op_Successed); 
                    op.ImpsError += new EventHandler(this.op_ImpsError); 
                    fwnd.AccountManager.CurrentUser.AsyncUnregister(op); 
                } 
            }); 
        } 
    } 
}