📄 initprofile.cs
字号:
namespace Imps.Client.Pc.Provsion2
{
using Imps.Client.Core;
using Imps.Client.Pc;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Pc.Options;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class InitProfile : XIMDialog
{
private OptionsControlBase _curControl;
private IFrameworkWindow _framework;
private ProvsionData _pdata;
private XButton btnCancel;
private XButton btnConfirm;
private IContainer components;
private OptionsControlBase[] controls;
private listbox_widget_t<headicon> lbOptionItems;
private headiconlist_drawer m_headicon_list_drawer = new headiconlist_drawer();
private Panel pnlContainer;
private Panel pnlProfile;
public InitProfile(ProvsionData pdata, IFrameworkWindow framework)
{
this._framework = framework;
this._pdata = pdata;
this.InitializeComponent();
this.LoadResource();
this.Init();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.controls[0].UpdateData(false);
this.controls[1].UpdateData(false);
this.controls[0].ControlUnload();
this.controls[1].ControlUnload();
base.Close();
}
private void btnConfirm_Click(object sender, EventArgs e)
{
if (this._curControl.CheckUserInput())
{
foreach (OptionsControlBase base2 in this.controls)
{
if (base2.Modified)
{
this._pdata.IsModified = true;
if (!base2.UpdateData(true))
{
this.LoadControl(base2);
this._framework.UnifiedMessageBox.ShowError(base.FindForm(), "发生未知错误!请检查您的输入。");
return;
}
}
}
this.controls[0].ControlUnload();
this.controls[1].ControlUnload();
base.Close();
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void Init()
{
this.lbOptionItems = new listbox_widget_t<headicon>();
this.lbOptionItems.drawer = this.m_headicon_list_drawer;
this.m_headicon_list_drawer.stretch_textarea = true;
this.m_headicon_list_drawer.show_focus = false;
this.lbOptionItems.set_FormattingEnabled(true);
this.lbOptionItems.Location = new System.Drawing.Point(7, 8);
this.lbOptionItems.Name = "lbOptionItems";
this.lbOptionItems.Size = new Size(0x75, 0x1de);
this.lbOptionItems.TabIndex = 5;
this.pnlContainer.Controls.Add(this.lbOptionItems);
this.lbOptionItems.add(new headicon(null, "基本资料"));
this.lbOptionItems.add(new headicon(null, "扩展资料"));
this.controls = new OptionsControlBase[] { new PsGeneralControl(this._framework, false), new PsPrivacyControl(this._framework, false) };
this.controls[0].ControlLoad();
this.controls[1].ControlLoad();
this.LoadControl(this.controls[0]);
this.lbOptionItems.SelectedIndex = 0;
base.Text = "详细资料";
this.lbOptionItems.SelectedIndexChanged += new EventHandler(this.lbOptionItems_SelectedIndexChanged);
this.lbOptionItems.SelectedIndexChanging += new listbox_widget.cancel_select_event_handler(this.lbOptionItems_SelectedIndexChanging);
}
private void InitializeComponent()
{
this.components = new Container();
ComponentResourceManager manager = new ComponentResourceManager(typeof(InitProfile));
this.btnConfirm = new XButton();
this.btnCancel = new XButton();
this.pnlProfile = new Panel();
this.pnlContainer = new Panel();
this.pnlContainer.SuspendLayout();
base.SuspendLayout();
this.btnConfirm.AutoSizeToImage = false;
this.btnConfirm.BackColor = Color.Transparent;
this.btnConfirm.BackgroundImageDisable = null;
this.btnConfirm.BackgroundImageDown = null;
this.btnConfirm.BackgroundImageHover = null;
this.btnConfirm.ChangeSkin = true;
this.btnConfirm.Location = new System.Drawing.Point(0x184, 0x1fb);
this.btnConfirm.Name = "btnConfirm";
this.btnConfirm.Size = new Size(0x4b, 0x17);
this.btnConfirm.TabIndex = 3;
this.btnConfirm.Text = "确定";
this.btnConfirm.set_UseVisualStyleBackColor(false);
this.btnConfirm.Click += new EventHandler(this.btnConfirm_Click);
this.btnCancel.AutoSizeToImage = false;
this.btnCancel.BackColor = Color.Transparent;
this.btnCancel.BackgroundImageDisable = null;
this.btnCancel.BackgroundImageDown = null;
this.btnCancel.BackgroundImageHover = null;
this.btnCancel.ChangeSkin = true;
this.btnCancel.DialogResult = DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(0x1d5, 0x1fa);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new Size(0x4b, 0x17);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "取消";
this.btnCancel.set_UseVisualStyleBackColor(false);
this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
this.pnlProfile.BackColor = Color.Transparent;
this.pnlProfile.Location = new System.Drawing.Point(0x7c, 8);
this.pnlProfile.Name = "pnlProfile";
this.pnlProfile.Size = new Size(420, 480);
this.pnlProfile.TabIndex = 1;
this.pnlContainer.BackColor = Color.Transparent;
this.pnlContainer.Controls.Add(this.pnlProfile);
this.pnlContainer.Location = new System.Drawing.Point(0, 0);
this.pnlContainer.Name = "pnlContainer";
this.pnlContainer.Size = new Size(0x220, 500);
this.pnlContainer.TabIndex = 2;
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
base.CancelButton = this.btnCancel;
base.ClientSize = new Size(0x22e, 0x227);
base.Controls.Add(this.pnlContainer);
base.Controls.Add(this.btnCancel);
base.Controls.Add(this.btnConfirm);
base.DisplayLocation = new System.Drawing.Point(0x12, 0x26);
base.DisplaySize = new Size(0x225, 0x227);
base.Icon = (Icon) manager.GetObject("$this.Icon");
base.MinimizeBox = false;
base.Name = "InitProfile";
base.set_Padding(new Padding(1, 0x16, 13, 4));
base.set_ShowIcon(false);
base.ShowInTaskbar = false;
base.StartPosition = FormStartPosition.CenterParent;
this.pnlContainer.ResumeLayout(false);
base.ResumeLayout(false);
}
private void lbOptionItems_SelectedIndexChanged(object sender, EventArgs e)
{
this.LoadControl(this.lbOptionItems.SelectedIndex);
}
private void lbOptionItems_SelectedIndexChanging(object sender, listbox_widget.cancel_select_event_args args)
{
if (!this._curControl.CheckUserInput())
{
args.Cancel = true;
}
}
private void LoadControl(OptionsControlBase c)
{
this._curControl = c;
base.SuspendLayout();
this.pnlProfile.Controls.Clear();
c.Dock = DockStyle.Fill;
if (!c.Modified)
{
c.UpdateData(false);
}
this.pnlProfile.Controls.Add(c);
base.ResumeLayout();
}
private void LoadControl(int index)
{
if ((index >= 0) && (index < this.controls.Length))
{
this.LoadControl(this.controls[index]);
}
}
private void LoadResource()
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -