本文整理汇总了C#中State.RefreshStorage方法的典型用法代码示例。如果您正苦于以下问题:C# State.RefreshStorage方法的具体用法?C# State.RefreshStorage怎么用?C# State.RefreshStorage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State.RefreshStorage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNewOcxState
private State CreateNewOcxState(State oldOcxState)
{
this.NoComponentChangeEvents++;
try
{
if (this.GetOcState() < 2)
{
return null;
}
try
{
PropertyBagStream pPropBag = null;
if (this.iPersistPropBag != null)
{
pPropBag = new PropertyBagStream();
this.iPersistPropBag.Save(pPropBag, true, true);
}
MemoryStream dataStream = null;
switch (this.storageType)
{
case 0:
case 1:
dataStream = new MemoryStream();
if (this.storageType != 0)
{
break;
}
this.iPersistStream.Save(new System.Windows.Forms.UnsafeNativeMethods.ComStreamFromDataStream(dataStream), true);
goto Label_00A9;
case 2:
if (oldOcxState == null)
{
return null;
}
return oldOcxState.RefreshStorage(this.iPersistStorage);
default:
return null;
}
this.iPersistStreamInit.Save(new System.Windows.Forms.UnsafeNativeMethods.ComStreamFromDataStream(dataStream), true);
Label_00A9:
if (dataStream != null)
{
return new State(dataStream, this.storageType, this, pPropBag);
}
if (pPropBag != null)
{
return new State(pPropBag);
}
}
catch (Exception)
{
}
}
finally
{
this.NoComponentChangeEvents--;
}
return null;
}
示例2: CreateNewOcxState
private State CreateNewOcxState(State oldOcxState) {
NoComponentChangeEvents++;
try {
if (GetOcState() < OC_RUNNING) {
return null;
}
try {
PropertyBagStream propBag = null;
if (iPersistPropBag != null) {
propBag = new PropertyBagStream();
iPersistPropBag.Save(propBag, true, true);
}
MemoryStream ms = null;
switch (storageType) {
case STG_STREAM:
case STG_STREAMINIT:
ms = new MemoryStream();
if (storageType == STG_STREAM) {
iPersistStream.Save(new UnsafeNativeMethods.ComStreamFromDataStream(ms), true);
}
else {
iPersistStreamInit.Save(new UnsafeNativeMethods.ComStreamFromDataStream(ms), true);
}
break;
case STG_STORAGE:
Debug.Assert(oldOcxState != null, "we got to have an old state which holds out scribble storage...");
if (oldOcxState != null) return oldOcxState.RefreshStorage(iPersistStorage);
return null;
default:
Debug.Fail("unknown storage type.");
return null;
}
if (ms != null) {
return new State(ms, storageType, this, propBag);
}
else if (propBag != null) {
return new State(propBag);
}
}
catch (Exception e) {
Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "Could not create new OCX State: " + e.ToString());
}
}
finally {
NoComponentChangeEvents--;
}
return null;
}