support for custom components CSS added

This commit is contained in:
Vladimir Enchev
2015-07-08 11:28:13 +03:00
parent 7ded3a7437
commit f478c619d8
7 changed files with 48 additions and 11 deletions

View File

@@ -20,7 +20,7 @@ var navigationBarHiddenProperty = new dependencyObservable.Property(
);
function onNavigationBarHiddenPropertyChanged(data: dependencyObservable.PropertyChangeData) {
console.log("onNavigationBarHiddenPropertyChanged("+data.newValue+")");
console.log("onNavigationBarHiddenPropertyChanged(" + data.newValue + ")");
var page = <Page>data.object;
if (page.isLoaded) {
page._updateNavigationBar(data.newValue);
@@ -116,15 +116,18 @@ export class Page extends contentView.ContentView implements dts.Page, view.AddA
this._refreshCss();
}
private _cssFiles = {};
public addCssFile(cssFileName: string) {
if (cssFileName.indexOf(fs.knownFolders.currentApp().path) !== 0) {
cssFileName = fs.path.join(fs.knownFolders.currentApp().path, cssFileName);
}
var cssString;
if (fs.File.exists(cssFileName)) {
new fileSystemAccess.FileSystemAccess().readText(cssFileName, r => { cssString = r; });
this._addCssInternal(cssString, cssFileName);
if (!this._cssFiles[cssFileName]) {
if (fs.File.exists(cssFileName)) {
new fileSystemAccess.FileSystemAccess().readText(cssFileName, r => {
this._addCssInternal(r, cssFileName);
this._cssFiles[cssFileName] = true;
});
}
}
}