コード例 #1
0
        private void OpenMolecule(string filename)
        {
            //try
            //{
            LoadingProgressDlg dlg = new LoadingProgressDlg(filename);

            dlg.ShowDialog();
            IChemFileWrapper chemFile = dlg.LoadedChemFile;    //MoleculeLoader.LoadFromFile(filename);
            Chem3DControl    control  = new Chem3DControl();
            ViewTab          tab      = new ViewTab(control);

            tab.Text      = chemFile.filename;
            tab.MdiParent = this;
            tab.Show();

            HashTableSettings settings = new HashTableSettings();

            settings["Base.Path"] = Path.GetFullPath(Application.StartupPath + ConfigurationSettings.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"]);     // /*+ "\\");*/ + "..\\..\\..\\..\\..\\..\\");
            control.Init(settings, cdi);
            control.LoadFile(chemFile);
            control.OnEntitySelected += control_OnEntitySelected;
            control.OnRenderUpdate    = onRenderUpdate;

            OnTabChanged();
            //}
            //catch (UserLevelException ule)
            //{
            //    MessageBox.Show(this, ule.Message, "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //    return;
            //}
            //catch { MessageBox.Show(this, "Error loading", "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; }

            recentFiles.AddFile(filename, RecentFiles.RecentFileType.Molecule);
            RebuildRecentFilesMenu();

            // load outline
            LoadOutline((IChemFile)control.GetRootNode());
        }
コード例 #2
0
        private void OpenMolecule(string filename)
        {
            //try
            //{
                LoadingProgressDlg dlg = new LoadingProgressDlg(filename);
                dlg.ShowDialog();
                IChemFileWrapper chemFile = dlg.LoadedChemFile;//MoleculeLoader.LoadFromFile(filename);
                Chem3DControl control = new Chem3DControl();
                ViewTab tab = new ViewTab(control);

                tab.Text = chemFile.filename;
                tab.MdiParent = this;
                tab.Show();

                HashTableSettings settings = new HashTableSettings();
                settings["Base.Path"] = Path.GetFullPath(Application.StartupPath + ConfigurationSettings.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"]); // /*+ "\\");*/ + "..\\..\\..\\..\\..\\..\\");
                control.Init(settings, cdi);
                control.LoadFile(chemFile);
                control.OnEntitySelected += control_OnEntitySelected;
                control.OnRenderUpdate = onRenderUpdate;

                OnTabChanged();
            //}
            //catch (UserLevelException ule)
            //{
            //    MessageBox.Show(this, ule.Message, "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //    return;
            //}
            //catch { MessageBox.Show(this, "Error loading", "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; }

            recentFiles.AddFile(filename, RecentFiles.RecentFileType.Molecule);
            RebuildRecentFilesMenu();

            // load outline
            LoadOutline((IChemFile)control.GetRootNode());
        }