//Wrap a generic exception handler to get some useful information in the event of a //crash. public void Init(MainWindow ParentWindow, Arguments Arguments) { LoggerFacade.Trace("MainController initializing"); this._envController = new EnvironmentController(this); this._pages = new List <TsPage>(); this._linkinglibrary = new LinkingLibrary(); this._grouplibrary = new GroupLibrary(); this._toggles = new List <IToggleControl>(); this._optionlibrary = new OptionLibrary(); this._authlibrary = new AuthLibrary(); this._args = Arguments; this.ParentWindow = ParentWindow; this.ParentWindow.MouseLeftButtonUp += this.OnWindowMouseUp; this.ParentWindow.LocationChanged += this.OnWindowMoving; try { this.Startup(); } catch (TsGuiKnownException exc) { string msg = "Error message: " + exc.CustomMessage; this.CloseWithError("Application Startup Exception", msg); return; } catch (Exception exc) { string msg = "Error message: " + exc.Message + Environment.NewLine + exc.ToString(); this.CloseWithError("Application Startup Exception", msg); return; } }
static object ChooseAuthMethodAndInvoke(BaseOptions options, AuthLibrary library) { if (!string.IsNullOrEmpty(options.JsonPath)) { return(library.AuthExplicit(options.ProjectId, options.JsonPath)); } if (options.Compute) { return(library.AuthExplicitComputeEngine(options.ProjectId)); } return(library.AuthImplicit(options.ProjectId)); }
public ActionResult Login(Agency agency) { try { applicationInfo.agencyName = agency.agencyName; applicationInfo.agencyEnvironment = agency.agencyEnv; AuthLibrary.Login(applicationInfo, ConfigurationManager.AppSettings["RedirectUrl"], ConfigurationManager.AppSettings["Scope"]); return(new EmptyResult()); } catch (Exception e) { // display error ViewBag.Message = e.Message; return(View("Index")); } }
public ActionResult Index() { try { CurrentUserProfile userProfile = AuthLibrary.GetCurrentUserProfile(ConfigurationManager.AppSettings["RedirectUrl"], applicationInfo); if (userProfile != null) { // good to do something here and take to next page return(View("Authenticated", userProfile)); } else { return(View("Index")); } } catch (Exception e) { // display error ViewBag.Message = e.Message; return(View("Index")); } }