public RulesEdit(ListRulesContext rulesContext, ControlRules.value cv, int Id = 0) { InitializeComponent(); this.rulesContext = rulesContext; this.cv = cv; this.Id = Id; folderDailog = new CommonOpenFileDialog(); folderDailog.IsFolderPicker = true; BindingSource bindOp = new BindingSource(EnumToDic <op>(), null); comboBoxOp.DataSource = bindOp; comboBoxOp.DisplayMember = "Value"; comboBoxOp.ValueMember = "Key"; BindingSource bindIf = new BindingSource(EnumToDic <ifEx>(), null); comboBoxIf.DataSource = bindIf; comboBoxIf.DisplayMember = "Value"; comboBoxIf.ValueMember = "Key"; if (cv == ControlRules.value.edit) { RuleItem rule = rulesContext.frules.Item.Find(x => x.Id == Id); textBoxDs.Text = rule.DirStart; textBoxDd.Text = rule.DirDest; comboBoxOp.SelectedValue = rule.Operation.ToString(); comboBoxIf.SelectedValue = rule.IfExist.ToString(); textBoxMask.Text = rule.FileMask; checkBoxEnable.Checked = rule.Status; } }
private void Panel_Load(object sender, EventArgs e) { try { rulesContext = new ListRulesContext(); historyContext = new ListHistoryContext(); settingsContext = new ListSettingsContext(); this.Text = settingsContext.settings.Program_name; notifyIcon1.Text = settingsContext.settings.Program_name; GridRefresh(); } catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); } }
public Rules(ListRulesContext rulesContext, ListSettingsContext sc) { InitializeComponent(); this.rulesContext = rulesContext; this.Text = sc.settings.Program_name + ": " + this.Text; }