public ToolStripTemplateNode(IComponent component, string text, Image image) { this.component = component; this.activeItem = component as ToolStripItem; this._designerHost = (IDesignerHost) component.Site.GetService(typeof(IDesignerHost)); this._designer = this._designerHost.GetDesigner(component); this._designSurface = (DesignSurface) component.Site.GetService(typeof(DesignSurface)); if (this._designSurface != null) { this._designSurface.Flushed += new EventHandler(this.OnLoaderFlushed); } if (!isScalingInitialized) { if (System.Windows.Forms.DpiHelper.IsScalingRequired) { TOOLSTRIP_TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x16); TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x13); TOOLSTRIP_TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x5c); TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x1f); TEMPLATE_HOTREGION_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(9); MINITOOLSTRIP_DROPDOWN_BUTTON_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(11); MINITOOLSTRIP_TEXTBOX_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(90); } isScalingInitialized = true; } this.SetupNewEditNode(this, text, image, component); this.commands = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveRight), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Delete), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Cut), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Copy), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeRight), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightDecrease) }; this.addCommands = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Undo), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Redo) }; }
public AttributeCollection GetDesignerAttributes(IDesigner designer) { if (designer == null) { throw new ArgumentNullException("designer"); } if (this._attributeHash == null) { this._attributeHash = new Hashtable(); } else { this._attributeHash.Clear(); } if (!(designer is ITreeDesigner)) { IComponent rootComponent = this._host.RootComponent; if (rootComponent != null) { this.RecurseDesignerTree(this._host.GetDesigner(rootComponent), this._attributeHash); } } this.RecurseDesignerTree(designer, this._attributeHash); Attribute[] array = new Attribute[this._attributeHash.Values.Count]; this._attributeHash.Values.CopyTo(array, 0); return new AttributeCollection(array); }
private void OnTypeDescriptorRefresh(RefreshEventArgs r) { if (r.ComponentChanged == this._filterDesigner) { this._filter = null; this._filterDesigner = null; } }
public override bool CanBeParentedTo(IDesigner parentDesigner) { if (parentDesigner == null) { return false; } return (parentDesigner.Component is WizardControl); }
/* * CanBeParentedTo */ /// <summary> /// Indicates if this designer's control can be parented by the control of the specified designer. /// </summary> /// <param name="parentDesigner">The <see cref="T:System.ComponentModel.Design.IDesigner"></see> that manages the control to check.</param> /// <returns> /// true if the control managed by the specified designer can parent the control managed by this designer; otherwise, false. /// </returns> public override bool CanBeParentedTo(IDesigner parentDesigner) { if (parentDesigner != null) { return parentDesigner.Component is NuGenTabControl; } return false; }
/// <summary> /// Indicates if this designer's control can be parented by the control of the specified designer. /// </summary> /// <param name="parentDesigner">The <see cref="T:System.ComponentModel.Design.IDesigner"></see> that manages the control to check.</param> /// <returns> /// true if the control managed by the specified designer can parent the control managed by this designer; otherwise, false. /// </returns> public override bool CanBeParentedTo(IDesigner parentDesigner) { if (parentDesigner != null) { return parentDesigner.Component is NuGenNavigationBar; } return false; }
public ComponentTray (IDesigner mainDesigner, IServiceProvider serviceProvider) { if (mainDesigner == null) { throw new ArgumentNullException ("mainDesigner"); } if (serviceProvider == null) { throw new ArgumentNullException ("serviceProvider"); } _mainDesigner = mainDesigner; _serviceProvider = serviceProvider; }
public ToolStripTemplateNode(IComponent component, string text, Image image) { this.component = component; this.activeItem = component as ToolStripItem; this._designerHost = (IDesignerHost) component.Site.GetService(typeof(IDesignerHost)); this._designer = this._designerHost.GetDesigner(component); this._designSurface = (DesignSurface) component.Site.GetService(typeof(DesignSurface)); if (this._designSurface != null) { this._designSurface.Flushed += new EventHandler(this.OnLoaderFlushed); } this.SetupNewEditNode(this, text, image, component); this.commands = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveRight), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Delete), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Cut), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Copy), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeRight), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightDecrease) }; this.addCommands = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Undo), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Redo) }; }
/// <summary> /// Initialize a new instance of the KryptonSplitContainerGlyph class. /// </summary> /// <param name="selectionService">Reference to the selection service.</param> /// <param name="behaviorService">Reference to the behavior service.</param> /// <param name="adorner">Reference to the containing adorner.</param> /// <param name="relatedDesigner">Reference to the containing designer.</param> public KryptonSplitContainerGlyph(ISelectionService selectionService, BehaviorService behaviorService, Adorner adorner, IDesigner relatedDesigner) : base(new KryptonSplitContainerBehavior(relatedDesigner)) { Debug.Assert(selectionService != null); Debug.Assert(behaviorService != null); Debug.Assert(adorner != null); Debug.Assert(relatedDesigner != null); // Remember incoming references _selectionService = selectionService; _behaviorService = behaviorService; _adorner = adorner; // Find the related control _splitContainer = relatedDesigner.Component as KryptonSplitContainer; // We want to know whenever the selection has changed or a property has changed _selectionService.SelectionChanged += new EventHandler(OnSelectionChanged); }
internal IDesigner GetDesigner(IComponent comp, ObjectInfo objInfo) { Console.WriteLine("Designer - GetDesigner - start " + comp + " " + objInfo + " "); DesignerAttribute da = null; if (comp == null) { return(null); } // For sites that are not ours, we don't treat them, unless // we are adding controls, we use our site instead if (comp.Site != null && !(comp.Site is DesignerSite)) { if (_addingControls) { comp.Site = null; } else { Console.WriteLine("Designer - GetDesigner - not ours " + comp.Site); return(null); } } DesignerSite site = (DesignerSite)comp.Site; // Don't allow getting a designer for anything higher than the // design surface if (comp == _designSurfaceParent) { return(null); } if (site == null) { String name; if (objInfo != null) { name = objInfo.ObjectName; } else { name = CompNumber.GetCompName(comp.GetType()); } Console.WriteLine("Comp.name: ", name); site = (DesignerSite)_container.CreateSite(comp, name); } if (site.Designer != null) { return(site.Designer); } IList attrs = Attribute.GetCustomAttributes(comp.GetType(), typeof(DesignerAttribute)); bool found = false; foreach (Attribute attr in attrs) { da = attr as DesignerAttribute; Console.WriteLine("Designer - GetDesigner da " + da.DesignerBaseTypeName + " " + da.DesignerTypeName); if (da.DesignerBaseTypeName.StartsWith("System.ComponentModel.Design.IRootDesigner")) { found = true; break; } } // Just take the first one if we did not find a root designer if (!found && attrs.Count > 0) { da = attrs[0] as DesignerAttribute; } if (da != null) { Type t = GetType(da.DesignerTypeName); Console.WriteLine("DesignerType: " + t.FullName); IDesigner d = (IDesigner)Activator.CreateInstance(t); if (_addingControls) { d.Initialize(comp); } site.Designer = d; if (comp is Control) { site.DesignWindowTarget = ((Control)comp).WindowTarget; } Console.WriteLine("Designer - GetDesigner " + site + " " + d); return(d); } Console.WriteLine("Designer - GetDesigner NOT FOUND " + comp); return(null); }
/// <summary> /// Indicates if this designer's control can be parented by the control of the specified designer. /// </summary> /// <param name="parentDesigner">The IDesigner that manages the control to check.</param> /// <returns>true if the control managed by the specified designer can parent the control managed by this designer; otherwise, false.</returns> public override bool CanBeParentedTo(IDesigner parentDesigner) { // We should only ever exist inside a Krypton split container return (parentDesigner is KryptonSplitContainerDesigner); }
public override bool CanBeParentedTo(IDesigner parentDesigner) { return(parentDesigner != null && parentDesigner.Component is TabList); }
public ComponentTray(IDesigner mainDesigner, IServiceProvider serviceProvider) : base() { }
public override bool CanBeParentedTo(IDesigner parentDesigner) { return base.CanBeParentedTo(parentDesigner); }
// Someone please tell me why the hell is this method here? // What about having ParentControlDesigner.CanParent(...) ? // public virtual bool CanBeParentedTo (IDesigner parentDesigner) { IDesignerHost host = this.GetService (typeof (IDesignerHost)) as IDesignerHost; if (parentDesigner is ParentControlDesigner && this.Component != host.RootComponent && !this.Control.Controls.Contains (((ParentControlDesigner)parentDesigner).Control)) { return true; } else { return false; } }
public override bool CanBeParentedTo(IDesigner parentDesigner) { return parentDesigner != null && parentDesigner.Component is TabList; }
internal virtual bool CanBeAssociatedWith(IDesigner parentDesigner) => true;
/// <include file='doc\DataFieldConverter.uex' path='docs/doc[@for="DataFieldConverter.GetStandardValues"]/*' /> /// <devdoc> /// <para> /// Gets the fields present within the selected data source if information about them is available. /// </para> /// </devdoc> public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { object[] names = null; String dataMember = null; bool autoGenerateFields = false; bool autoGenerateFieldsSet = false; ObjectList objectList = null; if (context != null) { ArrayList list = new ArrayList(); PropertyDescriptorCollection props = null; IComponent component = context.Instance as IComponent; if (component is IDeviceSpecificChoiceDesigner) { Object owner = ((ChoicePropertyFilter)component).Owner; PropertyDescriptor pd = ((ICustomTypeDescriptor)component).GetProperties()[_dataMemberPropertyName]; Debug.Assert(pd != null, "Cannot get DataMember"); if (owner is ObjectList) { autoGenerateFields = ((ObjectList)owner).AutoGenerateFields; autoGenerateFieldsSet = true; } component = ((IDeviceSpecificChoiceDesigner)component).UnderlyingControl; // See if owner already has a DataMember dataMember = (String)pd.GetValue(owner); Debug.Assert(dataMember != null); if (dataMember != null && dataMember.Length == 0) { // Get it from underlying object. dataMember = (String)pd.GetValue(component); Debug.Assert(dataMember != null); } } if (component != null) { objectList = component as ObjectList; if (objectList != null) { foreach (ObjectListField field in objectList.Fields) { list.Add(field.Name); } if (!autoGenerateFieldsSet) { autoGenerateFields = objectList.AutoGenerateFields; } } if (objectList == null || autoGenerateFields) { ISite componentSite = component.Site; if (componentSite != null) { IDesignerHost designerHost = (IDesignerHost)componentSite.GetService(typeof(IDesignerHost)); if (designerHost != null) { IDesigner designer = designerHost.GetDesigner(component); if (designer is IDataSourceProvider) { IEnumerable dataSource = null; if (!String.IsNullOrEmpty(dataMember)) { DataBindingCollection dataBindings = ((HtmlControlDesigner)designer).DataBindings; DataBinding binding = dataBindings[_dataSourcePropertyName]; if (binding != null) { dataSource = DesignTimeData.GetSelectedDataSource( component, binding.Expression, dataMember); } } else { dataSource = ((IDataSourceProvider)designer).GetResolvedSelectedDataSource(); } if (dataSource != null) { props = DesignTimeData.GetDataFields(dataSource); } } } } } } if (props != null) { foreach (PropertyDescriptor propDesc in props) { list.Add(propDesc.Name); } } names = list.ToArray(); Array.Sort(names); } return(new StandardValuesCollection(names)); }
public BorderLayoutActionList(IDesigner designer) : base(designer.Component) { this.designer = designer; }
public static IList <SqlTemplateModel> GetSqlTemplateModels(this IDesigner designer) { return(designer.GetElementsOfType(SqlTemplateModel.SpecializationTypeId) .Select(x => new SqlTemplateModel(x)) .ToList()); }
void DesignChecked(Object sender, EventArgs args) { Control selUIService = DesignerHost.Host.SelectionUIService; // Swap the design/non design panels by rebuilding the control // list for the wrapper panel. ObjectBrowser.DesignerHost.DesignMode = _designCheck.Checked; _wrapperPanel.Controls.Clear(); if (_designCheck.Checked) { // Move the controls from the non-design panel to the // design panel for (int i = 0; i < _nonDesignPanel.Controls.Count;) { Control c = (Control)_nonDesignPanel.Controls[i]; _nonDesignPanel.Controls.Remove(c); // This Control could have been added to the design // surface while it was not in design mode if (c.Site == null) { IDesigner designer = DesignerHost.Host.GetDesigner(c); if (designer != null) { designer.Initialize(c); } } _designPanel.Controls.Add(c); } SwitchWindowTarget(_designPanel); _wrapperPanel.Controls.Add(_designPanel); } else { // Move the controls from the design panel to the // non-design panel for (int i = 0; i < _designPanel.Controls.Count;) { Control c = (Control)_designPanel.Controls[i]; if (selUIService.Equals(c)) { i++; continue; } _designPanel.Controls.Remove(c); try { _nonDesignPanel.Controls.Add(c); } catch (Exception ex) { ErrorDialog.Show(ex, "Error adding control " + c + " to " + "non-design panel", MessageBoxIcon.Warning); i++; } } SwitchWindowTarget(_nonDesignPanel); _wrapperPanel.Controls.Add(_nonDesignPanel); } ResetSize(selUIService); new PanelLabel(_wrapperPanel, _desLabelPanel); }
internal static int GetMaxWidthToFit(MobileControl control, out byte templateStatus) { IDesigner parentDesigner = ControlDesigner(control.Parent); IDesigner controlDesigner = ControlDesigner(control); int defaultControlWidthInTemplate; NativeMethods.IHTMLElement2 htmlElement2Parent = null; if (controlDesigner == null) { templateStatus = CONTROL_IN_TEMPLATE_NONEDIT; return(0); } Debug.Assert(controlDesigner is MobileControlDesigner || controlDesigner is MobileTemplatedControlDesigner, "controlDesigner is not MobileControlDesigner or MobileTemplatedControlDesigner"); templateStatus = 0x00; if (parentDesigner is MobileTemplatedControlDesigner) { htmlElement2Parent = (NativeMethods.IHTMLElement2) ((MobileTemplatedControlDesigner)parentDesigner).DesignTimeElement; } else if (parentDesigner is MobileContainerDesigner) { htmlElement2Parent = (NativeMethods.IHTMLElement2) ((MobileContainerDesigner)parentDesigner).DesignTimeElement; } bool inTemplate; int nestingLevel = DesignerAdapterUtil.NestingLevel(control, out inTemplate, out defaultControlWidthInTemplate); if (inTemplate) { templateStatus = CONTROL_IN_TEMPLATE_EDIT; } if (htmlElement2Parent != null) { int maxWidth; if (!inTemplate) { Debug.Assert(control.Parent is MobileControl); Style parentStyle = ((MobileControl)control.Parent).Style; Alignment alignment = (Alignment)parentStyle[Style.AlignmentKey, true]; int parentChildOffset; // AUI 2786 if (alignment != Alignment.NotSet && alignment != Alignment.Left) { parentChildOffset = _regularParentChildOffset; } else { NativeMethods.IHTMLRectCollection rectColl; NativeMethods.IHTMLRect rect; int index = 0; Object obj = index; NativeMethods.IHTMLElement2 htmlElement2; if (controlDesigner is MobileControlDesigner) { htmlElement2 = (NativeMethods.IHTMLElement2)((MobileControlDesigner)controlDesigner).DesignTimeElement; } else { htmlElement2 = (NativeMethods.IHTMLElement2)((MobileTemplatedControlDesigner)controlDesigner).DesignTimeElement; } if (null == htmlElement2) { return(0); } try { rectColl = htmlElement2.GetClientRects(); } catch (Exception) { // this happens when switching from Design view to HTML view return(0); } Debug.Assert(rectColl.GetLength() == 1, "rectColl.GetLength() != 1"); rect = (NativeMethods.IHTMLRect)rectColl.Item(ref obj); parentChildOffset = rect.GetLeft(); rectColl = htmlElement2Parent.GetClientRects(); Debug.Assert(rectColl.GetLength() == 1); rect = (NativeMethods.IHTMLRect)rectColl.Item(ref obj); parentChildOffset -= rect.GetLeft(); } maxWidth = htmlElement2Parent.GetClientWidth() - _marginWidth - parentChildOffset; if (maxWidth > 0 && maxWidth > _defaultContainerWidth - nestingLevel * _marginPerLevel) { maxWidth = _defaultContainerWidth - nestingLevel * _marginPerLevel; } } else { int parentWidth = htmlElement2Parent.GetClientWidth(); if (parentWidth == 0) { // AUI 4525 maxWidth = defaultControlWidthInTemplate; } else { maxWidth = parentWidth - _templateParentChildOffset; } if (maxWidth > 0 && maxWidth > defaultControlWidthInTemplate - nestingLevel * _marginPerLevel) { maxWidth = defaultControlWidthInTemplate - nestingLevel * _marginPerLevel; } } return(maxWidth); } return(0); }
public override bool CanBeParentedTo(IDesigner parentDesigner) => parentDesigner?.Component is WizardPageContainer;
public DesignLayer(DesignerHost designerHost, IServiceProvider serviceProvider, string name, IDesigner parentDesigner, bool clearOnActivate) { this._designerHost = designerHost; this._serviceProvider = serviceProvider; this._name = name; this._parentDesigner = parentDesigner; this._clearOnActivate = clearOnActivate; }
IDesignLayer ILayeredDesignerHost.AddLayer(IServiceProvider serviceProvider, string name, IDesigner parentDesigner, bool clearOnActivate) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } if (parentDesigner == null) { throw new ArgumentNullException("parentDesigner"); } if (!this.DesignerTable.Contains(parentDesigner.Component)) { throw new ArgumentException("parentDesigner"); } IDesignLayer key = new DesignLayer(this, serviceProvider, name, parentDesigner, clearOnActivate); this.DesignLayers.Add(key, string.Empty); return key; }
/// <summary> /// Indicates if this designer's control can be parented by the control of the specified designer. /// </summary> /// <param name="parentDesigner">The IDesigner that manages the control to check.</param> /// <returns>true if the control managed by the specified designer can parent the control managed by this designer; otherwise, false.</returns> public override bool CanBeParentedTo(IDesigner parentDesigner) { // Can only place a KrytonPage in the KryptonNavigator return(parentDesigner?.Component is KryptonNavigator); }
internal override bool CanBeAssociatedWith(IDesigner parentDesigner) { return (parentDesigner is ToolStripDesigner); }
internal virtual bool CanBeAssociatedWith(IDesigner parentDesigner) { return(true); }
/// <summary> /// Indicates if this designer's control can be parented by the control of the specified designer. /// </summary> /// <param name="parentDesigner">The IDesigner that manages the control to check.</param> /// <returns>true if the control managed by the specified designer can parent the control managed by this designer; otherwise, false.</returns> public override bool CanBeParentedTo(IDesigner parentDesigner) { // Can only place a KrytonPage in the KryptonNavigator if (parentDesigner != null) return (parentDesigner.Component is KryptonNavigator); else return false; }
public override bool CanBeParentedTo(IDesigner parentDesigner) => ((parentDesigner != null) && (parentDesigner.Component is Form));
public virtual bool CanBeParentedTo(IDesigner parentDesigner) { ParentControlDesigner designer = parentDesigner as ParentControlDesigner; return ((designer != null) && !this.Control.Contains(designer.Control)); }
public override bool CanBeParentedTo(IDesigner parentDesigner) { return(parentDesigner is ICollapsibleContainerDesigner); }
public static IList <InstallationSettingsModel> GetInstallationSettingsModels(this IDesigner designer) { return(designer.GetElementsOfType(InstallationSettingsModel.SpecializationTypeId) .Select(x => new InstallationSettingsModel(x)) .ToList()); }
public void StartWorkflowInstances() { if (global.OpenRPAClient == null || !global.OpenRPAClient.isReadyForAction) { if (pendingTimer == null) { pendingTimer = new System.Timers.Timer(500); pendingTimer.Elapsed += (e, r) => { pendingTimer.Stop(); if (global.OpenRPAClient == null || !global.OpenRPAClient.isReadyForAction) { pendingTimer.Start(); return; } StartWorkflowInstances(); pendingTimer = null; }; pendingTimer.AutoReset = false; pendingTimer.Start(); } return; } foreach (var _instance in RunWorkflowInstances.ToList()) { if (!_instance.Value.Started) { try { _instance.Value.Started = true; var workflow = global.OpenRPAClient.GetWorkflowByIDOrRelativeFilename(_instance.Value.IDOrRelativeFilename); IWorkflowInstance instance = null; IDesigner designer = null; GenericTools.RunUI(() => { try { designer = global.OpenRPAClient.GetWorkflowDesignerByIDOrRelativeFilename(_instance.Value.IDOrRelativeFilename); if (designer != null) { designer.BreakpointLocations = null; // instance = workflow.CreateInstance(Arguments, null, null, designer.IdleOrComplete, designer.OnVisualTracking); instance = workflow.CreateInstance(_instance.Value.Arguments, null, null, IdleOrComplete, designer.OnVisualTracking); } else { instance = workflow.CreateInstance(_instance.Value.Arguments, null, null, IdleOrComplete, null); } instance.caller = _instance.Value.UniqueId; } catch (Exception ex) { _instance.Value.Error = ex; if (_instance.Value.Pending != null) { _instance.Value.Pending.Set(); } } if (designer != null) { designer.Run(designer.VisualTracking, designer.SlowMotion, instance); } else { if (instance != null) { instance.Run(); } } }); } catch (Exception ex) { _instance.Value.Error = ex; if (_instance.Value.Pending != null) { _instance.Value.Pending.Set(); } } } } }
public virtual bool CanBeParentedTo(IDesigner parentDesigner) { // TODO return false; }
/// <summary> /// Indicates if this designer's control can be parented by the control of the specified designer. /// </summary> /// <param name="parentDesigner">The IDesigner that manages the control to check.</param> /// <returns>true if the control managed by the specified designer can parent the control managed by this designer; otherwise, false.</returns> public override bool CanBeParentedTo(IDesigner parentDesigner) { // We should only ever exist inside a Krypton group container return((parentDesigner is KryptonGroup) || (parentDesigner is KryptonHeaderGroup)); }
// This is called during Dispose and Reload methods to unload the current designer. private void UnloadDocument() { if (helpService != null && rootDesigner != null) { helpService.RemoveContextAttribute("Keyword", "Designer_" + rootDesigner.GetType().FullName); } // Note: Because this can be called during Dispose, we are very anal here // about checking for null references. // If we can get a selection service, clear the selection... // we don't want the property browser browsing disposed components... // or components who's designer has been destroyed. IServiceProvider sp = (IServiceProvider)this; ISelectionService selectionService = (ISelectionService)sp.GetService(typeof(ISelectionService)); Debug.Assert(selectionService != null, "ISelectionService not found"); if (selectionService != null) { selectionService.SetSelectedComponents(null); } // Stash off the base designer and component. We are // going to be destroying these and we don't want them // to be accidently referenced after they're dead. // IDesigner rootDesignerHolder = rootDesigner; IComponent rootComponentHolder = rootComponent; rootDesigner = null; rootComponent = null; rootComponentClassName = null; SampleDesignSite[] siteArray = new SampleDesignSite[sites.Values.Count]; sites.Values.CopyTo(siteArray, 0); // Destroy all designers. We save the base designer for last. // IDesigner[] designers = new IDesigner[designerTable.Values.Count]; designerTable.Values.CopyTo(designers, 0); designerTable.Clear(); // Loading, unloading, it's all the same. It indicates that you // shouldn't dirty or otherwise mess with the buffer. We also // create a transaction here to limit the effects of making // so many changes. loadingDesigner = true; DesignerTransaction trans = CreateTransaction(); try { for (int i = 0; i < designers.Length; i++) { if (designers[i] != rootDesignerHolder) { try { designers[i].Dispose(); } catch { Debug.Fail("Designer " + designers[i].GetType().Name + " threw an exception during Dispose."); } } } // Now destroy all components. for (int i = 0; i < siteArray.Length; i++) { SampleDesignSite site = siteArray[i]; IComponent comp = site.Component; if (comp != null && comp != rootComponentHolder) { try { comp.Dispose(); } catch { Debug.Fail("Component " + site.Name + " threw during dispose. Bad component!!"); } if (comp.Site != null) { Debug.Fail("Component " + site.Name + " did not remove itself from its container"); Remove(comp); } } } // Finally, do the base designer and component. // if (rootDesignerHolder != null) { try { rootDesignerHolder.Dispose(); } catch { Debug.Fail("Designer " + rootDesignerHolder.GetType().Name + " threw an exception during Dispose."); } } if (rootComponentHolder != null) { try { rootComponentHolder.Dispose(); } catch { Debug.Fail("Component " + rootComponentHolder.GetType().Name + " threw during dispose. Bad component!!"); } if (rootComponentHolder.Site != null) { Debug.Fail("Component " + rootComponentHolder.Site.Name + " did not remove itself from its container"); Remove(rootComponentHolder); } } sites.Clear(); if (components != null) { components.Clear(); } } finally { loadingDesigner = false; trans.Commit(); } // And clear the document window // if (documentWindow != null) { documentWindow.SetDesigner(null); } }
public void CreatePictureDraft(IDesigner designer, TextReader textReader, TextWriter textWriter) { _pictureDraft = designer.CreateDraft(textWriter, textReader); }
public void Remove(IComponent component) { if (component == null) { throw new ArgumentException("component"); } // fire off changing and removing event ComponentEventArgs ce = new ComponentEventArgs(component); OnComponentChanging(component, null); try { if (ComponentRemoving != null) { ComponentRemoving(this, ce); } } catch { // dont throw here } // make sure we own the component if (component.Site != null && component.Site.Container == this) { // remove from extender provider list if (component is IExtenderProvider) { IExtenderProviderService extenderProvider = (IExtenderProviderService)GetService(typeof(IExtenderProviderService)); if (extenderProvider != null) { extenderProvider.RemoveExtenderProvider((IExtenderProvider)component); } } // remove the site sites.Remove(component.Site.Name); // dispose the designer IDesigner designer = designers[component] as IDesigner; if (designer != null) { designer.Dispose(); // get rid of the designer from the list designers.Remove(component); } // fire off removed event try { if (ComponentRemoved != null) { ComponentRemoved(this, ce); } this.OnComponentChanged(component, null, null, null); } catch { // dont throw here } // breakdown component, container, and site relationship component.Site = null; // now dispose the of the component too component.Dispose(); } }
public void Add(IComponent component, string name) { // we have to have a component if (component == null) { throw new ArgumentException("component"); } // if we dont have a name, create one if (name == null || name.Trim().Length == 0) { // we need the naming service INameCreationService nameCreationService = GetService(typeof(INameCreationService)) as INameCreationService; if (nameCreationService == null) { throw new Exception("Failed to get INameCreationService."); } name = nameCreationService.CreateName(this, component.GetType()); } // if we own the component and the name has changed // we just rename the component if (component.Site != null && component.Site.Container == this && name != null && string.Compare(name, component.Site.Name, true) != 0) { // name validation and component changing/changed events // are fired in the Site.Name property so we don't have // to do it here... component.Site.Name = name; // bail out return; } // create a site for the component ISite site = new SiteImpl(component, name, this); // create component-site association component.Site = site; // the container-component association was established when // we created the site through site.host. // we need to fire adding/added events. create a component event args // for the component we are adding. ComponentEventArgs evtArgs = new ComponentEventArgs(component); // fire off adding event if (ComponentAdding != null) { try { ComponentAdding(this, evtArgs); } catch {} } // if this is the root component IDesigner designer = null; if (rootComponent == null) { // set the root component rootComponent = component; // create the root designer designer = (IRootDesigner)TypeDescriptor.CreateDesigner(component, typeof(IRootDesigner)); } else { designer = TypeDescriptor.CreateDesigner(component, typeof(IDesigner)); } if (designer != null) { // add the designer to the list designers.Add(component, designer); // initialize the designer designer.Initialize(component); } // add to container component list sites.Add(site.Name, site); // now fire off added event if (ComponentAdded != null) { try { ComponentAdded(this, evtArgs); } catch {} } }
void IContainer.Add(IComponent component, string name) { if (component == null) { throw new ArgumentNullException("component"); } DesignSite site = this._newComponentSite; this._newComponentSite = null; if (name == null) { if (site != null) { name = site.Name; } else { name = this.GetNewComponentName(component.GetType()); } } ISite site2 = component.Site; if (((site2 != null) && (site2.Container == this)) && ((name != null) && !name.Equals(site2.Name))) { site2.Name = name; } if (!this.IsValidComponentName(name)) { throw new ArgumentException("'" + name + "' is not a valid name"); } if (this.ComponentTable[name] != null) { throw new ArgumentException("Component with name '" + name + "' already exists"); } if (site2 != null) { site2.Container.Remove(component); } ComponentEventArgs e = new ComponentEventArgs(component); this.OnComponentAdding(e); if (site == null) { IServiceProvider serviceProvider = null; if (this.ActiveLayer != null) { serviceProvider = this.ActiveLayer; } else { serviceProvider = this; } site = new DesignSite(serviceProvider, name); } else { site.Name = name; } bool flag = true; Type designerType = typeof(IDesigner); if ((this._documentComponent != null) && (this._rootComponent == null)) { designerType = typeof(IRootDesigner); } IDesigner designer = this.CreateComponentDesigner(component, designerType); if (designer == null) { throw new Exception("Unable to create a designer for component of type " + component.GetType().FullName); } if ((this._documentComponent == null) && name.Equals(this.DocumentComponentName)) { this._documentComponent = component; this._documentDesigner = designer; flag = false; } else if (this._rootComponent == null) { this._rootComponent = component; this._rootDesigner = designer; flag = false; } this.HasClearableComponents |= flag; site.SetComponent(component); component.Site = site; this.ComponentTable[name] = component; designer.Initialize(component); this.DesignerTable[component] = designer; this.OnComponentAdded(e); }
/// <summary> /// Indicates if this designer's control can be parented by the control of the specified designer. /// </summary> /// <param name="parentDesigner">The IDesigner that manages the control to check.</param> /// <returns>true if the control managed by the specified designer can parent the control managed by this designer; otherwise, false.</returns> public override bool CanBeParentedTo(IDesigner parentDesigner) { // We should only ever exist inside a Krypton split container return(parentDesigner is KryptonSplitContainerDesigner); }
private DesignerDataSourceView GetView(IDesigner dataBoundControlDesigner) { DataBoundControlDesigner designer = dataBoundControlDesigner as DataBoundControlDesigner; if (designer != null) { return designer.DesignerView; } BaseDataListDesigner designer2 = dataBoundControlDesigner as BaseDataListDesigner; if (designer2 != null) { return designer2.DesignerView; } RepeaterDesigner designer3 = dataBoundControlDesigner as RepeaterDesigner; if (designer3 != null) { return designer3.DesignerView; } return null; }
/// <summary> /// Initialize a new instance of the KryptonSplitContainerBehavior class. /// </summary> /// <param name="relatedDesigner">Reference to the containing designer.</param> public KryptonSplitContainerBehavior(IDesigner relatedDesigner) { _splitContainer = relatedDesigner.Component as KryptonSplitContainer; }
// the Controls must also be an IDesigner. public EditorControl(ServiceProvider site, IVsTextLines buffer, Control ctrl) : base(buffer){ this.control = ctrl; this.site = site; if (ctrl is IDesigner) { this.designer = (IDesigner)ctrl; } }
public override bool CanBeParentedTo(IDesigner parentDesigner) => parentDesigner?.Component is Control;
/// <param name="designer"> The property designer. </param> public PropertyDesignerManager(object instance, PropertyDescriptor descriptor, IDesigner designer) { _designer = designer; _designer.Disposed += new EventHandler(DesignerDisposed); _designer.Service.OnRequestSave += new RequestHandler(DesignerRequestedSave); _descriptor = descriptor; _descriptor.AddValueChanged(instance, new EventHandler(PropertyChanged)); _instance = instance; IDisposableNotify localInstance = _instance as IDisposableNotify; if (localInstance != null) { localInstance.Disposed += new EventHandler(InstanceDisposed); } ISite site = ((IComponent)_instance).Site; if (site != null) { _service = (IDesignService)site.GetService(typeof(IDesignService)); _service.Dependants.Add(_designer.Service); } else { _service = null; } }
///<summary> ///Indicates if this designer's control can be parented by the control of the specified designer. ///</summary> /// ///<returns> ///true if the control managed by the specified designer can parent the control managed by this designer; otherwise, false. ///</returns> /// ///<param name="parentDesigner">The <see cref="T:System.ComponentModel.Design.IDesigner"></see> that manages the control to check. </param> public override bool CanBeParentedTo(IDesigner parentDesigner) { return (parentDesigner is WizardDesigner); }
public override bool CanBeParentedTo(IDesigner parentDesigner) { return (parentDesigner.Component is TabStrip); }
public TabPanelActionList(IDesigner designer) : base(designer.Component) { this.designer = designer; }
/// <summary> /// Prevents the user to assign this page to anything else than a MultiPanel. /// </summary> /// <param name="parentDesigner"></param> /// <returns></returns> public override bool CanBeParentedTo(IDesigner parentDesigner) { return ((parentDesigner != null) && (parentDesigner.Component is MultiPanel)); }
public static IList <DTOModel> GetDTOModels(this IDesigner designer) { return(designer.GetElementsOfType(DTOModel.SpecializationTypeId) .Select(x => new DTOModel(x)) .ToList()); }
public AccordionActionList(IDesigner designer) : base(designer.Component) { this.designer = designer; }
/// <include file='doc\TabPageDesigner.uex' path='docs/doc[@for="TabPageDesigner.CanBeParentedTo"]/*' /> /// <devdoc> /// Determines if the this designer can be parented to the specified desinger -- /// generally this means if the control for this designer can be parented into the /// given ParentControlDesigner's designer. /// </devdoc> public override bool CanBeParentedTo(IDesigner parentDesigner) { return(parentDesigner is TabControlDesigner); }
internal override bool CanBeAssociatedWith(IDesigner parentDesigner) { return this.CanBeParentedTo(parentDesigner); }
public void Add(IComponent component, string name) { IDesigner designer = null; //input checks if (component == null) { throw new ArgumentException("Cannot add null component to container", "component"); } if (!(component is Control)) { throw new ArgumentException("This Container only accepts System.Web.UI.Control-derived components", "component"); } if (component.Site != null && component.Site.Container != this) { component.Site.Container.Remove(component); } //Check the name and create one if necessary INameCreationService nameService = host.GetService(typeof(INameCreationService)) as INameCreationService; if (nameService == null) { throw new Exception("The container must have access to a INameCreationService implementation"); } if (name == null || nameService.IsValidName(name)) { name = nameService.CreateName(this, component.GetType()); } //check we don't already have component with same name if (GetComponent(name) != null) { throw new ArgumentException("There is already a component with this name in the container", "name"); } //we're definately adding it now, so broadcast OnComponentAdding(component); //get a site and set ID property //this way (not PropertyDescriptor.SetValue) won't fire change events ((Control)component).ID = name; component.Site = new DesignSite(component, this); //Get designer. If first component, designer must be an IRootDesigner if (components.Count == 0) { host.SetRootComponent(component); designer = new RootDesigner(component); } //FIXME: Give Mono some base designers to find! We should never encounter this! //else // designer = TypeDescriptor.CreateDesigner (component, typeof(System.ComponentModel.Design.IDesigner)); if (designer == null) { //component.Site = null; //throw new Exception ("Designer could not be obtained for this component."); } else { //track and initialise it designers.Add(component, designer); designer.Initialize(component); } //add references to referenceManager, unless root component if (components.Count != 1) { host.WebFormReferenceManager.AddReference(component.GetType()); } //Finally put in container components.Add(component); //and broadcast completion OnComponentAdded(component); }
public void CollectionForm_CreateInstance_WithContextWithHostReturningComponent_CallsCreateComponent(IDesigner designer) { var mockEditorService = new Mock <IWindowsFormsEditorService>(MockBehavior.Strict); mockEditorService .Setup(s => s.ShowDialog(It.IsAny <Form>())) .Returns(DialogResult.OK); var mockServiceProvider = new Mock <IServiceProvider>(MockBehavior.Strict); mockServiceProvider .Setup(p => p.GetService(typeof(IWindowsFormsEditorService))) .Returns(mockEditorService.Object); var result = new Component(); var mockHost = new Mock <IDesignerHost>(MockBehavior.Strict); mockHost .Setup(h => h.CreateTransaction("Add or remove Int32 objects")) .Returns((DesignerTransaction)null); mockHost .Setup(c => c.GetService(typeof(IComponentChangeService))) .Returns(null); mockHost .Setup(h => h.CreateComponent(typeof(Component), null)) .Returns(result); mockHost .Setup(h => h.GetDesigner(result)) .Returns(designer); var mockContext = new Mock <ITypeDescriptorContext>(MockBehavior.Strict); mockContext .Setup(c => c.GetService(typeof(IDesignerHost))) .Returns(mockHost.Object); mockContext .Setup(c => c.GetService(typeof(AmbientProperties))) .Returns(null); mockContext .Setup(c => c.GetService(typeof(IComponentChangeService))) .Returns(null); var editor = new SubCollectionEditor(typeof(List <int>)); var value = new object(); Assert.Same(value, editor.EditValue(mockContext.Object, mockServiceProvider.Object, value)); Assert.Same(mockContext.Object, editor.Context); var form = new SubCollectionForm(editor); Assert.Same(result, form.CreateInstance(typeof(Component))); }
public static IList <ContentFolderModel> GetContentFolderModels(this IDesigner designer) { return(designer.GetElementsOfType(ContentFolderModel.SpecializationTypeId) .Select(x => new ContentFolderModel(x)) .ToList()); }
public DefaultMenuCommandService(IDesigner designer) { _designer = designer; }
public DesignerController(IFilerView filerView, IDesignerView designerView, IFiler filer, IDesigner designer, IFileable designerFileable) { FilerView = filerView; DesignerView = designerView; Designer = designer; Filer = filer; DesignerFileable = designerFileable; }