//******************
    // Test scaffold
    //
    public static void Main(string[] args)
    {
        PasswordForm passwordForm = new PasswordForm();

        passwordForm.Visible = true;
        Application.Run(passwordForm);
    }
Exemple #2
0
        private void BTN_Password_Click(object sender, EventArgs e)
        {
            var password = new PasswordForm("Hello World", "This is password windows form.");

            //password.SetFont(this.Font);
            password.ShowDialog();
        }
Exemple #3
0
        private bool AskAndGetConfirmedPassword()
        {
            PasswordForm passwordForm = new PasswordForm();

            passwordForm.Text             = "Enter the password:"******"password:"******"";
            passwordForm.Text             = "Confirm the password:"******"Confirm the password:"******"Password not confirmed!", "Operation canceled!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            confirmedPassword = passwordForm.txtPassword.Text;
            return(true);
        }
Exemple #4
0
        static SecureString GetKeyPassword(string keyId, string userId)
        {
            PasswordForm form = new PasswordForm();

            form.DescriptionText = "A password is needed to unlock the secret key for " + userId;
            return(form.ShowDialog() == DialogResult.OK ? form.GetPassword() : null);
        }
Exemple #5
0
        static SecureString GetDecryptionPassword()
        {
            PasswordForm form = new PasswordForm();

            form.DescriptionText = "This data is encrypted with a password. Enter the password to decrypt the data.";
            return(form.ShowDialog() == DialogResult.OK ? form.GetPassword() : null);
        }
Exemple #6
0
        public static bool AuthenticatePasswordWindow()
        {
            PasswordForm passwordForm = new PasswordForm();

            passwordForm.ShowDialog();
            return(passwordForm.PasswordEntered);
        }
Exemple #7
0
        private void LargeHeader_Submited(object sender, TappedRoutedEventArgs e)
        {
            var form = new PasswordForm()
            {
                OldPassword = oldPwdTb.Password,
                Password    = pwdTb.Password,
                RePassword  = rePwdTb.Password
            };

            if (!form.VerifyOldPassword())
            {
                _ = new MessageDialog(Constants.GetString("pwd_old_error")).ShowAsync();
                return;
            }
            if (!form.VerifyPassword())
            {
                _ = new MessageDialog(Constants.GetString("pwd_new_error")).ShowAsync();
                return;
            }
            if (form.Password != form.RePassword)
            {
                _ = new MessageDialog(Constants.GetString("login_re_pwd_error")).ShowAsync();
                return;
            }
            _ = EditPasswordAsync(form);
        }
Exemple #8
0
 public void Teardown()
 {
     _passwordForm.Dispose();
     while (_passwordForm.Disposing)
     {
     }
     _passwordForm = null;
 }
Exemple #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            PasswordForm form = new PasswordForm();

            form.FormClosed += (s, args) => this.Show();
            form.Show();
        }
Exemple #10
0
 public PasswordFormPresenter(PasswordForm form, TicketBLL ticket)
 {
     this.form      = form;
     user           = ticket;
     validator      = new FormValidator();
     serviceFactory = new ServiceFactory(new PGRepositoryFactory());
     service        = serviceFactory.getUserService();
 }
Exemple #11
0
 private static string PromptForPassword()
 {
     using (var form = new PasswordForm())
     {
         var result = form.ShowDialog();
         return(result != DialogResult.OK ? null : form.Password);
     }
 }
Exemple #12
0
        private static DialogResult AskForPassword()
        {
            PasswordForm passwordForm = new PasswordForm();
            var          result       = passwordForm.ShowDialog();

            Settings.EncryptionPass = passwordForm.Password;
            return(result);
        }
