public int Start(string[] args) { Menu.Add('1', new CMenu() { Text = "Start server", Fnc = StartServer }); Menu.Add('2', new CMenu() { Text = "Stop server", Fnc = StopServer }); Menu.Add('3', new CMenu() { Text = "Send data", Fnc = SendData }); Menu.Add('4', new CMenu() { Text = "Use SSL", Fnc = SetUseSSL }); Menu.Add('5', new CMenu() { Text = "Create log", Fnc = CreateLog }); Menu.Add('6', new CMenu() { Text = "Stop log", Fnc = StopLog }); Menu.Add('7', new CMenu() { Text = "Stop log", Fnc = TestConnect }); Menu.Add('X', new CMenu() { Text = "Exit", Fnc = Exit }); bool ok = true; while (ok) { DFnc fnc = DisplayMenu(out char c); ok = fnc(c); } StopServer('2'); return(0); }
protected void property_Load() { try { string value; //폼내용은 '/*폼이름:Top, Left, Width, Height, WindowState*/' 구성 switch (_configFileType) { case enConfigFileType.ConfigXml: Function.Setting xml = SavePosition_Setting as Function.Setting; if (xml == null) { value = string.Empty; } else { xml.Group_Select(_xmlSave_GroupName); value = xml.Value_Get(_propertySave_property_name, string.Empty); } break; default: value = Fnc.obj2String(Function.DFnc.Property_Get_Value(SavePosition_Setting, _propertySave_property_name)); break; } value = Function.form.fncForm.getSettingString(value, this.Name); string[] pp = value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); Control c; string[] v; int idx; //컨트롤과 컨트롤 구분은 ';', 컨틀롤내 값사이구분은 '/' foreach (string p in pp) { try { v = p.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); c = Function.form.fncForm.FindControlInControl(this, v[0]); if (c == null) { continue; } switch (c.GetType().ToString()) { case "DevExpress.XtraGrid.GridControl": //DevExpress.XtraGrid.GridControl gc = c as DevExpress.XtraGrid.GridControl; //DevExpress.XtraGrid.Views.Grid.GridView gv = (DevExpress.XtraGrid.Views.Grid.GridView)gc.FocusedView; Object gv = Function.DFnc.Property_Get_Value(c, "FocusedView"); CollectionBase cols = (CollectionBase)Function.DFnc.Property_Get_Value(gv, "Columns"); foreach (string cl in v) { string[] pv = cl.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); if (pv.Length < 2 || !Fnc.isNumeric(pv[1])) { continue; } //gv.Columns[pv[0]].Width = Fnc.obj2int(pv[1]); object col = Function.DFnc.Property_Get_Value(cols, "Item", new Type[] { typeof(string) }, new object[] { pv[0] }); Function.DFnc.Property_Set_Value(col, "Width", Fnc.obj2int(pv[1])); } break; case "DevExpress.XtraEditors.SplitterControl": //DevExpress.XtraEditors.SplitterControl sc = c as DevExpress.XtraEditors.SplitterControl; //sc.SplitPosition = Fnc.obj2int(v[1]); Function.DFnc.Property_Set_Value(c, "SplitPosition", Fnc.obj2int(v[1])); break; case "System.Windows.Forms.SplitContainer": Function.DFnc.Property_Set_Value(c, "SplitterDistance", Fnc.obj2int(v[1])); break; case "System.Windows.Forms.CheckBox": CheckBox cbox = c as CheckBox; cbox.Checked = bool.Parse(v[1]); break; //case "Function.form.usrInputBox": // Function.form.usrInputBox ib = c as Function.form.usrInputBox; // ib.Text = v[1]; // break; case "System.Windows.Forms.Panel": Panel pnl = c as Panel; pnl.Width = Fnc.obj2int(v[1]); pnl.Height = Fnc.obj2int(v[2]); break; case "System.Windows.Forms.Splitter": Splitter sp = c as Splitter; sp.Left = Fnc.obj2int(v[1]); sp.Top = Fnc.obj2int(v[2]); break; case "System.Windows.Forms.ListView": ListView lst = c as ListView; if (lst.Columns.Count != (v.Length - 1)) { return; } idx = 0; foreach (string cl in v) { //첫번째는 이름이므로 if (idx == 0) { idx++; continue; } try { string[] pv = cl.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); if (pv.Length < 2 || !Fnc.isNumeric(pv[1]) || !Fnc.isNumeric(pv[0])) { continue; } //gv.Columns[pv[0]].Width = Fnc.obj2int(pv[1]); lst.Columns[Fnc.obj2int(pv[0])].Width = Fnc.obj2int(pv[1]); } catch { } idx++; } break; case "System.Windows.Forms.DataGridView": System.Windows.Forms.DataGridView dgv = c as System.Windows.Forms.DataGridView; if (dgv.Columns.Count != (v.Length - 1)) { return; } idx = 0; foreach (string cl in v) { //첫번째는 이름이므로 if (idx == 0) { idx++; continue; } try { string[] pv = cl.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); if (pv.Length < 2 || !Fnc.isNumeric(pv[1]) || !Fnc.isNumeric(pv[0])) { continue; } //gv.Columns[pv[0]].Width = Fnc.obj2int(pv[1]); dgv.Columns[Fnc.obj2int(pv[0])].Width = Fnc.obj2int(pv[1]); } catch { } idx++; } break; default: try { DFnc.Property_Set_Value(c, "Text", v[1]); } catch { } break; } } catch { continue; } } } catch { } }
/// <summary> /// 컨트롤의 프로퍼티 정보를 저장한다. /// </summary> protected void property_Save() { if (SavePosition_Setting == null) { return; } try { //폼내용은 '/*폼이름:컨트롤정보들...*/' 구성 string value; Function.Setting xml = null; //폼내용은 '/*폼이름:Top, Left, Width, Height, WindowState*/' 구성 switch (_configFileType) { case enConfigFileType.ConfigXml: xml = SavePosition_Setting as Function.Setting; if (xml == null) { value = string.Empty; } else { xml.Group_Select(_xmlSave_GroupName); value = xml.Value_Get(_propertySave_property_name, string.Empty); } break; default: value = Fnc.obj2String(Function.DFnc.Property_Get_Value(SavePosition_Setting, _propertySave_property_name)); break; } string formNM = string.Format("/*{0}:", this.Name.ToUpper()); value = Function.form.fncForm.revSettingString(value, this.Name); value += formNM; string[] pp = _propertySaveContolsName.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); Control c; int idx; //컨트롤과 컨트롤 구분은 ';', 컨틀롤내 값사이구분은 '/' foreach (string p in pp) { try { c = Function.form.fncForm.FindControlInControl(this, p); if (c == null) { continue; } switch (c.GetType().ToString()) { case "DevExpress.XtraGrid.GridControl": //case "DevExpress.XtraGrid.Views.Grid.GridView": //DevExpress.XtraGrid.GridControl gc = c as DevExpress.XtraGrid.GridControl; //DevExpress.XtraGrid.Views.Grid.GridView gv = (DevExpress.XtraGrid.Views.Grid.GridView)gc.FocusedView; Object gv = Function.DFnc.Property_Get_Value(c, "FocusedView"); //value += gc.Name + ":"; value += Function.DFnc.Property_Get_Value(c, "Name").ToString() + ":"; CollectionBase cols = (CollectionBase)Function.DFnc.Property_Get_Value(gv, "Columns"); foreach (object col in cols) { //value += string.Format("{0}/{1}:", col.FieldName, col.Width); value += string.Format("{0}/{1}:", Function.DFnc.Property_Get_Value(col, "FieldName"), Function.DFnc.Property_Get_Value(col, "Width")); } value += ";"; break; case "DevExpress.XtraEditors.SplitterControl": //DevExpress.XtraEditors.SplitterControl sc = c as DevExpress.XtraEditors.SplitterControl; //value += string.Format("{0}:{1};", sc.Name, sc.SplitPosition); value += string.Format("{0}:{1};", Function.DFnc.Property_Get_Value(c, "Name"), Function.DFnc.Property_Get_Value(c, "SplitPosition")); break; case "System.Windows.Forms.SplitContainer": value += string.Format("{0}:{1};", Function.DFnc.Property_Get_Value(c, "Name"), Function.DFnc.Property_Get_Value(c, "SplitterDistance")); break; case "System.Windows.Forms.CheckBox": CheckBox cbox = c as CheckBox; value += string.Format("{0}:{1};", cbox.Name, cbox.Checked); break; //크기 조정이 splitter로 안됌 -> 판넬 크기 기억으로 처리.. //case "System.Windows.Forms.Splitter": // Splitter sp = c as Splitter; // value += string.Format("{0}:{1}:{2};", sp.Name, sp.Left, sp.Top); // break; case "System.Windows.Forms.Panel": Panel pnl = c as Panel; value += string.Format("{0}:{1}:{2};", pnl.Name, pnl.Width, pnl.Height); break; case "System.Windows.Forms.ListView": ListView lst = c as ListView; value += Function.DFnc.Property_Get_Value(c, "Name").ToString() + ":"; foreach (ColumnHeader col in lst.Columns) { //value += string.Format("{0}/{1}:", col.FieldName, col.Width); value += string.Format("{0}/{1}:", col.Index, col.Width); } value += ";"; break; case "System.Windows.Forms.DataGridView": System.Windows.Forms.DataGridView dgv = c as System.Windows.Forms.DataGridView; value += Function.DFnc.Property_Get_Value(c, "Name").ToString() + ":"; foreach (DataGridViewColumn col in dgv.Columns) { //value += string.Format("{0}/{1}:", col.FieldName, col.Width); value += string.Format("{0}/{1}:", col.Index, col.Width); } value += ";"; break; //case "Function.form.usrInputBox": // Function.form.usrInputBox ib = c as Function.form.usrInputBox; // value += string.Format("{0}:{1};", ib.Name, ib.Text); // break; default: try { value += string.Format("{0}:{1};", c.Name, DFnc.Property_Get_Value(c, "Text")); } catch { } break; } } catch { continue; } } value += "*/"; switch (_configFileType) { case enConfigFileType.ConfigXml: if (xml != null) { xml.Group_Select(_xmlSave_GroupName); xml.Value_Set(_propertySave_property_name, value); xml.Setting_Save(); } break; default: Function.DFnc.Property_Set_Value(SavePosition_Setting, _propertySave_property_name, value); Function.DFnc.Method_Excute(SavePosition_Setting, "Save", null); break; } } catch { } }