Esempio n. 1
0
        void UpdateXaml(string path)
        {
            var scope = Control.CreateScope(_watcher.Path, _engine);

            scope.OpenScope(new NullElementTabSet());
            var xaml = XamlReader.Parse(File.ReadAllText(path));

            scope.CloseScope();
            if (xaml is ResourceDictionary)
            {
                Application.Current.Resources = (ResourceDictionary)xaml;
                return;
            }
            else if (!(xaml is Window))
            {
                _errors.Text = "Changes detected in " + path + ", but there seems to be nowhere to put the changes";
                return;
            }

            var source = path.Substring(_watcher.Path.Length, path.Length - _watcher.Path.Length - 5);
            var tab    = new ElementTab(_engine.CreateScope(), _watcher.Path, source, this, true);

            _appTabs.Add(tab);
            tab.Refresh(source + ".xaml");
            _tabs.Items.Add(tab);
            if (File.Exists(_watcher.Path + source + ".rb"))
            {
                tab.Refresh(source + ".rb");
            }
        }
Esempio n. 2
0
        bool ObserveChange(string file)
        {
            if (_elementTab.Refresh(file))
            {
                Child = _elementTab.Element;
                return(true);
            }

            return(false);
        }