public MainPage()
        {
            this.InitializeComponent();
            SoapUtils.ServiceUrl = CrmServiceUrl;
            _accountsVM = new AccountsViewModel();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            // Every Windows Store application has a unique URI.
            // Windows ensures that only this application will receive messages sent to this URI.
            // ADAL uses this URI as the application's redirect URI to receive OAuth responses.
            // 
            // To determine this application's redirect URI, which is necessary when registering the app
            //      in AAD, set a breakpoint on the next line, run the app, and copy the string value of the URI.
            //      This is the only purposes of this line of code, it has no functional purpose in the application.
            //
            // store app:  "ms-app://s-1-15-2-1797451609-2481545285-2169326427-3565185340-866651618-3840574542-3393684411/"
            // phone app:  {ms-app://s-1-15-2-2671709060-4147598678-3876637945-4029922067-1409672279-882262885-2759017160/}

            _redirectURI = Windows.Security.Authentication.Web.WebAuthenticationBroker.GetCurrentApplicationCallbackUri();

            // Dyamics CRM Online OAuth URL.
            Uri serviceUri = new Uri(CrmServiceUrl + "/XRMServices/2011/Organization.svc/web?SdkClientVersion=6.1.0000.0000");
            string _oauthUrl = SoapUtils.GetOAuthAuthority(serviceUri);
            //string _oauthUrl = "https://login.windows.net/8ffacab8-e7fe-4f54-b08f-9da391ab5006/oauth2/authorize";

            // ADAL for Windows Phone 8.1 builds AuthenticationContext instances through a factory, which performs authority validation at creation time
            _authContext = AuthenticationContext.CreateAsync(_oauthUrl).GetResults();
        }
 public Accounts()
 {
     this.InitializeComponent();
     accountsVM = new AccountsViewModel();
 }