You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
4.0 KiB
C#

9 months ago
using POS.Language.Language;
using POSV.Entity;
using POSV.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace POSV.Component
{
public partial class LangSettingForm : BusinessForm
{
public LangSettingForm()
{
InitializeComponent();
var _type = Global.Instance.GlobalConfigStringValue(ConfigConstant.LAYOUT_LANGUAGETYPE, "中文");
switch (_type)
{
case "英语":
touchButtonX1.Style.BorderColor.Color = Color.Black;
break;
case "日语":
touchButtonX2.Style.BorderColor.Color = Color.Black;
break;
case "韩语":
touchButtonX4.Style.BorderColor.Color = Color.Black;
break;
default:
touchButtonX3.Style.BorderColor.Color = Color.Black;
break;
}
}
private void OnTouchClick(object sender, TouchEventArgs e)
{
var _btn = sender as TouchButtonX;
if (_btn == null)
{
return;
}
foreach (var item in this.Controls)
{
var _btnS = item as TouchButtonX;
if (_btnS == null)
{
continue;
}
_btnS.NotifyColor = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(197)))), ((int)(((byte)(95)))));
_btnS.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(197)))), ((int)(((byte)(95)))));
_btnS.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(197)))), ((int)(((byte)(95)))));
_btnS.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(197)))), ((int)(((byte)(95)))));
_btnS.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(197)))), ((int)(((byte)(95)))));
_btnS.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(197)))), ((int)(((byte)(95)))));
_btnS.CanvasColor = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(197)))), ((int)(((byte)(95)))));
}
_btn.Style.BorderColor.Color = Color.Black;
var config = new Config();
config.Id = IdWorkerUtils.Instance.NextId();
config.Group = ConfigConstant.LAYOUT_GROUP;
config.TenantId = Global.Instance.Authc.TenantId;
config.Keys = ConfigConstant.LAYOUT_LANGUAGETYPE;
switch (_btn.Text)
{
case "한국어":
config.Values = "韩语";
break;
case "わご":
config.Values = "韩语";
break;
case "English":
config.Values = "英语";
break;
default:
config.Values = "中文";
break;
}
using (var db = Global.Instance.OpenDataBase)
{
db.Save(config);
}
DialogForm dialog = new DialogForm(LangProxy.ToLang("参数更新成功"), LangProxy.ToLang("重启后软件后生效"), MessageBoxIcon.Information, MessageBoxButtons.OK);
dialog.ShowDialog();
if (this.Owner != null)
{
this.Owner.Close();
}
this.Close();
}
private void OnTouchCloseClick(object sender, TouchEventArgs e)
{
if (this.Owner != null)
{
this.Owner.Close();
}
this.Close();
}
}
}