public string GetComponentName() { //Console.WriteLine ("GetComponentName"); return(TypeDescriptor.GetComponentName(this, true)); }
public string GetComponentName() { return(TypeDescriptor.GetComponentName((object)this.settings, true)); }
/// <summary> /// Returns the name of this instance of Asset. /// </summary> /// <returns>The name of Asset</returns> public string GetComponentName() { return(TypeDescriptor.GetComponentName(m_asset, false)); }
/// <summary> /// Returns the name of the hosting type library /// </summary> /// <param name="instance">target instance</param> /// <returns>library name or empty if its failed to recieve</returns> internal string GetComponentName(ICOMObject instance) { return(null != instance?TypeDescriptor.GetComponentName(instance.UnderlyingObject) : String.Empty); }
public override void OnDragDrop(Glyph g, DragEventArgs e) { ToolStripItem dragItem = ToolStripDesigner.dragItem; if ((e.Data is ToolStripItemDataObject) && (dragItem != null)) { ToolStripItemDataObject data = (ToolStripItemDataObject)e.Data; ToolStripItem primarySelection = data.PrimarySelection; IDesignerHost host = (IDesignerHost)dragItem.Site.GetService(typeof(IDesignerHost)); if ((dragItem != primarySelection) && (host != null)) { string str; ArrayList dragComponents = data.DragComponents; ToolStrip currentParent = dragItem.GetCurrentParent(); int index = -1; bool flag = e.Effect == DragDropEffects.Copy; if (dragComponents.Count == 1) { string componentName = TypeDescriptor.GetComponentName(dragComponents[0]); if ((componentName == null) || (componentName.Length == 0)) { componentName = dragComponents[0].GetType().Name; } str = System.Design.SR.GetString(flag ? "BehaviorServiceCopyControl" : "BehaviorServiceMoveControl", new object[] { componentName }); } else { str = System.Design.SR.GetString(flag ? "BehaviorServiceCopyControls" : "BehaviorServiceMoveControls", new object[] { dragComponents.Count }); } DesignerTransaction transaction = host.CreateTransaction(str); try { IComponentChangeService service = (IComponentChangeService)dragItem.Site.GetService(typeof(IComponentChangeService)); if (service != null) { ToolStripDropDown down = currentParent as ToolStripDropDown; if (down != null) { ToolStripItem ownerItem = down.OwnerItem; service.OnComponentChanging(ownerItem, TypeDescriptor.GetProperties(ownerItem)["DropDownItems"]); } else { service.OnComponentChanging(currentParent, TypeDescriptor.GetProperties(currentParent)["Items"]); } } if (flag) { if (primarySelection != null) { index = dragComponents.IndexOf(primarySelection); } ToolStripKeyboardHandlingService keyBoardHandlingService = this.GetKeyBoardHandlingService(primarySelection); if (keyBoardHandlingService != null) { keyBoardHandlingService.CopyInProgress = true; } dragComponents = DesignerUtils.CopyDragObjects(dragComponents, dragItem.Site) as ArrayList; if (keyBoardHandlingService != null) { keyBoardHandlingService.CopyInProgress = false; } if (index != -1) { primarySelection = dragComponents[index] as ToolStripItem; } } if ((e.Effect == DragDropEffects.Move) || flag) { ISelectionService selectionService = this.GetSelectionService(dragItem); if (selectionService != null) { if (currentParent is ToolStripOverflow) { currentParent = ((ToolStripOverflow)currentParent).OwnerItem.Owner; } int num2 = currentParent.Items.IndexOf(ToolStripDesigner.dragItem); if (num2 != -1) { int num3 = 0; if (primarySelection != null) { num3 = currentParent.Items.IndexOf(primarySelection); } if ((num3 != -1) && (num2 > num3)) { num2--; } foreach (ToolStripItem item4 in dragComponents) { currentParent.Items.Insert(num2, item4); } } selectionService.SetSelectedComponents(new IComponent[] { primarySelection }, SelectionTypes.Click | SelectionTypes.Replace); } } if (service != null) { ToolStripDropDown down2 = currentParent as ToolStripDropDown; if (down2 != null) { ToolStripItem component = down2.OwnerItem; service.OnComponentChanged(component, TypeDescriptor.GetProperties(component)["DropDownItems"], null, null); } else { service.OnComponentChanged(currentParent, TypeDescriptor.GetProperties(currentParent)["Items"], null, null); } if (flag) { if (down2 != null) { ToolStripItem item6 = down2.OwnerItem; service.OnComponentChanging(item6, TypeDescriptor.GetProperties(item6)["DropDownItems"]); service.OnComponentChanged(item6, TypeDescriptor.GetProperties(item6)["DropDownItems"], null, null); } else { service.OnComponentChanging(currentParent, TypeDescriptor.GetProperties(currentParent)["Items"]); service.OnComponentChanged(currentParent, TypeDescriptor.GetProperties(currentParent)["Items"], null, null); } } } foreach (ToolStripItem item7 in dragComponents) { if (item7 is ToolStripDropDownItem) { ToolStripMenuItemDesigner designer = host.GetDesigner(item7) as ToolStripMenuItemDesigner; if (designer != null) { designer.InitializeDropDown(); } } ToolStripDropDown down3 = item7.GetCurrentParent() as ToolStripDropDown; if ((down3 != null) && !(down3 is ToolStripOverflow)) { ToolStripDropDownItem item8 = down3.OwnerItem as ToolStripDropDownItem; if (item8 != null) { ToolStripMenuItemDesigner designer2 = host.GetDesigner(item8) as ToolStripMenuItemDesigner; if (designer2 != null) { designer2.InitializeBodyGlyphsForItems(false, item8); designer2.InitializeBodyGlyphsForItems(true, item8); } } } } BehaviorService behaviorService = this.GetBehaviorService(dragItem); if (behaviorService != null) { behaviorService.SyncSelection(); } } catch (Exception exception) { if (transaction != null) { transaction.Cancel(); transaction = null; } if (System.Windows.Forms.ClientUtils.IsCriticalException(exception)) { throw; } } finally { if (transaction != null) { transaction.Commit(); transaction = null; } } } } }
public string GetComponentName() { return(TypeDescriptor.GetComponentName(Object.GetType())); }
/// <summary>GetComponentName.</summary> /// <returns>String</returns> public String GetComponentName() { return(TypeDescriptor.GetComponentName(m_SelectedObject, true)); }
string ICustomTypeDescriptor.GetComponentName() { return(TypeDescriptor.GetComponentName(component)); }
/// <summary> /// Returns a running com proxy from the running object table. the method takes the first proxy there matched with the input parameters. /// WARNING: the method returns always the first com proxy from the running object table if multiple (match) proxies exists. /// </summary> /// <param name="componentName">component name, for example Excel</param> /// <param name="className">class name, for example Application</param> /// <param name="throwExceptionIfNothingFound">throw an exception if no proxy was found</param> /// <returns>a native COM proxy</returns> public static object GetActiveProxy(string componentName, string className, bool throwExceptionIfNothingFound) { if (String.IsNullOrEmpty(componentName)) { throw new ArgumentNullException("componentName"); } if (String.IsNullOrEmpty(className)) { throw new ArgumentNullException("className"); } IEnumMoniker monikerList = null; IRunningObjectTable runningObjectTable = null; try { // query table and returns null if no objects runnings if (GetRunningObjectTable(0, out runningObjectTable) != 0 || runningObjectTable == null) { return(null); } // query moniker & reset runningObjectTable.EnumRunning(out monikerList); monikerList.Reset(); IMoniker[] monikerContainer = new IMoniker[1]; IntPtr pointerFetchedMonikers = IntPtr.Zero; // fetch all moniker while (monikerList.Next(1, monikerContainer, pointerFetchedMonikers) == 0) { // query com proxy info object comInstance = null; runningObjectTable.GetObject(monikerContainer[0], out comInstance); if (null == comInstance) { continue; } // get class name and component name string name = TypeDescriptor.GetClassName(comInstance); string component = TypeDescriptor.GetComponentName(comInstance, false); // match for equal and return bool componentNameEqual = (componentName.Equals(component, StringComparison.InvariantCultureIgnoreCase)); bool classNameEqual = (className.Equals(name, StringComparison.InvariantCultureIgnoreCase)); if (componentNameEqual && classNameEqual) { return(comInstance); } else { componentNameEqual = ((_ballmersPlace + componentName).Equals(component, StringComparison.InvariantCultureIgnoreCase)); if (componentNameEqual && classNameEqual) { return(comInstance); } else { if (comInstance.GetType().IsCOMObject) { TryMarshalReleaseComObject(comInstance); } } } } if (throwExceptionIfNothingFound) { throw new COMException("Target instance is not running."); } else { return(null); } } catch (Exception exception) { DebugConsole.Default.WriteException(exception); throw; } finally { // release proxies if (runningObjectTable != null) { TryMarshalReleaseComObject(runningObjectTable); } if (monikerList != null) { TryMarshalReleaseComObject(monikerList); } } }
public string GetComponentName() { return(TypeDescriptor.GetComponentName(_wrappedObject)); }
// OLE DragDrop virtual methods /// <summary> /// OnDragDrop can be overridden so that a Behavior can specify its own Drag/Drop rules. /// </summary> public override void OnDragDrop(Glyph g, DragEventArgs e) { ToolStripItem currentDropItem = ToolStripDesigner.s_dragItem; // Ensure that the list item index is contained in the data. if (e.Data is ToolStripItemDataObject && currentDropItem != null) { ToolStripItemDataObject data = (ToolStripItemDataObject)e.Data; // Get the PrimarySelection before the Drag operation... ToolStripItem selectedItem = data.PrimarySelection; IDesignerHost designerHost = (IDesignerHost)currentDropItem.Site.GetService(typeof(IDesignerHost)); Debug.Assert(designerHost != null, "Invalid DesignerHost"); //Do DragDrop only if currentDropItem has changed. if (currentDropItem != selectedItem && designerHost != null) { ArrayList components = data.DragComponents; ToolStrip parentToolStrip = currentDropItem.GetCurrentParent(); int primaryIndex = -1; string transDesc; bool copy = (e.Effect == DragDropEffects.Copy); if (components.Count == 1) { string name = TypeDescriptor.GetComponentName(components[0]); if (name is null || name.Length == 0) { name = components[0].GetType().Name; } transDesc = string.Format(copy ? SR.BehaviorServiceCopyControl : SR.BehaviorServiceMoveControl, name); } else { transDesc = string.Format(copy ? SR.BehaviorServiceCopyControls : SR.BehaviorServiceMoveControls, components.Count); } DesignerTransaction designerTransaction = designerHost.CreateTransaction(transDesc); try { if (currentDropItem.Site.TryGetService(out IComponentChangeService changeService)) { if (parentToolStrip is ToolStripDropDown dropDown) { ToolStripItem ownerItem = dropDown.OwnerItem; changeService.OnComponentChanging(ownerItem, TypeDescriptor.GetProperties(ownerItem)["DropDownItems"]); } else { changeService.OnComponentChanging(parentToolStrip, TypeDescriptor.GetProperties(parentToolStrip)["Items"]); } } // If we are copying, then we want to make a copy of the components we are dragging if (copy) { // Remember the primary selection if we had one if (selectedItem != null) { primaryIndex = components.IndexOf(selectedItem); } ToolStripKeyboardHandlingService keyboardHandlingService = GetKeyBoardHandlingService(selectedItem); if (keyboardHandlingService != null) { keyboardHandlingService.CopyInProgress = true; } components = DesignerUtils.CopyDragObjects(components, currentDropItem.Site) as ArrayList; if (keyboardHandlingService != null) { keyboardHandlingService.CopyInProgress = false; } if (primaryIndex != -1) { selectedItem = components[primaryIndex] as ToolStripItem; } } if (e.Effect == DragDropEffects.Move || copy) { ISelectionService selSvc = GetSelectionService(currentDropItem); if (selSvc != null) { // Insert the item. if (parentToolStrip is ToolStripOverflow) { parentToolStrip = (((ToolStripOverflow)parentToolStrip).OwnerItem).Owner; } int indexOfItemUnderMouseToDrop = parentToolStrip.Items.IndexOf(ToolStripDesigner.s_dragItem); if (indexOfItemUnderMouseToDrop != -1) { int indexOfPrimarySelection = 0; if (selectedItem != null) { indexOfPrimarySelection = parentToolStrip.Items.IndexOf(selectedItem); } if (indexOfPrimarySelection != -1 && indexOfItemUnderMouseToDrop > indexOfPrimarySelection) { indexOfItemUnderMouseToDrop--; } foreach (ToolStripItem item in components) { parentToolStrip.Items.Insert(indexOfItemUnderMouseToDrop, item); } } selSvc.SetSelectedComponents(new IComponent[] { selectedItem }, SelectionTypes.Primary | SelectionTypes.Replace); } } if (changeService != null) { ToolStripDropDown dropDown = parentToolStrip as ToolStripDropDown; if (dropDown != null) { ToolStripItem ownerItem = dropDown.OwnerItem; changeService.OnComponentChanged(ownerItem, TypeDescriptor.GetProperties(ownerItem)["DropDownItems"]); } else { changeService.OnComponentChanged(parentToolStrip, TypeDescriptor.GetProperties(parentToolStrip)["Items"]); } //fire extra changing/changed events. if (copy) { if (dropDown != null) { ToolStripItem ownerItem = dropDown.OwnerItem; changeService.OnComponentChanging(ownerItem, TypeDescriptor.GetProperties(ownerItem)["DropDownItems"]); changeService.OnComponentChanged(ownerItem, TypeDescriptor.GetProperties(ownerItem)["DropDownItems"]); } else { changeService.OnComponentChanging(parentToolStrip, TypeDescriptor.GetProperties(parentToolStrip)["Items"]); changeService.OnComponentChanged(parentToolStrip, TypeDescriptor.GetProperties(parentToolStrip)["Items"]); } } } //If Parent is DropDown... we have to manage the Glyphs .... foreach (ToolStripItem item in components) { if (item is ToolStripDropDownItem) { if (designerHost.GetDesigner(item) is ToolStripMenuItemDesigner itemDesigner) { itemDesigner.InitializeDropDown(); } } if (item.GetCurrentParent() is ToolStripDropDown dropDown && !(dropDown is ToolStripOverflow)) { if (dropDown.OwnerItem is ToolStripDropDownItem ownerItem) { if (designerHost.GetDesigner(ownerItem) is ToolStripMenuItemDesigner ownerDesigner) { ownerDesigner.InitializeBodyGlyphsForItems(false, ownerItem); ownerDesigner.InitializeBodyGlyphsForItems(true, ownerItem); } } } } // Refresh on SelectionManager... BehaviorService bSvc = GetBehaviorService(currentDropItem); if (bSvc != null) { bSvc.SyncSelection(); } } catch (Exception ex) { if (designerTransaction != null) { designerTransaction.Cancel(); designerTransaction = null; } if (ClientUtils.IsCriticalException(ex)) { throw; } } finally { if (designerTransaction != null) { designerTransaction.Commit(); } } } } }
string ICustomTypeDescriptor.GetComponentName() { return(TypeDescriptor.GetComponentName(_jsonObject, true)); }
string ICustomTypeDescriptor.GetComponentName() { return(TypeDescriptor.GetComponentName(this.column)); }
public string GetComponentName() => TypeDescriptor.GetComponentName(this, true);
public virtual string GetComponentName() { var name = TypeDescriptor.GetComponentName(this, true); return(name); }
/// <summary> /// Returns all running com proxies from the running object table there matched with the input parameters /// WARNING: the method returns always the first com proxy from the running object table if multiple (match) proxies exists. /// </summary> /// <param name="componentName">component name, for example Excel, null is a wildcard </param> /// <param name="className">class name, for example Application, null is a wildcard </param> /// <returns>COM proxy enumerator</returns> public static IDisposableSequence GetActiveProxies(string componentName, string className) { IEnumMoniker monikerList = null; IRunningObjectTable runningObjectTable = null; List <object> resultList = new List <object>(); try { // query table and returns null if no objects running if (GetRunningObjectTable(0, out runningObjectTable) != 0 || runningObjectTable == null) { return(null); } // query moniker & reset runningObjectTable.EnumRunning(out monikerList); monikerList.Reset(); IMoniker[] monikerContainer = new IMoniker[1]; IntPtr pointerFetchedMonikers = IntPtr.Zero; // fetch all moniker while (monikerList.Next(1, monikerContainer, pointerFetchedMonikers) == 0) { // query com proxy info object comInstance = null; runningObjectTable.GetObject(monikerContainer[0], out comInstance); if (null == comInstance) { continue; } // get class name and component name string name = TypeDescriptor.GetClassName(comInstance); string component = TypeDescriptor.GetComponentName(comInstance, false); // match for equal and add to list bool componentNameEqual = String.IsNullOrWhiteSpace(component) ? true : (componentName.Equals(component, StringComparison.InvariantCultureIgnoreCase)); bool classNameEqual = String.IsNullOrWhiteSpace(className) ? true : (className.Equals(name, StringComparison.InvariantCultureIgnoreCase)); if (componentNameEqual && classNameEqual) { resultList.Add(comInstance); } else { componentNameEqual = ((_ballmersPlace + componentName).Equals(component, StringComparison.InvariantCultureIgnoreCase)); if (componentNameEqual && classNameEqual) { resultList.Add(comInstance); } else { if (comInstance.GetType().IsCOMObject) { TryMarshalReleaseComObject(comInstance); } } } } return(new DisposableObjectList(resultList.ToArray())); } catch (Exception exception) { DebugConsole.Default.WriteException(exception); throw; } finally { // release proxies if (runningObjectTable != null) { TryMarshalReleaseComObject(runningObjectTable); } if (monikerList != null) { TryMarshalReleaseComObject(monikerList); } } }
public String GetComponentName() { return(TypeDescriptor.GetComponentName(Strategy, true)); }
/// <summary> /// Determines a proxy with given display name currently exists /// </summary> /// <param name="proxyDisplayName">target display name</param> /// <param name="ignoreCase">ignore case when compare the name</param> /// <returns>true if proxy exists, otherwise false</returns> public static bool ActiveProxyExists(string proxyDisplayName, bool ignoreCase = true) { IEnumMoniker monikerList = null; IRunningObjectTable runningObjectTable = null; try { // query table and returns null if no objects running if (GetRunningObjectTable(0, out runningObjectTable) != 0 || runningObjectTable == null) { return(false); } // query moniker & reset runningObjectTable.EnumRunning(out monikerList); monikerList.Reset(); IMoniker[] monikerContainer = new IMoniker[1]; IntPtr pointerFetchedMonikers = IntPtr.Zero; // fetch all moniker while (monikerList.Next(1, monikerContainer, pointerFetchedMonikers) == 0) { // query com proxy info object comInstance = null; runningObjectTable.GetObject(monikerContainer[0], out comInstance); if (null == comInstance) { continue; } // match for equal and add to list string name = TypeDescriptor.GetClassName(comInstance); string component = TypeDescriptor.GetComponentName(comInstance, false); IBindCtx bindInfo = null; string displayName = String.Empty; Guid classID = Guid.Empty; if (CreateBindCtx(0, out bindInfo) == 0) { monikerContainer[0].GetDisplayName(bindInfo, null, out displayName); monikerContainer[0].GetClassID(out classID); TryMarshalReleaseComObject(bindInfo); } string itemClassName = TypeDescriptor.GetClassName(comInstance); string itemComponentName = TypeDescriptor.GetComponentName(comInstance); COMTypes.ITypeInfo typeInfo = null; string itemLibrary = String.Empty; if (classID != Guid.Empty) { typeInfo = TryCreateTypeInfo(comInstance); itemLibrary = null != typeInfo?GetParentLibraryGuid(typeInfo).ToString() : String.Empty; } string itemID = classID != Guid.Empty ? classID.ToString() : String.Empty; if (classID != Guid.Empty && typeInfo != null) { ReleaseTypeInfo(typeInfo); } bool match = false; if (ignoreCase) { match = proxyDisplayName.Equals(displayName, StringComparison.InvariantCultureIgnoreCase); } else { match = proxyDisplayName.Equals(displayName); } if (match) { return(true); } } return(false); } catch (Exception exception) { DebugConsole.Default.WriteException(exception); throw; } finally { // release proxies if (runningObjectTable != null) { TryMarshalReleaseComObject(runningObjectTable); } if (monikerList != null) { TryMarshalReleaseComObject(monikerList); } } }
private void ReParentControls(ArrayList controls, bool copy) { IDesignerHost host = this.serviceProvider.GetService(typeof(IDesignerHost)) as IDesignerHost; if ((host != null) && (controls.Count > 0)) { string str; if ((controls.Count == 1) && (controls[0] is ToolStrip)) { string componentName = TypeDescriptor.GetComponentName(controls[0]); if ((componentName == null) || (componentName.Length == 0)) { componentName = controls[0].GetType().Name; } str = System.Design.SR.GetString(copy ? "BehaviorServiceCopyControl" : "BehaviorServiceMoveControl", new object[] { componentName }); } else { str = System.Design.SR.GetString(copy ? "BehaviorServiceCopyControls" : "BehaviorServiceMoveControls", new object[] { controls.Count }); } DesignerTransaction transaction = host.CreateTransaction(str); try { ArrayList objects = null; ISelectionService service = (ISelectionService)this.serviceProvider.GetService(typeof(ISelectionService)); if (copy) { objects = new ArrayList(); service = (ISelectionService)this.serviceProvider.GetService(typeof(ISelectionService)); } for (int i = 0; i < controls.Count; i++) { Control control = controls[i] as Control; if (control is ToolStrip) { if (copy) { objects.Clear(); objects.Add(control); objects = DesignerUtils.CopyDragObjects(objects, this.serviceProvider) as ArrayList; if (objects != null) { control = objects[0] as Control; control.Visible = true; } } Control relatedControl = this.relatedControl; IComponentChangeService service2 = this.serviceProvider.GetService(typeof(IComponentChangeService)) as IComponentChangeService; PropertyDescriptor member = TypeDescriptor.GetProperties(relatedControl)["Controls"]; Control parent = control.Parent; if ((parent != null) && !copy) { if (service2 != null) { service2.OnComponentChanging(parent, member); } parent.Controls.Remove(control); } if (service2 != null) { service2.OnComponentChanging(relatedControl, member); } relatedControl.Controls.Add(control); if (((service2 != null) && (parent != null)) && !copy) { service2.OnComponentChanged(parent, member, null, null); } if (service2 != null) { service2.OnComponentChanged(relatedControl, member, null, null); } if (service != null) { service.SetSelectedComponents(new object[] { control }, (i == 0) ? (SelectionTypes.Click | SelectionTypes.Replace) : SelectionTypes.Add); } } } } catch { if (transaction != null) { transaction.Cancel(); transaction = null; } } finally { if (transaction != null) { transaction.Commit(); transaction = null; } } } }
/// <summary> /// Returns all running com proxies + add. informations from the running object table there matched with the input parameters /// WARNING: the method returns always the first com proxy from the running object table if multiple (match) proxies exists. /// </summary> /// <returns>IDisposableEnumeration with proxy informations</returns> public static IDisposableSequence <ProxyInformation> GetActiveProxyInformations() { IEnumMoniker monikerList = null; IRunningObjectTable runningObjectTable = null; RunningObjectTableItemCollection resultList = new RunningObjectTableItemCollection(); try { // query table and returns null if no objects running if (GetRunningObjectTable(0, out runningObjectTable) != 0 || runningObjectTable == null) { return(null); } // query moniker & reset runningObjectTable.EnumRunning(out monikerList); monikerList.Reset(); IMoniker[] monikerContainer = new IMoniker[1]; IntPtr pointerFetchedMonikers = IntPtr.Zero; // fetch all moniker while (monikerList.Next(1, monikerContainer, pointerFetchedMonikers) == 0) { // query com proxy info object comInstance = null; runningObjectTable.GetObject(monikerContainer[0], out comInstance); if (null == comInstance) { continue; } string name = TypeDescriptor.GetClassName(comInstance); string component = TypeDescriptor.GetComponentName(comInstance, false); IBindCtx bindInfo = null; string displayName = String.Empty; Guid classID = Guid.Empty; if (CreateBindCtx(0, out bindInfo) == 0) { monikerContainer[0].GetDisplayName(bindInfo, null, out displayName); monikerContainer[0].GetClassID(out classID); TryMarshalReleaseComObject(bindInfo); } string itemClassName = TypeDescriptor.GetClassName(comInstance); string itemComponentName = TypeDescriptor.GetComponentName(comInstance); COMTypes.ITypeInfo typeInfo = null; string itemLibrary = String.Empty; if (classID != Guid.Empty) { typeInfo = TryCreateTypeInfo(comInstance); itemLibrary = null != typeInfo?GetParentLibraryGuid(typeInfo).ToString() : String.Empty; } string itemID = classID != Guid.Empty ? classID.ToString() : String.Empty; ProxyInformation entry = new ProxyInformation(comInstance, displayName, itemID, itemClassName, itemComponentName, itemLibrary, IntPtr.Zero, ProxyInformation.ProcessElevation.Unknown); resultList.Add(entry); if (classID != Guid.Empty && typeInfo != null) { ReleaseTypeInfo(typeInfo); } } return(resultList); } catch (Exception exception) { DebugConsole.Default.WriteException(exception); throw; } finally { // release proxies if (runningObjectTable != null) { TryMarshalReleaseComObject(runningObjectTable); } if (monikerList != null) { TryMarshalReleaseComObject(monikerList); } } }
string ICustomTypeDescriptor.GetComponentName() { return(TypeDescriptor.GetComponentName(ConfigUnit, true)); }
private static IDisposableSequence <ProxyInformation> GetKnownAccessibleProxiesFromPath(IEnumerable <AccessibleWindowTarget> targets, int maximumResultCount) { if (null == targets) { throw new ArgumentNullException("targets"); } RunningWindowTableItemCollection result = new RunningWindowTableItemCollection(); if (maximumResultCount <= 0) { return(result); } foreach (AccessibleWindowTarget target in targets) { WindowEnumerator enumerator = new WindowEnumerator( target.MainClassName, target.MainClassNameEnd, (WindowEnumerator.FilterMode)Convert.ToInt32(target.NameCompare)); IntPtr[] mainHandles = enumerator.EnumerateWindows(_mainWindowTimeoutMilliseconds); if (null == mainHandles) { continue; } foreach (IntPtr item in mainHandles) { ChildWindowBatchEnumerator childEnumerator = new ChildWindowBatchEnumerator(item); foreach (string subItem in target.ChildPath) { childEnumerator.SearchOrder.Add( new ChildWindowBatchEnumerator.SearchCriteria(subItem)); } IntPtr[] childHandles = childEnumerator.EnumerateWindows(_childWindowTimeoutMilliseconds); if (null == childHandles) { continue; } foreach (IntPtr childHandle in childHandles) { object accObject = Win32.AccessibleObjectFromWindow(childHandle); if (null != accObject && accObject is MarshalByRefObject) { object targetProxy = null; if (!String.IsNullOrEmpty(target.AccPropertyName)) { targetProxy = TryInvokeProperty(accObject, target.AccPropertyName); Marshal.ReleaseComObject(accObject); } else { targetProxy = accObject; } if (null != targetProxy) { string itemComponentName = TypeDescriptor.GetComponentName(targetProxy); COMTypes.ITypeInfo typeInfo = RunningObjectTable.TryCreateTypeInfo(targetProxy); string library = RunningObjectTable.GetParentLibraryGuid(typeInfo).ToString(); string id = GetTypeGuid(typeInfo).ToString(); string itemClassName = TypeDescriptor.GetClassName(targetProxy); string itemCaption = itemClassName; if (!String.IsNullOrWhiteSpace(itemClassName) && !String.IsNullOrWhiteSpace(itemComponentName)) { itemCaption = String.Format("{0} {1}", itemComponentName, itemClassName); } IntPtr procID = Win32.GetWindowThreadProcessId(childHandle); ProxyInformation.ProcessElevation procElevation = ProcessElevation.ConvertToProcessElevation(ProcessElevation.IsProcessElevated(procID)); ProxyInformation info = new ProxyInformation(targetProxy, itemCaption, id, itemClassName, itemComponentName, library, procID, procElevation); result.Add(info); if (null != typeInfo) { RunningObjectTable.ReleaseTypeInfo(typeInfo); } if (result.Count >= maximumResultCount) { return(result); } } } } } } return(result); }
private void EndDragDrop(bool allowSetChildIndexOnDrop) { Control target = this.data.Target as Control; if (target != null) { if (this.serviceProviderTarget == null) { this.serviceProviderTarget = target.Site; if (this.serviceProviderTarget == null) { return; } } if (this.destHost == null) { this.destHost = (IDesignerHost)this.serviceProviderTarget.GetService(typeof(IDesignerHost)); if (this.destHost == null) { return; } } if (this.behaviorServiceTarget == null) { this.behaviorServiceTarget = (BehaviorService)this.serviceProviderTarget.GetService(typeof(BehaviorService)); if (this.behaviorServiceTarget == null) { return; } } ArrayList list = null; bool flag = this.lastEffect == DragDropEffects.Copy; Control source = this.data.Source; bool localDrag = source.Equals(target); PropertyDescriptor member = TypeDescriptor.GetProperties(target)["Controls"]; PropertyDescriptor descriptor2 = TypeDescriptor.GetProperties(source)["Controls"]; IComponentChangeService service = (IComponentChangeService)this.serviceProviderSource.GetService(typeof(IComponentChangeService)); IComponentChangeService service2 = (IComponentChangeService)this.serviceProviderTarget.GetService(typeof(IComponentChangeService)); if (this.dragAssistanceManager != null) { this.dragAssistanceManager.OnMouseUp(); } ISelectionService service3 = null; if (flag || ((this.srcHost != this.destHost) && (this.destHost != null))) { service3 = (ISelectionService)this.serviceProviderTarget.GetService(typeof(ISelectionService)); } try { if ((this.dragComponents != null) && (this.dragComponents.Length > 0)) { string str; DesignerTransaction transaction = null; DesignerTransaction transaction2 = null; if (this.dragComponents.Length == 1) { string componentName = TypeDescriptor.GetComponentName(this.dragComponents[0].dragComponent); if ((componentName == null) || (componentName.Length == 0)) { componentName = this.dragComponents[0].dragComponent.GetType().Name; } str = System.Design.SR.GetString(flag ? "BehaviorServiceCopyControl" : "BehaviorServiceMoveControl", new object[] { componentName }); } else { str = System.Design.SR.GetString(flag ? "BehaviorServiceCopyControls" : "BehaviorServiceMoveControls", new object[] { this.dragComponents.Length }); } if ((this.srcHost != null) && (((this.srcHost == this.destHost) || (this.destHost == null)) || !flag)) { transaction = this.srcHost.CreateTransaction(str); } if ((this.srcHost != this.destHost) && (this.destHost != null)) { transaction2 = this.destHost.CreateTransaction(str); } try { ComponentTray tray = null; int num = 0; if (flag) { tray = this.serviceProviderTarget.GetService(typeof(ComponentTray)) as ComponentTray; num = (tray != null) ? tray.Controls.Count : 0; ArrayList objects = new ArrayList(); for (int j = 0; j < this.dragComponents.Length; j++) { objects.Add(this.dragComponents[j].dragComponent); } objects = DesignerUtils.CopyDragObjects(objects, this.serviceProviderTarget) as ArrayList; if (objects == null) { return; } list = new ArrayList(); for (int k = 0; k < objects.Count; k++) { list.Add(this.dragComponents[k].dragComponent); this.dragComponents[k].dragComponent = objects[k]; } } if ((!localDrag || flag) && ((service != null) && (service2 != null))) { service2.OnComponentChanging(target, member); if (!flag) { service.OnComponentChanging(source, descriptor2); } } int num4 = ParentControlDesigner.DetermineTopChildIndex(target); this.DropControl(this.primaryComponentIndex, target, source, localDrag); Point p = this.behaviorServiceSource.AdornerWindowPointToScreen(this.dragComponents[this.primaryComponentIndex].draggedLocation); p = ((Control)this.dragComponents[this.primaryComponentIndex].dragComponent).Parent.PointToClient(p); if (((Control)this.dragComponents[this.primaryComponentIndex].dragComponent).Parent.IsMirrored) { p.Offset(-((Control)this.dragComponents[this.primaryComponentIndex].dragComponent).Width, 0); } Control dragComponent = this.dragComponents[this.primaryComponentIndex].dragComponent as Control; PropertyDescriptor descriptor3 = TypeDescriptor.GetProperties(dragComponent)["Location"]; if ((dragComponent != null) && (descriptor3 != null)) { try { service2.OnComponentChanging(dragComponent, descriptor3); } catch (CheckoutException exception) { if (exception != CheckoutException.Canceled) { throw; } return; } } this.SetLocationPropertyAndChildIndex(this.primaryComponentIndex, target, p, this.shareParent ? (num4 + this.dragComponents[this.primaryComponentIndex].zorderIndex) : num4, allowSetChildIndexOnDrop); if (service3 != null) { service3.SetSelectedComponents(new object[] { this.dragComponents[this.primaryComponentIndex].dragComponent }, SelectionTypes.Click | SelectionTypes.Replace); } for (int i = 0; i < this.dragComponents.Length; i++) { if (i != this.primaryComponentIndex) { this.DropControl(i, target, source, localDrag); Point dropPoint = new Point(p.X + this.dragComponents[i].positionOffset.X, p.Y + this.dragComponents[i].positionOffset.Y); this.SetLocationPropertyAndChildIndex(i, target, dropPoint, this.shareParent ? (num4 + this.dragComponents[i].zorderIndex) : num4, allowSetChildIndexOnDrop); if (service3 != null) { service3.SetSelectedComponents(new object[] { this.dragComponents[i].dragComponent }, SelectionTypes.Add); } } } if ((!localDrag || flag) && ((service != null) && (service2 != null))) { service2.OnComponentChanged(target, member, target.Controls, target.Controls); if (!flag) { service.OnComponentChanged(source, descriptor2, source.Controls, source.Controls); } } if (list != null) { for (int m = 0; m < list.Count; m++) { this.dragComponents[m].dragComponent = list[m]; } list = null; } if (flag) { if (tray == null) { tray = this.serviceProviderTarget.GetService(typeof(ComponentTray)) as ComponentTray; } if (tray != null) { int num7 = tray.Controls.Count - num; if (num7 > 0) { ArrayList components = new ArrayList(); for (int n = 0; n < num7; n++) { components.Add(tray.Controls[num + n]); } tray.UpdatePastePositions(components); } } } this.CleanupDrag(false); if (transaction != null) { transaction.Commit(); transaction = null; } if (transaction2 != null) { transaction2.Commit(); transaction2 = null; } } finally { if (transaction != null) { transaction.Cancel(); } if (transaction2 != null) { transaction2.Cancel(); } } } } finally { if (list != null) { for (int num9 = 0; num9 < list.Count; num9++) { this.dragComponents[num9].dragComponent = list[num9]; } } this.CleanupDrag(false); if (this.statusCommandUITarget != null) { this.statusCommandUITarget.SetStatusInformation((service3 == null) ? (this.dragComponents[this.primaryComponentIndex].dragComponent as Component) : (service3.PrimarySelection as Component)); } } this.lastFeedbackLocation = new Point(-1, -1); } }
private void InitiateResize() { bool useSnapLines = this.BehaviorService.UseSnapLines; ArrayList dragComponents = new ArrayList(); IDesignerHost service = this.serviceProvider.GetService(typeof(IDesignerHost)) as IDesignerHost; for (int i = 0; i < this.resizeComponents.Length; i++) { this.resizeComponents[i].resizeBounds = ((Control)this.resizeComponents[i].resizeControl).Bounds; if (useSnapLines) { dragComponents.Add(this.resizeComponents[i].resizeControl); } if (service != null) { ControlDesigner designer = service.GetDesigner(this.resizeComponents[i].resizeControl as Component) as ControlDesigner; if (designer != null) { this.resizeComponents[i].resizeRules = designer.SelectionRules; } else { this.resizeComponents[i].resizeRules = SelectionRules.None; } } } this.BehaviorService.EnableAllAdorners(false); IDesignerHost host2 = (IDesignerHost)this.serviceProvider.GetService(typeof(IDesignerHost)); if (host2 != null) { string str; if (this.resizeComponents.Length == 1) { string componentName = TypeDescriptor.GetComponentName(this.resizeComponents[0].resizeControl); if ((componentName == null) || (componentName.Length == 0)) { componentName = this.resizeComponents[0].resizeControl.GetType().Name; } str = System.Design.SR.GetString("BehaviorServiceResizeControl", new object[] { componentName }); } else { str = System.Design.SR.GetString("BehaviorServiceResizeControls", new object[] { this.resizeComponents.Length }); } this.resizeTransaction = host2.CreateTransaction(str); } this.initialResize = true; if (useSnapLines) { this.dragManager = new DragAssistanceManager(this.serviceProvider, dragComponents, true); } else if (this.resizeComponents.Length > 0) { Control resizeControl = this.resizeComponents[0].resizeControl as Control; if ((resizeControl != null) && (resizeControl.Parent != null)) { PropertyDescriptor descriptor = TypeDescriptor.GetProperties(resizeControl.Parent)["SnapToGrid"]; if ((descriptor != null) && ((bool)descriptor.GetValue(resizeControl.Parent))) { PropertyDescriptor descriptor2 = TypeDescriptor.GetProperties(resizeControl.Parent)["GridSize"]; if (descriptor2 != null) { this.parentGridSize = (Size)descriptor2.GetValue(resizeControl.Parent); this.parentLocation = this.behaviorService.ControlToAdornerWindow(resizeControl); this.parentLocation.X -= resizeControl.Location.X; this.parentLocation.Y -= resizeControl.Location.Y; } } } } this.captureLost = false; }
public string GetComponentName() { return(TypeDescriptor.GetComponentName(this.object_0)); }
string ICustomTypeDescriptor.GetComponentName() { string cn = TypeDescriptor.GetComponentName(this, true); return(cn); }
string ICustomTypeDescriptor.GetComponentName() { return(TypeDescriptor.GetComponentName(this, true)); }
// Token: 0x06000037 RID: 55 RVA: 0x0000272A File Offset: 0x0000092A string ICustomTypeDescriptor.GetComponentName() { return(TypeDescriptor.GetComponentName(this.Target)); }
public string GetComponentName() { return(TypeDescriptor.GetComponentName(this, true)); }
public string GetComponentName() { return(TypeDescriptor.GetComponentName(mCurrentSelectObject)); }