Skip to content

Commit

Permalink
Merged XrmInterface with XrmStatic into one global Xrm namespace
Browse files Browse the repository at this point in the history
Factored out all enums into XrmEnum so that the Xrm module becomes a non-instantiated module.
  • Loading branch information
markusmauch committed Mar 8, 2016
1 parent a40550c commit d60e6cb
Show file tree
Hide file tree
Showing 3 changed files with 283 additions and 294 deletions.
2 changes: 1 addition & 1 deletion xrm/parature.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare module Xrm.Page
*
* @sa Control
*/
export interface KbSearchControl extends XrmInterface.Page.Control
export interface KbSearchControl extends Xrm.Page.Control
{
/**
* Use this method to add an event handler to the OnResultOpened event.
Expand Down
15 changes: 10 additions & 5 deletions xrm/xrm-tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/// <reference path="xrm.d.ts" />
/// <reference path="parature.d.ts" />

/// Demonstrate usage in the browser's window object

window.Xrm.Utility.alertDialog( "message", () => {} );
parent.Xrm.Page.context.getOrgLcid();

/// Demonstrate clientglobalcontext.d.ts

function _getContext()
Expand All @@ -27,11 +32,11 @@ var grids = Xrm.Page.getControl(( control ) =>
return control.getControlType() === "subgrid";
});

var selectedGridReferences: XrmInterface.Page.LookupValue[] = [];
var selectedGridReferences: Xrm.Page.LookupValue[] = [];

/// Demonstrate iterator typing with v7.1 additions

grids.forEach(( gridControl: XrmInterface.Page.GridControl ) =>
grids.forEach(( gridControl: Xrm.Page.GridControl ) =>
{
gridControl.getGrid().getSelectedRows().forEach(( row ) =>
{
Expand All @@ -41,8 +46,8 @@ grids.forEach(( gridControl: XrmInterface.Page.GridControl ) =>

/// Demonstrate generic overload vs typecast

var lookupAttribute = <XrmInterface.Page.LookupControl>Xrm.Page.getControl( "customerid" );
var lookupAttribute2 = Xrm.Page.getControl<XrmInterface.Page.LookupControl>( "customerid" );
var lookupAttribute = <Xrm.Page.LookupControl>Xrm.Page.getControl( "customerid" );
var lookupAttribute2 = Xrm.Page.getControl<Xrm.Page.LookupControl>( "customerid" );

/// Demonstrate ES6 String literal syntax

Expand Down Expand Up @@ -91,7 +96,7 @@ Xrm.Page.data.entity.addOnSave(( context ) =>
{
var eventArgs = context.getEventArgs();

if ( eventArgs.getSaveMode() === XrmInterface.Page.SaveMode.AutoSave || eventArgs.getSaveMode() === XrmInterface.Page.SaveMode.SaveAndClose )
if ( eventArgs.getSaveMode() === XrmEnum.SaveMode.AutoSave || eventArgs.getSaveMode() === XrmEnum.SaveMode.SaveAndClose )
eventArgs.preventDefault();
});

Expand Down
Loading

0 comments on commit d60e6cb

Please sign in to comment.