private static async Task ShowPageAsPerDocument() { var autoCadName = AutoCADManager.GetDrawingName(); if (!String.IsNullOrEmpty(OneNoteManager.PageName) && !String.Equals(autoCadName, OneNoteManager.PageName)) { await ShowPage(autoCadName); } }
private static async void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { // Check if the url incoming has a code, if so pass on to the AuthManager to get token if (e.Url.Query.Contains("code=")) { var token = await AuthManager.GetToken(e.Url); await ShowPage(AutoCADManager.GetDrawingName()); } else if (e.Url.ToString().StartsWith("https://onedrive.live.com")) { userControl.ShowLoadingLabel(false); } else if (e.Url.OriginalString.Contains("error=access_denied")) { // User refused to accept the permission scopes myPaletteSet.Visible = false; initialized = false; // Set initialize to false so that it tries to create again if opened next time. // Remove the wire-ups of events else they will happen twice AutoCADManager.UnWireUpDocumentReloadEvent(); AutoCADManager.DocumentChanged -= AutoCADManager_DocumentChanged; } }