public AmmoInfo() { Control.style.overflow = IStyle.OverflowEnum.hidden; Control.style.position = IStyle.PositionEnum.absolute; Control.style.SetSize(1, 10); Control.Hide(); }
public void Hide() { Control.Hide(); foreach (Card v in Cards.ToArray()) { v.Hide(); } }
private static void AddTypeProperty( IHTMLDiv parent, CompilationProperty type, Action <string> UpdateLocation ) { var div = new IHTMLDiv().AttachTo(parent); div.style.marginTop = "0.1em"; div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana; div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap; var i = new PublicProperty().AttachTo(div); i.style.verticalAlign = "middle"; i.style.marginRight = "0.5em"; var s = new IHTMLAnchor { innerText = type.Name }.AttachTo(div); s.href = "#"; s.style.textDecoration = "none"; s.style.color = JSColor.System.WindowText; Action onclick = delegate { }; s.onclick += e => { e.PreventDefault(); s.focus(); UpdateLocation(type.Name); onclick(); }; s.onfocus += delegate { s.style.backgroundColor = JSColor.System.Highlight; s.style.color = JSColor.System.HighlightText; }; s.onblur += delegate { s.style.backgroundColor = JSColor.None; s.style.color = JSColor.System.WindowText; }; onclick = delegate { var children = new IHTMLDiv().AttachTo(div); children.style.paddingLeft = "2em"; AddTypeMethod(children, type.GetGetMethod(), UpdateLocation); AddTypeMethod(children, type.GetSetMethod(), UpdateLocation); //a.GetTypes().ForEach( // (Current, Next) => // { // AddType(GetNamespaceContainer(children, Current), Current, UpdateLocation); // ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( // 50, // Next // ); // } //); var NextClickHide = default(Action); var NextClickShow = default(Action); NextClickHide = delegate { children.Hide(); onclick = NextClickShow; }; NextClickShow = delegate { children.Show(); onclick = NextClickHide; }; onclick = NextClickHide; }; }
private static void AddTypeEvent( IHTMLDiv parent, CompilationEvent type, Action <string> UpdateLocation ) { var div = new IHTMLDiv().AttachTo(parent); div.style.marginTop = "0.1em"; div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana; div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap; var i = new PublicEvent().AttachTo(div); i.style.verticalAlign = "middle"; i.style.marginRight = "0.5em"; var s = new IHTMLAnchor { innerText = type.Name }.AttachTo(div); s.href = "#"; s.style.textDecoration = "none"; s.style.color = JSColor.System.WindowText; Action onclick = delegate { }; s.onclick += e => { e.PreventDefault(); s.focus(); UpdateLocation(type.Name); onclick(); }; s.onfocus += delegate { s.style.backgroundColor = JSColor.System.Highlight; s.style.color = JSColor.System.HighlightText; }; s.onblur += delegate { s.style.backgroundColor = JSColor.None; s.style.color = JSColor.System.WindowText; }; onclick = delegate { var children = new IHTMLDiv().AttachTo(div); children.style.paddingLeft = "2em"; AddTypeMethod(children, type.GetAddMethod(), UpdateLocation); AddTypeMethod(children, type.GetRemoveMethod(), UpdateLocation); var NextClickHide = default(Action); var NextClickShow = default(Action); NextClickHide = delegate { children.Hide(); onclick = NextClickShow; }; NextClickShow = delegate { children.Show(); onclick = NextClickHide; }; onclick = NextClickHide; }; }
private void AddType(IHTMLDiv parent, CompilationType type, Action <string> UpdateLocation) { var div = new IHTMLDiv().AttachTo(parent); div.style.marginTop = "0.1em"; div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana; div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap; var i = default(IHTMLImage); if (type.IsInterface) { i = new PublicInterface(); } else { i = new PublicClass(); } i.AttachTo(div); i.style.verticalAlign = "middle"; i.style.marginRight = "0.5em"; var s = new IHTMLAnchor { innerText = type.Name, title = "" + type.MetadataToken }.AttachTo(div); if (!string.IsNullOrEmpty(type.HTMLElement)) { var c = new IHTMLCode(); Action <string, JSColor> Write = (Text, Color) => { var cs = new IHTMLSpan { innerText = Text }; cs.style.color = Color; cs.AttachTo(c); }; Write("<", JSColor.Blue); Write(type.HTMLElement, JSColor.FromRGB(0xa0, 0, 0)); Write("/>", JSColor.Blue); //c.style.marginLeft = "1em"; c.style.Float = ScriptCoreLib.JavaScript.DOM.IStyle.FloatEnum.right; c.AttachTo(s); } s.href = "#"; s.style.textDecoration = "none"; s.style.color = JSColor.System.WindowText; Action onclick = delegate { }; s.onclick += e => { e.PreventDefault(); s.focus(); if (TouchTypeSelected != null) { TouchTypeSelected(type); } UpdateLocation(type.FullName + " - " + type.Summary + " - HTML:" + type.HTMLElement); onclick(); }; s.onfocus += delegate { s.style.backgroundColor = JSColor.System.Highlight; s.style.color = JSColor.System.HighlightText; }; s.onblur += delegate { s.style.backgroundColor = JSColor.None; s.style.color = JSColor.System.WindowText; }; onclick = delegate { var children = new IHTMLDiv().AttachTo(div); children.style.paddingLeft = "1em"; Func <IHTMLDiv> Group = () => new IHTMLDiv().AttachTo(children); var Groups = new { Nested = Group(), Constructors = Group(), Methods = Group(), Events = Group(), Fields = Group(), Properties = Group(), }; type.GetNestedTypes().ForEach( (Current, Next) => { AddType(Groups.Nested, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); type.GetConstructors().ForEach( (Current, Next) => { AddTypeConstructor(Groups.Constructors, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); var HiddenMethods = new List <int>(); Action <CompilationMethod> AddIfAny = SourceMethod => { if (SourceMethod == null) { return; } HiddenMethods.Add(SourceMethod.MetadataToken); }; Action AfterEvents = delegate { type.GetMethods().ForEach( (Current, Next) => { if (!HiddenMethods.Contains(Current.MetadataToken)) { AddTypeMethod(Groups.Methods, Current, UpdateLocation); } ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); }; Action AfterProperties = delegate { type.GetEvents().ForEach( (Current, Next) => { AddIfAny(Current.GetAddMethod()); AddIfAny(Current.GetRemoveMethod()); AddTypeEvent(Groups.Events, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } )(AfterEvents); }; type.GetProperties().ForEach( (Current, Next) => { AddIfAny(Current.GetSetMethod()); AddIfAny(Current.GetGetMethod()); AddTypeProperty(Groups.Properties, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } )(AfterProperties); type.GetFields().ForEach( (Current, Next) => { AddTypeField(Groups.Fields, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); var NextClickHide = default(Action); var NextClickShow = default(Action); NextClickHide = delegate { children.Hide(); onclick = NextClickShow; }; NextClickShow = delegate { children.Show(); onclick = NextClickHide; }; onclick = NextClickHide; }; }
private static IHTMLDiv AddNamespace(IHTMLDiv parent, IHTMLDiv NextNamespaceOrDefault, string Namespace, Action <string> UpdateLocation) { var div = new IHTMLDiv(); if (NextNamespaceOrDefault == null) { div.AttachTo(parent); } else { NextNamespaceOrDefault.insertPreviousSibling(div); } div.style.marginTop = "0.1em"; div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana; div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap; var i = new Namespace().AttachTo(div); i.style.verticalAlign = "middle"; i.style.marginRight = "0.5em"; if (Namespace == "") { Namespace = "<Module>"; } var s = new IHTMLAnchor { innerText = Namespace }.AttachTo(div); s.href = "#"; s.style.textDecoration = "none"; s.style.color = JSColor.System.WindowText; Action onclick = delegate { }; s.onclick += e => { e.PreventDefault(); s.focus(); UpdateLocation(Namespace); onclick(); }; s.onfocus += delegate { s.style.backgroundColor = JSColor.System.Highlight; s.style.color = JSColor.System.HighlightText; }; s.onblur += delegate { s.style.backgroundColor = JSColor.None; s.style.color = JSColor.System.WindowText; }; var children = new IHTMLDiv().AttachTo(div); children.style.paddingLeft = "1em"; children.Hide(); var NextClickHide = default(Action); var NextClickShow = default(Action); NextClickHide = delegate { children.Hide(); onclick = NextClickShow; }; NextClickShow = delegate { children.Show(); onclick = NextClickHide; }; onclick = NextClickShow; return(children); }
private void RenderAssemblies( CompilationArchiveBase archive, IHTMLElement parent, Func <string, IHTMLDiv> AllTypes, Action <string> UpdateLocation, Action <Action <Action> > YieldLoadAction) { var Assemblies = archive.GetAssemblies(); foreach (var Assembly in Assemblies) { Console.WriteLine(new { Assembly.Name }); } var q = from a in Assemblies where a.Name.StartsWith("ScriptCoreLib") orderby a.Name select a; // limit to only first one for speedup foreach (var item2 in q.Take(1)) { var item = item2; var div = new IHTMLDiv().AttachTo(parent); div.style.marginTop = "0.1em"; div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana; div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap; var i = new Assembly().AttachTo(div); i.style.verticalAlign = "middle"; i.style.marginRight = "0.5em"; var s = new IHTMLAnchor { innerText = item2.Name }.AttachTo(div); //s.style.color = JSColor.Gray; s.href = "#"; s.style.textDecoration = "none"; s.style.color = JSColor.System.GrayText; Action onclick = delegate { }; s.onclick += e => { e.PreventDefault(); s.focus(); UpdateLocation(item.Name); onclick(); }; s.onfocus += delegate { s.style.backgroundColor = JSColor.System.Highlight; s.style.color = JSColor.System.HighlightText; }; s.onblur += delegate { s.style.backgroundColor = JSColor.None; s.style.color = JSColor.System.WindowText; }; var NamespaceLookup = new Dictionary <string, IHTMLDiv>(); Func <IHTMLDiv, CompilationType, IHTMLDiv> GetNamespaceContainer = (Container, SourceType) => { if (!NamespaceLookup.ContainsKey(SourceType.Namespace)) { NamespaceLookup[SourceType.Namespace] = null; var NextNamespaceOrDefault = default(IHTMLDiv); //var NextNamespaceOrDefault = NamespaceLookup.Keys.OrderBy(k => k).SkipWhile(k => k == SourceType.Namespace).Select(k => NamespaceLookup[k]).FirstOrDefault(); NamespaceLookup[SourceType.Namespace] = AddNamespace(Container, NextNamespaceOrDefault, SourceType.Namespace, UpdateLocation); } return(NamespaceLookup[SourceType.Namespace]); }; var children = new IHTMLDiv().AttachTo(div); children.style.paddingLeft = "1em"; Action <Action> LoadAction = done => { Console.WriteLine("enter LoadAction"); s.style.color = JSColor.System.Highlight; Action done_ = delegate { done(); }; item.WhenReady( a => { Console.WriteLine("enter WhenReady"); s.style.color = JSColor.System.WindowText; Console.WriteLine("before GetTypes ToArray"); var TypesArray = a.GetTypes().ToArray(); //Console.WriteLine("before TypesByName"); //var TypesByName = TypesArray.OrderBy(k => k.Name); //Console.WriteLine("before TypesByName ToArray"); //// chokes on android? //var TypesByNameArray = TypesByName.ToArray(); //Console.WriteLine("before ForEach"); TypesArray.ForEach( (Current, Index, Next) => { Console.WriteLine("AddType"); if (!Current.IsNested) { AddType( GetNamespaceContainer(children, Current), Current, UpdateLocation ); AddType( AllTypes(Current.Namespace), Current, UpdateLocation ); } if (Index % 8 == 0) { ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 7, Next ); } else { Next(); } } )(done_); Console.WriteLine("exit WhenReady"); } ); }; Console.WriteLine("before YieldLoadAction"); YieldLoadAction(LoadAction); Console.WriteLine("after YieldLoadAction"); var NextClickHide = default(Action); var NextClickShow = default(Action); NextClickHide = delegate { children.Hide(); onclick = NextClickShow; }; NextClickShow = delegate { children.Show(); onclick = NextClickHide; }; NextClickHide(); } }
private static void AddSection11(Action <string, IHTMLDiv> AddSection) { var ToolbarHeight = "24px"; var Content = new IHTMLDiv().With( k => { k.style.border = "1px solid gray"; k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.relative; k.style.width = "100%"; k.style.height = "20em"; } ); //global::ScriptCoreLib.Ultra.Components.HTML // reload the project to make visual studio happy! new TwentyTenWorkspace().ToBackground(Content.style, true); var ToolbarContainerBackground = new IHTMLDiv().With( k => { k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; k.style.left = "0px"; k.style.right = "0px"; k.style.top = "0px"; k.style.height = ToolbarHeight; k.style.backgroundColor = Color.White; k.style.Opacity = 0.5; } ).AttachTo(Content); var ToolbarContainer = new IHTMLDiv().With( k => { k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; k.style.left = "0px"; k.style.right = "0px"; k.style.top = "0px"; k.style.height = ToolbarHeight; } ).AttachTo(Content); var PreviewContainer = new IHTMLDiv().With( k => { k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; k.style.left = "0px"; k.style.right = "0px"; k.style.top = ToolbarHeight; k.style.bottom = "0px"; } ).AttachTo(Content); var PreviewFrame = new IHTMLIFrame { src = "about:blank" }; PreviewFrame.style.width = "100%"; PreviewFrame.style.height = "100%"; PreviewFrame.style.border = "0"; PreviewFrame.style.margin = "0"; PreviewFrame.style.padding = "0"; PreviewFrame.frameBorder = "0"; PreviewFrame.border = "0"; PreviewFrame.AttachTo(PreviewContainer); PreviewContainer.Hide(); var EditorContainer = new IHTMLDiv().With( k => { k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; k.style.left = "0px"; k.style.right = "0px"; k.style.top = ToolbarHeight; k.style.bottom = "0px"; } ).AttachTo(Content); var EditorFrame = VisualStudioView.CreateEditor().AttachTo(EditorContainer); PreviewFrame.allowTransparency = true; EditorFrame.allowTransparency = true; EditorFrame.WhenContentReady( body => { body.style.backgroundColor = Color.Transparent; new IHTMLDiv { "Hello world :)" }.With( div => { div.style.backgroundColor = Color.White; div.style.borderColor = Color.Gray; div.style.borderStyle = "solid"; div.style.borderWidth = "1px"; div.style.margin = "2em"; div.style.padding = "2em"; } ).AttachTo(body); } ); var ToolbarContent = new IHTMLDiv().AttachTo(ToolbarContainer); ToolbarContent.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.relative; Action <IHTMLElement> ApplyToolbarButtonStyle = k => { k.style.verticalAlign = "top"; k.style.padding = "0"; k.style.margin = "0"; k.style.overflow = ScriptCoreLib.JavaScript.DOM.IStyle.OverflowEnum.hidden; k.style.SetSize(24, 24); VisualStudioView.ApplyMouseHoverStyle(k, Color.Transparent); }; Func <IHTMLImage, IHTMLButton> AddButtonDummy = (img) => { return(new IHTMLButton { img.WithinContainer() }.With(k => ApplyToolbarButtonStyle(k)).AttachTo(ToolbarContent)); }; Func <IHTMLImage, Action, IHTMLButton> AddButtonAction = (img, command) => { return(AddButtonDummy(img).With( k => { k.onclick += delegate { command(); }; } )); }; Func <IHTMLImage, string, IHTMLButton> AddButton = (img, command) => { return(AddButtonAction(img, () => EditorFrame.contentWindow.document.execCommand( command, false, null ) )); }; //AddButtonDummy(new RTA_save()); var SaveContainer = new IHTMLDiv().With(k => ApplyToolbarButtonStyle(k)).AttachTo(ToolbarContent); SaveContainer.style.display = ScriptCoreLib.JavaScript.DOM.IStyle.DisplayEnum.inline_block; //var Save = new InternalSaveActionSprite(); //Save.ToTransparentSprite(); //Save.AttachSpriteTo(SaveContainer); var s = new { VisualStudioTemplates.VisualCSharpProject }; EditorFrame.WhenContentReady( body => { var t = (IHTMLTextArea)EditorFrame.contentWindow.document.createElement("textarea"); t.AttachTo(body); t.value = s.ToString(); } ); //Save.WhenReady( // i => // { // i.FileName = "Project1.zip"; // i.Add("Project1.txt", "x"); // i.Add("Project1.csproj", s.VisualCSharpProject); // } //); ToolbarContent.Add(new RTA_separator_horizontal()); var RTAButtons = new Dictionary <string, IHTMLImage> { // http://trac.symfony-project.org/browser/plugins/dmCkEditorPlugin/web/js/ckeditor/_source/plugins?rev=27455 { "Bold", new RTA_bold() }, { "Underline", new RTA_underline() }, { "Strikethrough", new RTA_strikethrough() }, { "Italic", new RTA_italic() }, { "JustifyLeft", new RTA_justifyleft() }, { "JustifyCenter", new RTA_justifycenter() }, { "JustifyRight", new RTA_justifyright() }, { "JustifyFull", new RTA_justifyfull() }, { "Indent", new RTA_indent() }, { "Outdent", new RTA_outdent() }, { "Superscript", new RTA_superscript() }, { "Subscript", new RTA_sub() }, { "Removeformat", new RTA_removeformat() }, { "InsertOrderedList", new RTA_numberedlist() }, { "InsertUnorderedList", new RTA_numberedlist() }, { "undo", new RTA_undo() }, { "redo", new RTA_redo() }, }.ToDictionary( k => k.Key, k => AddButton(k.Value, k.Key) ); var ButtonDesign = default(IHTMLButton); var ButtonHTML = default(IHTMLButton); ButtonDesign = AddButtonAction(new RTA_mode_design(), delegate { ButtonDesign.Hide(); ButtonHTML.Show(); EditorContainer.Show(); PreviewContainer.Hide(); } ); ButtonHTML = AddButtonAction(new RTA_mode_html(), delegate { ButtonHTML.Hide(); PreviewFrame.WithContent( body => { body.style.backgroundColor = Color.Transparent; body.innerHTML = EditorFrame.contentWindow.document.body.innerHTML; EditorContainer.Hide(); PreviewContainer.Show(); ButtonDesign.Show(); } ); } ); ButtonDesign.Hide(); AddSection( "Editor with toolbar with background and preview", Content ); }
public void Hide() { Control.Hide(); }