public void ChangeUser() { LoadCurrentUser(); File.textlist file = new PeonLib.File.textlist(definitions.path.UserList); forms.UserSelectForm f = new PeonLib.forms.UserSelectForm("Change User"); int i = 0; foreach (string s in file.Items) { if (s == mUser.NAME) { file.Items.RemoveAt(i); break; } ++i; } if (file.Items.Count == 0) { MessageBox.Show("There is no other user"); return; } f.LoadFile(file); f.ShowDialog(); if (f.DialogResult == DialogResult.OK) { int n = f.ID; mUser.PushFrontLastUserProfile(); mUser.WriteLastUserProfile(); SetCurrentUser(file.Items[n], true); mUser.WriteLastUserProfile(); } }
public void DeleteUser() { File.textlist file = new PeonLib.File.textlist(definitions.path.UserList); if (file.Items.Count > 1) { forms.UserSelectForm f = new PeonLib.forms.UserSelectForm("Delete User"); f.LoadFile(file); f.ShowDialog(); if (f.DialogResult == DialogResult.OK) { int n = f.ID; User u = new User(file.Items[n]); User.RemoveFromLastUserProfile(u.NAME, ""); if (LoadCurrentUser()) { if (mUser.NAME == u.NAME) { NextCurrentUser(); } } u.DestroyUser(); file.Items.RemoveAt(n); file.WriteList(); UpdateAllUserScript(); } } else { System.Windows.Forms.MessageBox.Show("You cannot delete the last user"); } }
public void AskToChangeCurrentProfile() { PeonLib.File.textlist file = new PeonLib.File.textlist(GetProfileListPath()); forms.UserSelectForm f = new PeonLib.forms.UserSelectForm("Change profile"); f.LoadFile(file); f.ShowDialog(); if (f.DialogResult == DialogResult.OK) { int n = f.ID; ChangeCurrentProfile(file.Items[n], true); } }
public void DeleteShortcutFolder() { forms.UserSelectForm f = new PeonLib.forms.UserSelectForm("Delete shortcut"); f.LoadShortcutInfo(m_lShortcut); f.ShowDialog(); if (f.DialogResult == DialogResult.OK) { int n = f.ID; if (m_lShortcut[n].IsCmd) { return; } m_lShortcut.RemoveAt(n); UpdateScriptShortcut(); TransferProfileInCurrentScript(); } }
public void DeleteProfile() { if (mlProfile.Count > 1) { PeonLib.File.textlist file = new PeonLib.File.textlist(GetProfileListPath()); forms.UserSelectForm f = new PeonLib.forms.UserSelectForm("Delete profile"); f.LoadFile(file); f.ShowDialog(); if (f.DialogResult == DialogResult.OK) { int n = f.ID; bool bIsCurrentProf = (n == GetProfileCase(mCurrentProfile.Name)); User.RemoveFromLastUserProfile(NAME, mlProfile[n].Name); mlProfile[n].DestroyProfile(); if (bIsCurrentProf) { if (n == 0) { SetCurrentProfile(mlProfile[1].Name); } else { SetCurrentProfile(mlProfile[0].Name); } TransferCurrentProfileInCurrentScript(); } mlProfile.RemoveAt(n); WriteProfileFile(); } } else { System.Windows.Forms.MessageBox.Show("you cannot delete the last profile"); } }