using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using BO.Utils;
|
|
using Forks.JsonRpc.Client;
|
|
|
|
namespace ButcherManageClient
|
|
{
|
|
public partial class SettingForm : Form
|
|
{
|
|
bool mInited;
|
|
public SettingForm(bool rpcFacadeInited)
|
|
{
|
|
InitializeComponent();
|
|
uTextBoxWithPad1.Text = ButcherAppContext.Context.UrlConfig.ServerUrl;
|
|
offlineSqlConInput.Text = ButcherAppContext.Context.UrlConfig.OfflineSqlConnection;
|
|
txtOutAddress.Text = ButcherAppContext.Context.UrlConfig.OutAddress;
|
|
if (string.IsNullOrEmpty(offlineSqlConInput.Text))
|
|
offlineSqlConInput.Text = "Server=localhost;Database=LocalClientService;Integrated Security=true;Language=Simplified Chinese;";
|
|
mInited = rpcFacadeInited;
|
|
}
|
|
|
|
private void cancelBtn_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void saveBtn_Click(object sender, EventArgs e)
|
|
{
|
|
string uri = this.uTextBoxWithPad1.Text.Trim();
|
|
if (string.IsNullOrEmpty(uri))
|
|
throw new Exception("请先设置服务器地址");
|
|
ButcherAppContext.Context.UrlConfig.ServerUrl = uri;
|
|
ButcherAppContext.Context.UrlConfig.OfflineSqlConnection = offlineSqlConInput.Text.Trim();
|
|
ButcherAppContext.Context.UrlConfig.OutAddress = txtOutAddress.Text.Trim();
|
|
ButcherAppContext.Context.Save();
|
|
|
|
if (mInited)
|
|
RpcFacade.ReInit(ButcherAppContext.Context.UrlConfig.ServerUrl);
|
|
MessageBox.Show("设置保存成功!");
|
|
}
|
|
}
|
|
}
|