public Exporter(GridCanvas gridCanvas) { this.gridCanvas = gridCanvas; elements = gridCanvas.Elements; images = new List<ImageResource>(); texts = new List<TextResource>(); audios = new List<AudioResource>(); themes = new List<Theme>(); }
public PropertyGridAdorner(UIElement adornedElement) : base(adornedElement) { ownerElement = ((Element)adornedElement); ownerCanvas = (GridCanvas)ownerElement.OwnerCanvas; visualChildren = new VisualCollection(this); BuildPropertyGrid(); }
public ConnectorAdorner(UIElement adornedElement, Element owner) : base(adornedElement) { ownerElement = owner; visualChildren = new VisualCollection(this); ownerCanvas = Global.WorkArea; // Call a helper method to initialize the Thumbs // with a customized cursors. BuildAdornerThumb(ref left, Cursors.Cross, ThumbPosition.Left); BuildAdornerThumb(ref right, Cursors.SizeNESW, ThumbPosition.Right); BuildAdornerThumb(ref top, Cursors.SizeNESW, ThumbPosition.Top); BuildAdornerThumb(ref bottom, Cursors.SizeNWSE, ThumbPosition.Bottom); }
private UrbanGameContextWrapper LoadUgWrappers(GridCanvas gridCanvas,out UrbanGameTemplateWrapper template,out UrbanGameContextWrapper context) { template = null; context = null; UG_CityElement city = elements.OfType<UG_CityElement>().FirstOrDefault(); #region controllo prerequisiti if (city == null) { MessageBox.Show("City element not found."); return null; } #endregion context = city.ConvertToWrapper(); template = city.ConvertToTemplate(); //adding monuments .. foreach (var item in gridCanvas.GetElementsConnectedTo(city).OfType<UG_ContentItem>()) { context.Luoghi.Add(item.ConvertToWrapper(gridCanvas, context)); template.Tappe.Add(item.ConvertToTemplate(gridCanvas, template)); } //todo: stile ???? context.stile = new stile { id = "1" }; return context; }
/// <summary> /// Export all Urban GameResources in folder /Data/ /// </summary> /// <param name="gridCanvas"></param> /// <param name="appName"></param> private void ExportUGResources(GridCanvas canvas, string appName) { List<string> resourceStrings = new List<string>(); foreach (var item in elements.OfType<ResourceElement>()) { foreach (AbstractResource res in item.ResourceBox.Items) { resourceStrings.Add(res.UriString); } } // Create Folder DirectoryInfo dir = new DirectoryInfo(appName+"\\Data"); if (!dir.Exists) dir.Create(); //save all; foreach (var item in resourceStrings) { try { FileInfo res = new FileInfo(item); res.CopyTo(string.Format("{0}\\{1}", dir.FullName, res.Name), true); } catch (Exception ex) { MessageBox.Show(string.Format ("Errore nella copia del file {0}", item)); } } }