public static bool Login(string loginName, string passWord, bool rememberPass) { if (!string.IsNullOrEmpty(loginName) && !string.IsNullOrEmpty(passWord)) { using (AuthenticationClient ac = new AuthenticationClient()) { string [] loginResult = ac.Login(loginName, passWord); if (loginResult.Length >= 2) { string token = loginResult[0]; if (token != null && token.Length > 0) { ConfigManager.SetConfigurationValue_AES(KeyName.loginName, loginName); if (rememberPass) { ConfigManager.SetConfigurationValue_AES(KeyName.pass, passWord); } else { ConfigManager.SetConfigurationValue(KeyName.pass, ""); } loginToken = token; LoginName = loginName; UserName = loginResult[1]; UserLoggedIn(null, EventArgs.Empty); return(true); } } } } return(false); }
public MainWindow() { this.DataContext = this; InitializeComponent(); StatusBarHelper.Init(this); characterToolBar.CommandCompleted += (x, y) => { editor.Focus(); }; equationToolBar.CommandCompleted += (x, y) => { editor.Focus(); }; SetTitle(); AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(MainWindow_MouseDown), true); Task.Factory.StartNew(CheckForUpdate); if (ConfigManager.GetConfigurationValue(KeyName.firstTime) == "true" || ConfigManager.GetConfigurationValue(KeyName.version) != version) { string successMessage = ""; if (ConfigManager.SetConfigurationValue(KeyName.firstTime, "false") && ConfigManager.SetConfigurationValue(KeyName.version, version)) { successMessage = "\r\n\r\nThis message will not be shown again."; } MessageBox.Show("Thanks for using Math Editor. Math Editor is under constant development and we regularly release better versions of this product." + Environment.NewLine + Environment.NewLine + "Please help us by sending your suggestions, feature requests or bug reports using our facebook page or our website (see help)." + Environment.NewLine + Environment.NewLine + successMessage, "Important message"); } UndoManager.CanUndo += (a, b) => { undoButton.IsEnabled = b.ActionPossible; }; UndoManager.CanRedo += (a, b) => { redoButton.IsEnabled = b.ActionPossible; }; EquationBase.SelectionAvailable += new EventHandler <EventArgs>(editor_SelectionAvailable); EquationBase.SelectionUnavailable += new EventHandler <EventArgs>(editor_SelectionUnavailable); underbarToggle.IsChecked = true; TextEquation.InputPropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(TextEquation_InputPropertyChanged); editor.ZoomChanged += new EventHandler(editor_ZoomChanged); MVService.UserLoggedIn += new EventHandler(MVService_UserLoggedIn); MVService.UserLoggedOut += new EventHandler(MVService_UserLoggedOut); ProcessLogout(); }
public void Save() { string data = ""; foreach (var s in recentList) { data += s + ","; } data = data.Trim(','); ConfigManager.SetConfigurationValue(KeyName.symbols, data); }