private void WriteClass(GUIObject obj) { string className = obj.Name; GUIObject root = (obj.GetParent() == null ? obj : null); // Global scope if (root == null) { _Script.AppendLine(); } if (!string.IsNullOrEmpty(obj.GlobalScope)) { AppendCode(obj.GlobalScope, _BaseIdent); _Script.AppendLine(); } // Class name _Script.AppendLine(_BaseIdent + "class " + className + " : Gui::" + obj.GetType().ToString().Substring(obj.GetType().ToString().IndexOf("GUI") + 3)); _Script.AppendLine(_BaseIdent + "{"); // Class fields if (!string.IsNullOrEmpty(obj.ClassFields)) { AppendCode(obj.ClassFields, _BaseIdent + " "); _Script.AppendLine(); } // Constructor _Script.AppendLine(_BaseIdent + " void OnConstruct() override"); _Script.AppendLine(_BaseIdent + " {"); if (root != null && root is GUIScreen) { GUIScreen screen = (GUIScreen)root; if (screen.IsModal) { _Script.AppendLine(_BaseIdent + " SetModal( true );"); } if (screen.IsMultiinstance) { _Script.AppendLine(_BaseIdent + " SetMultiinstance( true );"); } if (screen.IsCloseOnMiss) { _Script.AppendLine(_BaseIdent + " SetCloseOnMiss( true );"); } if (!string.IsNullOrEmpty(screen.AvailableCursors)) { _Script.AppendLine(_BaseIdent + " SetAvailableCursors( " + screen.AvailableCursors + " );"); } if (screen.IsCanMove) { _Script.AppendLine(_BaseIdent + " SetCanMove( true, " + screen.IsMoveIgnoreBorders.ToString().ToLower() + " );"); } } if (!obj.Active) { _Script.AppendLine(_BaseIdent + " SetActive( false );"); } if (!obj.Position.IsEmpty) { _Script.AppendLine(_BaseIdent + " SetPosition( " + obj.Position.X + ", " + obj.Position.Y + " );"); } if (!obj.Size.IsEmpty /*&& !obj.IsAutoSize()*/) { _Script.AppendLine(_BaseIdent + " SetSize( " + obj.Size.Width + ", " + obj.Size.Height + " );"); } if (obj.Anchor != AnchorStyles.None) { _Script.AppendLine(_BaseIdent + " SetAnchor( " + ConvertAnchorStyles(obj.Anchor) + " );"); } if (obj.Dock != DockStyle.None) { _Script.AppendLine(_BaseIdent + " SetDock( " + ConvertDockStyle(obj.Dock) + " );"); } if (obj.IsDraggable) { _Script.AppendLine(_BaseIdent + " SetDraggable( true );"); } if (obj.IsNotHittable) { _Script.AppendLine(_BaseIdent + " SetNotHittable( true );"); } if (obj.CheckTransparentOnHit) { _Script.AppendLine(_BaseIdent + " SetCheckTransparentOnHit( true );"); } if (obj is GUIPanel) { GUIPanel panel = (GUIPanel)obj; if (!string.IsNullOrEmpty(panel.BackgroundImage)) { if (panel.BackgroundImageLayout != ImageLayout.None) { _Script.AppendLine(_BaseIdent + " SetBackgroundImage( \"" + panel.BackgroundImage + "\", " + ConvertImageLayout(panel.BackgroundImageLayout) + " );"); } else { _Script.AppendLine(_BaseIdent + " SetBackgroundImage( \"" + panel.BackgroundImage + "\" );"); } } if (panel.CropContent) { _Script.AppendLine(_BaseIdent + " SetCropContent( true );"); } if (panel.IsVerticalScroll || panel.IsHorizontalScroll) { _Script.AppendLine(_BaseIdent + " SetAutoScroll( " + (panel.IsVerticalScroll ? "true" : "false") + ", " + (panel.IsHorizontalScroll ? "true" : "false") + " );"); } } if (obj is GUIButton) { GUIButton button = (GUIButton)obj; if (button.IsDisabled) { _Script.AppendLine(_BaseIdent + " SetCondition( false );"); } if (!string.IsNullOrEmpty(button.PressedImage)) { if (button.PressedImageLayout != ImageLayout.None) { _Script.AppendLine(_BaseIdent + " SetPressedImage( \"" + button.PressedImage + "\", " + ConvertImageLayout(button.PressedImageLayout) + " );"); } else { _Script.AppendLine(_BaseIdent + " SetPressedImage( \"" + button.PressedImage + "\" );"); } } if (!string.IsNullOrEmpty(button.HoverImage)) { if (button.HoverImageLayout != ImageLayout.None) { _Script.AppendLine(_BaseIdent + " SetHoverImage( \"" + button.HoverImage + "\", " + ConvertImageLayout(button.HoverImageLayout) + " );"); } else { _Script.AppendLine(_BaseIdent + " SetHoverImage( \"" + button.HoverImage + "\" );"); } } if (!string.IsNullOrEmpty(button.DisabledImage)) { if (button.DisabledImageLayout != ImageLayout.None) { _Script.AppendLine(_BaseIdent + " SetDisabledImage( \"" + button.DisabledImage + "\", " + ConvertImageLayout(button.DisabledImageLayout) + " );"); } else { _Script.AppendLine(_BaseIdent + " SetDisabledImage( \"" + button.DisabledImage + "\" );"); } } } if (obj is GUICheckBox) { GUICheckBox checkBox = (GUICheckBox)obj; if (!string.IsNullOrEmpty(checkBox.IsChecked)) { _Script.AppendLine(_BaseIdent + " SetChecked( " + checkBox.IsChecked + " );"); } } if (obj is GUIText) { GUIText text = (GUIText)obj; if (!string.IsNullOrEmpty(text.Text)) { _Script.AppendLine(_BaseIdent + " SetText( " + text.Text + " );"); } if (!string.IsNullOrEmpty(text.Font)) { _Script.AppendLine(_BaseIdent + " SetTextFont( " + text.Font + " );"); } string textFlags = ""; if (text.HorisontalAlignment == StringAlignment.Center) { textFlags += "FT_CENTERX | "; } if (text.VerticalAlignment == StringAlignment.Center) { textFlags += "FT_CENTERY | "; } if (text.HorisontalAlignment == StringAlignment.Far) { textFlags += "FT_CENTERR | "; } if (text.VerticalAlignment == StringAlignment.Far) { textFlags += "FT_BOTTOM | "; } if (text.DrawFromBottom) { textFlags += "FT_UPPER | "; } if (text.NoColorize) { textFlags += "FT_NO_COLORIZE | "; } if (text.Align) { textFlags += "FT_ALIGN | "; } if (text.Bordered) { textFlags += "FT_BORDERED | "; } if (textFlags != "") { textFlags = textFlags.Remove(textFlags.Length - 3); _Script.AppendLine(_BaseIdent + " SetTextFlags( " + textFlags + " );"); } if (!string.IsNullOrEmpty(text.NormalColor)) { _Script.AppendLine(_BaseIdent + " SetTextColor( " + text.NormalColor + " );"); } if (!string.IsNullOrEmpty(text.FocusedColor)) { _Script.AppendLine(_BaseIdent + " SetTextFocusedColor( " + text.FocusedColor + " );"); } } if (obj is GUITextInput) { GUITextInput textInput = (GUITextInput)obj; if (!string.IsNullOrEmpty(textInput.InputLength)) { _Script.AppendLine(_BaseIdent + " SetInputLength( " + textInput.InputLength + " );"); } if (textInput.Password) { _Script.AppendLine(_BaseIdent + " SetInputPassword( \"#\" );"); } } if (obj is GUIMessageBox) { GUIMessageBox messageBox = (GUIMessageBox)obj; if (!string.IsNullOrEmpty(messageBox.InvertMessages)) { _Script.AppendLine(_BaseIdent + " SetInvertMessages( " + messageBox.InvertMessages + " );"); } if (!string.IsNullOrEmpty(messageBox.DisplayedMessages)) { _Script.AppendLine(_BaseIdent + " SetDisplayedMessages( " + messageBox.DisplayedMessages + " );"); } } if (obj is GUIConsole) { GUIConsole console = (GUIConsole)obj; if (console.DisableDeactivation) { _Script.AppendLine(_BaseIdent + " SetDisableDeactivation( true );"); } if (!string.IsNullOrEmpty(console.HistoryStorageName)) { _Script.AppendLine(_BaseIdent + " SetHistoryStorage( " + console.HistoryStorageName + " );"); } if (!string.IsNullOrEmpty(console.HistoryMaxLength)) { _Script.AppendLine(_BaseIdent + " SetHistoryMaxLength( " + console.HistoryMaxLength + " );"); } } if (obj is GUIGrid) { GUIGrid grid = (GUIGrid)obj; if (!string.IsNullOrEmpty(grid.CellPrototype)) { _Script.AppendLine(_BaseIdent + " SetCellPrototype( " + grid.CellPrototype + " );"); } if (!string.IsNullOrEmpty(grid.GridSize)) { _Script.AppendLine(_BaseIdent + " SetGridSize( " + grid.GridSize + " );"); } if (grid.Columns != 0) { _Script.AppendLine(_BaseIdent + " SetColumns( " + grid.Columns + " );"); } if (!grid.Padding.IsEmpty) { _Script.AppendLine(_BaseIdent + " SetPadding( " + grid.Padding.Width + ", " + grid.Padding.Height + " );"); } } if (obj is GUIItemView) { GUIItemView itemView = (GUIItemView)obj; if (!string.IsNullOrEmpty(itemView.UserData)) { _Script.AppendLine(_BaseIdent + " SetUserData( " + itemView.UserData + " );"); } if (!string.IsNullOrEmpty(itemView.UserDataExt)) { _Script.AppendLine(_BaseIdent + " SetUserDataExt( " + itemView.UserDataExt + " );"); } if (itemView.UseSorting) { _Script.AppendLine(_BaseIdent + " SetUseSorting( true );"); } } _Script.AppendLine(_BaseIdent + " }"); // Callbacks WriteClassFunction("void OnInit() override", obj.OnInit); WriteClassFunction("void OnShow( dictionary params ) override", obj.OnShow); WriteClassFunction("void OnHide() override", obj.OnHide); WriteClassFunction("void OnAppear() override", obj.OnAppear); WriteClassFunction("void OnDisappear() override", obj.OnDisappear); WriteClassFunction("void OnDraw() override", obj.OnDraw); WriteClassFunction("void OnPostDraw() override", obj.OnPostDraw); WriteClassFunction("void OnMove( int deltaX, int deltaY ) override", obj.OnMove); WriteClassFunction("void OnMouseDown( int button ) override", obj.OnMouseDown); WriteClassFunction("void OnMouseUp( int button, bool lost ) override", obj.OnMouseUp); WriteClassFunction("void OnMousePressed( int button ) override", obj.OnMousePressed); WriteClassFunction("void OnLMousePressed() override", obj.OnLMousePressed); WriteClassFunction("void OnRMousePressed() override", obj.OnRMousePressed); WriteClassFunction("void OnMouseClick( int button ) override", obj.OnMouseClick); WriteClassFunction("void OnLMouseClick() override", obj.OnLMouseClick); WriteClassFunction("void OnRMouseClick() override", obj.OnRMouseClick); WriteClassFunction("void OnMouseMove() override", obj.OnMouseMove); WriteClassFunction("void OnGlobalMouseDown( int button ) override", obj.OnGlobalMouseDown); WriteClassFunction("void OnGlobalMouseUp( int button ) override", obj.OnGlobalMouseUp); WriteClassFunction("void OnGlobalMousePressed( int button ) override", obj.OnGlobalMousePressed); WriteClassFunction("void OnGlobalMouseClick( int button ) override", obj.OnGlobalMouseClick); WriteClassFunction("void OnGlobalMouseMove() override", obj.OnGlobalMouseMove); WriteClassFunction("void OnInput( uint8 key, string text ) override", obj.OnInput); WriteClassFunction("void OnGlobalInput( uint8 key, string text ) override", obj.OnGlobalInput); WriteClassFunction("void OnActiveChanged() override", obj.OnActiveChanged); WriteClassFunction("void OnFocusChanged() override", obj.OnFocusChanged); WriteClassFunction("void OnHoverChanged() override", obj.OnHoverChanged); WriteClassFunction("void OnDragChanged() override", obj.OnDragChanged); WriteClassFunction("void OnResizeGrid( Gui::Object cell, uint cellIndex ) override", obj.OnResizeGrid); WriteClassFunction("void OnDrawItem( Item item, Gui::Object cell, uint cellIndex ) override", obj.OnDrawItem); if (obj is GUICheckBox) { WriteClassFunction("void OnCheckedChanged() override", ((GUICheckBox)obj).OnCheckedChanged); } if (obj is GUIItemView) { WriteClassFunction("Item[] OnGetItems() override", ((GUIItemView)obj).OnGetItems); WriteClassFunction("int OnCheckItem( Item item ) override", ((GUIItemView)obj).OnCheckItem); } // Subtypes if (obj is GUIText) { GUIText text = (GUIText)obj; if (!string.IsNullOrEmpty(text.DynamicText)) { _Script.AppendLine(); _Script.AppendLine(_BaseIdent + " string get_Text() override"); _Script.AppendLine(_BaseIdent + " {"); AppendCode(text.DynamicText, _BaseIdent + " "); _Script.AppendLine(_BaseIdent + " }"); } } // Close _Script.AppendLine(_BaseIdent + "}"); }
public MainForm() { Instance = this; InitializeComponent(); // Optimize panel drawing typeof(Panel).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, Design, new object[] { true }); // Setup paths Func <string, string> fixPath = delegate(string path) { path = path.Replace('/', '\\'); if (!path.EndsWith("\\")) { path += "\\"; } return(Path.GetFullPath(path)); }; IniFile config = new IniFile(".\\FOnline.cfg"); Utilites.GuiPath = fixPath(config.IniReadValue("Options", "GuiPath", @"")); Utilites.GuiOutputPath = fixPath(config.IniReadValue("Options", "GuiOutputPath", @"")); Utilites.GuiResourcesPath = fixPath(config.IniReadValue("Options", "GuiResourcesPath", @"")); // Load default scheme LoadScheme(Utilites.GuiPath + "Default.foguischeme"); // Hierarchy drag and drop Hierarchy.ItemDrag += delegate(object sender, ItemDragEventArgs e) { DoDragDrop(e.Item, DragDropEffects.Move); }; Hierarchy.DragEnter += delegate(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Move; }; Hierarchy.DragDrop += delegate(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { TreeView tree = (TreeView)sender; Point pt = tree.PointToClient(new Point(e.X, e.Y)); TreeNode destNode = tree.GetNodeAt(pt); TreeNode srcNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); if (srcNode.Parent != null && destNode != null && srcNode != destNode && ((GUIObject)srcNode.Tag).Find(((GUIObject)destNode.Tag).Name) == null) { ((GUIObject)srcNode.Tag).AssignParent((GUIObject)destNode.Tag); } } }; // Hierarchy node selection Hierarchy.NodeMouseClick += delegate(object sender, TreeNodeMouseClickEventArgs e) { Hierarchy.SelectedNode = e.Node; Design.Invalidate(); }; Hierarchy.AfterSelect += delegate(object sender, TreeViewEventArgs e) { Properties.SelectedObject = e.Node.Tag; Design.Invalidate(); }; // Hierarchy menu strip ToolStripMenuItem addMenuStrip = new ToolStripMenuItem("Add"); addMenuStrip.DropDownItems.Add("Panel").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUIPanel(obj).RefreshRepresentation(false); }; addMenuStrip.DropDownItems.Add("Button").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUIButton(obj).RefreshRepresentation(false); }; addMenuStrip.DropDownItems.Add("CheckBox").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUICheckBox(obj).RefreshRepresentation(false); }; addMenuStrip.DropDownItems.Add("RadioButton").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUIRadioButton(obj).RefreshRepresentation(false); }; addMenuStrip.DropDownItems.Add("Text").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUIText(obj).RefreshRepresentation(false); }; addMenuStrip.DropDownItems.Add("Text Input").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUITextInput(obj).RefreshRepresentation(false); }; addMenuStrip.DropDownItems.Add("Message Box").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUIMessageBox(obj).RefreshRepresentation(false); }; addMenuStrip.DropDownItems.Add("Console").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUIConsole(obj).RefreshRepresentation(false); }; addMenuStrip.DropDownItems.Add("Grid").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUIGrid(obj).RefreshRepresentation(false); }; addMenuStrip.DropDownItems.Add("Item View").Tag = (Action <GUIObject>) delegate(GUIObject obj) { new GUIItemView(obj).RefreshRepresentation(false); }; ToolStripMenuItem convertMenuStrip = new ToolStripMenuItem("Convert"); convertMenuStrip.DropDownItems.Add("Panel").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUIPanel(obj)); }; convertMenuStrip.DropDownItems.Add("Button").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUIButton(obj)); }; convertMenuStrip.DropDownItems.Add("CheckBox").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUICheckBox(obj)); }; convertMenuStrip.DropDownItems.Add("RadioButton").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUIRadioButton(obj)); }; convertMenuStrip.DropDownItems.Add("Text").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUIText(obj)); }; convertMenuStrip.DropDownItems.Add("Text Input").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUITextInput(obj)); }; convertMenuStrip.DropDownItems.Add("Message Box").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUIMessageBox(obj)); }; convertMenuStrip.DropDownItems.Add("Console").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUIConsole(obj)); }; convertMenuStrip.DropDownItems.Add("Grid").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUIGrid(obj)); }; convertMenuStrip.DropDownItems.Add("Item View").Tag = (Func <GUIObject, GUIObject>) delegate(GUIObject obj) { return(new GUIItemView(obj)); }; ToolStripMenuItem moveUpMenuStrip = new ToolStripMenuItem("Move node up"); moveUpMenuStrip.Tag = (Action <GUIObject>) delegate(GUIObject obj) { if (obj != null) { obj.MoveUp(); } }; ToolStripMenuItem moveDownMenuStrip = new ToolStripMenuItem("Move node down"); moveDownMenuStrip.Tag = (Action <GUIObject>) delegate(GUIObject obj) { if (obj != null) { obj.MoveDown(); } }; ToolStripMenuItem deleteMenuStrip = new ToolStripMenuItem("Delete node"); deleteMenuStrip.Tag = (Action <GUIObject>) delegate(GUIObject obj) { if (obj != null) { obj.Delete(); } }; ToolStripMenuItem newTreeMenuStrip = new ToolStripMenuItem("New GUI"); newTreeMenuStrip.Tag = (Action <GUIObject>) delegate(GUIObject obj) { NewTree(); }; ToolStripMenuItem loadTreeMenuStrip = new ToolStripMenuItem("Load GUI"); loadTreeMenuStrip.Tag = (Action <GUIObject>) delegate(GUIObject obj) { LoadAndShowTree(); }; ToolStripMenuItem saveTreeMenuStrip = new ToolStripMenuItem("Save GUI"); saveTreeMenuStrip.Tag = (Action <GUIObject>) delegate(GUIObject obj) { SaveTree(obj, false); GenerateScheme(); }; ToolStripMenuItem saveAsTreeMenuStrip = new ToolStripMenuItem("Save GUI As"); saveAsTreeMenuStrip.Tag = (Action <GUIObject>) delegate(GUIObject obj) { SaveTree(obj, true); GenerateScheme(); }; ToolStripMenuItem setCoordsTreeMenuStrip = new ToolStripMenuItem("Set Coords"); setCoordsTreeMenuStrip.Tag = (Action <GUIObject>) delegate(GUIObject obj) { SetCoords(); }; ContextMenuStrip hierarchyMenuStrip = new ContextMenuStrip(); hierarchyMenuStrip.Items.Add(addMenuStrip); hierarchyMenuStrip.Items.Add(convertMenuStrip); hierarchyMenuStrip.Items.Add(moveUpMenuStrip); hierarchyMenuStrip.Items.Add(moveDownMenuStrip); hierarchyMenuStrip.Items.Add(deleteMenuStrip); hierarchyMenuStrip.Items.Add(newTreeMenuStrip); hierarchyMenuStrip.Items.Add(loadTreeMenuStrip); hierarchyMenuStrip.Items.Add(saveTreeMenuStrip); hierarchyMenuStrip.Items.Add(saveAsTreeMenuStrip); hierarchyMenuStrip.Items.Add(setCoordsTreeMenuStrip); ToolStripItemClickedEventHandler clickHandler = delegate(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Tag != null) { hierarchyMenuStrip.Close(); GUIObject curObj = (Hierarchy.SelectedNode != null ? (GUIObject)Hierarchy.SelectedNode.Tag : null); if (convertMenuStrip.DropDownItems.Contains(e.ClickedItem)) { if (curObj != null) { curObj.Delete(); GUIObject newObj = ((Func <GUIObject, GUIObject>)e.ClickedItem.Tag)(curObj.GetParent()); newObj.RefreshRepresentation(false); while (curObj.Children.Count > 0) { curObj.Children[0].AssignParent(newObj); } if (curObj.GetParent() == null) { LoadedTree = newObj; } List <FieldInfo> sourceFields = GetAllFields(curObj.GetType()); List <FieldInfo> destFields = GetAllFields(newObj.GetType()); foreach (FieldInfo fi in destFields) { if (destFields.FindIndex(fi2 => fi2.Name == fi.Name) != -1 && fi.Name != "_HierarchyNode" && fi.Name != "_Children") { fi.SetValue(newObj, fi.GetValue(curObj)); } } newObj.RefreshRepresentation(false); } else { MessageBox.Show("Create or load GUI first."); } } else { if (curObj == null && addMenuStrip.DropDownItems.Contains(e.ClickedItem)) { MessageBox.Show("Create or load GUI first."); } else { ((Action <GUIObject>)e.ClickedItem.Tag)(curObj); } } } }; addMenuStrip.DropDownItemClicked += clickHandler; convertMenuStrip.DropDownItemClicked += clickHandler; hierarchyMenuStrip.ItemClicked += clickHandler; Hierarchy.ContextMenuStrip = hierarchyMenuStrip; // Design drag handler bool designDragging = false; Point designDragMouseStart = Point.Empty; Point designDragObjectStart = Point.Empty; Design.MouseDown += delegate(object sender, MouseEventArgs e) { if (Hierarchy.SelectedNode != null) { GUIObject obj = (GUIObject)Hierarchy.SelectedNode.Tag; if (obj.IsHit(e.X, e.Y)) { designDragging = true; designDragMouseStart = new Point(e.X, e.Y); designDragObjectStart = obj.Position; Design.Capture = true; } } }; Design.MouseUp += delegate(object sender, MouseEventArgs e) { designDragging = false; Design.Capture = false; }; Design.MouseMove += delegate(object sender, MouseEventArgs e) { if (designDragging && Hierarchy.SelectedNode != null) { GUIObject obj = (GUIObject)Hierarchy.SelectedNode.Tag; Point position = obj.Position; position.X = designDragObjectStart.X + e.X - designDragMouseStart.X; position.Y = designDragObjectStart.Y + e.Y - designDragMouseStart.Y; obj.Position = position; Properties.Refresh(); Design.Refresh(); } }; }