本文整理汇总了C#中CAUUID类的典型用法代码示例。如果您正苦于以下问题:C# CAUUID类的具体用法?C# CAUUID怎么用?C# CAUUID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CAUUID类属于命名空间,在下文中一共展示了CAUUID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CAUUID
void ISpecifyPropertyPages.GetPages(CAUUID[] ppages) {
ppages[0] = new CAUUID();
Guid[] guids = GetPropertyPageGuids();
ppages[0].cElems = (uint)guids.Length;
int size = Marshal.SizeOf(typeof(Guid));
ppages[0].pElems = Marshal.AllocCoTaskMem(guids.Length*size);
IntPtr ptr = ppages[0].pElems;
for (int i = 0; i < guids.Length; i++) {
Marshal.StructureToPtr(guids[i], ptr, false);
ptr = new IntPtr(ptr.ToInt64() + size);
}
}
示例2: GetPages
public virtual void GetPages(CAUUID[] pages)
{
this.GetCommonPropertyPages(pages);
}
示例3: GetPages
public void GetPages(CAUUID[] pages)
{
// We do not check whether the supportsProjectDesigner is set to false on the ProjectNode.
// We rely that the caller knows what to call on us.
if (pages == null)
{
throw new ArgumentNullException("pages");
}
if (pages.Length == 0)
{
throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "pages");
}
// behave similar to C#\VB - return empty array
pages[0] = new CAUUID();
pages[0].cElems = 0;
}
示例4: GetCfgPropertyPages
/// <summary>
/// Retrieves the configuration dependent property pages.
/// </summary>
/// <param name="pages">The pages to return.</param>
private void GetCfgPropertyPages(CAUUID[] pages)
{
// We do not check whether the supportsProjectDesigner is set to true on the ProjectNode.
// We rely that the caller knows what to call on us.
if (pages == null)
{
throw new ArgumentNullException("pages");
}
if (pages.Length == 0)
{
throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "pages");
}
// Retrive the list of guids from hierarchy properties.
// Because a flavor could modify that list we must make sure we are calling the outer most implementation of IVsHierarchy
string guidsList = String.Empty;
IVsHierarchy hierarchy = project.InteropSafeIVsHierarchy;
object variant = null;
ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID2.VSHPROPID_CfgPropertyPagesCLSIDList, out variant), new int[] { VSConstants.DISP_E_MEMBERNOTFOUND, VSConstants.E_NOTIMPL });
guidsList = (string)variant;
Guid[] guids = Utilities.GuidsArrayFromSemicolonDelimitedStringOfGuids(guidsList);
if (guids == null || guids.Length == 0)
{
pages[0] = new CAUUID();
pages[0].cElems = 0;
}
else
{
pages[0] = PackageUtilities.CreateCAUUIDFromGuidArray(guids);
}
}
示例5: GetPages
public void GetPages(CAUUID[] pages)
{
this.GetCfgPropertyPages(pages);
}
示例6: GetProjectDesignerPages
public int GetProjectDesignerPages(CAUUID[] pPages)
{
var cfg = _baseCfg as IVsSpecifyProjectDesignerPages;
if (cfg != null)
{
return cfg.GetProjectDesignerPages(pPages);
}
return VSConstants.E_NOTIMPL;
}
示例7: GetPages
public void GetPages(CAUUID[] pPages)
{
var cfg = _baseCfg as ISpecifyPropertyPages;
if (cfg != null)
{
cfg.GetPages(pPages);
}
}
示例8: GetPages
/// <summary>
/// ills an array of CLSIDs for each property page that can be displayed in this object's property sheet.
/// </summary>
/// <param name="pPages">Pointer to a caller-allocated CAUUID structure that must be initialized and filled before returning.</param>
public void GetPages(ref CAUUID pPages)
{
Guid[] g = new Guid[1];
g[0] = typeof(SymbolSelectorPropPage).GUID;
pPages.SetPages(g);
}
示例9: OnClick
/// <summary>
/// Occurs when this command is clicked
/// </summary>
public override void OnClick()
{
try
{
IMapControl4 mapControl = null;
if (m_pHookHelper.Hook is IMapControl4)
mapControl = (IMapControl4)m_pHookHelper.Hook;
else if (m_pHookHelper.Hook is IToolbarControl2)
{
IToolbarControl2 toolbarControl = (IToolbarControl2)m_pHookHelper.Hook;
mapControl = (IMapControl4)toolbarControl.Buddy;
}
if (null == mapControl.CustomProperty || !(mapControl.CustomProperty is IFeatureLayer))
return;
IFeatureLayer featureLayer = (IFeatureLayer)mapControl.CustomProperty;
//Launch the layer's properties
Type typ;
object obj;
Guid[] g;
// METHOD 1: Instantiating a COM object and displaying its property pages
// ONLY WORKS ON TRUE COM OBJECTS! .NET objects that have rolled their own
// ISpecifyPropertyPages implementation will error out when you try to cast
// the instantiated object to your own ISpecifyPropertyPages implementation.
// Get the typeinfo for the ActiveX common dialog control
typ = Type.GetTypeFromProgID("MSComDlg.CommonDialog");
// Create an instance of the control. We pass it to the property frame function
// so the property pages have an object from which to get current settings and apply
// new settings.
obj = Activator.CreateInstance(typ);
// This handy function calls IPersistStreamInit->New on COM objects to initialize them
ActiveXMessageFormatter.InitStreamedObject(obj);
// Get the property pages for the control using the direct CAUUID method
// This only works for true COM objects and I demonstrate it here only
// to show how it is done. Use the static method
// PropertyPage.GetPagesForType() method for real-world use.
ISpecifyPropertyPages pag = (ISpecifyPropertyPages)obj;
CAUUID cau = new CAUUID(0);
pag.GetPages(ref cau);
g = cau.GetPages();
// Instantiating a .NET object and displaying its property pages
// WORKS ON ALL OBJECTS, .NET or COM
// Create an instance of the .NET control, MyUserControl
typ = Type.GetTypeFromProgID("SymbolSelector.PropertySheet");
// Retrieve the pages for the control
g = PropertyPage.GetPagesForType(typ);
// Create an instance of the control that we can give to the property pages
obj = Activator.CreateInstance(typ);
((SymbolSelector.PropertySheet)obj).OnFeatureLayerRendererChanged += new FeatureLayerRendererChanged(OnFeatureLayerRendererChanged);
//add the yahoo layer to the property-sheet control
((SymbolSelector.PropertySheet)obj).FeatureLayer = featureLayer;
// Display the OLE Property page for the control
object[] items = new object[] { obj };
PropertyPage.CreatePropertyFrame(IntPtr.Zero, 500, 500, "FeatureLayer Symbology", items, g);
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}
}
示例10: OnClick
/// <summary>
/// Occurs when this command is clicked
/// </summary>
public override void OnClick()
{
try
{
//search for the weatherLayer first
ILayer layer = null;
RSSWeatherLayerClass RSSLayer = null;
if (m_pHookHelper.FocusMap.LayerCount == 0)
return;
IEnumLayer layers = m_pHookHelper.FocusMap.get_Layers(null, false);
layers.Reset();
layer = layers.Next();
while (layer != null)
{
if (layer is RSSWeatherLayerClass)
{
RSSLayer = (RSSWeatherLayerClass)layer;
break;
}
layer = layers.Next();
}
//In case that the weather layer wasn't found,just return
if (null == RSSLayer)
return;
//Launch the layer's properties
Type typ;
object obj;
Guid[] g;
// METHOD 1: Instantiating a COM object and displaying its property pages
// ONLY WORKS ON TRUE COM OBJECTS! .NET objects that have rolled their own
// ISpecifyPropertyPages implementation will error out when you try to cast
// the instantiated object to your own ISpecifyPropertyPages implementation.
// Get the typeinfo for the ActiveX common dialog control
typ = Type.GetTypeFromProgID("MSComDlg.CommonDialog");
// Create an instance of the control. We pass it to the property frame function
// so the property pages have an object from which to get current settings and apply
// new settings.
obj = Activator.CreateInstance(typ);
// This handy function calls IPersistStreamInit->New on COM objects to initialize them
ActiveXMessageFormatter.InitStreamedObject(obj);
// Get the property pages for the control using the direct CAUUID method
// This only works for true COM objects and I demonstrate it here only
// to show how it is done. Use the static method
// PropertyPage.GetPagesForType() method for real-world use.
ISpecifyPropertyPages pag = (ISpecifyPropertyPages)obj;
CAUUID cau = new CAUUID(0);
pag.GetPages(ref cau);
g = cau.GetPages();
// Instantiating a .NET object and displaying its property pages
// WORKS ON ALL OBJECTS, .NET or COM
// Create an instance of the .NET control, MyUserControl
typ = Type.GetTypeFromProgID("RSSWeatherLayer.PropertySheet");
// Retrieve the pages for the control
g = PropertyPage.GetPagesForType(typ);
// Create an instance of the control that we can give to the property pages
obj = Activator.CreateInstance(typ);
//add the RSS layer to the property-sheet control
((PropertySheet)obj).RSSWatherLayer = RSSLayer;
// Display the OLE Property page for the control
object[] items = new object[] { obj };
PropertyPage.CreatePropertyFrame(IntPtr.Zero, 500, 500, "RSS Layer properties", items, g);
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}
}
示例11: CAUUID
//==========================================================================================
// ISpecifyPropertyPages Implementation
//==========================================================================================
void ISpecifyPropertyPages.GetPages(CAUUID[] pages)
{
Tracer.VerifyNonEmptyArrayArgument(pages, "pages");
pages[0] = new CAUUID();
pages[0].cElems = 0;
// Get the property pages that the project supports
if (this.ShouldTriggerPropertyPages)
{
#if !VS_2003 // TODO: On VS 2003, we get an error when showing a property page, saying something like "There is not enough storage space to complete the current operation."
Guid[] propertyPageGuids = this.Node.Hierarchy.AttachedProject.CommonPropertyPageGuids;
pages[0] = PackageUtility.CreateCAUUIDFromGuidArray(propertyPageGuids);
#endif
}
}
示例12: CreateCAUUIDFromGuidArray
/// <summary>
/// Creates a native <see cref="CAUUID"/> structure by allocating the necessary COM memory for the array.
/// </summary>
/// <param name="guids">An array of GUIDs to return in the <b>CAUUID</b> structure.</param>
/// <returns>A <see cref="CAUUID"/> structure filled in with the contents of <paramref name="guids"/>.</returns>
public static CAUUID CreateCAUUIDFromGuidArray(Guid[] guids)
{
CAUUID cauuid = new CAUUID();
if (guids != null)
{
cauuid.cElems = (uint)guids.Length;
// Allocate the memory for the array of GUIDs
int cbGuid = Marshal.SizeOf(typeof(Guid));
cauuid.pElems = Marshal.AllocCoTaskMem(guids.Length * cbGuid);
// Iterate over the GUID array and copy them into the COM memory
IntPtr pCurrent = cauuid.pElems;
for (int i = 0; i < guids.Length; i++)
{
// Copy the managed GUID structure to the COM memory block
Marshal.StructureToPtr(guids[i], pCurrent, false);
// Move the pointer to the next element
pCurrent = new IntPtr(pCurrent.ToInt64() + cbGuid);
}
}
return cauuid;
}
示例13: GetPages
public void GetPages(ref CAUUID pPages)
{
Guid[] g = new Guid[2];
g[0] = typeof(RSSLayerProps).GUID;
g[1] = typeof(RSSLayerProps2).GUID;
pPages.SetPages(g);
}
示例14: GetProjectDesignerPages
/// <summary>
/// Implementation of the IVsSpecifyProjectDesignerPages. It will retun the pages that are configuration independent.
/// </summary>
/// <param name="pages">The pages to return.</param>
/// <returns></returns>
public virtual int GetProjectDesignerPages(CAUUID[] pages)
{
this.GetCommonPropertyPages(pages);
return VSConstants.S_OK;
}
示例15: GetPages
/// <include file='doc\PropertyPages.uex' path='docs/doc[@for="NodeProperties.GetPages"]/*' />
public virtual void GetPages(CAUUID[] ppages) {
ppages[0] = new CAUUID();
if (Node.ProjectMgr != null) {
Guid[] guids = Node.ProjectMgr.GetPropertyPageGuids();
if (guids != null) {
ppages[0].cElems = (uint)guids.Length;
int size = Marshal.SizeOf(typeof(Guid));
ppages[0].pElems = Marshal.AllocCoTaskMem(guids.Length * size);
IntPtr ptr = ppages[0].pElems;
for (int i = 0; i < guids.Length; i++) {
Marshal.StructureToPtr(guids[i], ptr, false);
ptr = new IntPtr(ptr.ToInt64() + size);
}
}
} else {
ppages[0].cElems = 0;
}
}