Esempio n. 1
0
 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>();
 }
Esempio n. 2
0
        public PropertyGridAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            ownerElement = ((Element)adornedElement);
            ownerCanvas = (GridCanvas)ownerElement.OwnerCanvas;
            visualChildren = new VisualCollection(this);

            BuildPropertyGrid();
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        /// <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));
                }
            }
        }