Example #1
0
        /// ------------------------------------------------------------------------------------
        internal static void ArchiveUsingRAMP(IRAMPArchivable element)
        {
            // now that we added a separate title field for projects, make sure it's not empty
            var title = string.IsNullOrEmpty(element.Title) ? element.Id : element.Title;

            var model = new RampArchivingDlgViewModel(Application.ProductName, title, element.Id,
                                                      element.ArchiveInfoDetails, element.SetFilesToArchive, element.GetFileDescription)
            {
                FileCopyOverride = FileCopySpecialHandler
            };

            model.AppSpecificFilenameNormalization = element.CustomFilenameNormalization;
            model.OverrideDisplayInitialSummary    = fileLists => element.DisplayInitialArchiveSummary(fileLists, model);
            model.HandleNonFatalError = (exception, s) => ErrorReport.NotifyUserOfProblem(exception, s);

            element.InitializeModel(model);
            element.SetAdditionalMetsData(model);

            using (var dlg = new ArchivingDlg(model, ApplicationContainer.kSayMoreLocalizationId,
                                              Program.DialogFont, Settings.Default.ArchivingDialog))
            {
                dlg.ShowDialog();
                Settings.Default.ArchivingDialog = dlg.FormSettings;
            }
        }
Example #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Prepares the selected files to be uploaded to REAP using RAMP.
        /// </summary>
        /// <param name="owner">RAMP dialog owner</param>
        /// <param name="dialogFont">RAMP dialog font (for localization and consistency)</param>
        /// <param name="localizationDialogIcon"></param>
        /// <param name="filesToArchive"></param>
        /// <param name="propertyTable"></param>
        /// <param name="thisapp"></param>
        /// <param name="cache"></param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public bool ArchiveNow(Form owner, Font dialogFont, Icon localizationDialogIcon,
                               IEnumerable <string> filesToArchive, PropertyTable propertyTable, FwApp thisapp, LcmCache cache)
        {
            var viProvider             = new VersionInfoProvider(Assembly.LoadFile(thisapp.ProductExecutableFile), false);
            WritingSystemManager wsMgr = cache.ServiceLocator.WritingSystemManager;
            var appName   = thisapp.ApplicationName;
            var title     = cache.LanguageProject.ShortName;
            var uiLocale  = wsMgr.Get(cache.DefaultUserWs).IcuLocale;
            var projectId = cache.LanguageProject.ShortName;

            var model = new RampArchivingDlgViewModel(Application.ProductName, title, projectId, /*appSpecificArchivalProcessInfo:*/ string.Empty, SetFilesToArchive(filesToArchive), GetFileDescription);

            // image files should be labeled as Graphic rather than Photograph (the default).
            model.ImagesArePhotographs = false;

            // show the count of media files, not the duration
            model.ShowRecordingCountNotLength = true;

            // set the general description, in each available language
            IMultiString descr        = cache.LanguageProject.Description;
            var          descriptions = new Dictionary <string, string>();

            foreach (int wsid in descr.AvailableWritingSystemIds)
            {
                var descrText = descr.get_String(wsid).Text;
                if ((!string.IsNullOrEmpty(descrText)) && (descrText != "***"))
                {
                    descriptions[wsMgr.Get(wsid).GetIso3Code()] = descrText;
                }
            }

            if (descriptions.Count > 0)
            {
                model.SetDescription(descriptions);
            }

            AddMetsPairs(model, viProvider.ShortNumericAppVersion, cache);

            // create the dialog
            using (var dlg = new ArchivingDlg(model, "Palaso", dialogFont, new FormSettings()))
                using (var reportingAdapter = new SilErrorReportingAdapter(dlg, propertyTable))
                {
                    ErrorReport.SetErrorReporter(reportingAdapter);
                    dlg.ShowDialog(owner);
                    ErrorReport.SetErrorReporter(null);
                }

            return(true);
        }
Example #3
0
        /// ------------------------------------------------------------------------------------
        public void ArchiveUsingRAMP()
        {
            Analytics.Track("Archive Session using RAMP");

            var model = new RampArchivingDlgViewModel(Application.ProductName, Title, Id,
                                                      ArchiveInfoDetails, SetFilesToArchive, GetFileDescription);

            model.FileCopyOverride = ArchivingHelper.FileCopySpecialHandler;
            model.AppSpecificFilenameNormalization = CustomFilenameNormalization;
            model.OverrideDisplayInitialSummary    = fileLists => DisplayInitialArchiveSummary(fileLists, model);
            model.HandleNonFatalError = (exception, s) => ErrorReport.NotifyUserOfProblem(exception, s);

            SetAdditionalMetsData(model);

            using (var dlg = new ArchivingDlg(model, ApplicationContainer.kSayMoreLocalizationId,
                                              Program.DialogFont, Settings.Default.ArchivingDialog))
            {
                dlg.ShowDialog();
                Settings.Default.ArchivingDialog = dlg.FormSettings;
            }
        }