| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:DKDockPanelBase.cs
- * 2.功能描述:扩展的窗口:单实例、异步共通处理等。
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2015/03/27 1.00 新建
- *******************************************************************************/
- using System;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- namespace Dongke.IBOSS.PRD.Client.Controls
- {
- /// <summary>
- /// 扩展的窗口
- /// </summary>
- public partial class DKDockPanelBase : DockPanelBase
- {
- #region 构造函数
- /// <summary>
- /// 构造函数
- /// </summary>
- protected DKDockPanelBase()
- {
- InitializeComponent();
- }
- #endregion 构造函数
- #region 程序异步处理
- /// <summary>
- /// 窗体的异步处理
- /// </summary>
- /// <param name="method">异步方法</param>
- /// <returns></returns>
- public T DoAsync<T>(DKAsyncMethod<T> method)
- {
- T result = default(T);
- try
- {
- this.StartProgress();
- IAsyncResult asyncResult = method.BeginInvoke(null, null);
- while (!asyncResult.IsCompleted)
- {
- Application.DoEvents();
- System.Threading.Thread.Sleep(1);
- }
- result = method.EndInvoke(asyncResult);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- this.EndProgress();
- if (result is ServiceResultEntity)
- {
- ServiceResultManager.Invoke(this, result as ServiceResultEntity);
- }
- }
- return result;
- }
- #endregion
- }
- }
|