68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Microsoft.Tools.ServiceModel;
|
|
|
|
namespace DeiNiu.Wms.CE
|
|
{
|
|
public partial class basicForm : Form
|
|
{
|
|
MobileClient _client;
|
|
protected MobileClient client
|
|
{
|
|
get
|
|
{
|
|
if (_client == null)
|
|
{
|
|
_client = new MobileClient(WcfHelp.getBasicBinding(), WcfHelp.getEndpoint("MobileService"));
|
|
}
|
|
return _client;
|
|
}
|
|
}
|
|
|
|
public basicForm()
|
|
{
|
|
InitializeComponent();
|
|
|
|
}
|
|
protected void setTitle()
|
|
{
|
|
this.Text = getTitle;
|
|
}
|
|
string getTitle
|
|
{
|
|
get
|
|
{
|
|
return string.Format("{0} {1}",this.Text, LoginInfo.UserId > 0 ? LoginInfo.Account : "无名");
|
|
|
|
}
|
|
}
|
|
internal void showErrorMsg(Exception er )
|
|
{
|
|
showErrorMsg( er, "发生错误:") ;
|
|
}
|
|
internal void showErrorMsg(Exception er,string hint )
|
|
{
|
|
MessageBox.Show(hint+ ": " + getExceptionMsg(er));
|
|
}
|
|
string getExceptionMsg(Exception er)
|
|
{
|
|
if (er is CFFaultException)
|
|
{
|
|
String msg = ((CFFaultException)er).FaultMessage;
|
|
msg = msg.Substring(msg.IndexOf("<Message>"));
|
|
msg = msg.Substring(0, msg.LastIndexOf("</StackTrace>"));
|
|
|
|
return msg;
|
|
}
|
|
|
|
return er.Message;
|
|
|
|
}
|
|
}
|
|
} |