/// <summary> /// Performs all the operations needed to init the plugin/App /// </summary> /// <param name="user">singleton instance of UserPlugin</param> /// <param name="rootPath">path where the config files can be found</param> /// <returns>true if the user is already logged in; false if still logged out</returns> public static bool InitApp(UserClient user, string rootPath, IPluginManager pluginManager) { if (user == null) return false; // initialize the config file Snip2Code.Utils.AppConfig.Current.Initialize(rootPath); log = LogManager.GetLogger("ClientUtils"); // login the user bool res = user.RetrieveUserPreferences(); bool loggedIn = false; if (res && ((!BaseWS.Username.IsNullOrWhiteSpaceOrEOF()) || (!BaseWS.IdentToken.IsNullOrWhiteSpaceOrEOF()))) { LoginPoller poller = new LoginPoller(BaseWS.Username, BaseWS.Password, BaseWS.IdentToken, BaseWS.UseOneAll, pluginManager); LoginTimer = new System.Threading.Timer(poller.RecallLogin, null, 0, AppConfig.Current.LoginRefreshTimeSec * 1000); loggedIn = true; } System.Threading.ThreadPool.QueueUserWorkItem(delegate { user.LoadSearchHistoryFromFile(); }, null); //set the empty profile picture for search list results: PictureManager.SetEmptyProfilePic(rootPath); return loggedIn; }