Пример #1
0
        public string[] GetDbFileNames()
        {
            var list = new List <string>();
            var dir  = _lotusNotesServerSession.GetDbDirectory(CurrentServer);
            var db   = dir.GetFirstDatabase(DB_TYPES.NOTES_DATABASE);

            while (db != null)
            {
                //if (db.FilePath.StartsWith(@"mail\")) { db = dir.GetNextDatabase(); continue; }
                list.Add(db.FilePath);
                db = dir.GetNextDatabase();
            }
            return(list.ToArray());
        }
Пример #2
0
        private void bSearchServer_Click(object sender, EventArgs ea)
        {
            treeView1.Nodes.Clear();
            onLocalComputer = false;
            InputBox input = InputBox.Show("Domino Server", new InputBoxItem[] { new InputBoxItem("Server", notesServer), new InputBoxItem("Domain", notesDomain), new InputBoxItem("Password", notesPassword, true) }, InputBoxButtons.OKCancel);

            if (input.Result == InputBoxResult.OK)
            {
                notesServer   = input.Items["Server"];
                notesDomain   = input.Items["Domain"];
                notesPassword = input.Items["Password"];

                ProgressDialog pDialog = new ProgressDialog();
                pDialog.Title   = "Get Databases";
                pDialog.Style   = ProgressBarStyle.Marquee;
                pDialog.DoWork += delegate(object dialog, DoWorkEventArgs e)
                {
                    try
                    {
                        NotesSession nSession = initSession(notesPassword);
                        pDialog.ReportProgress(0);
                        NotesDbDirectory directory = nSession.GetDbDirectory(notesServer + "//" + notesDomain);
                        NotesDatabase    db        = directory.GetFirstDatabase(DB_TYPES.DATABASE);
                        int i = 0;
                        while (db != null)
                        {
                            if (pDialog.IsCancelled)
                            {
                                e.Cancel = true;
                                return;
                            }
                            string[] path = db.FilePath.Split(new char[] { '\\' });
                            treeView1.Invoke((MethodInvoker) delegate()
                            {
                                TreeNodeCollection nodes = treeView1.Nodes;
                                for (int n = 0; n < path.Length - 1; n++)
                                {
                                    string folder = path[n].ToUpper();
                                    if (!nodes.ContainsKey(folder))
                                    {
                                        nodes.Add(folder, folder, "folder", "folder");
                                    }
                                    nodes = nodes[folder].Nodes;
                                }
                                nodes.Add(db.FilePath, db.Title, "database", "database");
                            });
                            db = directory.GetNextDatabase();
                            pDialog.ReportProgress(i);
                            i++;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                };
                pDialog.ProgressChanged += delegate(object dialog, ProgressChangedEventArgs e)
                {
                    pDialog.Message = e.ProgressPercentage + " Databases Found";
                };
                pDialog.Completed += delegate(object dialog, RunWorkerCompletedEventArgs e)
                {
                    //treeView1.Invoke((MethodInvoker)delegate()
                    //{
                    if (e.Cancelled)
                    {
                        treeView1.Nodes.Clear();
                    }
                    else
                    {
                        treeView1.Sort();
                    }
                    //});
                };
                pDialog.Run();
            }
        }