예제 #1
0
        public static void LoadSample(RadDiagram diagram, string name)
        {
            if (diagram.GraphSource == null)
            {
                diagram.Clear();
            }
            using (var stream = ExtensionUtilities.GetStream(string.Format("/View/Diagrams/Common/SampleDiagrams/{0}.xml", name)))
            {
                using (var reader = new StreamReader(stream))
                {
                    var xml = reader.ReadToEnd();
                    if (!string.IsNullOrEmpty(xml))
                    {
                        diagram.Load(xml);
                    }
                }
            }
#if WPF
            diagram.Dispatcher.BeginInvoke(new Action(() => diagram.AutoFit()), System.Windows.Threading.DispatcherPriority.ApplicationIdle);
#else
            diagram.Dispatcher.BeginInvoke(new Action(() => diagram.AutoFit()));
#endif
        }
        public static void LoadDiagram(RadDiagram diagram, string name)
        {


            diagram.Clear();

            using (var stream = ExtensionUtilities.GetStream(string.Format("{0}.xml", name), "Procbel.Apps.Silverlight.Modules.Inicio"))
            {
                using (var reader = new StreamReader(stream))
                {
                    var xml = reader.ReadToEnd();
                    if (!string.IsNullOrEmpty(xml))
                    {
                        diagram.Load(xml);
                    }
                }
            }
#if WPF
            diagram.Dispatcher.BeginInvoke(new Action(() => diagram.AutoFit()), System.Windows.Threading.DispatcherPriority.Loaded);
#else
            diagram.Dispatcher.BeginInvoke(new Action(() => diagram.AutoFit()));
#endif
        }
예제 #3
0
 private static void LoadSample(RadDiagram diagram, string name)
 {
     diagram.Clear();
     using (var stream = ExtensionUtilities.GetStream(string.Format("/Common/SampleDiagrams/{0}.xml", name)))
     {
         using (var reader = new StreamReader(stream))
         {
             var xml = reader.ReadToEnd();
             if (!string.IsNullOrEmpty(xml))
             {
                 diagram.Load(xml);
             }
         }
     }
     diagram.Dispatcher.BeginInvoke(new Action(() => diagram.AutoFit()), System.Windows.Threading.DispatcherPriority.Loaded);
 }
예제 #4
0
        /// <summary>
        /// Creates a balanced radial forest.
        /// </summary>
        /// <param name="diagram">The diagram.</param>
        /// <param name="specs">The specs.</param>
        public static void BalancedRadialForest(this RadDiagram diagram, GraphGenerationSpecifications specs)
        {
            diagram.Clear();
            Dictionary <Node, RadDiagramShape>      nodeMap;
            Dictionary <Edge, RadDiagramConnection> edgeMap;
            var g        = diagram.CreateDiagram(CreateBalancedForest(), out nodeMap, out edgeMap, CreateShape, specs.RandomShapeSize);
            var settings = new TreeLayoutSettings
            {
                TreeLayoutType                  = specs.TreeType,
                HorizontalSeparation            = specs.HorizontalSeparation,
                VerticalSeparation              = specs.VerticalSeparation,
                UnderneathHorizontalOffset      = specs.UnderneathHorizontalOffset,
                UnderneathVerticalSeparation    = specs.UnderneathVerticalSeparation,
                KeepComponentsInOneRadialLayout = specs.KeepComponentsInOneRadialLayout
            };
            var center = g.FindNode(1);

            settings.Roots.Add(nodeMap[center]);
            var layout = new TreeLayout();

            layout.Layout(diagram, settings);
            diagram.AutoFit();
        }
예제 #5
0
		private static void LoadSample(RadDiagram diagram, string name)
		{
			diagram.Clear();
			using (var stream = ExtensionUtilities.GetStream(string.Format("/Common/SampleDiagrams/{0}.xml", name)))
			{
				using (var reader = new StreamReader(stream))
				{
					var xml = reader.ReadToEnd();
					if (!string.IsNullOrEmpty(xml))
					{
						diagram.Load(xml);
					}
				}
			}
			diagram.Dispatcher.BeginInvoke(new Action(() => diagram.AutoFit()));
		}
        public static void LoadSample(RadDiagram diagram, string name)
        {
            if (diagram.GraphSource == null)
                diagram.Clear();
            using (var stream = ExtensionUtilities.GetStream(string.Format("/Common/SampleDiagrams/{0}.xml", name)))
            {
                using (var reader = new StreamReader(stream))
                {
                    var xml = reader.ReadToEnd();
                    if (!string.IsNullOrEmpty(xml))
                    {
                        diagram.Load(xml);
                    }
                }
            }
#if WPF
			diagram.Dispatcher.BeginInvoke(new Action(() => diagram.AutoFit()), System.Windows.Threading.DispatcherPriority.ApplicationIdle);
#else
            diagram.Dispatcher.BeginInvoke(new Action(() => diagram.AutoFit()));
#endif
        }