Exemplo n.º 1
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);
        }
 public void SetDescription_Null_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => _helper.SetDescription(null));
 }