Пример #1
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            // base.OnClosed() invokes this class' Closed() code, so we flipped the order of exec to reduce the number of surprises for yours truly.
            // This NULLing stuff is really the last rites of Dispose()-like so we stick it at the end here.

            _library = null;

            mdd = null;
            edd = null;
        }
        public ImportFromThirdParty(Library library)
        {
            this._library = library;

            InitializeComponent();

            this.btnProvider_BibTeX.Icon   = Icons.GetAppIcon(Icons.Import_BibTeX);
            this.btnProvider_Mendeley.Icon = Icons.GetAppIcon(Icons.Import_Mendeley);
            this.btnProvider_Zotero.Icon   = Icons.GetAppIcon(Icons.Import_Zotero);
            this.btnProvider_EndNote.Icon  = Icons.GetAppIcon(Icons.Import_EndNote);
            this.btnProvider_JabRef.Icon   = Icons.GetAppIcon(Icons.Import_JabRef);

            this.btnProvider_BibTeX.Click   += ProviderChosen_Click;
            this.btnProvider_Mendeley.Click += ProviderChosen_Click;
            this.btnProvider_Zotero.Click   += ProviderChosen_Click;
            this.btnProvider_EndNote.Click  += ProviderChosen_Click;
            this.btnProvider_JabRef.Click   += ProviderChosen_Click;

            this.btnChooseFile_BibTeX.Click   += ChooseExportFile;
            this.btnChooseFile_Mendeley.Click += ChooseExportFile;
            this.btnChooseFile_Zotero.Click   += ChooseExportFile;
            this.btnChooseFile_EndNote.Click  += ChooseExportFile;
            this.btnChooseFile_JabRef.Click   += ChooseExportFile;

            this.btnChooseFile_EndNoteLibraryFolder.Click += ChooseSupplementaryFolder;

            this.btnBack.Caption = "Back";
            this.btnBack.Icon    = Icons.GetAppIcon(Icons.Back);
            this.btnBack.Click  += btnBack_Click;

            this.btnCancel.Caption = "Cancel";
            this.btnCancel.Icon    = Icons.GetAppIcon(Icons.Cancel);
            this.btnCancel.Click  += btnCancel_Click;

            this.btnSelectAll.Caption  = "Select all";
            this.btnSelectNone.Caption = "Select none";
            this.btnSelectAll.Click   += btnSelectAll_Click;
            this.btnSelectNone.Click  += btnSelectNone_Click;

            this.btnImport.Caption = "Import Selected Entries";
            this.btnImport.Icon    = Icons.GetAppIcon(Icons.DocumentsImportFromThirdParty);
            this.btnImport.Click  += btnImport_Click;

            this.Header.Caption = "Import";
            this.Header.Img     = Icons.GetAppIcon(Icons.DocumentsImportFromThirdParty);

            SetUiState(UiState.ChooseProvider);

            {
                edd = Auto.EndnoteImporter.DetectEndnoteDatabaseDetails();
                if (0 < edd.documents_found)
                {
                    AugmentedToolBarButton ab = new AugmentedToolBarButton();
                    ab.Icon    = Icons.GetAppIcon(Icons.Import_EndNote);
                    ab.Caption = "EndNote™\r\n" + edd.PotentialImportMessage;
                    ab.Click  += CmdAutomaticEndnoteImport_Click;
                    ObjAutoImportDescriptionDocument.Children.Add(ab);

                    ObjAutoImportDescriptionDocument.Children.Add(new TextBlock());
                    ObjAutoImportDescriptionDocument.Children.Add(new TextBlock());
                }
            }
            {
                mdd = Auto.MendeleyImporter.DetectMendeleyDatabaseDetails();
                if (0 < mdd.documents_found)
                {
                    AugmentedToolBarButton ab = new AugmentedToolBarButton();
                    ab.Icon    = Icons.GetAppIcon(Icons.Import_Mendeley);
                    ab.Caption = "Mendeley™\r\n" + mdd.PotentialImportMessage;
                    ab.Click  += CmdAutomaticMendeleyImport_Click;
                    ObjAutoImportDescriptionDocument.Children.Add(ab);

                    ObjAutoImportDescriptionDocument.Children.Add(new TextBlock());
                    ObjAutoImportDescriptionDocument.Children.Add(new TextBlock());
                }
            }

            if (0 == mdd.documents_found && 0 == edd.documents_found)
            {
                TextBlock tb = new TextBlock();
                tb.TextWrapping = TextWrapping.Wrap;
                tb.Text         = "Qiqqa has not been able to automatically detect any other reference managers on your computer.  Please use the manual import options to the right.";
                ObjAutoImportDescriptionDocument.Children.Add(tb);

                ObjAutoImportDescriptionDocument.Children.Add(new TextBlock());
            }
        }