Exemple #13
0
        // passing
        public void AddNewPassword()
        {
            // 表单验证
            if (string.IsNullOrEmpty(TagNameAdded))
            {
                WindowToolTip = "Please choose or add a tag for the password";
                return;
            }
            if (string.IsNullOrEmpty(PasswordForm.Title))
            {
                WindowToolTip = "Please fill the title";
                return;
            }
            if (string.IsNullOrEmpty(PasswordForm.Password))
            {
                WindowToolTip = "Please enter the password!";
            }
            if (!PasswordForm.Website.StartsWith("https://"))
            {
                PasswordForm.Website = "https://" + PasswordForm.Website;
            }

            if (DbHelper.IfTagedPasswordListContain(TagList, TagNameAdded))
            {
                // 如果该 tag 在列表中已存在
                int tagId = DbHelper.GetTagId(TagNameAdded);
                // 保留明文密码
                string password          = PasswordForm.Password;
                string encryptedPassword = Encryptor.AESEncrypt(PasswordForm.Password, KeyPassword);
                PasswordForm.TagId    = tagId;
                PasswordForm.Avatar   = AvatarDictionary.GetAvatarPath(PasswordForm.Title);
                PasswordForm.Password = encryptedPassword;
                DbHelper.InsertPasswordItem(PasswordForm);
                // 处理好后将密码明文添加进TagList
                PasswordForm.Password = password;
                AddPasswordToTagList(PasswordForm, TagNameAdded);
            }
            else
            {
                // tag 不存在, 将新来的 tag 入表
                // 插入新 tag 返回 tag Id
                int tagId = DbHelper.InsertTagName(TagNameAdded);
                // 重复,待优化
                string password          = PasswordForm.Password;
                string encryptedPassword = Encryptor.AESEncrypt(PasswordForm.Password, KeyPassword);
                PasswordForm.TagId    = tagId;
                PasswordForm.Avatar   = AvatarDictionary.GetAvatarPath(PasswordForm.Title);
                PasswordForm.Password = encryptedPassword;
                DbHelper.InsertPasswordItem(PasswordForm);
                // 处理好后将密码明文添加进TagList
                PasswordForm.Password = password;
                AddPasswordToTagList(PasswordForm, TagNameAdded);
            }
            UpdateTagList();

            PasswordForm.Clean();
            Switcher.AddNewPassword();
        }
Exemple #14
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Settings settings = new Settings();

            Database.SetSettings(settings);

            Database.CheckPassword();
            if (Database.IsPasswordProtected)
            {
                PasswordForm form = new PasswordForm(settings);
                form.ShowDialog();

                if (!Database.PasswordIsOk())
                {
                    return;
                }
            }

            Database.Create();
            Database.ReadSetting();

            Application.Run(new MainForm(settings));

            /*
             * TODO:
             *
             * Если будет желание, можно переделать Bookmarks и Desires. Сделать их в виде дерева (как в браузере).
             * https://www.codeproject.com/Articles/23746/TreeView-with-Columns
             * https://www.codeproject.com/Articles/3273/ContainerListView-and-TreeListView-Writing-VS-NET
             * https://sourceforge.net/projects/treeviewadv/
             * Так можно будет создавать подкатегории. К примеру, здоровье, спорт, программы.
             *
             * Также неплохо было б избавиться от лишних библиотек, если найдутся нормальные стандартные средства для парсинга json и html.
             *
             * Добавить новую настройку - что отображать для состояния All. Выбирать через чекбоксы нужные состояния.
             * Удобно, к примеру, для сокрытия удаленных.
             *
             * К Desires добавить приоритеты, стоимость. В иерархическом виде (если сделать в виде дерева)
             * будет удобно смотреть, насколько что дорого. Например, велосипед со всеми аксессуарами.
             *
             * Добавить Problems. Типа какие проблемы у меня висят и что нужно для их решения.
             *
             * Добавить к фильмам и книгам мои оценки, чтоб советовать.
             *
             * Добавить Minds. Мысли, идеи, лайфхаки и прочее. Можно назвать типа Useful или еще как.
             *
             * Сделать ссылки на Bookmarks. Типа {ref=id}.
             * Можно через "Правая кнопка - Вставить ссылку - Выбор ссылки из сохраненных".
             * Можно сделать проверку текста после сохранения. Если в тексте есть корректные ссылки, искать их среди Bookmarks
             * и выделять синим с возможностью клика.
             *
             * Переработать регулярные дела. Или убрать. На ПК ими пользоваться не удобно. Нужна или синхронизация с телефоном или другой формат.
             */
        }
Exemple #15
0
        private void button4_Click_1(object sender, EventArgs e)
        {
            PasswordForm frm = new PasswordForm();

            if (frm.ShowDialog() != DialogResult.OK)
            {
                // The user canceled.
                this.Close();
            }
            frm.Close();
        }
Exemple #16
0
        private void sowEditing()
        {
            PasswordForm frm = new PasswordForm();

            if (frm.ShowDialog() != DialogResult.OK)
            {
                // The user canceled.
                this.Close();
            }
            frm.Close();
        }
