public void Dispose_CalledTwice_CallsHandlerOnce() { Prompt prompt = new Prompt(); int disposedCalledCount = 0; prompt.Disposed += delegate { ++disposedCalledCount; }; Assert.AreEqual(0, disposedCalledCount); prompt.Dispose(); Assert.AreEqual(1, disposedCalledCount); prompt.Dispose(); Assert.AreEqual(1, disposedCalledCount); }
public void SetSite_CalledAfterDisposed_Throws() { var prompt = new Prompt(); prompt.Dispose(); Assert.Throws <ObjectDisposedException>( () => prompt.Site = null ); }
public void Dispose_HasDisposedEventHandler_CallsHandler() { Prompt prompt = new Prompt(); bool disposedCalled = false; prompt.Disposed += delegate { disposedCalled = true; }; Assert.IsFalse(disposedCalled); prompt.Dispose(); Assert.IsTrue(disposedCalled); }
public void GetSite_CalledAfterDisposed_Throws() { #pragma warning disable 219 var prompt = new Prompt(); prompt.Dispose(); ISite site; Assert.Throws <ObjectDisposedException>( () => site = prompt.Site ); #pragma warning restore 219 }
public void CanExtend_CalledAfterDisposed_Throws() { var prompt = new Prompt(); prompt.Dispose(); using (var textBox = new TextBox()) { Assert.Throws<ObjectDisposedException>( () => prompt.CanExtend(textBox) ); } }
public void GetIsPromptVisible_CalledAfterDisposed_Throws() { var prompt = new Prompt(); prompt.Dispose(); using (var textBox = new TextBox()) { Assert.Throws <ObjectDisposedException>( () => prompt.GetIsPromptVisible(textBox) ); } }
public void CanExtend_CalledAfterDisposed_Throws() { var prompt = new Prompt(); prompt.Dispose(); using (var textBox = new TextBox()) { Assert.Throws <ObjectDisposedException>( () => prompt.CanExtend(textBox) ); } }
public void SetPrompt_CalledAfterDisposed_Throws() { var prompt = new Prompt(); prompt.Dispose(); using (var textBox = new TextBox()) { Assert.Throws <ObjectDisposedException>( () => prompt.SetPrompt(textBox, "prompt") ); } }
public bool Save() { if (EncDec.DecryptData(_group.password,MainForm.Conf.EncryptCode)!=txtPassword.Text) { var p = new Prompt(LocRm.GetString("ConfirmPassword")+": "+_group.name, "", true); if (p.ShowDialog(this) == DialogResult.OK) { var v = p.Val; if (v != txtPassword.Text) { MessageBox.Show(this, LocRm.GetString("PasswordMismatch")); p.Dispose(); return false; } } p.Dispose(); _group.password = EncDec.EncryptData(txtPassword.Text,MainForm.Conf.EncryptCode); } var tot = (from CheckBox c in fpFeatures.Controls where c.Checked select (int)c.Tag).Sum(); _group.featureset = tot; return true; }
public bool Save() { if (EncDec.DecryptData(_group.password, MainForm.Conf.EncryptCode) != txtPassword.Text) { var p = new Prompt(LocRm.GetString("ConfirmPassword") + ": " + _group.name, "", true); if (p.ShowDialog(this) == DialogResult.OK) { var v = p.Val; if (v != txtPassword.Text) { MessageBox.Show(this, LocRm.GetString("PasswordMismatch")); p.Dispose(); return(false); } } p.Dispose(); _group.password = EncDec.EncryptData(txtPassword.Text, MainForm.Conf.EncryptCode); } var tot = (from CheckBox c in fpFeatures.Controls where c.Checked select(long) c.Tag).Sum(); _group.featureset = tot; return(true); }
/// <summary> /// Display a popup with the message and an entry box. Data entered into the entry box will be passed back to Lua environment upon submission. /// </summary> /// <param name="message">A message to display on popup window.</param> /// <returns>A string value inserted into textbox.</returns> public static string ShowPrompt(string message) { string text = null; var prompt = new Prompt(); prompt.PromptMessage.Text = message; prompt.PromptSubmit.Click += (o, e) => { text = prompt.PromptEntryBox.Text; prompt.Close(); prompt.Dispose(); }; prompt.ShowDialog(); return(text); }
/// <summary> /// 释放资源 /// </summary> public override void Dispose() { if (Error != null) { Error.Dispose(); } if (DisplayName != null) { DisplayName.Dispose(); } if (ShortName != null) { ShortName.Dispose(); } if (Prompt != null) { Prompt.Dispose(); } if (Description != null) { Description.Dispose(); } base.Dispose(); }
public void SetPrompt_CalledAfterDisposed_Throws() { var prompt = new Prompt(); prompt.Dispose(); using (var textBox = new TextBox()) { Assert.Throws<ObjectDisposedException>( () => prompt.SetPrompt(textBox, "prompt") ); } }
public void Dispose_HasDisposedEventHandler_CallsHandler() { Prompt prompt = new Prompt(); bool disposedCalled = false; prompt.Disposed += delegate { disposedCalled = true; }; Assert.IsFalse(disposedCalled); prompt.Dispose(); Assert.IsTrue(disposedCalled); }
public void Dispose_CalledTwice_CallsHandlerOnce() { Prompt prompt = new Prompt(); int disposedCalledCount = 0; prompt.Disposed += delegate { ++disposedCalledCount; }; Assert.AreEqual(0, disposedCalledCount); prompt.Dispose(); Assert.AreEqual(1, disposedCalledCount); prompt.Dispose(); Assert.AreEqual(1, disposedCalledCount); }
public void GetIsPromptVisible_CalledAfterDisposed_Throws() { var prompt = new Prompt(); prompt.Dispose(); using (var textBox = new TextBox()) { Assert.Throws<ObjectDisposedException>( () => prompt.GetIsPromptVisible(textBox) ); } }
public void GetSite_CalledAfterDisposed_Throws() { #pragma warning disable 219 var prompt = new Prompt(); prompt.Dispose(); ISite site; Assert.Throws<ObjectDisposedException>( () => site = prompt.Site ); #pragma warning restore 219 }
public void Teardown() { _prompt.Dispose(); }
public void SetSite_CalledAfterDisposed_Throws() { var prompt = new Prompt(); prompt.Dispose(); Assert.Throws<ObjectDisposedException>( () => prompt.Site = null ); }