forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,683 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import appModule = require("./application-common"); | ||
import definition = require("application"); | ||
import frame = require("ui/frame"); | ||
import observable = require("data/observable"); | ||
import * as typesModule from "utils/types"; | ||
import * as enumsModule from "ui/enums"; | ||
var presentation = requireAssembly("PresentationFramework"); | ||
|
||
let enums: typeof enumsModule; | ||
|
||
global.moduleMerge(appModule, exports); | ||
const typedExports: typeof definition = exports; | ||
|
||
let started = false; | ||
let mainWindow; | ||
export function start(entry?: frame.NavigationEntry) { | ||
if (started) { | ||
throw new Error("Application is already started."); | ||
} | ||
|
||
started = true; | ||
if (entry) { | ||
typedExports.mainEntry = entry; | ||
} | ||
|
||
loadCss(); | ||
wpf.initialize(); | ||
} | ||
|
||
function loadCss() { | ||
//HACK: identical to application.ios.ts | ||
typedExports.appSelectors = typedExports.loadCss(typedExports.cssFile) || []; | ||
if (typedExports.appSelectors.length > 0) { | ||
typedExports.mergeCssSelectors(typedExports); | ||
} | ||
} | ||
|
||
export function addCss(cssText: string) { | ||
//HACK: identical to application.ios.ts | ||
const parsed = typedExports.parseCss(cssText); | ||
if (parsed) { | ||
typedExports.additionalSelectors.push.apply(typedExports.additionalSelectors, parsed); | ||
typedExports.mergeCssSelectors(typedExports); | ||
} | ||
} | ||
|
||
class WPFApp extends observable.Observable implements definition.WPFApplication { | ||
public nativeApp; | ||
public mainWindow; | ||
|
||
public initialize() { | ||
this.nativeApp = new presentation.System.Windows.Application(); | ||
var that = this; | ||
this.nativeApp.Startup.connect(function(sender, e) { | ||
var navParam = typedExports.mainEntry; | ||
if (!navParam) { | ||
navParam = { | ||
moduleName: typedExports.mainModule | ||
} | ||
} | ||
|
||
var rootFrame = new frame.Frame(); | ||
|
||
that.mainWindow = new presentation.System.Windows.Window(); | ||
that.mainWindow.Loaded.connect(function(s, e) { | ||
rootFrame.onLoaded(); | ||
}); | ||
navParam.context = that.mainWindow; | ||
|
||
rootFrame.navigate(navParam); | ||
that.mainWindow.Show(); | ||
}); | ||
this.nativeApp.Run(); | ||
} | ||
} | ||
|
||
export var wpf = new WPFApp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import common = require("./color-common"); | ||
|
||
let presentationCore = requireAssembly("PresentationCore"); | ||
|
||
export class Color extends common.Color { | ||
private _wpf; | ||
|
||
get wpf(): number { | ||
if(!this._wpf) { | ||
this._wpf = presentationCore.System.Windows.Media.Color.FromArgb(this.a, this.r, this.g, this.b); | ||
} | ||
return this._wpf; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.