Esempio n. 1
0
 public void updateSigDb(SignatureDatabase db)
 {
     if (db != null)
     {
         sigDb = db;
     }
 }
Esempio n. 2
0
        private void SignatureDatabaseForm_Load(object sender, EventArgs e)
        {
            sigDb = LoadSignatureDatabase(sigRefPath);
            if (sigDb != null)
            {
                sigRefList = sigDb.List.ToList();
            }
            else
            {
                sigDb      = new SignatureDatabase();
                sigRefList = new List <SignatureReference>();
            }

            LoadListView(sigRefList);
        }
Esempio n. 3
0
        public static SignatureDatabase LoadSignatureDatabase(string path)
        {
            if (CreateSigRefJsonFileIfNotExist() == false)
            {
                return(null);
            }

            try
            {
                StreamReader reader = new StreamReader(path);
                string       json   = reader.ReadToEnd();
                reader.Dispose();

                SignatureDatabase db = JsonConvert.DeserializeObject <SignatureDatabase>(json);
                return(db);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to load signature database from " + path + "." + Environment.NewLine + ex.Message);
                return(null);
            }
        }
Esempio n. 4
0
        public DialogResult ShowDialog(SignatureDatabase sigDb, string name, string email, string reason)
        {
            _sigDb = sigDb;
            if (_sigDb == null)
            {
                MessageBox.Show("Signature database is empty");
                return(this.ShowDialog());
            }
            foreach (SignatureReference sigRef in _sigDb.List)
            {
                cboName.Items.Add(sigRef.Name);
            }
            if (cboName.Items.Count > 0)
            {
                cboName.SelectedIndex = 0;
                lblEmail.Text         = _sigDb.List[cboName.SelectedIndex].Email;
            }

            if (name != null && email != null)
            {
                for (int i = 0; i < _sigDb.List.Length; i++)
                {
                    SignatureReference sigRef = _sigDb.List[i];
                    if (sigRef.Name == name && sigRef.Email == email)
                    {
                        cboName.SelectedIndex = i;
                        lblEmail.Text         = email;
                    }
                }
            }

            if (reason != null)
            {
                txtReason.Text = reason;
            }

            return(this.ShowDialog());
        }
Esempio n. 5
0
 public PDFViewer()
 {
     InitializeComponent();
     sigDb = SignatureDatabaseForm.LoadSignatureDatabase(SignatureDatabaseForm.sigRefPath);
 }