private void CompareLMIndexEntry(LearningModulesIndexEntry expected, LearningModulesIndexEntry actual) { Assert.IsTrue(actual.DisplayName == expected.DisplayName, "Display name is not equal"); Assert.IsTrue(actual.ConnectionName == expected.ConnectionName, "Connection name is not equal"); Assert.IsTrue(actual.ConnectionString.ConnectionString == expected.ConnectionString.ConnectionString, "Connection string is not equal"); Assert.IsTrue(actual.ConnectionString.LmId == expected.ConnectionString.LmId, "LmId is not equal"); }
/// <summary> /// Initializes a new instance of the <see cref="LearningModuleListViewItem"/> class. /// </summary> /// <param name="entry">The entry.</param> /// <remarks>Documented by Dev05, 2009-03-07</remarks> public LearningModuleListViewItem(LearningModulesIndexEntry entry) : base(entry.DisplayName) { LearningModule = entry; LearningModule.IsVerifiedChanged += new EventHandler(LearningModule_IsVerifiedChanged); while (SubItems.Count < 6) { SubItems.Add(new ListViewItem.ListViewSubItem()); } //grey pictures ImageIndex = entry.Type == LearningModuleType.Local ? 1 : 5; Group = entry.Group; if (entry.IsVerified) { UpdateDetails(); } else { SubItems[1].Text = Resources.STARTPAGE_LOADING; } }
private void learningModulesPageMain_LearningModuleSelected(object sender, LearningModuleSelectedEventArgs e) { selectedConnection = e.LearnModule; IsUsedDragAndDrop = e.IsUsedDragAndDrop; this.DialogResult = DialogResult.OK; Close(); }
/// <summary> /// Adds the recent file to the stick config. /// </summary> /// <param name="learningModule">The learning module.</param> /// <remarks>Documented by Dev03, 2009-05-12</remarks> private static void AddRecentFileToStick(LearningModulesIndexEntry learningModule) { if (learningModule.ConnectionString.Typ == MLifter.DAL.DatabaseType.MsSqlCe) { List <string> recentFiles = Setup.GetRecentFilesFromStick(); if (recentFiles.Count > 0) { recentFiles.Reverse(); if (recentFiles.Exists(r => r == learningModule.ConnectionString.ConnectionString)) { recentFiles.Remove(learningModule.ConnectionString.ConnectionString); } recentFiles.Add(learningModule.ConnectionString.ConnectionString); if (recentFiles.Count > Settings.Default.RecentFilesCount && Settings.Default.RecentFilesCount > 0) { recentFiles.Remove(recentFiles[0]); } recentFiles.Reverse(); Settings.Default.Reload(); Settings.Default.RecentFiles = "\"" + String.Join("\",\"", recentFiles.ToArray()) + "\""; } else { Settings.Default.Reload(); Settings.Default.RecentFiles = "\"" + learningModule.ConnectionString.ConnectionString + "\""; } Settings.Default.Save(); } }
public void OpenLearningModuleFileNotFoundTest() { LearnLogic llogic = new LearnLogic((GetLoginInformation)MLifterTest.DAL.TestInfrastructure.GetTestUser, (DataAccessErrorDelegate) delegate { return; }); LearningModulesIndexEntry module = new LearningModulesIndexEntry(); module.ConnectionString = new ConnectionStringStruct(DatabaseType.Xml, "invalid"); llogic.OpenLearningModule(module); }
/// <summary> /// Loads the dictionary. /// </summary> /// <param name="module">The module.</param> /// <returns></returns> /// <remarks>Documented by Dev08, 2009-03-27</remarks> public static bool LoadDictionary(LearningModulesIndexEntry module, string helpfile) { if (!ValidLearningModuleIndexEntry(module)) { return(false); } return(LoadDictionary(new Dictionary(module.Dictionary, null), helpfile)); }
/// <summary> /// Adds the recent learning module. /// </summary> /// <param name="learningModule">The learning module.</param> /// <remarks>Documented by Dev03, 2009-05-11</remarks> public static void AddRecentLearningModule(LearningModulesIndexEntry learningModule) { RecentLearningModules.Add(learningModule); RecentLearningModules.Dump(Setup.RecentLearningModulesPath); if (RunningFromStick()) { Setup.AddRecentFileToStick(learningModule); } }
/// <summary> /// Opens the learning module (or schedules it for opening). /// </summary> /// <param name="configFilePath">The config file path.</param> /// <param name="LmId">The lm id.</param> /// <param name="LmName">Name of the lm.</param> /// <param name="UserId">The user id.</param> /// <param name="UserName">Name of the user.</param> /// <param name="UserPassword">The user password (needed for FormsAuthentication, else empty).</param> /// <remarks>Documented by Dev02, 2009-06-26</remarks> /// <exception cref="MLHasOpenFormsException">Occurs when settings or the learning module could not be changed because MemoryLifter has other forms/windows open.</exception> /// <exception cref="ConfigFileParseException">Occurs when the supplied config file could not be parsed properly or does not contain a valid connection.</exception> /// <exception cref="MLCouldNotBeStartedException">Occurs when MemoryLifter did not start or did not react to connection attempts.</exception> public void OpenLearningModule(string configFilePath, int LmId, string LmName, int UserId, string UserName, string UserPassword) { ConnectionStringHandler csHandler = new ConnectionStringHandler(configFilePath); if (csHandler.ConnectionStrings.Count < 1) { throw new ConfigFileParseException(); } Debug.WriteLine(string.Format("Config file parsed ({0}), building connection...", configFilePath)); IConnectionString connectionString = csHandler.ConnectionStrings[0]; ConnectionStringStruct css = new ConnectionStringStruct(); css.LmId = LmId; css.Typ = connectionString.ConnectionType; css.ConnectionString = connectionString.ConnectionString; if (connectionString is UncConnectionStringBuilder) { css.ConnectionString = Path.Combine(css.ConnectionString, LmName + Helper.EmbeddedDbExtension); css.Typ = DatabaseType.MsSqlCe; } if (connectionString is ISyncableConnectionString) { ISyncableConnectionString syncConnectionString = (ISyncableConnectionString)connectionString; css.LearningModuleFolder = syncConnectionString.MediaURI; css.ExtensionURI = syncConnectionString.ExtensionURI; css.SyncType = syncConnectionString.SyncType; } LearningModulesIndexEntry entry = new LearningModulesIndexEntry(css); entry.User = new DummyUser(UserId, UserName); ((DummyUser)entry.User).Password = UserPassword; entry.UserName = UserName; entry.UserId = UserId; entry.Connection = connectionString; entry.DisplayName = LmName; entry.SyncedPath = LmName + Helper.SyncedEmbeddedDbExtension; Debug.WriteLine("Opening learning module..."); try { loader.LoadDictionary(entry); } catch (MLifter.Classes.FormsOpenException) { throw new MLHasOpenFormsException(); } }
/// <summary> /// Runs a test for opening file types that throw exceptions. /// </summary> /// <param name="ext">The ext.</param> /// <remarks>Documented by Dev09, 2009-03-05</remarks> private void FileExtTestHelper(String ext) { // create temp file with desired extension String filename = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + "." + ext); File.Create(filename); LearnLogic llogic = new LearnLogic((GetLoginInformation)MLifterTest.DAL.TestInfrastructure.GetTestUser, (DataAccessErrorDelegate) delegate { return; }); LearningModulesIndexEntry module = new LearningModulesIndexEntry(); module.ConnectionString = new ConnectionStringStruct(DatabaseType.Xml, filename); llogic.OpenLearningModule(module); }
public void OpenLearningModuleCannotCloseTest() { if (TestInfrastructure.IsActive(TestContext) && TestInfrastructure.ConnectionType(TestContext).ToLower() != "file") { LearnLogic llogic = new LearnLogic((GetLoginInformation)MLifterTest.DAL.TestInfrastructure.GetTestUser, (DataAccessErrorDelegate) delegate { return; }); LearningModulesIndexEntry module = new LearningModulesIndexEntry(); module.ConnectionString = TestInfrastructure.GetConnectionStringWithDummyData(TestContext); llogic.LearningModuleClosing += new LearnLogic.LearningModuleClosingEventHandler(llogic_LearningModuleClosing); llogic.OpenLearningModule(module); llogic.OpenLearningModule(module); } else { throw new CouldNotCloseLearningModuleException(); } }
/// <summary> /// Valids the learning module index entry. /// </summary> /// <param name="module">The module.</param> /// <returns></returns> /// <remarks>Documented by Dev08, 2009-03-27</remarks> private static bool ValidLearningModuleIndexEntry(LearningModulesIndexEntry module) { if (module == null) { return(false); } if (!module.IsAccessible || !module.IsVerified) { return(false); } if (module.NotAccessibleReason != LearningModuleNotAccessibleReason.IsAccessible) { return(false); } if (module.ConnectionString.Typ == MLifter.DAL.DatabaseType.Xml) { return(false); } return(true); }
/// <summary> /// Upgrades the settings from an earlier version. /// </summary> /// <remarks>Documented by Dev05, 2007-11-14</remarks> public static void UpgradeFromEarlierVersion() { if (!Settings.Default.Upgraded) { try //[ML-397] ML sometimes throws an exception when trying to update old user seetings { Settings.Default.Upgrade(); } catch { } Settings.Default.Upgraded = true; Settings.Default.Save(); //try to import recent files List <string> recent = GetRecentFilesFromStick();; if (recent.Count > 0) { recent.Reverse(); recent.ForEach(delegate(String file) { try { if (!File.Exists(file)) { return; } } catch { return; } LearningModulesIndexEntry entry = FolderIndexEntry.CreateNewOdxLearningModuleEntryStatic(file); RecentLearningModules.Add(entry); }); RecentLearningModules.Dump(RecentLearningModulesPath); Settings.Default.RecentFiles = string.Empty; } Settings.Default.Save(); } }
/// <summary> /// Initializes a new instance of the <see cref="RecentLearningModulesTest"/> class. /// </summary> /// <remarks>Documented by Dev07, 2009-03-03</remarks> public RecentLearningModulesTest() { lm1 = new LearningModulesIndexEntry(); lm2 = new LearningModulesIndexEntry(); ConnectionStringStruct css1 = new ConnectionStringStruct(); css1.ConnectionString = "con1"; css1.LmId = 1; ConnectionStringStruct css2 = new ConnectionStringStruct(); css2.ConnectionString = "con2"; css2.LmId = 2; lm1.DisplayName = "learnmodule1"; lm1.ConnectionName = "connectionname1"; lm1.ConnectionString = css1; lm2.DisplayName = "learnmodule2"; lm2.ConnectionName = "connectionname2"; lm2.ConnectionString = css2; }
/// <summary> /// Loads the dictionary. /// </summary> /// <param name="entry">The entry.</param> /// <remarks>Documented by Dev02, 2009-06-26</remarks> public void LoadDictionary(LearningModulesIndexEntry entry) { if (MLifter.Program.MainForm.IsHandleCreated && !MLifter.Program.SuspendIPC) { MLifter.Program.MainForm.Invoke((MethodInvoker) delegate { try { //[ML-1126] Do not allow to open dictionaries when an edit form is still open MLifter.Program.MainForm.CloseLearningModulesPage(); if (!MLifter.Program.MainForm.OtherFormsOpen) { MLifter.Program.MainForm.OpenEntry(entry); } else { throw new FormsOpenException(); } } catch (Exception exp) { if (exp is FormsOpenException) { throw; } RemotingException(exp); } }); } else { MLifter.Program.MainForm.MainformLoaded += new EventHandler(delegate { LoadDictionary(entry); }); } }
/// <summary> /// Initializes a new instance of the <see cref="RecentLearningModulesTest"/> class. /// </summary> /// <remarks>Documented by Dev07, 2009-03-03</remarks> public OfflineModulesTest() { tempFolder = Path.Combine(Path.GetTempPath(), "ML_Temp"); Directory.CreateDirectory(tempFolder); File.Create(Path.Combine(tempFolder, "lm1.mlm")); File.Create(Path.Combine(tempFolder, "lm2.mlm")); lm1 = new LearningModulesIndexEntry(); lm2 = new LearningModulesIndexEntry(); ConnectionStringStruct css1 = new ConnectionStringStruct(); css1.ConnectionString = Path.Combine(tempFolder, "lm1.mlm"); css1.Typ = MLifter.DAL.DatabaseType.MsSqlCe; css1.LmId = 1; ConnectionStringStruct css2 = new ConnectionStringStruct(); css2.ConnectionString = Path.Combine(tempFolder, "lm2.mlm"); css2.Typ = MLifter.DAL.DatabaseType.MsSqlCe; css2.LmId = 2; IConnectionString con = new UncConnectionStringBuilder(tempFolder); lm1.DisplayName = "learnmodule1"; lm1.ConnectionName = "connectionname1"; lm1.Connection = con; lm1.ConnectionString = css1; lm1.SyncedPath = css1.ConnectionString; lm2.DisplayName = "learnmodule2"; lm2.ConnectionName = "connectionname2"; lm2.Connection = con; lm2.ConnectionString = css2; lm2.SyncedPath = css2.ConnectionString; }
/// <summary> /// Initializes the profile environment. /// </summary> /// <remarks>Documented by Dev05, 2007-11-15</remarks> public static void InitializeProfile(bool copyDemoDictionary, string dictionaryParentPath) { MLifter.Controls.LoadStatusMessage progress = new MLifter.Controls.LoadStatusMessage(Resources.UNPACK_TLOADMSG, 100, true); try { if (!Directory.Exists(dictionaryParentPath)) { Directory.CreateDirectory(dictionaryParentPath); } if (!copyDemoDictionary) { return; } string zipFilePath = Path.Combine(Application.StartupPath, Resources.SETUP_STARTUP_FOLDERS); if (!File.Exists(zipFilePath)) { return; } progress.SetProgress(0); Cursor.Current = Cursors.WaitCursor; progress.Show(); long zCount = 0; ZipFile zFile = null; try { zFile = new ZipFile(zipFilePath); zCount = zFile.Count; } catch (Exception ex) { throw ex; } finally { if (zFile != null) { zFile.Close(); } } if (zCount == 0) { return; } using (ZipInputStream zipFile = new ZipInputStream(File.OpenRead(zipFilePath))) { ZipEntry entry; int zCounter = 1; while ((entry = zipFile.GetNextEntry()) != null) { string directoryName = Path.GetDirectoryName(entry.Name); string fileName = Path.GetFileName(entry.Name); if (directoryName.Length > 0) { Directory.CreateDirectory(Path.Combine(dictionaryParentPath, directoryName)); } if (fileName.Length > 0) { using (FileStream stream = File.Open(Path.Combine(Path.Combine(dictionaryParentPath, directoryName), fileName), FileMode.Create, FileAccess.Write, FileShare.None)) { int bufferSize = 1024; byte[] buffer = new byte[bufferSize]; while (bufferSize > 0) { bufferSize = zipFile.Read(buffer, 0, buffer.Length); if (bufferSize > 0) { stream.Write(buffer, 0, bufferSize); } } } } if ((Path.GetExtension(fileName) == MLifter.DAL.Helper.OdxExtension) || (Path.GetExtension(fileName) == MLifter.DAL.Helper.EmbeddedDbExtension)) { string dicPath = Path.Combine(Path.Combine(dictionaryParentPath, directoryName), fileName); LearningModulesIndexEntry indexEntry = new LearningModulesIndexEntry(); indexEntry.DisplayName = "StartUp"; indexEntry.ConnectionString = new MLifter.DAL.Interfaces.ConnectionStringStruct(MLifter.DAL.DatabaseType.MsSqlCe, dicPath, false); Setup.AddRecentLearningModule(indexEntry); } progress.SetProgress((int)Math.Floor(100.0 * (zCounter++) / zCount)); } } Settings.Default.Save(); } catch { MessageBox.Show(Properties.Resources.INITIALIZE_ENVIRONMENT_ERROR_TEXT, Properties.Resources.INITIALIZE_ENVIRONMENT_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { progress.Dispose(); Cursor.Current = Cursors.Default; } }
/// <summary> /// Initializes a new instance of the <see cref="ImportLearningModuleEventArgs"/> class. /// </summary> /// <param name="treeNode">The the tree node to which the learning module should be imported.</param> /// <remarks>Documented by Dev05, 2008-12-03</remarks> public ImportLearningModuleEventArgs(FolderTreeNode treeNode, LearningModulesIndexEntry learningModule) { this.treeNode = treeNode; this.learningModule = learningModule; }
/// <summary> /// Initializes a new instance of the <see cref="LearningModuleSelectedEventArgs"/> class. /// </summary> /// <param name="entry">The entry which was updated.</param> /// <remarks>Documented by Dev05, 2008-12-03</remarks> public LearningModuleSelectedEventArgs(LearningModulesIndexEntry learnModuleConnection) { this.learnModule = learnModuleConnection; IsUsedDragAndDrop = false; }
public byte[] GetLearningModuleIndexEntry(int learningModuleId, string clientId) { try { if ((int)Session["uid"] < 0) { throw new NoValidUserException(); } string key = string.Format("user-{0}", (int)Session["uid"]); string lmKey = string.Format("lm-{0}", learningModuleId); IUser user = null; lock (formatter) { try { user = HttpContext.Current.Cache[key] as IUser; } catch { } if (user == null) { user = UserFactory.Create((GetLoginInformation) delegate(UserStruct u, ConnectionStringStruct c) { if (u.LastLoginError != LoginError.NoError) { throw new InvalidCredentialsException("Some of the submited credentials are wrong!"); } string username = Session["username"].ToString(); string password = Session["password"].ToString(); UserAuthenticationTyp authType = password == string.Empty ? UserAuthenticationTyp.ListAuthentication : UserAuthenticationTyp.FormsAuthentication; return(new UserStruct(username, password, authType, true, true)); }, new ConnectionStringStruct(DatabaseType.PostgreSQL, ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString, -1), (DataAccessErrorDelegate) delegate { return; }, ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString, true); HttpContext.Current.Cache[key] = user; } } IDictionary dic = new MLifter.DAL.DB.DbDictionary(learningModuleId, user); LearningModulesIndexEntry entry = new LearningModulesIndexEntry(); entry.User = user; entry.Dictionary = dic; entry.DisplayName = dic.Title; entry.Type = LearningModuleType.Remote; entry.Type = LearningModuleType.Remote; entry.ConnectionString = new ConnectionStringStruct(DatabaseType.PostgreSQL, dic.Connection, dic.Id, user.ConnectionString.SessionId); LearningModulesIndex.LoadEntry(entry); if (entry.Dictionary.ContentProtected) { // MemoryLifter > 2.3 does not support DRM protected content entry.IsAccessible = false; entry.NotAccessibleReason = LearningModuleNotAccessibleReason.Protected; } ConnectionStringStruct conString = entry.ConnectionString; conString.ConnectionString = string.Empty; entry.ConnectionString = conString; MemoryStream stream = new MemoryStream(); formatter.Serialize(stream, entry); return(stream.ToArray()); } catch (Exception exp) { try { WriteLogEntry(exp.ToString()); } catch { throw exp; } return(null); } }
/// <summary> /// Initializes the control with the specified connection (name). /// </summary> /// <param name="connectionName">Name of the connection.</param> /// <param name="connection">The connection.</param> /// <remarks>Documented by Dev05, 2009-03-03</remarks> public UserStruct?Initialize(ConnectionStringStruct connection, UserStruct lastUser) { ConnectionString = LearningModulesIndex.ConnectionsHandler.GetConnectionFromConnectionStringStruct(connection); if (ConnectionString == null) { LearningModulesIndexEntry entry = RecentLearningModules.GetRecentModules().Find(m => m.ConnectionString.ConnectionString == connection.ConnectionString); if (entry != null) { ConnectionString = entry.Connection; } } ConnectionName = connection.Typ != DatabaseType.MsSqlCe ? (ConnectionString != null ? ConnectionString.Name : Resources.NO_CONNECTION_NAME) : Path.GetFileName(connection.ConnectionString); Connection = connection; if (connection.Typ == DatabaseType.MsSqlCe) { comboBoxUserSelection.DropDownStyle = ComboBoxStyle.DropDownList; } else { comboBoxUserSelection.DropDownStyle = ComboBoxStyle.DropDown; } #region error handling switch (lastUser.LastLoginError) { case LoginError.AlreadyLoggedIn: EmulatedTaskDialog taskDialog = new EmulatedTaskDialog(); taskDialog.Title = Resources.TASKDIALOG_KICK_TITLE; taskDialog.MainInstruction = string.Format(Resources.TASKDIALOG_KICK_MAIN, lastUser.UserName); taskDialog.Content = string.Format(Resources.TASKDIALOG_KICK_CONTENT, ConnectionName); taskDialog.CommandButtons = Resources.TASKDIALOG_KICK_BUTTONS; taskDialog.VerificationText = string.Empty; taskDialog.VerificationCheckBoxChecked = false; taskDialog.Buttons = TaskDialogButtons.None; taskDialog.MainIcon = TaskDialogIcons.Warning; taskDialog.FooterIcon = TaskDialogIcons.Warning; taskDialog.MainImages = new Image[] { Resources.system_log_out, Resources.processStopBig }; taskDialog.HoverImages = new Image[] { Resources.system_log_out, Resources.processStopBig }; taskDialog.CenterImages = true; taskDialog.BuildForm(); DialogResult dialogResult = taskDialog.ShowDialog(); if (dialogResult != DialogResult.Cancel && taskDialog.CommandButtonClickedIndex == 0) { lastUser.CloseOpenSessions = true; return(lastUser); } else { AllowAutoLogin = false; } break; case LoginError.InvalidUsername: TaskDialog.MessageBox(Resources.TASKDIALOG_WRONG_USER_TITLE, Resources.TASKDIALOG_WRONG_USER_MAIN, Resources.TASKDIALOG_WRONG_USER_CONTENT, TaskDialogButtons.OK, TaskDialogIcons.Error); break; case LoginError.InvalidPassword: TaskDialog.MessageBox(Resources.TASKDIALOG_WRONG_PASSWORD_TITLE, Resources.TASKDIALOG_WRONG_PASSWORD_MAIN, Resources.TASKDIALOG_WRONG_PASSWORD_CONTENT, TaskDialogButtons.OK, TaskDialogIcons.Error); break; case LoginError.WrongAuthentication: case LoginError.ForbiddenAuthentication: TaskDialog.MessageBox(Resources.TASKDIALOG_WRONG_AUTHENTIFICATION_TITLE, Resources.TASKDIALOG_WRONG_AUTHENTIFICATION_MAIN, Resources.TASKDIALOG_WRONG_AUTHENTIFICATION_CONTENT, TaskDialogButtons.OK, TaskDialogIcons.Error); break; case LoginError.NoError: default: break; } #endregion labelHeader.Text = string.Format(Resources.LOGIN_HEADER_TEXT, ConnectionName); buttonCancel.Enabled = connection.Typ != DatabaseType.MsSqlCe; try { SetListItems(); UpdateSelection(false); #region persitancy Stream outputStream = null; try { BinaryFormatter binary = new BinaryFormatter(); IsolatedStorageFile storageFile = IsolatedStorageFile.GetUserStoreForAssembly(); outputStream = new IsolatedStorageFileStream(Settings.Default.AuthDataFile, FileMode.Open, storageFile); outputStream = new CryptoStream(outputStream, Rijndael.Create().CreateDecryptor(Encoding.Unicode.GetBytes("mlifter"), Encoding.Unicode.GetBytes("omicron")), CryptoStreamMode.Read); persitancyData = binary.Deserialize(outputStream) as Dictionary <string, SavedUserData>; outputStream.Close(); } catch { persitancyData = new Dictionary <string, SavedUserData>(); } finally { if (outputStream != null) { outputStream.Close(); } } if (ConnectionString != null && persitancyData.ContainsKey(ConnectionString.ConnectionString)) { SavedUserData data = persitancyData[ConnectionString.ConnectionString]; if (data.SaveUsername) { checkBoxSaveUsername.Checked = true; ShowOptions = true; comboBoxUserSelection.Text = data.Username; if (data.SavePassword) { checkBoxSavePassword.Checked = true; textBoxPassword.Text = data.Password; textBoxPassword.Tag = PasswordType.Hashed; if (data.AutoLogin) { checkBoxAutoLogin.Checked = true; if (AllowAutoLogin && !MLifter.BusinessLayer.User.PreventAutoLogin) { Login(); return(GetActualUser()); } } else { checkBoxAutoLogin.Checked = false; } } else { checkBoxSavePassword.Checked = false; } } else { checkBoxSaveUsername.Checked = false; ShowOptions = false; } } #endregion comboBoxUserSelection.Focus(); if (lastUser.LastLoginError != LoginError.NoError) { comboBoxUserSelection.Text = lastUser.UserName; textBoxPassword.Text = string.Empty; textBoxPassword.Tag = PasswordType.ClearText; } LoginError = lastUser.LastLoginError; } catch (ConnectionNotSetException ex) { Debug.WriteLine(ex.ToString()); } return(null); }