ModulePropertiesPage.ClearDirty Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Clears the internal flag that indicates whether a PropertyGridObject object has been modified.
protected:
void ClearDirty();
protected void ClearDirty ();
member this.ClearDirty : unit -> unit
Protected Sub ClearDirty ()
Examples
The following example populates a custom Microsoft.Web.Management.Client.PropertyGridObject object and then calls the ClearDirty method to clear the internal flag that indicates that the object was modified.
internal class CustomPropertiesInfo : PropertyGridObject {
private PropertyBag _bag;
public CustomPropertiesInfo(
ModulePropertiesPage page,
PropertyBag bag)
: base(page) {
Initialize(bag);
}
public CustomPropertiesInfo(
ModulePropertiesPage page,
PropertyBag bag,
bool bRO)
: base(page, bRO) {
Initialize(bag);
}
internal void Initialize(PropertyBag bag) {
_bag = bag;
TrcData();
}
bool GetBoolProp(SH.PropInt pi) {
object o = _bag[pi.Indx];
if (o == null)
return false;
return (bool)o;
}
//
protected override void ProcessProperties(
PropertyBag properties) {
_bag = properties;
_clone = _bag.Clone(ReadOnly);
CustomPropertiesInfo info =
(CustomPropertiesInfo)TargetObject;
if (info == null) {
info = new CustomPropertiesInfo(this, _clone);
TargetObject = info;
} else {
info.Initialize(_clone);
}
ClearDirty();
}
internal class CustomPropertiesInfo : PropertyGridObject {
private PropertyBag _bag;
public CustomPropertiesInfo(
ModulePropertiesPage page,
PropertyBag bag)
: base(page) {
Initialize(bag);
}
public CustomPropertiesInfo(
ModulePropertiesPage page,
PropertyBag bag,
bool bRO)
: base(page, bRO) {
Initialize(bag);
}
internal void Initialize(PropertyBag bag) {
_bag = bag;
TrcData();
}
bool GetBoolProp(SH.PropInt pi) {
object o = _bag[pi.Indx];
if (o == null)
return false;
return (bool)o;
}
string GetStrProp(SH.PropInt pi) {
object o = _bag[pi.Indx];
if (o == null)
return String.Empty;
return (string)o;
}
int GetIntProp(SH.PropInt pi) {
object o = _bag[pi.Indx];
if (o == null)
return -1234567;
return (int)o;
}
System.TimeSpan GetTSProp(SH.PropInt pi) {
object o = _bag[pi.Indx];
if (o == null)
return TimeSpan.MinValue;
return (TimeSpan)o;
}
void SetProp(SH.PropInt pi, bool val) {
_bag[pi.Indx] = val;
}
void SetProp(SH.PropInt pi, string val) {
_bag[pi.Indx] = val;
}
void SetProp(SH.PropInt pi, int val) {
_bag[pi.Indx] = val;
}
void SetProp(SH.PropInt pi, TimeSpan val) {
_bag[pi.Indx] = val;
}
/* Add custom props here
* Property get/set name is not case sensitive
*
* You can add the attribute [DefaultValue here
* but it's does nothing
*/
public bool BoolProp {
get {
return GetBoolProp(SH.boolProp);
}
set {
SetProp(SH.boolProp, value);
}
}
public string strProp {
get {
return GetStrProp(SH.strProp);
}
set {
SetProp(SH.strProp, value);
}
}
public string strProp2 {
get {
return GetStrProp(SH.strProp2);
}
set {
SetProp(SH.strProp2, value);
}
}
public int intProp {
get {
return GetIntProp(SH.intProp);
}
set {
SetProp(SH.intProp, value);
}
}
public System.TimeSpan TSprop {
get {
return GetTSProp(SH.TSprop);
}
set {
SetProp(SH.TSprop, value);
}
}