Exemple #17
0
        public void Start()
        {
            form        = new T();
            correctPass = false;

            using (var passwordForm = new PasswordForm("Please re enter you password to continue."))
            {
                passwordForm.OnCorrectPassword += PasswordForm_OnCorrectPassword;
                passwordForm.Disposed          += PasswordForm_Disposed;
                passwordForm.ShowDialog();
            }
        }
        private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PasswordForm pswdForm = new PasswordForm(User.CurrentUser);

            if (DialogResult.OK != pswdForm.ShowDialog())
            {
                return;
            }
            User.CurrentUser.Password = pswdForm.NewPassword;
            ServicesProvider.GetInstance().GetUserServices().SaveUser(User.CurrentUser);
            Notify("passwordChanged");
        }
Exemple #19
0
        public static Optional <SecureString> PasswordDialog(string passwordName = null, bool verify = true)
        {
            var splash = FrmSplashScreen.getInstance();

            if (!splash.IsDisposed && splash.Visible)
            {
                splash.Close();
            }

            var passwordForm = new PasswordForm(passwordName, verify);

            return(passwordForm.GetKey());
        }
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            PasswordForm passForm = cmdData.ProtoBufDeserialize <PasswordForm>();

            if (Compiled.Debug)
            {
                passForm.Debug("=== User.SetPassword 上行数据===");
            }

            string oldPassword = passForm.OldPassword ?? string.Empty;
            string newPassword = passForm.NewPassword ?? string.Empty;

            if (string.IsNullOrEmpty(oldPassword) || string.IsNullOrEmpty(newPassword))
            {
                context.Flush(RespondCode.DataInvalid);
                return;
            }

            UserAccount uAccount   = UserBiz.GetUserAccount(context.UserId);
            string      oldEncrypt = UserBiz.CreatePassword(oldPassword, uAccount.PasswordSalt);

            if (!oldEncrypt.Equals(uAccount.Password))
            {
                context.Flush(RespondCode.ShowError, "旧密码错误!");
                return;
            }

            if (!oldPassword.Equals(newPassword))
            {
                uAccount.Password = UserBiz.CreatePassword(newPassword, uAccount.PasswordSalt);
                uAccount.LastPasswordChangedDate = DateTime.Now;
                UserBiz.UserChangedPassword(uAccount);
            }

            context.SessionId.RemoveSession();
            context.Flush();
        }
Exemple #21
0
        private bool CheckPassword(String content)
        {
            Text2OpCodeServices text2OpCodeServices = new Text2OpCodeServices(content);

            text2OpCodeServices.GetHeaderInformation();
            if (text2OpCodeServices.AskPassword)
            {
                bool         passwordOK   = false;
                PasswordForm passwordForm = new PasswordForm();
                passwordForm.Text             = "Type the password (1/2):";
                passwordForm.lblPassword.Text = "Password:"******"Operation canceled!", "LadderApp", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(false);
                    }
                    else
                    {
                        if (text2OpCodeServices.password != passwordForm.txtPassword.Text)
                        {
                            passwordForm.txtPassword.Text = "";
                            passwordForm.Text             = "Type the password (1/2):";
                        }
                        else
                        {
                            passwordOK = true;
                            i          = 5; //sai
                        }
                    }
                }
                if (!passwordOK)
                {
                    MessageBox.Show("Operation canceled!", "LadderApp", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(false);
                }
            }

            return(true);
        }
Exemple #22
0
        private async Task EditPasswordAsync(PasswordForm form)
        {
            App.ViewModel.IsLoading = true;
            var data = await App.Repository.User.PasswordUpdateAsync(form, async res =>
            {
                var dispatcherQueue = Windows.System.DispatcherQueue.GetForCurrentThread();
                await dispatcherQueue.EnqueueAsync(() =>
                {
                    App.ViewModel.IsLoading = false;
                    _ = new MessageDialog(res.Message).ShowAsync();
                });
            });

            App.ViewModel.IsLoading = false;
            if (data == null)
            {
                return;
            }
            App.Logout();
            _ = new MessageDialog(Constants.GetString("pwd_update_success_tip")).ShowAsync();
            Frame.Navigate(typeof(LoginPage));
        }
        public async Task <DialogResult> ShowUpdatePasswordDialogAsync()
        {
            var settings = await SettingsService.Instance.GetSettingsAsync();

            var detail = settings.SelectedConnection;
            var dialog = new PasswordForm(detail)
            {
                UserLogin  = detail.UserName,
                UserDomain = detail.UserDomain,
            };

            dialog.ShowDialog();
            if (dialog.DialogResult == DialogResult.OK)
            {
                detail.SetPassword(dialog.UserPassword, false);
                if (dialog.SavePassword)
                {
                    detail.SavePassword = true;
                    settings.Save();
                }
            }
            return(dialog.DialogResult);
        }
