本文整理汇总了C#中DialogResult类的典型用法代码示例。如果您正苦于以下问题:C# DialogResult类的具体用法?C# DialogResult怎么用?C# DialogResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DialogResult类属于命名空间,在下文中一共展示了DialogResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BtnSave_Click
private void BtnSave_Click(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(textBox.Text))
{
DialogResult dr = new DialogResult();
ConfirmDialogView confirm = new ConfirmDialogView();
confirm.getLabelConfirm().Text = "Weet u zeker dat u de naam van de vragenlijst wilt wijzigen?";
dr = confirm.ShowDialog();
if (dr == DialogResult.Yes)
{
Model.QuestionList questionList = new Model.QuestionList();
questionList.Id = QuestionListId;
questionList.Name = textBox.Text;
Controller.UpdateQuestionList(questionList);
this.QuestionListNameChanged = true;
confirm.Close();
}
}
else
{
MessageBox.Show("U heeft niks ingevuld, vul alstublieft de nieuwe naam in");
}
}
示例2: btnSlipOrReport_Click
private void btnSlipOrReport_Click(object sender, EventArgs e)
{
this.Hide();
DialogResult dr = new DialogResult();
SalarySlip ss = new SalarySlip();
dr = ss.ShowDialog();
}
开发者ID:shivam01990,项目名称:Human-Resource-Management-System-windows-Application,代码行数:7,代码来源:SearchSalaryDetails.cs
示例3: brisiDioNekretnineButton_Click
private void brisiDioNekretnineButton_Click(object sender, EventArgs e)
{
try
{
DAO dao = new DAO("localhost", "ikzavrsni", "root", "root");
for (int i = 0; i < dijeloviNekretnineListView.Items.Count; i++)
if (dijeloviNekretnineListView.Items[i].Selected == true)
{
foreach (DioNekretnine dn in dijeloviNekretnina)
if (dn.Naziv == dijeloviNekretnineListView.Items[i].Text)
{
DialogResult dr = new DialogResult();
dr = MessageBox.Show("Da li ste sigurni da želite izbrisati odabrani dio nekretnine iz baze podataka?", "Upozorenje", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dr == System.Windows.Forms.DialogResult.Yes)
{
dao.IzbrisiDioNekretnine(dn.Sifra);
dijeloviNekretnineListView.Items.Clear();
statusStrip1.BackColor = Color.White;
toolStripStatusLabel1.ForeColor = Color.Green;
toolStripStatusLabel1.Text = "Uspješno izbrisani podaci.";
return;
}
}
}
}
catch (Exception)
{
statusStrip1.BackColor = Color.White;
toolStripStatusLabel1.ForeColor = Color.Red;
toolStripStatusLabel1.Text = "Podaci nisu obrisani!";
}
}
示例4: DGProduct_UserDeletingRow
private void DGProduct_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
{
if (countDeleting == 1)
{
dialogResult = MessageBox.Show("Esta seguro que desea eliminar los productos seleccionados?\r\n" + DGProduct.SelectedRows.Count + " productos seran eliminados!", "Eliminar productos", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
countSelectedRows = DGProduct.SelectedRows.Count;
}
if (countDeleting == countSelectedRows)
{
countDeleting = 1;
countSelectedRows = 0;
}
else
countDeleting++;
if (dialogResult == DialogResult.Cancel)
e.Cancel = true;
else
{
try {
int id = Int32.Parse(e.Row.Cells["Id"].Value.ToString());
Product prod = stock.Product.First(i => i.id == id);
prod.deleted_at = DateTime.Now;
stock.SaveChanges();
}catch(Exception exc)
{
Console.WriteLine(exc);
}
finally {
e.Cancel = false;
}
}
}
示例5: SetInfomation
public void SetInfomation(DialogResult _result, int _textId, Vector3 _location)
{
tranformBtn.gameObject.SetActive(true);
result = _result;
//text.text = AvLocalizationManager.GetString(_textId);
tranformBtn.localPosition = _location;
}
示例6: SendDialogManagerMessage
public const string DIALOG_RESULT = "DialogResult"; // Type: DialogResult
public static void SendDialogManagerMessage(Guid dialogHandle, DialogResult result)
{
SystemMessage msg = new SystemMessage(MessageType.DialogClosed);
msg.MessageData[DIALOG_HANDLE] = dialogHandle;
msg.MessageData[DIALOG_RESULT] = result;
ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg);
}
示例7: CloseThis
void CloseThis(DialogResult result= System.Windows.Forms.DialogResult.OK)
{
if (Loading)
return;
this.DialogResult = result;
this.Close();
}
示例8: CreatePerson
public void CreatePerson(Packet templatePacket = null)
{
FormMode = Mode.Create;
saveDialogResult = DialogResult.None;
btnClose.Visible = true;
_templatePacket = templatePacket;
}
示例9: AddAction
public void AddAction(string text, DialogResult result, Image image = null, bool isDefault = false)
{
int width = this.ClientSize.Width-20;
var button = new SimpleButton();
button.Text = text;
button.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
button.Image = image;
button.Width = width;
button.Left = 10;
button.Height = ButtonHeight;
button.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
button.Tag = result;
button.Click += button_Click;
this.Controls.Add(button);
if (isDefault)
this.AcceptButton = button;
button.DialogResult = result;
if (result == DialogResult.Cancel)
{
this.CancelButton = button;
this.ControlBox = true;
this.SelectedAction = result;
}
}
示例10: HandleResult
/// <summary>
/// <para>If DPAPI settings change, this saves the key algorithm out with the new settings.</para>
/// </summary>
/// <param name="dialogResult">
/// <para>One of the <see cref="DialogResult"/> values.</para>
/// </param>
/// <param name="originalSettings">
/// <para>The original <see cref="DpapiSettings"/> before editing.</para>
/// </param>
/// <param name="newSettingsData">
/// <para>The new <see cref="DpapiSettingsData"/> from the editor.</para>
/// </param>
/// <returns>
/// <para>If accepted, the new <see cref="DpapiSettings"/>; otherwise the <paramref name="originalSettings"/>.</para>
/// </returns>
protected override object HandleResult(DialogResult dialogResult, DpapiSettings originalSettings, DpapiSettingsData newSettingsData)
{
bool returnBaseResult = true;
if (dialogResult == DialogResult.OK)
{
DpapiSettings newDpapiSettings = null;
if (newSettingsData != null)
{
newDpapiSettings = new DpapiSettings(newSettingsData);
}
if (newDpapiSettings != originalSettings)
{
returnBaseResult = SaveKeyAlgorithmPairWithNewDapiSettings(newDpapiSettings, originalSettings);
}
}
if (returnBaseResult)
{
return base.HandleResult(dialogResult, originalSettings, newSettingsData);
}
else
{
return originalSettings;
}
}
示例11: ShowInputDialog
/// <summary>
/// Ввод значения из модального диалога
/// </summary>
/// <param name="caption">заголовок окна диалога</param>
/// <param name="label">надпись в окне слева от поля ввода</param>
/// <param name="enableCancel">видимость кнопки "Отмена"</param>
/// <param name="inputText">начальное значение</param>
/// <param name="rst">DialogResult.OK - нажата кнопка "Принять", DialogResult.Cancel - нажата кнопка "Отмена"</param>
/// <returns></returns>
public static string ShowInputDialog(string caption, string label,
bool enableCancel, string inputText, out DialogResult rst)
{
var dlg = new SimpleDialog(caption, label, enableCancel, inputText);
rst = dlg.ShowDialog();
return dlg.InputValue;
}
示例12: btnAddProfile_Click
private void btnAddProfile_Click(object sender, EventArgs e)
{
// Make sure the email is valid
if (SGGlobals.IsEmailValid(txtDefaultAddress.Text) == false)
{
MessageBox.Show("Email address does not appear to be valid!", "Error creating profile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
// Make sure the profile doesn't exist
try
{
UserProfiles.GetProfileByName(txtProfileName.Text);
// Profile exists!
MessageBox.Show("Profile name already exists!", "Error creating profile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
catch (ProfileNotFoundException)
{
// Profile does not exist, create it
Profile objNewProfile = new Profile();
objNewProfile.Name = txtProfileName.Text;
objNewProfile.ToAddresses.Add(txtDefaultAddress.Text);
objNewProfile.Save();
this._objDialogStatus = DialogResult.OK;
this.Close();
}
catch (Exception ex)
{
MessageBox.Show("An unknown error occured creating the new profile:"
+ Environment.NewLine + ex.Message, "Error creating profile", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例13: button1_Click
private void button1_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.AddExtension = true;
sfd.DefaultExt = ".h";
sfd.FileName = "os_cfg";
DialogResult dr = new DialogResult();
dr=sfd.ShowDialog();
if (dr == DialogResult.OK)
{
String directory = @sfd.FileName;
String text = textBox1.Text;
if (File.Exists(directory))
{
StreamWriter swWriter = new StreamWriter(directory);
swWriter.WriteLine(text);
swWriter.Flush();
swWriter.Close();
}
else
{
FileStream fs = File.Create(directory);
fs.Flush();
fs.Close();
StreamWriter swWriter = new StreamWriter(directory);
swWriter.WriteLine(text);
swWriter.Flush();
swWriter.Close();
}
}
}
示例14: SettingsDlg_FormClosing
private void SettingsDlg_FormClosing(object sender, FormClosingEventArgs e)
{
if (uidBox.Focused && uidBox.Text != HatHConfig.UserID)
{
HatHConfig.UserID = uidBox.Text;
exitWith = DialogResult.OK;
}
if (passBox.Focused && passBox.Text != HatHConfig.PassHash)
{
HatHConfig.PassHash = passBox.Text;
exitWith = DialogResult.OK;
}
if (hathrootBox.Focused && hathrootBox.Text != HatHConfig.HatHRoot)
{
HatHConfig.HatHRoot = hathrootBox.Text;
exitWith = DialogResult.OK;
}
if (outdirBox.Focused && outdirBox.Text != HatHConfig.OutputDirectory)
{
HatHConfig.OutputDirectory = outdirBox.Text;
exitWith = DialogResult.OK;
}
DialogResult = exitWith;
}
示例15: OnRunStarted
/// <summary>
/// Runs custom wizard logic at the beginning of a template wizard run.
/// </summary>
protected override void OnRunStarted()
{
TraceService.WriteLine("WebRequestServiceWizard::OnRunStarted");
WebRequestServiceView view = new WebRequestServiceView();
view.ShowDialog();
this.dialogResult = view.DialogResult;
if (this.dialogResult == DialogResult.OK)
{
this.entityName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(view.EntityName);
this.ReplacementsDictionary.Add("$webRequestEntityName$", this.entityName);
this.AddGlobal("MockWebRequestService", "mock" + this.entityName + "WebRequestService");
this.AddGlobal("InterfaceWebRequest", "I" + this.entityName + "WebRequestService");
this.AddGlobal("webRequestInstance", this.entityName.LowerCaseFirstCharacter() + "WebRequestService");
this.AddGlobal("WebRequestService", this.entityName + "WebRequestService");
this.AddGlobal("SampleWebRequestService", this.entityName + "WebRequestService");
this.AddGlobal("SampleWebRequestData", this.entityName);
this.AddGlobal("WebRequestSampleData", this.entityName);
this.AddGlobal("SampleWebRequestDataInstance", this.entityName.LowerCaseFirstCharacter());
this.AddGlobal("SampleWebRequestTranslator", this.entityName + "Translator");
}
}