本文整理汇总了C#中XPCollection.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# XPCollection.Dispose方法的具体用法?C# XPCollection.Dispose怎么用?C# XPCollection.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XPCollection
的用法示例。
在下文中一共展示了XPCollection.Dispose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bbtnRegister_Click
private void bbtnRegister_Click(object sender, EventArgs e)
{
clsBase64 base64 = new clsBase64();
string regKey = "";
try
{
regKey = base64.base64Decode(tbKey.Text);
}
catch (Exception)
{
XtraMessageBox.Show("Unable to decode the key, please check the key and try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (regKey != "")
{
string[] regDetails = regKey.Split('|');
string regName = regDetails[0];
string regCompany = regDetails[1];
if (regName == tbName.Text && regCompany == tbCompany.Text)
{
// Registration Details Match, Save Key...
XPCollection collection = new XPCollection(typeof(Database.Registration));
if (collection.Count > 0)
{
Session.DefaultSession.Delete(collection);
Session.DefaultSession.Save(collection);
}
collection.Dispose();
Database.Registration dbRegistration = new Database.Registration();
dbRegistration.Name = regName;
dbRegistration.Company = regCompany;
dbRegistration.Key = tbKey.Text;
dbRegistration.Save();
Close();
}
else
{
XtraMessageBox.Show("The details you entered do not match the key, please check the details and try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
XtraMessageBox.Show("Registration Key cannot be blank, please enter a key and try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例2: wizardControl1_SelectedPageChanging
private void wizardControl1_SelectedPageChanging(object sender, DevExpress.XtraWizard.WizardPageChangingEventArgs e)
{
if (e.PrevPage == welcomeWizardPage1 && e.Direction == DevExpress.XtraWizard.Direction.Forward)
{
lblError.Text = "";
// Verify all fields are filled in
if (tbOffset.Text == "")
{
lblError.Text = "Offset is a required field";
e.Page = welcomeWizardPage1;
return;
}
if (tbLength.Text == "")
{
lblError.Text = "The offset length is a required field";
e.Page = welcomeWizardPage1;
return;
}
if (cbOffsetType.Text == "Bit")
{
if (tbBit.Text == "")
{
lblError.Text = "You must specify the bit in which you wish to watch";
e.Page = welcomeWizardPage1;
return;
}
}
try
{
int offsettest = Int32.Parse(tbOffset.Text, System.Globalization.NumberStyles.HexNumber);
}
catch (Exception)
{
lblError.Text = "Offset needs to be just the offset number, for example 0x0D0C would be just 0D0C";
e.Page = welcomeWizardPage1;
return;
}
try
{
int lengthtest = Convert.ToInt32(tbLength.Text);
}
catch (Exception)
{
lblError.Text = "Offset length needs to be a number";
e.Page = welcomeWizardPage1;
return;
}
if (cbOffsetType.Text == "Bit")
{
try
{
int bittest = Convert.ToInt32(tbBit.Text);
}
catch (Exception)
{
lblError.Text = "Bit needs to be a number";
e.Page = welcomeWizardPage1;
return;
}
}
if (Convert.ToInt32(tbLength.Text) > 8)
{
lblError.Text = "Offset length needs to be between 1 and 8";
e.Page = welcomeWizardPage1;
return;
}
if (Convert.ToInt32(tbLength.Text) < 1)
{
lblError.Text = "Offset length needs to be between 1 and 8";
e.Page = welcomeWizardPage1;
return;
}
if (cbOffsetType.Text == "Bit")
{
if (Convert.ToInt32(tbBit.Text) < 0)
{
lblError.Text = "Bit cannot be a negative number";
e.Page = welcomeWizardPage1;
return;
}
}
if (cbOffsetType.Text == "Byte")
{
XPCollection collection = new XPCollection(typeof(Database.AnalogOutputScripts), CriteriaOperator.Parse(String.Format("CardModel == '{0}' AND CardRevision == '{1}' AND CardSerial == {2} AND Offset == '{3}'", _CardModel, _CardRevision, _CardSerialNumber, tbOffset.Text)));
if (collection.Count > 0)
{
lblError.Text = "Offset already added";
e.Page = welcomeWizardPage1;
return;
}
collection.Dispose();
//.........这里部分代码省略.........
示例3: GetIds
/// <summary>
#pragma warning disable 1574
/// retrive a list of <see cref="DBObject.ClassInfo.KeyProperty"/> values (IDs)
#pragma warning restore 1574
/// </summary>
/// <param name="collection"></param>
/// <returns></returns>
public static SortedList GetIds(XPCollection collection)
{
var sortedList = new SortedList();
foreach (IXPSimpleObject ixpSimpleObject in collection)
sortedList.Add(ixpSimpleObject.ClassInfo.KeyProperty.GetValue(ixpSimpleObject), ixpSimpleObject);
collection.Dispose();
return sortedList;
}
示例4: wizardControl1_SelectedPageChanging
private void wizardControl1_SelectedPageChanging(object sender, DevExpress.XtraWizard.WizardPageChangingEventArgs e)
{
if (e.PrevPage == welcomeWizardPage1 && e.Direction == DevExpress.XtraWizard.Direction.Forward)
{
meCardDetails.Text = String.Format("Please confirm that you wish to add a {0}{1} with a Serial Number of {2} to the system. These details are not able to be edited once added to the system. If anything is incorrect, please click the back button now to fix them.", cbModelNumber.Text, cbRevisionNumber.Text, tbSerialNumber.Text);
}
if (e.PrevPage == wizardPage1 && e.Direction == DevExpress.XtraWizard.Direction.Forward)
{
lblStep1Error.Text = ""; // Clear Error Box
// Add Card Details to the Database
cardDB.CardModel = cbModelNumber.Text;
cardDB.CardRevision = cbRevisionNumber.Text;
cardDB.CardSerialNumber = Convert.ToInt32(tbSerialNumber.Text);
cardDB.CardConnected = false;
XPCollection collection = new XPCollection(typeof(Database.Cards), CriteriaOperator.Parse(String.Format("CardModel == '{0}' AND CardRevision == '{1}' AND CardSerialNumber = {2}", cbModelNumber.Text, cbRevisionNumber.Text, Convert.ToInt32(tbSerialNumber.Text))));
if (collection.Count == 0)
{
tbCardName.Text = String.Format("{0}{1} [{2}]", cbModelNumber.Text, cbRevisionNumber.Text, tbSerialNumber.Text);
}
else
{
lblStep1Error.Text = "The card you are trying to add already exists in the system, please check the card and try again.";
e.Page = welcomeWizardPage1;
}
collection.Dispose();
}
if (e.PrevPage == wizardPage2 && e.Direction == DevExpress.XtraWizard.Direction.Forward)
{
if (tbCardName.Text == "")
tbCardName.Text = String.Format("{0}{1} [{2}]", cbModelNumber.Text, cbRevisionNumber.Text, tbSerialNumber.Text);
cardDB.CardName = tbCardName.Text;
cardDB.CardDescription = tbCardDescription.Text;
cardDB.Save();
}
if (e.PrevPage == completionWizardPage1)
{
MessageBox.Show("test");
}
}
示例5: SetupScriptNewScript
private void SetupScriptNewScript()
{
XPCollection collection = new XPCollection(typeof(Database.AnalogOutputScripts), CriteriaOperator.Parse(String.Format("CardModel == '{0}' AND CardRevision == '{1}' AND CardSerial == {2}", _CardModel, _CardRevision, _CardSerialNumber)));
foreach (Database.AnalogOutputScripts dbitem in collection)
{
ImageComboBoxItem item;
if (dbitem.Bit == -1)
{
// Offset is a byte
item = new ImageComboBoxItem
{
Description = string.Format("Offset 0x{0}", dbitem.Offset),
Value = dbitem.Oid,
ImageIndex = 6
};
}
else
{
// Offset is a bit
item = new ImageComboBoxItem
{
Description = string.Format("Offset 0x{0}, Bit {1}", dbitem.Offset, dbitem.Bit),
Value = dbitem.Oid,
ImageIndex = 6
};
}
bool itemadded = false;
foreach (ImageComboBoxItem cbitem in repositoryItemImageComboBox1.Items)
{
if (cbitem.Description == item.Description)
itemadded = true;
}
if (itemadded == false)
repositoryItemImageComboBox1.Items.Add(item);
}
collection.Dispose();
}