//no items in list private void SetInitialState() { ControlUtil.DisableButtons(_btnEdit, _btnDelete, _btnCancel, _btnSave, _btnAddProduct, _btnRemoveProduct); ControlUtil.EnableButtons(_btnNew); DisablInputForm(); }
public void UpdateForm() { this.Show(); MainPanel.Controls.Clear(); this.Menu = null; if (null != TheUser && TheUser.User != null) { CustomConsole.WriteLine("User OK"); TitleLabel WelcomeLabel = new TitleLabel(20) { Text = "Welcome, " + TheUser.User.name }; TitleLabel AppLabel = new TitleLabel(30) { Text = "Our Library PC APP" }; Control[] ControlParam = { AppLabel, WelcomeLabel }; Panel HeaderPanel = ControlUtil.GeneratePanel(1, ControlParam, 5, 400, 50, System.Drawing.Color.Blue); MainPanel.Controls.Add(HeaderPanel); AddMenus(true); this.Enabled = true; } else { AddMenus(false); CustomConsole.WriteLine("User Not OK"); } }
private Panel GenerateBookIssuesTable(List <book_issue> BookIssues, int x, int y) { Control[] TableControls = new Control[5 * (BookIssues.Count + 1)]; int ControlIdx = 0; TableControls[ControlIdx++] = new Label() { Text = "No" }; TableControls[ControlIdx++] = new Label() { Text = "RecId" }; TableControls[ControlIdx++] = new Label() { Text = "Title" }; TableControls[ControlIdx++] = new Label() { Text = "Option" }; TableControls[ControlIdx++] = new Label() { Text = "GeneratedId" }; int No = 1; foreach (book_issue BS in BookIssues) { string RecId = BS.book_record.id; Button BtnRemove = new Button() { Text = "Remove" }; BtnRemove.Click += new EventHandler((s, e) => { RemoveBookIssue(RecId); }); TableControls[ControlIdx++] = new Label() { Text = No++.ToString() }; TableControls[ControlIdx++] = new TextBoxReadonly() { Text = BS.book_record.id + "(" + BS.book_record.available + ")" }; TableControls[ControlIdx++] = new TextBoxReadonly() { Text = BS.book_record.book.title }; TableControls[ControlIdx++] = BtnRemove; TableControls[ControlIdx++] = new TextBoxReadonly() { Text = BS.id }; } return(ControlUtil.GeneratePanel(5, TableControls, 5, 100, 20, Color.Cornsilk, x, y, 550, 400)); }
protected void initTracker(Control control) { if (control == null) { return; } foreach (Control c in control.Controls) { string controlName = ControlUtil.GetFullNameOfControl(c); if (controlNames.Contains(controlName)) { continue; } controlNames.Add(controlName); Form form = ControlUtil.GetForm(c); Queue queue = queues[form.Name]; foreach (BaseControlHandler controlHandler in controlHandlers) { controlHandler.ActivityObservers = queue; controlHandler.HandleControl(c); } this.initTracker(c); } }
private void loadThongTinHocTap() { if (ControlUtil.IsEditValueNull(cmbLop) || ControlUtil.IsEditValueNull(cmbNam) || ControlUtil.IsEditValueNull(cmbThang)) { return; } int lopId = (int)cmbLop.EditValue; int nam = (int)cmbNam.EditValue; int thang = IntUtil.StringToInt((string)cmbThang.EditValue).Value; DateTime ngay = new DateTime(nam, thang, DateTime.DaysInMonth(nam, thang)); this.viewHocTapRowBindingSource.DataSource = this.viewHocTapTableAdapter.GetDataByLopAndNgay(lopId, ngay); this.DataTable = this.viewHocTapRowBindingSource.DataSource as DataTable; foreach (QLMamNon.Dao.QLMamNonDs.ViewHocTapRow row in (this.DataTable as QLMamNon.Dao.QLMamNonDs.ViewHocTapDataTable)) { if (row.IsNgayTinhNull()) { row.NgayTinh = new MySql.Data.Types.MySqlDateTime(nam, thang, DateTime.DaysInMonth(nam, thang), 0, 0, 0, 0); } if (row.IsSoNgayNghiThangNull()) { row.SoNgayNghiThang = 0; } } }
private void AddEQ_Load(object sender, EventArgs e) { ControlUtil.RegKeyEnter(this); this.selTextInpt1.Sql = "FindEQKSID"; this.selTextInpt1.SelParam = His.his.Choscode + "|{key}|{key}|{key}"; this.choscode_yTextBox1.Text = His.his.Choscode.ToString(); this.userid_yTextBox.Text = His.his.UserId.ToString(); this.username_yTextBox.Text = His.his.UserName; TvList.newBind().add("启用", "1").add("停用", "0").Bind(ifuse_ytComboBox);//这里的1与0是对应的键值对,下标对应为0,1 TvList.newBind().add("是", "1").add("否", "0").Bind(ifall_ytComboBox); warename_yTextBox1.TextChanged += new EventHandler(warename_yTextBox1_TextChanged); if (isFlag == 2) { //根据初始化构造函数,判断是否为添加或修改 this.ifuse_ytComboBox.SelectedIndex = 0; this.ifall_ytComboBox.SelectedIndex = 0; } if (isFlag == 1 || isFlag == 0) { LoadInfoInEQWare(); if (isFlag == 0) { groupBox1.Enabled = false; btnSave.Enabled = false; } ifuse_ytComboBox.Enabled = false; } }
private void InitialScreen() { BindPeriodCombobox(); txtYear.Text = (DateTime.Now.Year).ToString(); ControlUtil.VisibleControl(false, m_toolBarFind, m_toolBarAdd, m_toolBarEdit, m_toolBarDelete, m_toolBarSave, m_toolBarCancel, m_toolBarRefresh, m_toolBarPrint, m_toolBarExport, m_toolBarImport); UpdateToolbarSeparator(); }
/// <summary> /// 得到组织机构选择类型Radio字符串 /// </summary> /// <returns></returns> public static string GetOrgSelectTypeCheckboxs(string name, string value, string att = "") { ListItem[] items = { new ListItem("部门", "0") { Selected = "0" == value }, new ListItem("岗位", "1") { Selected = "1" == value }, new ListItem("人员", "2") { Selected = "2" == value }, new ListItem("工作组", "3") { Selected = "3" == value }, new ListItem("单位", "4") { Selected = "4" == value } }; return(ControlUtil.GetCheckBoxString(items, name, value.Split(','), att)); }
internal void InitializePlugins() { lv.Items.Clear(); lv.Columns.Clear(); ControlUtil.LvCh(lv, "Name", "Document", "Settings", "Description"); foreach (KeyValuePair <string, IExt> iext in Globe.Plugins) { ListViewItem lvi = new ListViewItem(iext.Key); lvi.Tag = iext; if (iext.Value.HasDocument) { lvi.SubItems.Add("true"); } else { lvi.SubItems.Add("false"); } if (iext.Value.HasSettings) { lvi.SubItems.Add("true"); } else { lvi.SubItems.Add("false"); } if (iext.Value.Info.Description != null) { lvi.SubItems.Add(iext.Value.Info.Description); } else { lvi.SubItems.Add(" ... empty ... "); } lv.Items.Add(lvi); } }
virtual public void MenuItemBuilder() { this.ContextMenuStrip = new ContextMenuStrip(); this.ContextMenuStrip.Items.Add(_tssmooth = ControlUtil.EmumMenuItem <SmoothingMode>("Smoothing", MenuItemClick)); this.ContextMenuStrip.Items.Add(_tsinterp = ControlUtil.EmumMenuItem <InterpolationMode>("Interpolation", MenuItemClick)); CheckItems(); }
/// <summary> /// create new instance with default attributes /// </summary> public ConnectionStringForm() { InitializeComponent(); ControlUtil.PopulateControl(cboSourceType, typeof(InputSource)); ControlUtil.PopulateControl(cboDatabaseProvider, typeof(DatabaseProvider)); cboDatabaseProvider.Items.Remove(DatabaseProvider.Unspecified); }
public override void SetScreenMode(eScreenMode eScreenMode) { base.SetScreenMode(eScreenMode); switch (eScreenMode) { case eScreenMode.Idle: ControlUtil.EnabledControl(true, m_toolBarClose, m_toolBarAdd, m_toolBarFind); ControlUtil.EnabledControl(false, m_toolBarEdit, m_toolBarDelete, m_toolBarSave, m_toolBarCancel, m_toolBarRefresh, m_toolBarPrint, m_toolBarImport, m_toolBarExport); break; case eScreenMode.View: ControlUtil.EnabledControl(true, m_toolBarClose, m_toolBarAdd, m_toolBarEdit, m_toolBarDelete, m_toolBarRefresh, m_toolBarPrint, m_toolBarImport, m_toolBarExport, m_toolBarFind); ControlUtil.EnabledControl(false, m_toolBarSave, m_toolBarCancel); break; case eScreenMode.Add: ControlUtil.EnabledControl(false, m_toolBarClose, m_toolBarAdd, m_toolBarEdit, m_toolBarDelete, m_toolBarRefresh, m_toolBarPrint, m_toolBarImport, m_toolBarExport, m_toolBarFind); ControlUtil.EnabledControl(true, m_toolBarSave, m_toolBarCancel); break; case eScreenMode.Edit: ControlUtil.EnabledControl(false, m_toolBarClose, m_toolBarAdd, m_toolBarEdit, m_toolBarDelete, m_toolBarRefresh, m_toolBarPrint, m_toolBarImport, m_toolBarExport, m_toolBarFind); ControlUtil.EnabledControl(true, m_toolBarSave, m_toolBarCancel); break; case eScreenMode.Custom: break; } }
private void FilterSearchList() { List <Order> currList = Orders; string searchTerm = _txtOrderSearch.Text; if (currList.Count > 0) { _searchList.Clear(); if (string.IsNullOrWhiteSpace(searchTerm)) { ControlUtil.ResetList(Orders, _bndOrders, _lstOrders, "ToString"); } else { foreach (Order o in Orders) { //searches both order # and client name if (o.ToString().ToLower().Contains(searchTerm.ToLower())) { _searchList.Add(o); } } currList = _searchList; ControlUtil.ResetList(_searchList, _bndOrders, _lstOrders, "ToString"); } //SetSearchingState(currList, lbox); } }
//selected mode -> edit, delete, new btns enabled //disabling other btns prevents unnecessary bugs private void SetItemSelectedState() { ControlUtil.DisableButtons(_btnSave, _btnCancel, _btnAddProduct, _btnRemoveProduct); ControlUtil.EnableButtons(_btnEdit, _btnDelete, _btnNew); DisablInputForm(); ControlUtil.EnableListBoxes(_lstOrders); }
public override bool OnCommandEdit() { try { this.Cursor = Cursors.WaitCursor; SetScreenMode(eScreenMode.Edit); ControlUtil.EnabledControl(true, grpAddEdit.Controls); txtGroupName.Focus(); txtGroupName.SelectAll(); gvResult.Enabled = false; DataRow dr = ((DataTable)gvResult.DataSource).Rows[gvResult.CurrentRow.Index]; dr[(int)eColDetail.UpdateDate] = DateTime.Now; dr[(int)eColDetail.UpdateUser] = AppEnvironment.UserLogin; return(true); } catch (Exception ex) { ExceptionManager.ManageException(this, ex); return(false); } finally { this.Cursor = Cursors.Default; } }
private void btnMoveRight_Click(object sender, EventArgs e) { if (ControlUtil.IsEditValueNull(this.cmbLopHocDen)) { MessageBox.Show("Xin vui long chọn Lớp học", "Chọn lớp học", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.hocSinhRowBindingSourceDi.Current == null) { return; } DataRowView rowView = this.hocSinhRowBindingSourceDi.Current as DataRowView; QLMamNon.Dao.QLMamNonDs.HocSinhRow oldRow = rowView.Row as QLMamNon.Dao.QLMamNonDs.HocSinhRow; if (this.isHocSinhExisted(this.hocSinhRowBindingSourceDen, oldRow.HocSinhId)) { return; } DataRowView newRowView = this.hocSinhRowBindingSourceDen.AddNew() as DataRowView; QLMamNon.Dao.QLMamNonDs.HocSinhRow newRow = newRowView.Row as QLMamNon.Dao.QLMamNonDs.HocSinhRow; copyHocSinhRow(oldRow, newRow); newRow.LopDangHoc = this.cmbLopHocDen.Text; newRow.NgayVaoLop = DateTime.Now; this.gvDen.ShowEditForm(); }
public override void SetScreenMode(eScreenMode eScreenMode) { base.SetScreenMode(eScreenMode); // ÊÓËÃѺ㹠Base class ¨ÐÁÕ function ÊÓËÃѺ Enabled & Disabled ¡Ñº Toolbar ÍÂÙèáÅéÇ àÃÕ¡ãªéä´éàÅ // TODO : Enabled & Disabled Control µèÒ§ æ µÒÁ mode ¢Í§ Screen m_dlgFindUser = new FindUserDialog(new FindDialogSqlDAO(AppEnvironment.Database), true, true); switch (ScreenMode) { case eScreenMode.Idle: ControlUtil.EnabledControl(false, grpAddEdit); ControlUtil.ClearControlData(grpAddEdit.Controls); lstvMember.Items.Clear(); break; case eScreenMode.View: ControlUtil.EnabledControl(false, grpAddEdit); break; case eScreenMode.Add: ControlUtil.EnabledControl(true, grpAddEdit); lstvMember.Items.Clear(); break; case eScreenMode.Edit: ControlUtil.EnabledControl(true, grpAddEdit); break; } }
protected override void InitForm() { this.bsDepartment.DataSource = BusinessFactory <DepartmentBusiness> .Instance.FindInGroup(EnergyConstant.TargetDepartmentGroupCode, true); ControlUtil.BindDictToComboBox(this.cmbType, typeof(TargetRecord), "Type"); base.InitForm(); }
internal void InitializeForm() { InitializeComponent(); LanguageUtil.SetCurrentLanguage(this); ControlUtil.SetContextMenuStrip(this, lineNumericUpDown); Form1 form = (Form1)Owner; int linesNumber = TextManager.ReadRTBLineNumbers(form) == 0 ? 1 : TextManager.ReadRTBLineNumbers(form); lineNumberLabel.Text = linesNumber.ToString(); lineNumericUpDown.Maximum = linesNumber; lineNumericUpDown.Minimum = 1; int currentRow; if (!Int32.TryParse(form.rowToolStripStatusLabel1.Text, out currentRow)) { currentRow = 1; } lineNumericUpDown.Value = currentRow; lineCurrentLabel.Text = currentRow.ToString(); lineNumericUpDown.Select(0, lineNumericUpDown.Text.Length); }
private void CopyProperties(Control target, Control source) { source.Parent?.PerformLayout(); foreach (string p in copiablePropertiesPre) { CopyPropertyIfExists(target, source, p); } if (target is DLEUserControl) { (target as DLEUserControl).Owner = this.Owner; } if (target is DLELayoutableUserControl) { SetDialogLayout(target as DLELayoutableUserControl, DialogLayout); } foreach (string p in copiablePropertiesPost) { CopyPropertyIfExists(target, source, p); } if (!ControlUtil.IsTypableControl(target)) { CopyPropertyIfExists(target, source, "Text"); } target.Visible = !MathUtil.RectangleOutside(target.Bounds, this.ClientRectangle); }
//////////////////////////////////////// // static public ToolStripItem SetItem(ContextMenuStrip menu, string name, object tag, EventHandler handler) { ToolStripItem item; menu.Items.Add(item = ControlUtil.TSItem(name, tag, handler)); return(item); }
private void PopulateStudentDetail(string Id) { PanelStudentInfo.Controls.Clear(); student Std = StudentService.GetByIdFull(Id); if (Std != null) { visit Visit = new visit(); Visit.student_id = Std.id; Visit.date = DateTime.Now; Visit.info = "visit"; visit VisitDB = (visit)VisitService.Add(Visit); if (VisitDB != null) { Dictionary <string, object> StudentInfo = new Dictionary <string, object>(); StudentInfo.Add("Student ID", Std.id); StudentInfo.Add("Student Name", Std.name); if (Std.@class != null) { StudentInfo.Add("Student Class", [email protected]_name); } StudentInfo.Add("Visit_No", VisitDB.id.ToString()); StudentInfo.Add("Date", VisitDB.date.ToString()); PanelStudentInfo.Controls.Add(ControlUtil.GenerateTableFromMap(StudentInfo)); } } else { PanelStudentInfo.Controls.Add(ControlUtil.GenerateLabel("~<i>Student Not Found</i>")); } }
private StackPanel createErrorInfoStack(List <List <string> > titleValues) { StackPanel stack = new StackPanel(); stack.Orientation = Orientation.Horizontal; StackPanel titleStack = new StackPanel(); StackPanel valueStack = new StackPanel(); titleStack.Margin = new Thickness(10, 0, 0, 0); valueStack.Margin = new Thickness(10, 0, 0, 0); foreach (List <string> titleValue in titleValues) { string title = titleValue[0]; string value = titleValue[1]; ControlUtil.AddTextToStack(titleStack, title); ControlUtil.AddTextToStack(valueStack, ": " + value); } stack.Children.Add(titleStack); stack.Children.Add(valueStack); return(stack); }
public List <ToolStripItem> GetDirectoryList(string path) { if (!Directory.Exists(path)) { return(null); } DirectoryInfo di = new DirectoryInfo(path); List <ToolStripItem> items = new List <ToolStripItem>(); if (di.Root.FullName != di.FullName) { items.Add(Client.ParentItemNavigation); } else { items.AddRange( new ToolStripItem[] { DesktopItem, ActivePathBrowseItem, DriveItems, ControlUtil.TSItem() // a separator } ); } string[] directories = DirUtil.GetDirList(path); if (directories != null) { foreach (string dn in directories) { items.Add(MakeItem(dn)); } } return(items); }
private void popularCampeonatos(int idGrupo, int idCampeonato) { DataKartDataContext dk = new DataKartDataContext(); var kg = (from g in dk.Kart_Campeonatos where g.idGrupo == idGrupo && (g.Ativo == true || g.idCampeonato == idCampeonato) select new { Text = g.NomeCampeonato, Value = g.idCampeonato, g.Ativo, g.idCampeonato }); ddlCampeonatos.Items.Clear(); ddlCampeonatos.DataSource = kg; ddlCampeonatos.DataTextField = "Text"; ddlCampeonatos.DataValueField = "Value"; ddlCampeonatos.DataBind(); if (ddlCampeonatos.Items.Count <= 0) { ddlCampeonatos.Items.Add(new ListItem("Nenhum campeonato neste grupo", "0")); } else if (idCampeonato > 0) { ControlUtil.SelectByValue(ref ddlCampeonatos, idCampeonato.ToString()); bool?kgAtivo = (from k in kg where k.idCampeonato == idCampeonato select k.Ativo).FirstOrDefault(); ViewState["kgAtivo"] = kgAtivo.HasValue ? kgAtivo.Value : false; } if (ddlCampeonatos.SelectedIndex >= 0) { IdCampeonato = Convert.ToInt16(ddlCampeonatos.SelectedValue); } }
HResult INiIsolationHost.SelectNextControl(bool forward) { try { if (_select > 0) { return(HResult.False); } _select++; try { // The client was the target of select next control. It // has handed the search over to us and we continue from // here. We need to wrap to get the correct behavior. return(ControlUtil.GetRoot(this).SelectNextControl(this, forward, true, true, true) ? HResult.OK : HResult.False); } finally { _select--; } } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
private Panel GenerateStudentInfoPanel(student Student, int x, int y) { return(ControlUtil.GeneratePanel(1, new Control[] { new Label() { Text = "Student ID" }, new TextBoxReadonly(13) { Text = Student.id }, new Label() { Text = "Student Name" }, new TextBoxReadonly(13) { Text = Student.name }, new Label() { Text = "Student ClassId" }, new TextBoxReadonly(13) { Text = Student.class_id }, }, 5, 200, 17, Color.Yellow, x, y)); }
/// <summary> /// Function ¹Õé¨Ð¶Ù¡àÃÕÂÍ¡àÁ×èͼÙéãªé Click ·Õè ToolbarAdd /// </summary> /// <returns>Bool</returns> public override bool OnCommandAdd() { try { this.Cursor = Cursors.WaitCursor; SetScreenMode(eScreenMode.Add); ControlUtil.ClearControlData(grpAddEdit.Controls); lstvMember.Items.Clear(); ControlUtil.EnabledControl(true, grpAddEdit.Controls); // TODO : ¡Ó˹´¤èÒàÃÔèÁµé¹ãËé¡Ñº Control µèÒ§ æ ·ÕèÍÂÙè㹡ÅØèÁ Add/Edit // Example : txtGroupName.Text = string.Empty; txtDescription.Text = string.Empty; // TODO : ¡Ó˹´¤èÒàÃÔèÁµé¹ãËé¡Ñº Column µèÒ§ æ gvResult.Enabled = false; gvResult.ClearSelection(); return(true); } catch (Exception ex) { ExceptionManager.ManageException(this, ex); return(false); } finally { this.Cursor = Cursors.Default; } }
private void GenerateFields() { BtnAddBook.Enabled = Student != null; BtnClear.Enabled = Student != null; BtnSubmitIssue.Enabled = Student != null; Control[] FieldControls = new Control[] { new TitleLabel(20) { Text = "Book Return" }, new BlankControl() { Reserved = ReservedFor.BEFORE_HOR }, new Label() { Text = "Student ID" }, InputStudentId, BtnSearchStudent, null, new Label() { Text = "Rec Id" }, InputRecId, BtnAddBook, BtnClear, BtnSubmitIssue, null }; IssueDetailPanel = ControlUtil.GeneratePanel(2, FieldControls, 5, 150, 30, Color.Coral, 10, 10); Controls.Add(IssueDetailPanel); }
private void DoRight() { Control control = LinkedControl; if (control is SparseTrackBar) { ControlUtil.SafeDecrement(control as SparseTrackBar); } else if (control is TrackBar) { ControlUtil.SafeIncrement(control as TrackBar); } else if (control is ListBox) { ControlUtil.SafeIncrement(control as ListBox); } else if (control is ComboBox) { ControlUtil.SafeIncrement(control as ComboBox); } else if (control is NumericUpDown) { ControlUtil.SafeIncrement(control as NumericUpDown); } }