private void commandOK_Click(object sender, EventArgs e) { //Get selected rules var rules = getSelectedRules(); //Make sure the chosen rules are compatible. if (!checkRulesCompatible(rules)) { return; } //Make sure the chosen rules are valid. foreach (SpecialRule rule in rules) { if (!rule.specialRuleIsValid(ability, rules)) { return; } } //After confirming all selected rules are compatible, cycle through those with parameters and have the user provide them. foreach (SpecialRule rule in rules) { if (rule.Variables.Count == 0) { continue; } ParameterForm pform = new ParameterForm(rule); pform.ShowDialog(); } ability.SpecialRules = rules; this.Dispose(); }
private void ShowParameterForm(ISensor sensor) { ParameterForm form = new ParameterForm(); form.Parameters = sensor.Parameters; form.captionLabel.Text = sensor.Name; form.ShowDialog(); }
/// <summary> /// sets the external movies player parameters. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void parametersButton_Click(object sender, EventArgs e) { ParameterForm parameters = new ParameterForm(); parameters.AddParameter("%filename%", "Will be replaced by currently selected media file"); if (parameters.ShowDialog(parametersButton) == DialogResult.OK) { parametersTextBox.Text += parameters.SelectedParameter; } }
/****************** Getting needed parameters ******************/ /// <summary> /// Calls the parameter form to get the output file path. /// </summary> /// <returns> /// 1 on success /// </returns> public int CallParameterForm() { ParameterForm frm = new ParameterForm(); try { frm.ShowDialog(); ProdLoggerInputParameters t = new ProdLoggerInputParameters { ParamName = "OutputFile", ParamType = "string", ParamValue = frm.SavePath }; ReturnParameters.Add(t); return(1); } finally { frm.Dispose(); } }
private void tsbCreateNewParameter_Click(object sender, EventArgs e) { if (lvForms.CheckedItems.Count == 0) { MessageBox.Show(this, "Please select a form before creating a parameter", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var pForm = new ParameterForm(Service); if (pForm.ShowDialog(this) == DialogResult.OK) { SetState(true); WorkAsync("Creating attribute...", (bw, evt) => { var parameter = (FormParameter)((object[])evt.Argument)[0]; var lvItems = (ListView.CheckedListViewItemCollection)((object[])evt.Argument)[1]; var formsUpdated = new List <CrmForm>(); foreach (ListViewItem item in lvItems) { var crmForm = (CrmForm)item.Tag; // Creating attribute on form crmForm.AddParameter(parameter); // Updating form crmForm.UpdateForm(Service); item.Tag = crmForm; formsUpdated.Add(crmForm); } // Publishing form bw.ReportProgress(0, "Publishing form(s) ..."); CrmForm.PublishForms(Service, formsUpdated.Select(f => f.EntityLogicalName)); evt.Result = lvItems; }, evt => { if (evt.Error != null) { MessageBox.Show(this, evt.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var lvItems = (ListView.CheckedListViewItemCollection)evt.Result; foreach (ListViewItem item in lvItems) { item.SubItems[2].Text = (((CrmForm)item.Tag).Parameters.Count > 0).ToString(); } lvForms_ItemChecked(null, null); } SetState(false); }, evt => SetWorkingMessage(evt.UserState.ToString()), new object[] { pForm.Parameter, lvForms.CheckedItems }); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void parametersButton_Click(object sender, EventArgs e) { ParameterForm parameters = new ParameterForm(); parameters.AddParameter("%filename%", "This will be replaced by the selected media file"); if (parameters.ShowDialog(parametersButton) == DialogResult.OK) { parametersTextBox.Text += parameters.SelectedParameter; } }
/// <summary> /// sets the external movies player parameters. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void parametersButton_Click(object sender, EventArgs e) { ParameterForm parameters = new ParameterForm(); parameters.AddParameter("%filename%", "Will be replaced by currently selected media file"); parameters.AddParameter("%root%", "Will be replaced by root directory from currently selected media file"); if (parameters.ShowDialog(parametersButton) == DialogResult.OK) { parametersTextBox.Text += parameters.SelectedParameter; } }