MethodTaskItem.Usage Property
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.
Gets or sets the method usage.
public:
property Microsoft::Web::Management::Client::MethodTaskItemUsages Usage { Microsoft::Web::Management::Client::MethodTaskItemUsages get(); void set(Microsoft::Web::Management::Client::MethodTaskItemUsages value); };
public Microsoft.Web.Management.Client.MethodTaskItemUsages Usage { get; set; }
member this.Usage : Microsoft.Web.Management.Client.MethodTaskItemUsages with get, set
Public Property Usage As MethodTaskItemUsages
Property Value
One of the MethodTaskItemUsages values.
Examples
The following example displays the following output in the trace listener.
TaskList enabled True
ContextMenu enabled True
Person prs = new Person(66, "Joe", "Smith");
MethodTaskItem mti_i = new MethodTaskItem(
"InvTst", // Method Name
"Invoke Test", // Menu item Text
sDemoCat, // Category
"Tool Tip:SC", // ToolTip non-functional
imgAsk, // Menu Icon
prs); // user data
mti_i.CausesNavigation = false;
traceMTI(mti_i);
items.Add(mti_i);
void traceMTI(MethodTaskItem mti) {
Trace.WriteLine(mti.MethodName);
Type mtiType = typeof(MethodTaskItemUsages);
int k = Convert.ToInt32(mti.Usage);
foreach (string s in Enum.GetNames(mtiType)) {
int j = Convert.ToInt32(Enum.Format(mtiType, Enum.Parse(mtiType, s), "d"));
Trace.WriteLine(s + " enabled " + ((j & k) != 0));
}
}
Remarks
The MethodTaskItem constructor combines both Microsoft.Web.Management.Client.MethodTaskItemUsages enumeration values by using the bitwise OR
operation.