本文整理汇总了C#中Bar.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Bar.Dispose方法的具体用法?C# Bar.Dispose怎么用?C# Bar.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bar
的用法示例。
在下文中一共展示了Bar.Dispose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestNativeToManagedMapWithOwnObjects
public void TestNativeToManagedMapWithOwnObjects()
{
using (var testNativeToManagedMap = new TestNativeToManagedMap())
{
var bar = new Bar();
testNativeToManagedMap.PropertyWithNoVirtualDtor = bar;
Assert.AreSame(bar, testNativeToManagedMap.PropertyWithNoVirtualDtor);
Assert.IsTrue(Qux.NativeToManagedMap.ContainsKey(bar.__Instance));
bar.Dispose();
Assert.IsFalse(Qux.NativeToManagedMap.ContainsKey(bar.__Instance));
}
}
示例2: DeleteBar
public void DeleteBar()
{
var bar = new Bar(Context);
bar.Dispose();
Assert.AreEqual(1, Context.Count());
}
示例3: dotNetBarManager1_ItemClick
//.........这里部分代码省略.........
m_SaveFileDialog.DefaultExt = "xml";
m_SaveFileDialog.FileName = (bar.Name!=""?bar.Name:"MyBar");
m_SaveFileDialog.Filter = "DotNetBar Bar Files (*.xml)|*.xml|All Files (*.*)|*.*";
if(m_SaveFileDialog.ShowDialog()==DialogResult.OK)
{
bar.SaveDefinition(m_SaveFileDialog.FileName);
}
m_SaveFileDialog.Title=stitle;
m_SaveFileDialog.DefaultExt=defaultExt;
m_SaveFileDialog.FileName=fileName;
m_SaveFileDialog.Filter=filter;
break;
}
case LOAD_BAR:
{
string defaultExt=m_OpenFileDialog.DefaultExt;
string filter=m_OpenFileDialog.Filter;
m_OpenFileDialog.DefaultExt="xml";
m_OpenFileDialog.Filter = "DotNetBar Bar Files (*.xml)|*.xml|All Files (*.*)|*.*";
if(m_OpenFileDialog.ShowDialog()==DialogResult.OK && System.IO.File.Exists(m_OpenFileDialog.FileName))
{
Bar bar=new Bar();
try
{
bar.LoadDefinition(m_OpenFileDialog.FileName);
}
catch(Exception ex)
{
MessageBox.Show("File '"+m_OpenFileDialog.FileName+"' does not appear to be valid Bar file.\n\rException has been generated while loading: "+ex.Source+": "+ex.Message+"\n\r"+ex.StackTrace);
return;
}
bar.Dispose();
bar=new Bar();
this.GetDesignManager().SuspendLayout=true;
this.GetDesignManager().Bars.Add(bar);
bar.LoadDefinition(m_OpenFileDialog.FileName);
this.GetDesignManager().SuspendLayout=false;
this.DisplayTreeBar(bar);
}
m_OpenFileDialog.DefaultExt=defaultExt;
m_OpenFileDialog.Filter=filter;
break;
}
case MOVE_LEFT:
case MOVE_RIGHT:
case MOVE_UP:
case MOVE_DOWN:
{
MoveSelectedItem(item.Name);
RefreshDesignBar();
break;
}
case SYNC_CATEGORIES:
{
RescanCategories();
break;
}
case NEW_BUTTON:
{
ButtonItem btn=CreateObject(typeof(ButtonItem)) as ButtonItem;
AssignItemName(btn);
btn.Text=btn.Name;
AddNewItem(btn);
RefreshDesignBar();
示例4: AddBar
public void AddBar()
{
var bar = new Bar(Context);
Assert.AreEqual(2, Context.Count()); // new bar + default one
bar.Dispose();
}