private string GetExpressionBinding(ViewElement element, bool isBindingExpression) { if (element.Value != null) { return(element.Value.ToString()); } else if (ExpressionHelper.IsValueAStringConstant(element.Expression)) { return(ExpressionHelper.GetStringConstant(element.Expression)); } else if (ExpressionHelper.IsValueAModelRefererence(element.Expression)) { var expressionString = ExpressionHelper.GetMemberReference(element.Expression); if (expressionString.Contains("~")) { var subexpressions = expressionString.Split('~'); expressionString = ""; for (int i = 0; i < subexpressions.Length - 1; i++) { var repeter = repeaters.Find((t) => t.Item1 == subexpressions[i].Substring(0, subexpressions[i].Length - 1)); expressionString = expressionString + repeter.Item2; } expressionString += subexpressions[subexpressions.Length - 1]; } return(isBindingExpression ? "{{" + expressionString + "}}": expressionString); } return(" "); }
protected void ValidateOrReplaceViewElementSizes(ViewElement element) { if (!this.IsFiniteSizeInValidRange(element.MinimumHeight)) { element.MinimumHeight = (double)ViewElement.MinimumHeightProperty.DefaultMetadata.DefaultValue; } if (!this.IsFiniteSizeInValidRange(element.MinimumWidth)) { element.MinimumWidth = (double)ViewElement.MinimumWidthProperty.DefaultMetadata.DefaultValue; } if (!this.IsFiniteSizeInValidRange(element.AutoHideHeight)) { element.AutoHideHeight = (double)ViewElement.AutoHideHeightProperty.DefaultMetadata.DefaultValue; } if (!this.IsFiniteSizeInValidRange(element.AutoHideWidth)) { element.AutoHideWidth = (double)ViewElement.AutoHideWidthProperty.DefaultMetadata.DefaultValue; } if (!this.IsFiniteSizeInValidRange(element.FloatingHeight)) { element.FloatingHeight = (double)ViewElement.FloatingHeightProperty.DefaultMetadata.DefaultValue; } if (this.IsFiniteSizeInValidRange(element.FloatingWidth)) { return; } element.FloatingWidth = (double)ViewElement.FloatingWidthProperty.DefaultMetadata.DefaultValue; }
protected override void OnAutoHideViewCore(ViewElement autoHidingElement, bool autoHideOnlyActiveView) { TabGroup tabGroup = autoHidingElement as TabGroup; if (tabGroup != null) { if (autoHideOnlyActiveView) { ExpressionView expressionView = tabGroup.SelectedElement as ExpressionView; if (expressionView != null) { expressionView.WasSelectedBeforeAutoHide = false; } } else { foreach (ViewElement viewElement in (IEnumerable <ViewElement>)tabGroup.Children) { ExpressionView expressionView = viewElement as ExpressionView; if (expressionView != null) { expressionView.WasSelectedBeforeAutoHide = expressionView.IsSelected; } } } } base.OnAutoHideViewCore(autoHidingElement, autoHideOnlyActiveView); }
public static List <ViewElement> controls(this ViewElement viewElement, Predicate <ViewElement> predicate) { return((List <ViewElement>)viewElement.wpfInvoke( () => { return viewElement.FindAll(predicate).toList(); })); }
private Rect GetDockPreviewRect(DockDirection dockDirection, FrameworkElement adornedElement, ViewElement element) { Rect rect1 = new Rect(); Orientation orientation = Orientation.Horizontal; ViewElement viewElement = adornedElement.DataContext as ViewElement; SplitterLength itemLength = new SplitterLength(); if (dockDirection == DockDirection.FirstValue || dockDirection == DockDirection.Bottom) { orientation = Orientation.Vertical; itemLength = element.DockedHeight; } else if (dockDirection == DockDirection.Left || dockDirection == DockDirection.Right) { orientation = Orientation.Horizontal; itemLength = element.DockedWidth; } Rect rect2; if (dockDirection != DockDirection.Fill) { SplitterPanel panel = (SplitterPanel)null; int targetIndex = -1; this.GetPreviewSplitterPanel(out panel, out targetIndex, dockDirection, viewElement, adornedElement, orientation); rect2 = panel == null || orientation != panel.Orientation ? this.PreviewDockCounterOrientation(dockDirection, adornedElement, viewElement, itemLength, orientation) : this.PreviewDockSameOrientation(dockDirection, panel, viewElement, itemLength, orientation, targetIndex); } else { rect2 = this.PreviewDockFill(adornedElement); } return(rect2); }
protected override SizeF ArrangeOverride(SizeF finalSize) { RectangleF clientRect = this.GetClientRectangle(finalSize); if (this.columnContainer.Visibility != ElementVisibility.Collapsed) { this.columnContainer.Arrange(new System.Drawing.RectangleF(clientRect.X + cornerCellWidth, clientRect.Y, clientRect.Width - this.VScrollBar.DesiredSize.Width - cornerCellWidth, this.columnContainer.DesiredSize.Height)); } RectangleF viewElementRect = new RectangleF(clientRect.X, clientRect.Y + this.columnContainer.DesiredSize.Height, clientRect.Width - VScrollBar.DesiredSize.Width, clientRect.Height - this.columnContainer.DesiredSize.Height); this.layoutManagerPart.Arrange(clientRect); RectangleF hscrollBarRect = ArrangeHScrollBar(ref viewElementRect, clientRect); ArrangeVScrollBar(ref viewElementRect, hscrollBarRect, clientRect); viewElementRect.Width = Math.Max(1, viewElementRect.Width); viewElementRect.Height = Math.Max(1, viewElementRect.Height); ViewElement.Arrange(viewElementRect); return(finalSize); }
private static void GetViews(Document doc, ProjectModel model) { var views = doc.GetElements <View>(); foreach (var v in views) { var vv = new ViewElement { Id = v.Id.IntegerValue, Guid = v.UniqueId, Name = v.ViewName, //ViewName = v.ViewName, ViewType = (int)v.ViewType }; if (v.HasViewDiscipline()) { vv.ViewDiscipline = (int)v.Discipline; } if (v.GenLevel != null) { var lev = doc.GetElement(v.GenLevel.Id); vv.GenLevel = lev.UniqueId; } model.Views.Add(vv); } }
public static void AddProperties(this ViewElement view, PropertyValues pvs, VaultAliases vaultAlias, int levelId, int modeId) { view.AddBasicProperties(pvs, vaultAlias, modeId); var vtPV = new PropertyValue { PropertyDef = vaultAlias.PdDict[PD.ViewType] }; vtPV.Value.SetValue(MFDataType.MFDatatypeInteger, view.ViewType); pvs.Add(-1, vtPV); if (view.ViewDiscipline != null) { var vdPV = new PropertyValue { PropertyDef = vaultAlias.PdDict[PD.ViewDisc] }; vdPV.Value.SetValue(MFDataType.MFDatatypeInteger, view.ViewDiscipline.Value); pvs.Add(-1, vdPV); } if (view.GenLevel != null) { if (levelId <= 0) { throw new Exception("必须指定楼层"); } var glPV = new PropertyValue { PropertyDef = vaultAlias.PdDict[PD.Level] }; glPV.Value.SetValue(MFDataType.MFDatatypeLookup, levelId); pvs.Add(-1, glPV); } }
public override ViewElement CreateLabelView() { ViewElement newView = new ViewElement(); var elementsList = new List <IGuiElement>(); var firstLabelPosition = new Point(0, 100); var firstLabelColor = new MonoGameColor(MyColor.AliceBlue); var firstLabelText = "I returned, and saw under the sun, that the race is not to the swift, \n" + "nor the battle to the strong, neither yet bread to the wise, \n" + "nor yet riches to men of understanding, nor yet favour to men of skill; \n" + "but time and chance happeneth to them all. \n"; elementsList.Add(new LabelElement(firstLabelPosition, firstLabelColor, firstLabelText)); var backBtnPosition = new Point(0, 200); var backBtnColor = new MonoGameColor(MyColor.AliceBlue); var backBtnText = "Clicketh thou mouse pointer here to return from whence thy came"; System.Action backBtnOnClickAction = () => { GuiManager.currentView = this.CreateMainView(); }; elementsList.Add(new ClickableDecorator(new LabelElement(backBtnPosition, backBtnColor, backBtnText), backBtnOnClickAction, backBtnPosition, 500, 30)); newView.elements = new GUIElementsIterator(elementsList); return(newView); }
protected bool ValidateOrReplaceViewElement(ref ViewElement element, WindowProfileValidationContext context) { this.ValidateOrReplaceViewElementSizes(element); this.ValidateOrReplaceViewElementPosition(element); View view = element as View; if (view != null) { bool flag = this.ValidateOrReplaceView(ref view, context); element = (ViewElement)view; return(flag); } ViewGroup viewGroup = element as ViewGroup; if (viewGroup != null) { bool flag = this.ValidateOrReplaceViewGroup(ref viewGroup, context); element = (ViewElement)viewGroup; return(flag); } ViewBookmark viewBookmark = element as ViewBookmark; if (viewBookmark == null) { return(this.ValidateOrReplaceCustomViewElement(ref element, context)); } bool flag1 = this.ValidateOrReplaceViewBookmark(ref viewBookmark, context); element = (ViewElement)viewBookmark; return(flag1); }
private void ConvertElement(XmlWriter writer, ViewElement element) { if (element is Container) { ConvertContainer(writer, (Container)element); } else if (element is ModelRefreshButtonBase) { ConvertModelRefreshButtonBase(writer, (ModelRefreshButtonBase)element); } else if (element is Button) { ConvertButton(writer, (Button)element); } else if (element is Label) { ConvertLabel(writer, (Label)element); } else if (element is NumberInput) { ConvertNumberInput(writer, (NumberInput)element); } else if (element is TextInput) { ConvertTextInput(writer, (TextInput)element); } else if (element is TableLayoutBase) { ConvertTableLayout(writer, (TableLayoutBase)element); } }
private List <ViewElement> GetChildrenEelements(ViewElement element) { var resultElements = new List <ViewElement>(); var viewElements = element.ChildrenViewElement; if (viewElements != null) { viewElements = viewElements.ToList(); foreach (var viewElement in viewElements) { // if(!resultElements.Any(a=>a.Id==element.Id)) resultElements.Add(viewElement); } if (element.ChildrenViewElement != null) { foreach (var childEl in element.ChildrenViewElement.Where(a => (!a.InVisible)).ToList()) { var hElement = GetChildrenEelements(childEl); resultElements.AddRange(hElement); } } } return(resultElements); }
public override ViewElement CreateMainView() { ViewElement newView = new ViewElement(); var elementsList = new List <IGuiElement>(); var firstBtnPosition = new Point(0, 100); var firstBtnColor = new MonoGameColor(MyColor.AliceBlue); var firstBtnText = "Clicketh thou mouse pointer here to bombard \n Thine eyes with quotes"; System.Action firstBtnOnClickAction = () => { GuiManager.currentView = this.CreateLabelView(); }; elementsList.Add(new ClickableDecorator(new LabelElement(firstBtnPosition, firstBtnColor, firstBtnText), firstBtnOnClickAction, firstBtnPosition, 500, 30)); var exitBtnPosition = new Point(0, 300); var exitBtnColor = new MonoGameColor(MyColor.AliceBlue); var exitBtnText = "Clicketh thou mouse pointer here to leave"; System.Action exitBtnOnClickAction = () => { exitFunc(); }; elementsList.Add(new ClickableDecorator(new LabelElement(exitBtnPosition, exitBtnColor, exitBtnText), exitBtnOnClickAction, exitBtnPosition, 500, 30)); newView.elements = new GUIElementsIterator(elementsList); return(newView); }
void OnEnable() { //When this inspector is created, also create the built-in inspector defaultEditor = Editor.CreateEditor(targets, Type.GetType("UnityEditor.RectTransformEditor, UnityEditor")); rectTransform = target as RectTransform; viewElement = rectTransform.GetComponent <ViewElement>(); }
public static PropertyValues UpdateView(this ViewElement view, VaultAliases vaultAlias, int levelId, int modelId) { var pvs = new PropertyValues(); AddProperties(view, pvs, vaultAlias, levelId, modelId); return(pvs); }
protected override bool ValidateOrReplaceCustomViewElement(ref ViewElement element, WindowProfileValidationContext context) { if (element is NakedView) { return(true); } return(base.ValidateOrReplaceCustomViewElement(ref element, context)); }
public override bool IsChildAllowed(ViewElement element) { if (!(element is View) && !(element is DockGroup)) { return(element is TabGroup); } return(true); }
public override bool IsChildAllowed(ViewElement element) { if (!(element is NakedView)) { return(base.IsChildAllowed(element)); } return(true); }
public override bool IsChildAllowed(ViewElement element) { if (!(element is View)) { return(element is ViewBookmark); } return(true); }
public DockManager.UndockingScope CreateUndockingScope(ViewElement element, Point undockingPoint) { if (this.UndockingInformation != null) { throw new InvalidOperationException("Only one undocking operation can happen at a time."); } return(new DockManager.UndockingScope(element, undockingPoint)); }
//public static WindowFrame GetActiveWindowFrame(IEnumerable<IVsWindowFrame> frames, DTE2 dte) //{ // return (from vsWindowFrame in frames // let window = GetWindow(vsWindowFrame) // where window == dte.ActiveWindow // select vsWindowFrame as WindowFrame) // .FirstOrDefault(); //} //public static Window GetWindow(IVsWindowFrame vsWindowFrame) //{ // object window; // ErrorHandler.ThrowOnFailure(vsWindowFrame.GetProperty((int) __VSFPROPID.VSFPROPID_ExtWindowObject, // out window)); // return window as Window; //} public static int FindSubtreeIndex(this ViewGroup rootElement, ViewElement subtreeElement) { while (subtreeElement.Parent != rootElement) { subtreeElement = subtreeElement.Parent; } return(rootElement.Children.IndexOf(subtreeElement)); }
protected FloatingOperationFinishedEventArgs(RoutedEvent routedEvent, ViewElement content) : base(routedEvent) { if (content == null) { throw new ArgumentNullException("content"); } this.Content = content; }
protected virtual bool IsValidFillPreviewOperation(DockTarget dockTarget, ViewElement dockingView) { bool flag = false; if (dockTarget != null && dockTarget.DockTargetType == DockTargetType.FillPreview && (DockOperations.AreDockRestrictionsFulfilled(dockingView, dockTarget.TargetElement) && dockTarget.TargetElement.AreDockTargetsEnabled)) { flag = true; } return(flag); }
public override bool IsFloatingElementValidForDock(ViewElement floatingElement) { DependencyObject dependencyObject = this.Content as DependencyObject; if (dependencyObject != null) { return(!(bool)dependencyObject.GetValue(FloatingWindow.IsFloatingProperty)); } return(true); }
private List <int?> GetParents(ViewElement viewElement) { if (viewElement.ParentId != null) { parentslist.Add(viewElement.ParentId); GetParents(viewElement.ParentViewElement); } return(parentslist); }
private void CopyViewGroupProperties(ViewGroup from, ViewGroup to) { this.CopyViewElementProperties((ViewElement)from, (ViewElement)to); to.Children.Clear(); while (from.Children.Count > 0) { ViewElement viewElement = from.Children[0]; to.Children.Add(viewElement); } to.SelectedElement = from.SelectedElement; }
private void UpdateDockPreview(DragAbsoluteEventArgs args, FloatingElement floatingElement) { DockManager.DockSiteHitTestResult hitElement = this.FindHitElement(args.ScreenPoint, (Predicate <DockManager.DockSite>)(s => s.Visual != floatingElement)); if (hitElement != null) { DockSiteAdorner ancestorOrSelf1 = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestorOrSelf <DockSiteAdorner>(hitElement.VisualHit); DockAdornerWindow ancestorOrSelf2 = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestorOrSelf <DockAdornerWindow>(hitElement.VisualHit); DockTarget ancestorOrSelf3 = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestorOrSelf <DockTarget>(hitElement.VisualHit); FloatSite floatSite = floatingElement.Content as FloatSite; DockDirection dockDirection = DockDirection.Fill; FrameworkElement adornedElement = (FrameworkElement)null; if (floatSite == null) { throw new InvalidOperationException("Dragging element must be a FloatSite"); } if (floatSite.Child == null) { throw new InvalidOperationException("floatSite must have at least one child."); } ViewElement child = floatSite.Child; if (this.IsValidFillPreviewOperation(ancestorOrSelf3, child)) { dockDirection = DockDirection.Fill; adornedElement = ancestorOrSelf3.AdornmentTarget == null ? (FrameworkElement)ancestorOrSelf3 : ancestorOrSelf3.AdornmentTarget; } if (ancestorOrSelf1 != null && ancestorOrSelf2 != null && ancestorOrSelf2.AdornedElement != null) { dockDirection = ancestorOrSelf1.DockDirection; adornedElement = ancestorOrSelf2.AdornedElement; if (!ancestorOrSelf1.CreatesDocumentGroup && dockDirection != DockDirection.Fill && adornedElement.DataContext is DocumentGroup) { adornedElement = (FrameworkElement)Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestor <DocumentGroupContainerControl>((Visual)adornedElement); } } if (adornedElement != null) { Rect dockPreviewRect = this.GetDockPreviewRect(dockDirection, adornedElement, child); this.DockPreviewWindow.Left = dockPreviewRect.Left; this.DockPreviewWindow.Top = dockPreviewRect.Top; this.DockPreviewWindow.Width = dockPreviewRect.Width; this.DockPreviewWindow.Height = dockPreviewRect.Height; this.OnDockPreviewWindowShowing(this.DockPreviewWindow, dockDirection); this.DockPreviewWindow.Show(); } else { this.HideDockPreview(); } } else { this.HideDockPreview(); } }
public static ObjVer CreateView(this ViewElement view, VaultAliases vaultAlias, int levelId, int modelId, AccessControlList acl) { var objTypeId = vaultAlias.ObDict[OB.View]; var classId = vaultAlias.CsDict[CS.View]; var pvs = new PropertyValues(); AddProperties(view, pvs, vaultAlias, levelId, modelId); return(BaseElementExtensions.CreateBasicObject(objTypeId, classId, pvs, vaultAlias.Vault, acl)); }
protected void ValidateOrReplaceViewElementPosition(ViewElement element) { if (!this.IsValueInValidRange(element.FloatingLeft, double.NegativeInfinity, double.PositiveInfinity, false, false)) { element.FloatingLeft = (double)ViewElement.FloatingLeftProperty.DefaultMetadata.DefaultValue; } if (this.IsValueInValidRange(element.FloatingTop, double.NegativeInfinity, double.PositiveInfinity, false, false)) { return; } element.FloatingTop = (double)ViewElement.FloatingTopProperty.DefaultMetadata.DefaultValue; }
public static ViewElement control(this ViewElement viewElement, string title) { return((ViewElement)viewElement.wpfInvoke( () => { foreach (var control in viewElement.controls()) { if (control.str() == title) { return control; } } return null; })); }
public static string ViewWebForm(Artech.Architecture.Common.Objects.KBObject Object, Artech.Architecture.Common.Objects.KBObjectPart Part, Heurys.Patterns.HPattern.HPatternInstance Instance, ViewElement view) { string ret = ""; HPatternSettings settings = Instance.Settings; SelectionElement selection = view.Parent.Selection; string sdescription = view.Description; string stitle = String.Empty; string sviewall = WebForm.TextBlock("ViewAll", settings.Theme.TextToLink, selection.Description); string sviewheader = String.Empty; string stabs = String.Empty; string stransaction = String.Empty; if (view.BackToSelection && selection != null) { stitle = WebForm.TextBlock("ViewTitle", "" , view.Description); } else { stitle = WebForm.TextBlock("ViewTitle", settings.Theme.Subtitle, view.Description); } if (view.FixedData != null) { StringBuilder sb = new StringBuilder(); sb.AppendLine(WebForm.BeginTable("TableView",null)); foreach (AttributeElement fixedAtt in view.FixedData.Attributes.Attributes) { sb.AppendLine("<TR><TD>"); sb.AppendLine(WebForm.TextBlock("FixText" + fixedAtt.Attribute.Name, settings.Theme.Label, fixedAtt.Description)); sb.AppendLine("</TD><TD>"); sb.AppendLine( WebForm.Attribute(fixedAtt.Attribute.Name)); sb.AppendLine("</TD></TR>"); } sb.AppendLine( WebForm.EndTable()); sviewheader = sb.ToString(); } Tab tab = Tab.getTab(view,Object); if (tab != null) { stabs = tab.WebForm(); stransaction = tab.WebFormCmp(); } HTemplate viewTemplate = Template.GetTemplate(settings, ObjTemplate.ViewTemplate); if (stitle != String.Empty) viewTemplate.SetAttribute(SelTemplate.Title, stitle); if (sdescription != String.Empty) viewTemplate.SetAttribute(SelTemplate.Description, sdescription); if (sviewall != String.Empty) viewTemplate.SetAttribute(SelTemplate.ViewAll, sviewall); if (stabs != String.Empty) viewTemplate.SetAttribute(SelTemplate.Tabs, stabs); if (sviewheader != String.Empty) viewTemplate.SetAttribute(SelTemplate.ViewHeader, sviewheader); if (!String.IsNullOrEmpty(stransaction)) viewTemplate.SetAttribute(SelTemplate.Transaction, stransaction); ret = viewTemplate.ToString(); return ret; }