Exemple #24
0
        private void ChangePassword_Click(object sender, EventArgs e)
        {
            bool isAdmin = sender == vbtnChangeAdmin;

            //No authentication is needed here
            if (PasswordForm.ChangePassword(this.FindForm(), isAdmin))
            {
                if (!isAdmin)
                {
                    new MethodInvoker(() =>
                    {
                        var url      = SettingsTable.Get <string>(Strings.All_CentralServerUrl, Strings.All_CentralServerUrlPathDefault);
                        var authUser = SettingsTable.Get <UserAuth>(Strings.Transferring_AuthObject);
                        //Validate on TRS server
                        DataServiceClient.CallValidateUser(authUser.CountryID, authUser.Name, authUser.Password);

                        //Send to win service
                        var settingsObj = SettingsTable.Get <SettingsObj>(Strings.Transferring_SettingsObject, SettingsObj.Default);
                        DBConfigValue.Save(Strings.Transferring_AuthObject, authUser);
                        DBConfigValue.Save(Strings.Transferring_SettingsObject, settingsObj);
                    }).FireAndForget();
                }
            }
        }
        public CodeCreateNewPasswordForm(PasswordForm passwordForm)
        {
            InitializeComponent();

            _passwordForm = passwordForm;
        }
Exemple #26
0
        private void btnChgPwd_Click(object sender, EventArgs e)
        {
            bool changed = false;
            try
            {
                PasswordForm pwdform = new PasswordForm();
                pwdform.ShowDialog(this);
                //try to change the password for this user.
                if (pwdform.Password != null)
                {
                    UserStorageView[] users = new UserStorageView[1];
                    users[0] = _User;
                    _User.Password = pwdform.Password;
                    console.Manager.Admon_UpdateUsers(console.Credentials, users);

                    changed = true;

                    //update the console credentials if needed
                    if (console.Credentials.Username == _User.Username)
                    {
                        console.Credentials.Password = pwdform.Password;
                    }
                }
            }
            catch (Exception ex)
            {
                changed = false;
                MessageBox.Show("Error changing password:"******"Change Password", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (changed)
                {
                    MessageBox.Show("Password changed successfully.", "Change Password", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemple #27
0
        void ExtractAndDeleteFile(ZipFile zip, Manifest.File FileM, string DestinationPath)
        {
            for (; ;)
            {
                try
                {
                    if (File.Exists(DestinationPath))
                    {
                        // In case the file is marked read-only, unmark it.  We'll correctly set the attributes after we create the file.
                        File.SetAttributes(DestinationPath, FileM.WindowsAttributes & ~System.IO.FileAttributes.ReadOnly & ~System.IO.FileAttributes.Hidden & ~System.IO.FileAttributes.System);
                    }

                    ZipEntry ze;
                    try
                    {
                        string PathInArchive = FileM.PathInArchive.Replace('\\', '/').Replace('’', '\'');
                        ze = zip[PathInArchive];
                        if (ze == null)
                        {
                            throw new FileNotFoundException();
                        }
                    }
                    catch (CancelException ce) { throw ce; }
                    catch (Exception ex)
                    {
                        throw new FileNotFoundException(ex.Message + "\nThe file '" + FileM.RelativePath + "' is missing from archive '" + FileM.ArchiveFile + "'.", ex);
                    }

                    using (FileStream Dest = new FileStream(DestinationPath, FileMode.Create, FileAccess.ReadWrite, FileShare.Read))
                    {
                        bool FirstPasswordPrompt = true;
                        for (; ;)
                        {
                            try
                            {
                                if (String.IsNullOrEmpty(Project.SafePassword.Password))
                                {
                                    ze.Extract(Dest);
                                }
                                else
                                {
                                    ze.ExtractWithPassword(Dest, Project.SafePassword.Password);
                                }
                                if (ZipError != null)
                                {
                                    throw ZipError;
                                }
                                break;
                            }
                            catch (Ionic.Zip.BadPasswordException bpe)
                            {
                                Dest.SetLength(0); Dest.Seek(0, System.IO.SeekOrigin.Begin);
                                try
                                {
                                    if (!String.IsNullOrEmpty(Project.AlternativePassword))
                                    {
                                        ze.ExtractWithPassword(Dest, Project.AlternativePassword);
                                    }
                                    else
                                    {
                                        throw bpe;
                                    }
                                    if (ZipError != null)
                                    {
                                        throw ZipError;
                                    }
                                    break;
                                }
                                catch (Ionic.Zip.BadPasswordException)
                                {
                                    Dest.SetLength(0); Dest.Seek(0, System.IO.SeekOrigin.Begin);

                                    PasswordForm pf = new PasswordForm();
                                    if (FirstPasswordPrompt)
                                    {
                                        pf.Prompt = "The archive '" + FileM.ArchiveFile + "' was created with a different password.  (121)";
                                    }
                                    else
                                    {
                                        pf.Prompt = "That was not a valid password for the archive '" + FileM.ArchiveFile + "'.";
                                    }
                                    FirstPasswordPrompt = false;
                                    if (pf.ShowDialog() != DialogResult.OK)
                                    {
                                        throw new CancelException();
                                    }
                                    Project.AlternativePassword = pf.Password;
                                    continue;
                                }
                            }
                        }
                    }
                    ZippyForm.LogWriteLine(LogLevel.HeavyDebug, "Success extracting file '" + FileM.RelativePath + "'.");
                    break;
                }
                catch (CancelException ce) { throw ce; }
                catch (Ionic.Zip.ZipException ze) { throw ze; }
                catch (Ionic.Zlib.ZlibException ze) { throw ze; }
                catch (FileNotFoundException fe) { throw fe; }
                catch (Exception ex)
                {
#                   if DEBUG
                    DialogResult dr = MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.AbortRetryIgnore);
#                   else
                    DialogResult dr = MessageBox.Show(ex.Message, "Error", MessageBoxButtons.AbortRetryIgnore);
#                   endif
                    if (dr == DialogResult.Abort)
Exemple #28
0
    //**********************************************
    // event handling method for "Log In" Button
    //
    public void LogInButtonClicked(object source, EventArgs e)
    {
        // First, clear the fields reflecting the
          // previous student's information.
          ClearFields();

          //  Display password dialog
          passwordDialog = new PasswordForm();
          passwordDialog.ShowDialog(this);

          string password = passwordDialog.Password;
          string id = passwordDialog.Id;
          passwordDialog.Dispose();

          // We'll try to construct a Student based on
          // the id we read, and if a file containing
          // Student's information cannot be found,
          // we have a problem.

          currentUser = new Student(id+".dat");
          currentUser.ReadStudentData(schedule);

          // Test to see if the Student fields were properly
          // initialized. If not, reset currentUser to null
          // and display a message box

          if (!currentUser.StudentSuccessfullyInitialized()) {
        // Drat!  The ID was invalid.
        currentUser = null;

        // Let the user know that login failed,
        string message = "Invalid student ID; please try again.";
        MessageBox.Show(message, "Invalid Student ID",
                 MessageBoxButtons.OK, MessageBoxIcon.Warning);
          }
          else {
        // We have a valid Student.  Now, we need
        // to validate the password.

        if (currentUser.ValidatePassword(password)) {

          // Let the user know that the login succeeded.
          string message =
               "Log in succeeded for " + currentUser.Name + ".";
          MessageBox.Show(message, "Log In Succeeded",
                 MessageBoxButtons.OK, MessageBoxIcon.Information);

          // Load the data for the current user into the TextBox and
          // ListBox components.
          SetFields(currentUser);
        }
        else {
          // The id was okay, but the password validation failed;
          // notify the user of this.
          currentUser = null;
          string message = "Invalid password; please try again.";
          MessageBox.Show(message, "Invalid Password",
                 MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
          }
          // Check states of the various buttons.
          ResetButtons();
    }
        public NewCreateAccountPassword(PasswordForm passwordForm)
        {
            InitializeComponent();

            _passwordForm = passwordForm;
        }
Exemple #30
0
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="form"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public async Task <ResponseDataOne <bool> > PasswordUpdateAsync(PasswordForm form, Action <HttpException> action = null)
 => await http.PutAsync <PasswordForm, ResponseDataOne <bool> >("auth/password/update", form, action);
        public static string Password(PasswordOptions options)
        {
            using var form = new PasswordForm(options);

            return(form.Start());
        }
 /// <summary>
 /// LoadArchiveManifest decompresses the manifest information from the backup archive into RAM
 /// and converts it from XML into a Manifest object.  An exception is thrown if the manifest
 /// cannot be retrieved.
 ///
 /// Precondition: Access to the backup folder must be available - thus any impersonation should
 /// be done before calling.
 /// </summary>
 /// <returns>The manifest from this backup archive.</returns>
 public Manifest LoadArchiveManifest(BackupProject Project, bool PromptForPassword)
 {
     try
     {
         using (ZipFile zip = ZipFile.Read(Project.CompleteBackupFolder + "\\" + this.ToString()))
         {
             foreach (ZipEntry ze in zip)
             {
                 if (ze.FileName.ToLowerInvariant() == "manifest.xml")
                 {
                     using (MemoryStream ms = new MemoryStream())
                     {
                         try
                         {
                             if (String.IsNullOrEmpty(Project.SafePassword.Password))
                             {
                                 ze.Extract(ms);
                             }
                             else
                             {
                                 ze.ExtractWithPassword(ms, Project.SafePassword.Password);
                             }
                         }
                         catch (Ionic.Zip.BadPasswordException bpe1)
                         {
                             try
                             {
                                 if (!String.IsNullOrEmpty(Project.AlternativePassword))
                                 {
                                     ze.ExtractWithPassword(ms, Project.AlternativePassword);
                                 }
                                 else
                                 {
                                     throw bpe1;
                                 }
                             }
                             catch (Ionic.Zip.BadPasswordException)
                             {
                                 bool FirstPrompt = true;
                                 if (!PromptForPassword)
                                 {
                                     throw bpe1;
                                 }
                                 while (PromptForPassword)
                                 {
                                     PasswordForm pf = new PasswordForm();
                                     if (FirstPrompt)
                                     {
                                         pf.Prompt = "The archive '" + ToString() + "' was created with a different password.  (242)";
                                     }
                                     else
                                     {
                                         pf.Prompt = "That was not a valid password for the archive '" + ToString() + "'.";
                                     }
                                     FirstPrompt = false;
                                     if (pf.ShowDialog() != DialogResult.OK)
                                     {
                                         throw new CancelException();
                                     }
                                     Project.AlternativePassword = pf.Password;
                                     try { ze.ExtractWithPassword(ms, Project.AlternativePassword); break; }
                                     catch (Ionic.Zip.BadPasswordException) { }
                                 }
                             }
                         }
                         ms.Seek(0, System.IO.SeekOrigin.Begin);
                         try
                         {
                             Manifest ret = Manifest.FromXml(ms);
                             if (ret == null)
                             {
                                 throw new FormatException();
                             }
                             return(ret);
                         }
                         catch (Exception ex)
                         {
                             throw new FormatException("Unable to parse archive's manifest.  Error: " + ex.Message + "\n\n" +
                                                       "Project: " + Project.ToString() + "\nArchive: " + ToString() + "\nManifest File: " + ze.FileName);
                         }
                     }
                 }
             }
             throw new FileNotFoundException("Manifest was not found within the archive.");
         }
     }
     catch (CancelException ce) { throw ce; }
     catch (Ionic.Zip.BadPasswordException ex)
     {
         throw new Ionic.Zip.BadPasswordException(ex.Message + "\nUnable to retrieve archive manifest.\nArchive name: " + this.ToString(), ex);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message + "\nUnable to retrieve archive manifest.\nArchive name: " + this.ToString(), ex);
     }
 }
        void ShowForm()
        {
            if ( this.form == null )
            {
                this.form = new PasswordForm( this );
            }

            this.form.ShowTheWindow();
        }
 void FormClosedHandler( object sender, EventArgs e )
 {
     this.form = null;
 }
Exemple #35
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            using (var dlg = new PasswordForm())
            {
                var dr = dlg.ShowDialog(this);
                if (dr == System.Windows.Forms.DialogResult.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            if (Properties.Settings.Default.StartInFullScreen)
            {
                EnterFullScreenMode(false);
            }

            controller.Stop();

            if ((thread != null) && (thread.IsAlive))
            {
                thread.Abort();
            }

            if (lastSelCamID != null)
            {
                Properties.Settings.Default.LastSelCamID = (int)this.lastSelCamID;
            }
            try
            {
                _navController.NavReturnDefultPos();
            }
            catch { }

            Properties.Settings.Default.WorkingMode = (int)switchMode.EditValue;
            Debug.WriteLine(Properties.Settings.Default.WorkingMode);
            Properties.Settings.Default.Save();

            dockManager1.SaveLayoutToXml(GetLayoutPath());
        }