Esempio n. 1
0
        private static string LoadStringFromFile(string path)
        {
            string javaScript = string.Empty;

            using (var stream = ExtensionUtilities.GetStream(path))
            {
                using (var reader = new StreamReader(stream))
                {
                    javaScript = reader.ReadToEnd();
                }
            }

            return(javaScript);
        }
Esempio n. 2
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
        }