diff --git a/ArchivingTestApp/MainForm.Designer.cs b/ArchivingTestApp/MainForm.Designer.cs index 21a61e201..e2ffae0d3 100644 --- a/ArchivingTestApp/MainForm.Designer.cs +++ b/ArchivingTestApp/MainForm.Designer.cs @@ -50,6 +50,7 @@ private void InitializeComponent() m_btnIMDI.TabIndex = 0; m_btnIMDI.Text = "IMDI Archive"; m_btnIMDI.UseVisualStyleBackColor = true; + m_btnIMDI.Click += m_btnIMDI_Click; // // m_tableLayoutPanelMain // diff --git a/ArchivingTestApp/MainForm.cs b/ArchivingTestApp/MainForm.cs index b91c03002..f8bcff64c 100644 --- a/ArchivingTestApp/MainForm.cs +++ b/ArchivingTestApp/MainForm.cs @@ -1,6 +1,10 @@ using L10NSharp; using SIL.Archiving; +using SIL.Archiving.Generic; +using SIL.Archiving.IMDI; +using SIL.IO; using SIL.Windows.Forms.Archiving; +using SIL.Windows.Forms.Archiving.IMDI; using static System.IO.Path; using static System.String; @@ -9,6 +13,15 @@ namespace ArchivingTestApp public partial class MainForm : Form { private const string kAppName = "Archiving Test App"; + + private string GetTitle() + { + var title = m_txtTitle.Text; + if (title.Length == 0) + title = "Arbitrary title"; + return title; + } + public MainForm() { InitializeComponent(); @@ -16,9 +29,7 @@ public MainForm() private void m_btnRamp_Click(object sender, EventArgs e) { - var title = m_txtTitle.Text; - if (title.Length == 0) - title = "Arbitrary title"; + var title = GetTitle(); var model = new RampArchivingDlgViewModel(kAppName, title, title.ToLatinOnly("~", "_", ""), SetFilesToArchive, GetFileDescription); using (var rampArchiveDlg = new ArchivingDlg(model, LocalizationManager.GetString( @@ -28,6 +39,50 @@ private void m_btnRamp_Click(object sender, EventArgs e) } } + private void m_btnIMDI_Click(object sender, EventArgs e) + { + var title = GetTitle(); + TempFile.NamePrefix = kAppName.Replace(" ", "_"); + var folder = new TempFile().Path; + RobustFile.Delete(folder); + Directory.CreateDirectory(folder); + var model = new IMDIArchivingDlgViewModel(kAppName, title, + title.ToLatinOnly("~", "_", ""), false, SetFilesToArchive, folder); + + model.ArchivingPackage.AccessCode = "internal"; + model.ArchivingPackage.Access.DateAvailable = "3 March 2029"; + model.ArchivingPackage.Access.Owner = "Fred"; + model.ArchivingPackage.Publisher = "SIL Elbonia"; + model.ArchivingPackage.Location = new ArchivingLocation + { + Address = "1234 Shoulder St.; Armstrong", + Country = "Elbonia" + }; + model.ArchivingPackage.Author = "Test Dude"; + model.ArchivingPackage.Owner = "Mike"; + + foreach (ListViewGroup group in m_listFiles.Groups) + { + var session = model.AddSession(group.Header); + foreach (var file in (from ListViewItem item in @group.Items select item.Text)) + { + session.AddFile(new ArchivingFile(file)); + session.AddFileAccess(file, (ArchivingPackage)model.ArchivingPackage); + } + + session.Genre = "Dance"; + session.SubGenre = "Entertainment"; + session.PlanningType = "Spontaneous"; + } + + + using (var imdiArchiveDlg = new IMDIArchivingDlg(model, LocalizationManager.GetString( + "ArchivingTestApp.MainForm.AdditionalImdiArchiveProcessInfo", "This is a test of IMDI archival."))) + { + imdiArchiveDlg.ShowDialog(this); + } + } + private void SetFilesToArchive(ArchivingDlgViewModel model, CancellationToken cancellationToken) { foreach (ListViewGroup group in m_listFiles.Groups) @@ -41,7 +96,7 @@ private void SetFilesToArchive(ArchivingDlgViewModel model, CancellationToken ca private static string GetFileDescription(string key, string filename) { - return $"{key} - {filename}"; + return filename.Replace("\\", "_"); } private void HandleAddFilesClick(object sender, EventArgs e) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb5d7a994..b27fe3f54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - [SIL.Windows.Forms.Archiving] Added (protected) override of method PackageCreationComplete to IMDIArchivingDlg. - [SIL.Windows.Forms.Archiving] Added (public) override of method GetMessage to IMDIArchivingDlg. - [SIL.Windows.Forms.Archiving] Added public extensions class LinkLabelExtensions with some methods that were formerly in Extensions class (now in SIL.Archiving). +- [SIL.Archiving] Added public property isValid to IMDIPackage. +- [SIL.Archiving] Added public event InitializationFailed to IMDIArchivingDlgViewModel. ### Changed @@ -61,6 +63,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - [SIL.Windows.Forms] Split ClearShare code, moving non-Winforms portions to SIL.Core (SIL.Core.ClearShare namespace) - [SIL.Core] Added optional parameter to OlacSystem.GetRoles to allow caller to provide its own XML with role definitions. - [SIL.Windows.Forms] Split License into a base class called License and a derived LicenseWithLogo, so that License could be in SIL.Core. +- [SIL.Archiving] Changed IArchivingSession.Files (and Session.Files) into an IReadonlyList. ### Fixed - [SIL.Archiving] Fixed typo in RampArchivingDlgViewModel for Ethnomusicology performance collection. diff --git a/Palaso.sln.DotSettings b/Palaso.sln.DotSettings index ef9fcff4d..53e0bb3f5 100644 --- a/Palaso.sln.DotSettings +++ b/Palaso.sln.DotSettings @@ -25,6 +25,9 @@ True True True + True + True + True True True True @@ -77,11 +80,13 @@ True True True + True True True True True True + True True True True diff --git a/SIL.Archiving/ArchivingDlgViewModel.cs b/SIL.Archiving/ArchivingDlgViewModel.cs index 930debf2c..0de1c4c6a 100644 --- a/SIL.Archiving/ArchivingDlgViewModel.cs +++ b/SIL.Archiving/ArchivingDlgViewModel.cs @@ -74,6 +74,7 @@ public enum StringId PreArchivingStatus, SearchingForArchiveUploadingProgram, ArchiveUploadingProgramNotFound, + IMDIPackageInvalid, ErrorStartingArchivalProgram, PreparingFiles, SavingFilesInPackage, @@ -597,8 +598,14 @@ protected string GetFileExcludedMsg(string file) => /// ------------------------------------------------------------------------------------ public static bool IsMono => (Type.GetType("Mono.Runtime") != null); - /// - /// + /// ------------------------------------------------------------------------------------ + /// Adds a "session" or "resource bundle". This usually corresponds to a + /// meaningful unit of analysis, e.g., to a piece of data having the same overall + /// content, the same set of actors, and the same location and time (e.g., one + /// elicitation session on topic X, or one folktale, or one ‘matching game’, or one + /// conversation between several speakers). + /// Unique Identifier for this session. + /// ------------------------------------------------------------------------------------ [PublicAPI] public abstract IArchivingSession AddSession(string sessionId); diff --git a/SIL.Archiving/Generic/ArchivingPackage.cs b/SIL.Archiving/Generic/ArchivingPackage.cs index 684d5be95..56a2611da 100644 --- a/SIL.Archiving/Generic/ArchivingPackage.cs +++ b/SIL.Archiving/Generic/ArchivingPackage.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Runtime.CompilerServices; using SIL.Archiving.Generic.AccessProtocol; namespace SIL.Archiving.Generic diff --git a/SIL.Archiving/Generic/ArchivingSession.cs b/SIL.Archiving/Generic/ArchivingSession.cs index a711c4f28..7c215c277 100644 --- a/SIL.Archiving/Generic/ArchivingSession.cs +++ b/SIL.Archiving/Generic/ArchivingSession.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using JetBrains.Annotations; namespace SIL.Archiving.Generic { @@ -10,10 +11,11 @@ public interface IArchivingSession : IArchivingGenericObject void AddFile(ArchivingFile file); /// + [PublicAPI] void AddFileAccess(string fullFileName, ArchivingPackage package); - /// - List Files { get; } + /// The paths of all resource files in the session. + IReadOnlyList Files { get; } /// Set session date with DateTime object void SetDate(DateTime date); @@ -25,36 +27,47 @@ public interface IArchivingSession : IArchivingGenericObject void SetDate(int year); /// + [PublicAPI] void AddContentLanguage(ArchivingLanguage language, LanguageString description); /// + [PublicAPI] void AddActor(ArchivingActor actor); /// + [PublicAPI] void AddGroupKeyValuePair(string key, string value); /// + [PublicAPI] void AddContentKeyValuePair(string key, string value); /// + [PublicAPI] void AddFileKeyValuePair(string fullFileName, string key, string value); /// + [PublicAPI] void AddContentDescription(LanguageString description); /// + [PublicAPI] void AddActorDescription(ArchivingActor actor, LanguageString description); /// + [PublicAPI] void AddFileDescription(string fullFileName, LanguageString description); /// + [PublicAPI] void AddActorContact(ArchivingActor actor, ArchivingContact contact); /// + [PublicAPI] void AddMediaFileTimes(string fullFileName, string start, string stop); /// + [PublicAPI] void AddProject(ArchivingPackage package); /// @@ -66,10 +79,11 @@ public interface IArchivingSession : IArchivingGenericObject /// string Interactivity { get; set; } - /// + /// Indicates in how far the researcher was involved in the linguistic event + [PublicAPI] string Involvement { get; set; } - /// + /// Degree of planning of the event string PlanningType { get; set; } /// diff --git a/SIL.Archiving/IMDI/IMDIArchivingDlgViewModel.cs b/SIL.Archiving/IMDI/IMDIArchivingDlgViewModel.cs index bcffc068a..6d695228e 100644 --- a/SIL.Archiving/IMDI/IMDIArchivingDlgViewModel.cs +++ b/SIL.Archiving/IMDI/IMDIArchivingDlgViewModel.cs @@ -25,6 +25,8 @@ public class IMDIArchivingDlgViewModel : ArchivingDlgViewModel, ISupportMetadata private readonly string _configFileName = Path.Combine(ArchivingFileSystem.SilCommonArchivingDataFolder, "IMDIProgram.config"); private string _outputFolder; + public event EventHandler InitializationFailed; + #region Properties public override Standard ArchiveType => Standard.IMDI; @@ -92,8 +94,12 @@ public IMDIArchivingDlgViewModel(string appName, string title, string id, bool c /// ------------------------------------------------------------------------------------ protected override bool DoArchiveSpecificInitialization() { - // no-op - return true; + if (_imdiData.IsValid) + return true; + + DisplayMessage(Progress.GetMessage(StringId.IMDIPackageInvalid), MessageType.Error); + InitializationFailed?.Invoke(this, EventArgs.Empty); + return false; } /// ------------------------------------------------------------------------------------ diff --git a/SIL.Archiving/IMDI/IMDIPackage.cs b/SIL.Archiving/IMDI/IMDIPackage.cs index 8b4205c3b..c45ccaa98 100644 --- a/SIL.Archiving/IMDI/IMDIPackage.cs +++ b/SIL.Archiving/IMDI/IMDIPackage.cs @@ -1,4 +1,3 @@ - using System; using System.Collections.Generic; using System.IO; @@ -53,6 +52,12 @@ public string PackagePath _packagePath = value; } } + + /// Generally an IMDI package should have at least one session. (This is not + /// strictly required for a corpus package, though it would be strange to want to + /// archive a corpus with no sessions.) + public bool IsValid => _corpus || Sessions.Any(); + #endregion // **** Corpus Layout **** @@ -70,6 +75,9 @@ public string PackagePath /// public bool CreateIMDIPackage() { + if (!IsValid) + return false; + _creationStarted = true; // list of session files for the corpus diff --git a/SIL.Archiving/IMDI/Schema/IMDIExtensions.cs b/SIL.Archiving/IMDI/Schema/IMDIExtensions.cs index 70c0f6091..f656fc3c3 100644 --- a/SIL.Archiving/IMDI/Schema/IMDIExtensions.cs +++ b/SIL.Archiving/IMDI/Schema/IMDIExtensions.cs @@ -1,4 +1,4 @@ -using SIL.Archiving.Generic; +using SIL.Archiving.Generic; using SIL.Archiving.IMDI.Lists; namespace SIL.Archiving.IMDI.Schema @@ -15,8 +15,7 @@ public static void SetValue(this VocabularyType vocabularyType, string value, bo { if (value == null) return; - if (vocabularyType == null) - vocabularyType = new VocabularyType(); + vocabularyType ??= new VocabularyType(); vocabularyType.Value = value; vocabularyType.Type = isClosedVocabulary diff --git a/SIL.Archiving/IMDI/Schema/IMDI_3_0.cs b/SIL.Archiving/IMDI/Schema/IMDI_3_0.cs index 12f392313..a9d84ee75 100644 --- a/SIL.Archiving/IMDI/Schema/IMDI_3_0.cs +++ b/SIL.Archiving/IMDI/Schema/IMDI_3_0.cs @@ -8,10 +8,12 @@ using System.Xml.Schema; using System.Xml.Serialization; using System.Diagnostics; +using JetBrains.Annotations; using SIL.Archiving.Generic; using SIL.Archiving.Generic.AccessProtocol; using SIL.Archiving.IMDI.Lists; using SIL.Extensions; +using static SIL.Archiving.IMDI.Lists.ListType; namespace SIL.Archiving.IMDI.Schema { @@ -29,10 +31,10 @@ public interface IIMDIMajorObject } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlType(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] - [XmlRootAttribute("METATRANSCRIPT", Namespace="http://www.mpi.nl/IMDI/Schema/IMDI", IsNullable=false)] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] + [XmlRoot("METATRANSCRIPT", Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd", IsNullable=false)] public class MetaTranscript { /// @@ -73,9 +75,9 @@ public MetaTranscript(MetatranscriptValueType type) public string SchemaLocation { get; set; } /// - [XmlElementAttribute("Catalogue", typeof(Catalogue))] - [XmlElementAttribute("Corpus", typeof(Corpus))] - [XmlElementAttribute("Session", typeof(Session))] + [XmlElement("Catalogue", typeof(Catalogue))] + [XmlElement("Corpus", typeof(Corpus))] + [XmlElement("Session", typeof(Session))] public object[] Items { get; set; } /// @@ -95,7 +97,7 @@ public MetaTranscript(MetatranscriptValueType type) public string FormatId { get; set; } /// - [XmlAttributeAttribute] + [XmlAttribute] public MetatranscriptValueType Type { get; set; } /// @@ -120,7 +122,6 @@ public override string ToString() var serializer = new XmlSerializer(GetType()); serializer.Serialize(xmlWriter, this); - //return strWriter.ToString(); return Encoding.UTF8.GetString(memStream.ToArray()); } } @@ -255,48 +256,41 @@ private void ArbilCheckSession(Session session) foreach (var actor in session.MDGroup.Actors.Actor) { - if (actor.Role == null) - actor.Role = string.Empty.ToVocabularyType(false, ListType.Link(ListType.ActorRole)); + actor.Role ??= string.Empty.ToVocabularyType(false, Link(ActorRole)); - if (actor.FamilySocialRole == null) - actor.FamilySocialRole = string.Empty.ToVocabularyType(false, ListType.Link(ListType.ActorFamilySocialRole)); + actor.FamilySocialRole ??= string.Empty.ToVocabularyType(false, + Link(ActorFamilySocialRole)); - if (actor.Anonymized == null) - actor.Anonymized = new BooleanType { Link = ListType.Link(ListType.Boolean) }; + actor.Anonymized ??= new BooleanType { Link = Link(ListType.Boolean) }; - if (actor.Sex == null) - actor.Sex = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ActorSex) }; + actor.Sex ??= new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(ActorSex) }; } foreach (var file in session.Resources.WrittenResource) { - if (file.SubType == null) - file.SubType = new VocabularyType { Link = ListType.Link(ListType.WrittenResourceSubType) }; + file.SubType ??= new VocabularyType { Link = Link(WrittenResourceSubType) }; - if (file.Validation == null) - file.Validation = new ValidationType - { - Type = new VocabularyType{ Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ValidationType) }, - Methodology = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ValidationMethodology) }, - Level = new IntegerType { Value = "Unspecified" }, - Description = new DescriptionTypeCollection { new LanguageString() } - }; + file.Validation ??= new ValidationType + { + Type = new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(ListType.ValidationType) }, + Methodology = new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(ValidationMethodology) }, + Level = new IntegerType { Value = "Unspecified" }, + Description = new DescriptionTypeCollection { new LanguageString() } + }; - if (file.Derivation == null) - file.Derivation = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.WrittenResourceDerivation) }; + file.Derivation ??= new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(WrittenResourceDerivation) }; - if (file.Anonymized == null) - file.Anonymized = new BooleanType { Link = ListType.Link(ListType.Boolean) }; + file.Anonymized ??= new BooleanType { Link = Link(ListType.Boolean) }; - if (file.Access == null) - file.Access = new AccessType(); + file.Access ??= new AccessType(); } foreach (var file in session.Resources.MediaFile) - { - if (file.Access == null) - file.Access = new AccessType(); - } + file.Access ??= new AccessType(); } /// Set the access code on session files if not set already. @@ -306,8 +300,7 @@ private void SetFileAccessCode(Session session) foreach (var file in session.Resources.MediaFile) { - if (file.Access == null) - file.Access = new AccessType(); + file.Access ??= new AccessType(); if (string.IsNullOrEmpty(file.Access.Availability)) file.Access.Availability = session.AccessCode; @@ -315,8 +308,7 @@ private void SetFileAccessCode(Session session) foreach (var file in session.Resources.WrittenResource) { - if (file.Access == null) - file.Access = new AccessType(); + file.Access ??= new AccessType(); if (string.IsNullOrEmpty(file.Access.Availability)) file.Access.Availability = session.AccessCode; @@ -325,9 +317,9 @@ private void SetFileAccessCode(Session session) } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class CommaSeparatedStringType { /// @@ -336,10 +328,10 @@ public class CommaSeparatedStringType } /// - [XmlIncludeAttribute(typeof(SubjectLanguageType))] - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [XmlInclude(typeof(SubjectLanguageType))] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class SimpleLanguageType { /// @@ -350,19 +342,19 @@ public class SimpleLanguageType } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class LanguageNameType : VocabularyType { } /// - [XmlIncludeAttribute(typeof(LanguageNameType))] - [XmlIncludeAttribute(typeof(KeyType))] - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [XmlInclude(typeof(LanguageNameType))] + [XmlInclude(typeof(KeyType))] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class VocabularyType { /// @@ -388,27 +380,27 @@ public VocabularyType() { } /// - [SerializableAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public enum VocabularyTypeValueType { /// ClosedVocabulary, - /// + [PublicAPI] ClosedVocabularyList, /// OpenVocabulary, - /// + [PublicAPI] OpenVocabularyList, } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class KeyType { /// @@ -421,35 +413,43 @@ public class KeyType } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class SubjectLanguageType : SimpleLanguageType { private DescriptionTypeCollection _descriptionField; - /// + /// + /// Is it the most frequently used language in the document. Only applicable if used in the context of the resource's language + /// + [PublicAPI] public BooleanType Dominant { get; set; } - /// + /// + /// Source language of translation. Only applicable in case it is the context of a lexicon resource + /// public BooleanType SourceLanguage { get; set; } - /// + /// + /// Target language of translation. Only applicable in case it is the context of a lexicon resource + /// + [PublicAPI] public BooleanType TargetLanguage { get; set; } /// - [XmlElementAttribute("Description")] + [XmlElement("Description")] public DescriptionTypeCollection Description { - get { return _descriptionField ?? (_descriptionField = new DescriptionTypeCollection()); } - set { _descriptionField = value; } + get => _descriptionField ??= new DescriptionTypeCollection(); + set => _descriptionField = value; } } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class BooleanType { /// @@ -475,9 +475,9 @@ public BooleanType() { } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public partial class DescriptionType { /// @@ -502,9 +502,9 @@ public partial class DescriptionType } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class Catalogue : IIMDIMajorObject { /// @@ -617,17 +617,17 @@ public Catalogue() } /// - /// I think this is the DocumentLanguages subelement of a Catalogue element - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(AnonymousType=true, Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + /// I think this is the DocumentLanguages sub-element of a Catalogue element + [Serializable] + [DebuggerStepThrough] + [XmlType(AnonymousType=true, Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class CatalogueDocumentLanguages : IMDIDescription { [XmlElement("Description")] public DescriptionTypeCollection Description { - get { return DescriptionInternal; } - set { DescriptionInternal = value; } + get => DescriptionInternal; + set => DescriptionInternal = value; } /// @@ -642,16 +642,16 @@ public CatalogueDocumentLanguages() } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(AnonymousType=true, Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(AnonymousType=true, Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class CatalogueSubjectLanguages : IMDIDescription { [XmlElement("Description")] public DescriptionTypeCollection Description { - get { return DescriptionInternal; } - set { DescriptionInternal = value; } + get => DescriptionInternal; + set => DescriptionInternal = value; } /// @@ -666,16 +666,16 @@ public CatalogueSubjectLanguages() } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class LocationType { /// public LocationType() { - Continent = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.Continents) }; - Country = new VocabularyType { Link = ListType.Link(ListType.Countries) }; + Continent = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(Continents) }; + Country = new VocabularyType { Link = Link(Countries) }; Region = new List(); } @@ -701,8 +701,8 @@ public LocationType(ArchivingLocation location) : this() /// Closed vocabulary public void SetContinent(string continent) { - var continentList = ListConstructor.GetClosedList(ListType.Continents, false, ListConstructor.RemoveUnknown.RemoveNone); - Continent = continentList.FindByValue(continent).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, ListType.Link(ListType.Continents)); + var continentList = ListConstructor.GetClosedList(Continents, false, ListConstructor.RemoveUnknown.RemoveNone); + Continent = continentList.FindByValue(continent).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, Link(Continents)); } /// Open vocabulary @@ -711,11 +711,11 @@ public void SetContinent(string continent) /// public void SetCountry(string country) { - Country = IMDISchemaHelper.SetVocabulary(country, false, ListType.Link(ListType.Countries)); + Country = IMDISchemaHelper.SetVocabulary(country, false, Link(Countries)); } /// - [XmlElementAttribute("Region")] + [XmlElement("Region")] public List Region { get; set; } /// @@ -741,9 +741,9 @@ public ArchivingLocation ToArchivingLocation() } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(AnonymousType=true, Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(AnonymousType=true, Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class CatalogueFormat { /// @@ -760,9 +760,9 @@ public class CatalogueFormat } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(AnonymousType=true, Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(AnonymousType=true, Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class CatalogueQuality { /// @@ -779,9 +779,9 @@ public class CatalogueQuality } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class Project : IIMDIMajorObject { /// @@ -842,9 +842,9 @@ public Project(IMDIPackage package) } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class ContactType { /// @@ -861,9 +861,9 @@ public class ContactType } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class AccessType : IMDIDescription { /// initialize for Arbil @@ -908,15 +908,15 @@ public AccessType(IArchivingPackage package) [XmlElement("Description")] public DescriptionTypeCollection Description { - get { return DescriptionInternal; } - set { DescriptionInternal = value; } + get => DescriptionInternal; + set => DescriptionInternal = value; } } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class KeysType { private List _keyField; @@ -925,15 +925,15 @@ public class KeysType [XmlElement("Key")] public List Key { - get { return _keyField ?? (_keyField = new List()); } - set { _keyField = value; } + get => _keyField ??= new List(); + set => _keyField = value; } } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class Corpus : IIMDIMajorObject { /// @@ -982,9 +982,9 @@ public Corpus() } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class MDGroupType { /// @@ -1015,9 +1015,9 @@ public MDGroupType() } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class ContentType { /// @@ -1079,87 +1079,82 @@ public void AddLanguage(ArchivingLanguage language, BooleanEnum dominantLanguage /// public void SetInteractivity(string interactivity) { - IMDIItemList list = ListConstructor.GetClosedList(ListType.ContentInteractivity); - CommunicationContext.Interactivity = list.FindByValue(interactivity).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, ListType.Link(ListType.ContentInteractivity)); + IMDIItemList list = ListConstructor.GetClosedList(ContentInteractivity); + CommunicationContext.Interactivity = list.FindByValue(interactivity).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, Link(ContentInteractivity)); } /// public void SetPlanningType(string planningType) { - IMDIItemList list = ListConstructor.GetClosedList(ListType.ContentPlanningType, DontRequireUppercaseFirstCharacter); - CommunicationContext.PlanningType = list.FindByValue(planningType).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, ListType.Link(ListType.ContentPlanningType)); + IMDIItemList list = ListConstructor.GetClosedList(ContentPlanningType, DontRequireUppercaseFirstCharacter); + CommunicationContext.PlanningType = list.FindByValue(planningType).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, Link(ContentPlanningType)); } /// public void SetInvolvement(string involvement) { - IMDIItemList list = ListConstructor.GetClosedList(ListType.ContentInvolvement, DontRequireUppercaseFirstCharacter); - CommunicationContext.Involvement = list.FindByValue(involvement).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, ListType.Link(ListType.ContentInvolvement)); + IMDIItemList list = ListConstructor.GetClosedList(ContentInvolvement, DontRequireUppercaseFirstCharacter); + CommunicationContext.Involvement = list.FindByValue(involvement).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, Link(ContentInvolvement)); } /// public void SetSocialContext(string socialContext) { - IMDIItemList list = ListConstructor.GetClosedList(ListType.ContentSocialContext); - CommunicationContext.SocialContext = list.FindByValue(socialContext).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, ListType.Link(ListType.ContentSocialContext)); + IMDIItemList list = ListConstructor.GetClosedList(ContentSocialContext); + CommunicationContext.SocialContext = list.FindByValue(socialContext).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, Link(ContentSocialContext)); } /// public void SetEventStructure(string eventStructure) { - IMDIItemList list = ListConstructor.GetClosedList(ListType.ContentEventStructure); - CommunicationContext.EventStructure = list.FindByValue(eventStructure).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, ListType.Link(ListType.ContentEventStructure)); + IMDIItemList list = ListConstructor.GetClosedList(ContentEventStructure); + CommunicationContext.EventStructure = list.FindByValue(eventStructure).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, Link(ContentEventStructure)); } /// public void SetChannel(string channel) { - IMDIItemList list = ListConstructor.GetClosedList(ListType.ContentChannel); - CommunicationContext.Channel = list.FindByValue(channel).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, ListType.Link(ListType.ContentChannel)); + IMDIItemList list = ListConstructor.GetClosedList(ContentChannel); + CommunicationContext.Channel = list.FindByValue(channel).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, Link(ContentChannel)); } /// public void CheckRequiredFields() { - if (Genre == null) - Genre = new VocabularyType { Link = ListType.Link(ListType.ContentGenre) }; + Genre ??= new VocabularyType { Link = Link(ContentGenre) }; - if (SubGenre == null) - SubGenre = new VocabularyType { Link = ListType.Link(ListType.ContentSubGenre) }; + SubGenre ??= new VocabularyType { Link = Link(ContentSubGenre) }; - if (Task == null) - Task = new VocabularyType { Link = ListType.Link(ListType.ContentTask) }; + Task ??= new VocabularyType { Link = Link(ContentTask) }; - if (Modalities == null) - Modalities = new VocabularyType { Link = ListType.Link(ListType.ContentModalities) }; + Modalities ??= new VocabularyType { Link = Link(ContentModalities) }; - if (Subject == null) - Subject = new ContentTypeSubject { Link = ListType.Link(ListType.ContentSubject) }; + Subject ??= new ContentTypeSubject { Link = Link(ContentSubject) }; - if (CommunicationContext.Interactivity == null) - CommunicationContext.Interactivity = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ContentInteractivity) }; + CommunicationContext.Interactivity ??= new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(ContentInteractivity) }; - if (CommunicationContext.PlanningType == null) - CommunicationContext.PlanningType = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ContentPlanningType) }; + CommunicationContext.PlanningType ??= new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(ContentPlanningType) }; - if (CommunicationContext.Involvement == null) - CommunicationContext.Involvement = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ContentInvolvement) }; + CommunicationContext.Involvement ??= new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(ContentInvolvement) }; - if (CommunicationContext.SocialContext == null) - CommunicationContext.SocialContext = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ContentSocialContext) }; + CommunicationContext.SocialContext ??= new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(ContentSocialContext) }; - if (CommunicationContext.EventStructure == null) - CommunicationContext.EventStructure = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ContentEventStructure) }; + CommunicationContext.EventStructure ??= new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(ContentEventStructure) }; - if (CommunicationContext.Channel == null) - CommunicationContext.Channel = new VocabularyType { Type = VocabularyTypeValueType.ClosedVocabulary, Link = ListType.Link(ListType.ContentChannel) }; + CommunicationContext.Channel ??= new VocabularyType + { Type = VocabularyTypeValueType.ClosedVocabulary, Link = Link(ContentChannel) }; } } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(AnonymousType = true, Namespace = "https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class ContentTypeCommunicationContext { /// Closed vocabulary, Content-Interactivity.xml @@ -1182,9 +1177,9 @@ public class ContentTypeCommunicationContext } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(AnonymousType=true, Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(AnonymousType=true, Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class ContentTypeSubject : VocabularyType { /// @@ -1193,9 +1188,9 @@ public class ContentTypeSubject : VocabularyType } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class LanguagesType : IMDIDescription { private List _languageField; @@ -1208,10 +1203,10 @@ public DescriptionTypeCollection Description } /// - [XmlElementAttribute("Language")] + [XmlElement("Language")] public List Language { - get { return _languageField ?? (_languageField = new List()); } - set { _languageField = value; } + get => _languageField ??= new List(); + set => _languageField = value; } /// @@ -1223,9 +1218,9 @@ public static LanguageType GetLanguage(string iso3CodeOrEnglishName) } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class LanguageType : IMDIDescription { /// @@ -1253,8 +1248,8 @@ public class LanguageType : IMDIDescription [XmlElement("Description")] public DescriptionTypeCollection Description { - get { return DescriptionInternal; } - set { DescriptionInternal = value; } + get => DescriptionInternal; + set => DescriptionInternal = value; } /// @@ -1263,9 +1258,9 @@ public DescriptionTypeCollection Description } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class ActorsType : IMDIDescription { private List _actorField; @@ -1273,22 +1268,22 @@ public class ActorsType : IMDIDescription [XmlElement("Description")] public DescriptionTypeCollection Description { - get { return DescriptionInternal; } - set { DescriptionInternal = value; } + get => DescriptionInternal; + set => DescriptionInternal = value; } /// - [XmlElementAttribute("Actor")] + [XmlElement("Actor")] public List Actor { - get { return _actorField ?? (_actorField = new List()); } - set { _actorField = value; } + get => _actorField ??= new List(); + set => _actorField = value; } } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class ActorType { private LanguagesType _languagesField; @@ -1352,7 +1347,7 @@ public ActorType(ArchivingActor actor) : this() // Role if (!string.IsNullOrEmpty(actor.Role)) - Role = actor.Role.ToVocabularyType(false, ListType.Link(ListType.ActorRole)); ; + Role = actor.Role.ToVocabularyType(false, Link(ActorRole)); ; // Occupation if (!string.IsNullOrEmpty(actor.Occupation)) @@ -1371,7 +1366,7 @@ public ActorType(ArchivingActor actor) : this() public VocabularyType Role { get; set; } /// - [XmlElementAttribute("Name")] + [XmlElement("Name")] public string[] Name { get; set; } /// @@ -1387,8 +1382,8 @@ public ActorType(ArchivingActor actor) : this() [XmlElement("Languages")] public LanguagesType Languages { - get { return _languagesField ?? (_languagesField = new LanguagesType()); } - set { _languagesField = value; } + get => _languagesField ??= new LanguagesType(); + set => _languagesField = value; } /// @@ -1418,8 +1413,8 @@ public void SetBirthDate(string birthDate) /// public void SetSex(string gender) { - IMDIItemList genderList = ListConstructor.GetClosedList(ListType.ActorSex); - Sex = genderList.FindByValue(gender).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, ListType.Link(ListType.ActorSex)); + IMDIItemList genderList = ListConstructor.GetClosedList(ActorSex); + Sex = genderList.FindByValue(gender).ToVocabularyType(VocabularyTypeValueType.ClosedVocabulary, Link(ActorSex)); } /// @@ -1435,11 +1430,11 @@ public void AddLanguage(ArchivingLanguage language, BooleanEnum primaryLanguage, if (primaryLanguage == BooleanEnum.Unspecified) imdiLanguage.PrimaryLanguage = null; else - imdiLanguage.PrimaryLanguage = new BooleanType { Value = primaryLanguage, Link = ListType.Link(ListType.Boolean) }; + imdiLanguage.PrimaryLanguage = new BooleanType { Value = primaryLanguage, Link = Link(ListType.Boolean) }; if (motherTongue == BooleanEnum.Unspecified) imdiLanguage.MotherTongue = null; else - imdiLanguage.MotherTongue = new BooleanType { Value = motherTongue, Link = ListType.Link(ListType.Boolean) }; + imdiLanguage.MotherTongue = new BooleanType { Value = motherTongue, Link = Link(ListType.Boolean) }; Languages.Language.Add(imdiLanguage); } @@ -1458,14 +1453,14 @@ public void AddLanguage(ArchivingLanguage language, BooleanEnum primaryLanguage, public DescriptionTypeCollection Description { get; set; } /// - [XmlAttributeAttribute] + [XmlAttribute] public string ResourceRef { get; set; } // TODO: Do we need this method? /// public ArchivingActor ToArchivingActor() { - ArchivingActor actr = new ArchivingActor + ArchivingActor actor = new ArchivingActor { Age = Age, Education = Education, @@ -1473,38 +1468,38 @@ public ArchivingActor ToArchivingActor() }; if (Sex != null) - actr.Gender = Sex.Value; + actor.Gender = Sex.Value; if (Name.Length > 0) - actr.Name = Name[0]; + actor.Name = Name[0]; if (!string.IsNullOrEmpty(Role.Value)) - actr.Role = Role.Value; + actor.Role = Role.Value; if (!string.IsNullOrEmpty(BirthDate)) - actr.BirthDate = BirthDate; + actor.BirthDate = BirthDate; foreach (LanguageType lang in Languages.Language) { var iso3 = lang.Id.Substring(lang.Id.Length - 3); var archLanguage = new ArchivingLanguage(iso3, lang.Name[0].Value); - actr.Iso3Languages.Add(archLanguage); + actor.Iso3Languages.Add(archLanguage); if (lang.PrimaryLanguage.Value == BooleanEnum.@true) - actr.PrimaryLanguage = archLanguage; + actor.PrimaryLanguage = archLanguage; if (lang.MotherTongue.Value == BooleanEnum.@true) - actr.MotherTongueLanguage = archLanguage; + actor.MotherTongueLanguage = archLanguage; } - return actr; + return actor; } } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class CorpusLinkType : ResourceLinkType { /// @@ -1513,10 +1508,10 @@ public class CorpusLinkType : ResourceLinkType } /// - [XmlIncludeAttribute(typeof(CorpusLinkType))] - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [XmlInclude(typeof(CorpusLinkType))] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class ResourceLinkType { /// @@ -1528,13 +1523,16 @@ public class ResourceLinkType public string Value { get; set; } } - /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + /// Groups data about name conversions for persons who are anonymised> + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class AnonymsType { - /// + /// + /// URL to information to convert pseudo named to real-names + /// + [PublicAPI] public ResourceLinkType ResourceLink { get; set; } /// @@ -1542,9 +1540,9 @@ public class AnonymsType } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class CounterPositionType { /// @@ -1555,9 +1553,9 @@ public class CounterPositionType } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class IntegerType { /// @@ -1566,9 +1564,9 @@ public class IntegerType } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class SourceType : IMDIDescription { /// @@ -1580,7 +1578,10 @@ public class SourceType : IMDIDescription /// public QualityType Quality { get; set; } - /// + /// + /// Position (start (+end) ) on a old fashioned tape without time indication + /// + [PublicAPI] public CounterPositionType CounterPosition { get; set; } /// @@ -1589,8 +1590,8 @@ public class SourceType : IMDIDescription [XmlElement("Description")] public DescriptionTypeCollection Description { - get { return DescriptionInternal; } - set { DescriptionInternal = value; } + get => DescriptionInternal; + set => DescriptionInternal = value; } /// @@ -1602,9 +1603,9 @@ public DescriptionTypeCollection Description } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class QualityType { /// @@ -1624,9 +1625,9 @@ public QualityType() {} } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class ValidationType { /// @@ -1650,9 +1651,9 @@ public ValidationType() } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class WrittenResourceType : IIMDISessionFile { /// @@ -1735,9 +1736,9 @@ public void AddDescription(LanguageString description) } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class MediaFileType : IIMDISessionFile { /// @@ -1799,10 +1800,15 @@ public void AddDescription(LanguageString description) public string OutputDirectory { get; set; } } - /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + /// + /// A "session" (aka, "resource bundle") usually corresponds to a meaningful unit of analysis, + /// e.g., to a piece of data having the same overall content, the same set of actors, and the + /// same location and time (e.g., one elicitation session on topic X, or one folktale, or one + /// ‘matching game’, or one conversation between several speakers). + /// + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class Session : IIMDIMajorObject, IArchivingSession { private static int _anonymizedCounter = 1; @@ -1816,7 +1822,7 @@ public Session() References = new SessionTypeReferences(); } - /// Name of object + /// Name of session [XmlElement("Name")] public string Name { get; set; } @@ -1863,7 +1869,7 @@ public void SetDate(int year) [XmlIgnore] public ArchivingLocation Location { - get { return MDGroup.Location.ToArchivingLocation(); } + get => MDGroup.Location.ToArchivingLocation(); set { var loc = MDGroup.Location; @@ -1904,8 +1910,7 @@ public void AddProject(ArchivingPackage package) } }; var imdiPackage = package as IMDIPackage; - var corpus = imdiPackage?.BaseImdiFile?.Items?.FirstOrDefault() as Corpus; - if (corpus != null) + if (imdiPackage?.BaseImdiFile?.Items?.FirstOrDefault() is Corpus corpus) project.Description.Add(corpus.Description.FirstOrDefault()); MDGroup.Project = new List{ project }; } @@ -1985,27 +1990,23 @@ public void AddContentKeyValuePair(string key, string value) public void AddFileKeyValuePair(string fullFileName, string key, string value) { var sessionFile = GetFile(fullFileName); - if (sessionFile == null) return; - if (sessionFile is MediaFileType) - { - var audioOrVisualFile = sessionFile as MediaFileType; + if (sessionFile == null) + return; + if (sessionFile is MediaFileType audioOrVisualFile) audioOrVisualFile.Keys.Key.Add(new KeyType { Name = key, Value = value }); - } - else if (sessionFile is WrittenResourceType) - { - var writtenResourceFile = sessionFile as WrittenResourceType; + else if (sessionFile is WrittenResourceType writtenResourceFile) writtenResourceFile.Keys.Key.Add(new KeyType { Name = key, Value = value }); - } } public void AddFileDescription(string fullFileName, LanguageString description) { var sessionFile = GetFile(fullFileName); - if (sessionFile == null) return; + if (sessionFile == null) + return; // IMDIFile.cs line 160 adds a default value which will block the adding of the first entry if (sessionFile.Description.Count == 1 && - sessionFile.Description.FirstOrDefault().Value == null) + sessionFile.Description.FirstOrDefault()?.Value == null) sessionFile.Description.Remove(sessionFile.Description.FirstOrDefault()); sessionFile.Description.Add(description); @@ -2014,7 +2015,8 @@ public void AddFileDescription(string fullFileName, LanguageString description) public void AddActorContact(ArchivingActor actor, ArchivingContact contact) { var actorType = GetActor(actor.FullName); - if (actorType == null) return; + if (actorType == null) + return; actorType.Contact = new ContactType { Name = contact.Name, @@ -2027,8 +2029,8 @@ public void AddActorContact(ArchivingActor actor, ArchivingContact contact) public void AddMediaFileTimes(string fullFileName, string start, string stop) { var sessionFile = GetFile(fullFileName); - if (!(sessionFile is MediaFileType)) return; - var audioOrVisualFile = sessionFile as MediaFileType; + if (!(sessionFile is MediaFileType audioOrVisualFile)) + return; audioOrVisualFile.TimePosition.Start = start; audioOrVisualFile.TimePosition.End = stop; } @@ -2068,22 +2070,13 @@ private ActorType GetActor(string fullName) /// private IIMDISessionFile GetFile(string fileName) { - foreach (var fileType in Resources.MediaFile) - { - if (fileType.FullPathAndFileName == fileName) - return fileType; - } - foreach (var writtenResourceType in Resources.WrittenResource) - { - if (writtenResourceType.FullPathAndFileName == fileName) - return writtenResourceType; - } - return null; + return Resources.MediaFile.FirstOrDefault(fileType => fileType.FullPathAndFileName == fileName) as IIMDISessionFile ?? + Resources.WrittenResource.FirstOrDefault(writtenResourceType => writtenResourceType.FullPathAndFileName == fileName); } /// [XmlIgnore] - public List Files + public IReadOnlyList Files { get { @@ -2099,126 +2092,85 @@ public List Files [XmlIgnore] public string Genre { - get - { - return MDGroup.Content.Genre == null ? null : MDGroup.Content.Genre.Value; - } - set - { - MDGroup.Content.Genre = value?.Replace("<","")?.Replace(">","").ToVocabularyType(false, ListType.Link(ListType.ContentGenre)); - } + get => MDGroup.Content.Genre?.Value; + set => MDGroup.Content.Genre = value?.Replace("<","")?.Replace(">","") + .ToVocabularyType(false, Link(ContentGenre)); } /// [XmlIgnore] public string SubGenre { - get - { - return MDGroup.Content.SubGenre == null ? null : MDGroup.Content.SubGenre.Value; - } - set - { - MDGroup.Content.SubGenre = value.ToVocabularyType(false, ListType.Link(ListType.ContentSubGenre)); - } + get => MDGroup.Content.SubGenre?.Value; + set => MDGroup.Content.SubGenre = value.ToVocabularyType(false, Link(ContentSubGenre)); } /// [XmlIgnore] public string Interactivity { - get - { - return MDGroup.Content.CommunicationContext.Interactivity == null ? null : MDGroup.Content.CommunicationContext.Interactivity.Value; - } - set - { - MDGroup.Content.SetInteractivity(value); - } + get => MDGroup.Content.CommunicationContext.Interactivity?.Value; + set => MDGroup.Content.SetInteractivity(value); } /// [XmlIgnore] public string Involvement { - get - { - return MDGroup.Content.CommunicationContext.Involvement == null ? null : MDGroup.Content.CommunicationContext.Involvement.Value; - } - set - { - MDGroup.Content.SetInvolvement(value); - } + get => MDGroup.Content.CommunicationContext.Involvement?.Value; + set => MDGroup.Content.SetInvolvement(value); } /// [XmlIgnore] public string PlanningType { - get - { - return MDGroup.Content.CommunicationContext.PlanningType == null ? null : MDGroup.Content.CommunicationContext.PlanningType.Value; - } - set - { - MDGroup.Content.SetPlanningType(value); - } + get => MDGroup.Content.CommunicationContext.PlanningType?.Value; + set => MDGroup.Content.SetPlanningType(value); } /// [XmlIgnore] public string SocialContext { - get - { - return MDGroup.Content.CommunicationContext.SocialContext == null ? null : MDGroup.Content.CommunicationContext.SocialContext.Value; - } - set - { - MDGroup.Content.SetSocialContext(value); - } + get => MDGroup.Content.CommunicationContext.SocialContext?.Value; + set => MDGroup.Content.SetSocialContext(value); } /// [XmlIgnore] public string Task { - get - { - return MDGroup.Content.Task == null ? null : MDGroup.Content.Task.Value; - } - set - { - MDGroup.Content.Task = value.ToVocabularyType(false, ListType.Link(ListType.ContentTask)); - } + get => MDGroup.Content.Task?.Value; + set => MDGroup.Content.Task = value.ToVocabularyType(false, Link(ContentTask)); } } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(AnonymousType=true, Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(AnonymousType=true, Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class SessionResources { private List _mediaFileField; private List _writtenResourceField; /// - [XmlElementAttribute("MediaFile")] + [XmlElement("MediaFile")] public List MediaFile { - get { return _mediaFileField ?? (_mediaFileField = new List()); } - set { _mediaFileField = value; } + get => _mediaFileField ??= new List(); + set => _mediaFileField = value; } /// - [XmlElementAttribute("WrittenResource")] + [XmlElement("WrittenResource")] public List WrittenResource { - get { return _writtenResourceField ?? (_writtenResourceField = new List()); } - set { _writtenResourceField = value; } + get { return _writtenResourceField ??= new List(); } + set => _writtenResourceField = value; } /// - [XmlElementAttribute("Source")] + [XmlElement("Source")] public SourceType[] Source { get; set; } /// @@ -2226,22 +2178,22 @@ public List WrittenResource { } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(AnonymousType=true, Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(AnonymousType=true, Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class SessionReferences : IMDIDescription { [XmlElement("Description")] public DescriptionTypeCollection Description { - get { return DescriptionInternal; } - set { DescriptionInternal = value; } + get => DescriptionInternal; + set => DescriptionInternal = value; } } /// - [SerializableAttribute] - [XmlTypeAttribute(Namespace="http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [XmlType(Namespace="https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public enum MetatranscriptValueType { // ReSharper disable InconsistentNaming @@ -2249,36 +2201,37 @@ public enum MetatranscriptValueType SESSION, /// - [XmlEnumAttribute("SESSION.Profile")] + [XmlEnum("SESSION.Profile")] SESSIONProfile, /// + [PublicAPI] LEXICON_RESOURCE_BUNDLE, /// - [XmlEnumAttribute("LEXICON_RESOURCE_BUNDLE.Profile")] + [XmlEnum("LEXICON_RESOURCE_BUNDLE.Profile")] LEXICON_RESOURCE_BUNDLEProfile, /// CATALOGUE, /// - [XmlEnumAttribute("CATALOGUE.Profile")] + [XmlEnum("CATALOGUE.Profile")] CATALOGUEProfile, /// CORPUS, /// - [XmlEnumAttribute("CORPUS.Profile")] + [XmlEnum("CORPUS.Profile")] CORPUSProfile, // ReSharper restore InconsistentNaming } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(Namespace = "http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(Namespace = "https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class TimePositionRangeType { /// @@ -2296,9 +2249,9 @@ public TimePositionRangeType() } /// - [SerializableAttribute] - [DebuggerStepThroughAttribute] - [XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.mpi.nl/IMDI/Schema/IMDI")] + [Serializable] + [DebuggerStepThrough] + [XmlType(AnonymousType = true, Namespace = "https://www.mpi.nl/IMDI/Schema/IMDI_3.0.xsd")] public class SessionTypeReferences { /// diff --git a/SIL.Windows.Forms.Archiving/ArchivingDlg.Designer.cs b/SIL.Windows.Forms.Archiving/ArchivingDlg.Designer.cs index b45d5e81d..6ae64e05a 100644 --- a/SIL.Windows.Forms.Archiving/ArchivingDlg.Designer.cs +++ b/SIL.Windows.Forms.Archiving/ArchivingDlg.Designer.cs @@ -30,215 +30,218 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this._tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); - this._buttonCreatePackage = new System.Windows.Forms.Button(); - this._linkOverview = new System.Windows.Forms.LinkLabel(); - this._progressBar = new System.Windows.Forms.ProgressBar(); - this._logBox = new SIL.Windows.Forms.Progress.LogBox(); - this._buttonLaunchRamp = new System.Windows.Forms.Button(); - this._buttonCancel = new System.Windows.Forms.Button(); - this._flowLayoutExtra = new System.Windows.Forms.FlowLayoutPanel(); - this.locExtender = new L10NSharp.UI.L10NSharpExtender(this.components); - this._chkMetadataOnly = new System.Windows.Forms.CheckBox(); - this._tableLayoutPanel.SuspendLayout(); - this._flowLayoutExtra.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.locExtender)).BeginInit(); - this.SuspendLayout(); - // - // _tableLayoutPanel - // - this._tableLayoutPanel.ColumnCount = 3; - this._tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this._tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this._tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this._tableLayoutPanel.Controls.Add(this._buttonCreatePackage, 0, 4); - this._tableLayoutPanel.Controls.Add(this._linkOverview, 0, 0); - this._tableLayoutPanel.Controls.Add(this._progressBar, 0, 2); - this._tableLayoutPanel.Controls.Add(this._logBox, 0, 1); - this._tableLayoutPanel.Controls.Add(this._buttonLaunchRamp, 1, 4); - this._tableLayoutPanel.Controls.Add(this._buttonCancel, 2, 4); - this._tableLayoutPanel.Controls.Add(this._flowLayoutExtra, 0, 3); - this._tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this._tableLayoutPanel.Location = new System.Drawing.Point(12, 12); - this._tableLayoutPanel.Name = "_tableLayoutPanel"; - this._tableLayoutPanel.RowCount = 5; - this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this._tableLayoutPanel.Size = new System.Drawing.Size(355, 408); - this._tableLayoutPanel.TabIndex = 0; - // - // _buttonCreatePackage - // - this._buttonCreatePackage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._buttonCreatePackage.AutoSize = true; - this.locExtender.SetLocalizableToolTip(this._buttonCreatePackage, null); - this.locExtender.SetLocalizationComment(this._buttonCreatePackage, null); - this.locExtender.SetLocalizingId(this._buttonCreatePackage, "DialogBoxes.ArchivingDlg._buttonCreatePackage"); - this._buttonCreatePackage.Location = new System.Drawing.Point(58, 382); - this._buttonCreatePackage.Margin = new System.Windows.Forms.Padding(8, 0, 0, 0); - this._buttonCreatePackage.Name = "_buttonCreatePackage"; - this._buttonCreatePackage.Size = new System.Drawing.Size(106, 26); - this._buttonCreatePackage.TabIndex = 0; - this._buttonCreatePackage.Text = "&1) Create Package"; - this._buttonCreatePackage.UseVisualStyleBackColor = true; - this._buttonCreatePackage.Click += new System.EventHandler(this.CreatePackage); - - // - // _linkOverview - // - this._linkOverview.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.components = new System.ComponentModel.Container(); + this._tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this._buttonCreatePackage = new System.Windows.Forms.Button(); + this._linkOverview = new System.Windows.Forms.LinkLabel(); + this._progressBar = new System.Windows.Forms.ProgressBar(); + this._logBox = new SIL.Windows.Forms.Progress.LogBox(); + this._buttonLaunchRamp = new System.Windows.Forms.Button(); + this._buttonCancel = new System.Windows.Forms.Button(); + this._flowLayoutExtra = new System.Windows.Forms.FlowLayoutPanel(); + this._chkMetadataOnly = new System.Windows.Forms.CheckBox(); + this.locExtender = new L10NSharp.UI.L10NSharpExtender(this.components); + this._tableLayoutPanel.SuspendLayout(); + this._flowLayoutExtra.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.locExtender)).BeginInit(); + this.SuspendLayout(); + // + // _tableLayoutPanel + // + this._tableLayoutPanel.ColumnCount = 3; + this._tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this._tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this._tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this._tableLayoutPanel.Controls.Add(this._buttonCreatePackage, 0, 4); + this._tableLayoutPanel.Controls.Add(this._linkOverview, 0, 0); + this._tableLayoutPanel.Controls.Add(this._progressBar, 0, 2); + this._tableLayoutPanel.Controls.Add(this._logBox, 0, 1); + this._tableLayoutPanel.Controls.Add(this._buttonLaunchRamp, 1, 4); + this._tableLayoutPanel.Controls.Add(this._buttonCancel, 2, 4); + this._tableLayoutPanel.Controls.Add(this._flowLayoutExtra, 0, 3); + this._tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this._tableLayoutPanel.Location = new System.Drawing.Point(12, 12); + this._tableLayoutPanel.Name = "_tableLayoutPanel"; + this._tableLayoutPanel.RowCount = 5; + this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this._tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this._tableLayoutPanel.Size = new System.Drawing.Size(355, 408); + this._tableLayoutPanel.TabIndex = 0; + // + // _buttonCreatePackage + // + this._buttonCreatePackage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._buttonCreatePackage.AutoSize = true; + this._buttonCreatePackage.Enabled = false; + this.locExtender.SetLocalizableToolTip(this._buttonCreatePackage, null); + this.locExtender.SetLocalizationComment(this._buttonCreatePackage, null); + this.locExtender.SetLocalizingId(this._buttonCreatePackage, "DialogBoxes.ArchivingDlg._buttonCreatePackage"); + this._buttonCreatePackage.Location = new System.Drawing.Point(58, 382); + this._buttonCreatePackage.Margin = new System.Windows.Forms.Padding(8, 0, 0, 0); + this._buttonCreatePackage.Name = "_buttonCreatePackage"; + this._buttonCreatePackage.Size = new System.Drawing.Size(106, 26); + this._buttonCreatePackage.TabIndex = 0; + this._buttonCreatePackage.Text = "&1) Create Package"; + this._buttonCreatePackage.UseVisualStyleBackColor = true; + this._buttonCreatePackage.Click += new System.EventHandler(this.CreatePackage); + // + // _linkOverview + // + this._linkOverview.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this._linkOverview.AutoSize = true; - this._tableLayoutPanel.SetColumnSpan(this._linkOverview, 3); - this._linkOverview.LinkArea = new System.Windows.Forms.LinkArea(0, 0); - this.locExtender.SetLocalizableToolTip(this._linkOverview, null); - this.locExtender.SetLocalizationComment(this._linkOverview, ""); - this.locExtender.SetLocalizationPriority(this._linkOverview, L10NSharp.LocalizationPriority.NotLocalizable); - this.locExtender.SetLocalizingId(this._linkOverview, "DialogBoxes.ArchivingDlg.OverviewText"); - this._linkOverview.Location = new System.Drawing.Point(3, 0); - this._linkOverview.Name = "_linkOverview"; - this._linkOverview.Size = new System.Drawing.Size(349, 13); - this._linkOverview.TabIndex = 3; - this._linkOverview.Text = "#"; - this._linkOverview.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.HandleRampLinkClicked); - // - // _progressBar - // - this._progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this._linkOverview.AutoSize = true; + this._tableLayoutPanel.SetColumnSpan(this._linkOverview, 3); + this._linkOverview.LinkArea = new System.Windows.Forms.LinkArea(0, 0); + this.locExtender.SetLocalizableToolTip(this._linkOverview, null); + this.locExtender.SetLocalizationComment(this._linkOverview, ""); + this.locExtender.SetLocalizationPriority(this._linkOverview, L10NSharp.LocalizationPriority.NotLocalizable); + this.locExtender.SetLocalizingId(this._linkOverview, "DialogBoxes.ArchivingDlg.OverviewText"); + this._linkOverview.Location = new System.Drawing.Point(3, 0); + this._linkOverview.Name = "_linkOverview"; + this._linkOverview.Size = new System.Drawing.Size(349, 13); + this._linkOverview.TabIndex = 3; + this._linkOverview.Text = "#"; + this._linkOverview.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.HandleRampLinkClicked); + // + // _progressBar + // + this._progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this._tableLayoutPanel.SetColumnSpan(this._progressBar, 3); - this._progressBar.Location = new System.Drawing.Point(0, 326); - this._progressBar.Margin = new System.Windows.Forms.Padding(0, 0, 0, 12); - this._progressBar.Name = "_progressBar"; - this._progressBar.Size = new System.Drawing.Size(355, 15); - this._progressBar.TabIndex = 4; - // - // _logBox - // - this._logBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this._tableLayoutPanel.SetColumnSpan(this._progressBar, 3); + this._progressBar.Location = new System.Drawing.Point(0, 326); + this._progressBar.Margin = new System.Windows.Forms.Padding(0, 0, 0, 12); + this._progressBar.Name = "_progressBar"; + this._progressBar.Size = new System.Drawing.Size(355, 15); + this._progressBar.TabIndex = 4; + // + // _logBox + // + this._logBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this._logBox.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this._logBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this._logBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this._logBox.CancelRequested = false; - this._tableLayoutPanel.SetColumnSpan(this._logBox, 3); - this._logBox.ErrorEncountered = false; - this._logBox.Font = new System.Drawing.Font("Segoe UI", 9F); - this._logBox.GetDiagnosticsMethod = null; - this.locExtender.SetLocalizableToolTip(this._logBox, null); - this.locExtender.SetLocalizationComment(this._logBox, null); - this.locExtender.SetLocalizingId(this._logBox, "LogBox"); - this._logBox.Location = new System.Drawing.Point(0, 18); - this._logBox.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5); - this._logBox.Name = "_logBox"; - this._logBox.ProgressIndicator = null; - this._logBox.ShowCopyToClipboardMenuItem = false; - this._logBox.ShowDetailsMenuItem = false; - this._logBox.ShowDiagnosticsMenuItem = false; - this._logBox.ShowFontMenuItem = false; - this._logBox.ShowMenu = false; - this._logBox.Size = new System.Drawing.Size(355, 303); - this._logBox.TabIndex = 5; - this._logBox.TabStop = false; - this._logBox.ReportErrorLinkClicked += new System.EventHandler(this.HandleLogBoxReportErrorLinkClicked); - // - // _buttonLaunchRamp - // - this._buttonLaunchRamp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._buttonLaunchRamp.AutoSize = true; - this._buttonLaunchRamp.DialogResult = System.Windows.Forms.DialogResult.OK; - this.locExtender.SetLocalizableToolTip(this._buttonLaunchRamp, null); - this.locExtender.SetLocalizationComment(this._buttonLaunchRamp, null); - this.locExtender.SetLocalizingId(this._buttonLaunchRamp, "DialogBoxes.ArchivingDlg._buttonLaunchRamp"); - this._buttonLaunchRamp.Location = new System.Drawing.Point(172, 382); - this._buttonLaunchRamp.Margin = new System.Windows.Forms.Padding(8, 0, 0, 0); - this._buttonLaunchRamp.Name = "_buttonLaunchRamp"; - this._buttonLaunchRamp.Size = new System.Drawing.Size(100, 26); - this._buttonLaunchRamp.TabIndex = 1; - this._buttonLaunchRamp.Text = "&2) Launch {0}"; - this._buttonLaunchRamp.UseVisualStyleBackColor = true; - // - // _buttonCancel - // - this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._buttonCancel.AutoSize = true; - this._buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.locExtender.SetLocalizableToolTip(this._buttonCancel, null); - this.locExtender.SetLocalizationComment(this._buttonCancel, null); - this.locExtender.SetLocalizingId(this._buttonCancel, "DialogBoxes.ArchivingDlg._buttonCancel"); - this._buttonCancel.Location = new System.Drawing.Point(280, 382); - this._buttonCancel.Margin = new System.Windows.Forms.Padding(8, 0, 0, 0); - this._buttonCancel.Name = "_buttonCancel"; - this._buttonCancel.Size = new System.Drawing.Size(75, 26); - this._buttonCancel.TabIndex = 2; - this._buttonCancel.Text = "Cancel"; - this._buttonCancel.UseVisualStyleBackColor = true; - this._buttonCancel.Click += new System.EventHandler(this.HandleButtonCancelClick); - // - // _flowLayoutExtra - // - this._flowLayoutExtra.AutoSize = true; - this._flowLayoutExtra.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this._tableLayoutPanel.SetColumnSpan(this._flowLayoutExtra, 3); - this._flowLayoutExtra.Controls.Add(this._chkMetadataOnly); - this._flowLayoutExtra.Dock = System.Windows.Forms.DockStyle.Top; - this._flowLayoutExtra.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this._flowLayoutExtra.Location = new System.Drawing.Point(3, 356); - this._flowLayoutExtra.Name = "_flowLayoutExtra"; - this._flowLayoutExtra.Size = new System.Drawing.Size(349, 23); - this._flowLayoutExtra.TabIndex = 6; - // - // locExtender - // - this.locExtender.LocalizationManagerId = "SIL.Windows.Forms.Archiving"; - this.locExtender.PrefixForNewItems = null; - // - // _chkMetadataOnly - // - this._chkMetadataOnly.AutoSize = true; - this.locExtender.SetLocalizableToolTip(this._chkMetadataOnly, "Select this to prevent copying actual data files into archive"); - this.locExtender.SetLocalizationComment(this._chkMetadataOnly, null); - this.locExtender.SetLocalizingId(this._chkMetadataOnly, "ArchivingDlg._chkMetadataOnly"); - this._chkMetadataOnly.Location = new System.Drawing.Point(3, 3); - this._chkMetadataOnly.Name = "_chkMetadataOnly"; - this._chkMetadataOnly.Size = new System.Drawing.Size(93, 17); - this._chkMetadataOnly.TabIndex = 0; - this._chkMetadataOnly.Text = "Metadata only"; - this._chkMetadataOnly.UseVisualStyleBackColor = true; - this._chkMetadataOnly.Visible = false; - this._chkMetadataOnly.CheckedChanged += new System.EventHandler(this._chkMetadataOnly_CheckedChanged); - // - // ArchivingDlg - // - this.AcceptButton = this._buttonLaunchRamp; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._buttonCancel; - this.ClientSize = new System.Drawing.Size(379, 432); - this.Controls.Add(this._tableLayoutPanel); - this.locExtender.SetLocalizableToolTip(this, null); - this.locExtender.SetLocalizationComment(this, "Parameter is application name"); - this.locExtender.SetLocalizingId(this, "DialogBoxes.ArchivingDlg.WindowTitle"); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(355, 320); - this.Name = "ArchivingDlg"; - this.Padding = new System.Windows.Forms.Padding(12); - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "{0}: Archive using {1}"; - this._tableLayoutPanel.ResumeLayout(false); - this._tableLayoutPanel.PerformLayout(); - this._flowLayoutExtra.ResumeLayout(false); - this._flowLayoutExtra.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.locExtender)).EndInit(); - this.ResumeLayout(false); + this._logBox.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this._logBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this._logBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this._logBox.CancelRequested = false; + this._tableLayoutPanel.SetColumnSpan(this._logBox, 3); + this._logBox.ErrorEncountered = false; + this._logBox.Font = new System.Drawing.Font("Segoe UI", 9F); + this._logBox.GetDiagnosticsMethod = null; + this.locExtender.SetLocalizableToolTip(this._logBox, null); + this.locExtender.SetLocalizationComment(this._logBox, null); + this.locExtender.SetLocalizingId(this._logBox, "LogBox"); + this._logBox.Location = new System.Drawing.Point(0, 18); + this._logBox.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5); + this._logBox.MaxLength = 715827882; + this._logBox.MaxLengthErrorMessage = "Maximum length exceeded!"; + this._logBox.Name = "_logBox"; + this._logBox.ProgressIndicator = null; + this._logBox.ShowCopyToClipboardMenuItem = false; + this._logBox.ShowDetailsMenuItem = false; + this._logBox.ShowDiagnosticsMenuItem = false; + this._logBox.ShowFontMenuItem = false; + this._logBox.ShowMenu = false; + this._logBox.Size = new System.Drawing.Size(355, 303); + this._logBox.TabIndex = 5; + this._logBox.TabStop = false; + this._logBox.ReportErrorLinkClicked += new System.EventHandler(this.HandleLogBoxReportErrorLinkClicked); + // + // _buttonLaunchRamp + // + this._buttonLaunchRamp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._buttonLaunchRamp.AutoSize = true; + this._buttonLaunchRamp.DialogResult = System.Windows.Forms.DialogResult.OK; + this._buttonLaunchRamp.Enabled = false; + this.locExtender.SetLocalizableToolTip(this._buttonLaunchRamp, null); + this.locExtender.SetLocalizationComment(this._buttonLaunchRamp, null); + this.locExtender.SetLocalizingId(this._buttonLaunchRamp, "DialogBoxes.ArchivingDlg._buttonLaunchRamp"); + this._buttonLaunchRamp.Location = new System.Drawing.Point(172, 382); + this._buttonLaunchRamp.Margin = new System.Windows.Forms.Padding(8, 0, 0, 0); + this._buttonLaunchRamp.Name = "_buttonLaunchRamp"; + this._buttonLaunchRamp.Size = new System.Drawing.Size(100, 26); + this._buttonLaunchRamp.TabIndex = 1; + this._buttonLaunchRamp.Text = "&2) Launch {0}"; + this._buttonLaunchRamp.UseVisualStyleBackColor = true; + // + // _buttonCancel + // + this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._buttonCancel.AutoSize = true; + this._buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.locExtender.SetLocalizableToolTip(this._buttonCancel, null); + this.locExtender.SetLocalizationComment(this._buttonCancel, null); + this.locExtender.SetLocalizingId(this._buttonCancel, "DialogBoxes.ArchivingDlg._buttonCancel"); + this._buttonCancel.Location = new System.Drawing.Point(280, 382); + this._buttonCancel.Margin = new System.Windows.Forms.Padding(8, 0, 0, 0); + this._buttonCancel.Name = "_buttonCancel"; + this._buttonCancel.Size = new System.Drawing.Size(75, 26); + this._buttonCancel.TabIndex = 2; + this._buttonCancel.Text = "Cancel"; + this._buttonCancel.UseVisualStyleBackColor = true; + this._buttonCancel.Click += new System.EventHandler(this.HandleButtonCancelClick); + // + // _flowLayoutExtra + // + this._flowLayoutExtra.AutoSize = true; + this._flowLayoutExtra.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this._tableLayoutPanel.SetColumnSpan(this._flowLayoutExtra, 3); + this._flowLayoutExtra.Controls.Add(this._chkMetadataOnly); + this._flowLayoutExtra.Dock = System.Windows.Forms.DockStyle.Top; + this._flowLayoutExtra.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this._flowLayoutExtra.Location = new System.Drawing.Point(3, 356); + this._flowLayoutExtra.Name = "_flowLayoutExtra"; + this._flowLayoutExtra.Size = new System.Drawing.Size(349, 23); + this._flowLayoutExtra.TabIndex = 6; + // + // _chkMetadataOnly + // + this._chkMetadataOnly.AutoSize = true; + this.locExtender.SetLocalizableToolTip(this._chkMetadataOnly, "Select this to prevent copying actual data files into archive"); + this.locExtender.SetLocalizationComment(this._chkMetadataOnly, null); + this.locExtender.SetLocalizingId(this._chkMetadataOnly, "ArchivingDlg._chkMetadataOnly"); + this._chkMetadataOnly.Location = new System.Drawing.Point(3, 3); + this._chkMetadataOnly.Name = "_chkMetadataOnly"; + this._chkMetadataOnly.Size = new System.Drawing.Size(93, 17); + this._chkMetadataOnly.TabIndex = 0; + this._chkMetadataOnly.Text = "Metadata only"; + this._chkMetadataOnly.UseVisualStyleBackColor = true; + this._chkMetadataOnly.Visible = false; + this._chkMetadataOnly.CheckedChanged += new System.EventHandler(this._chkMetadataOnly_CheckedChanged); + // + // locExtender + // + this.locExtender.LocalizationManagerId = "SIL.Windows.Forms.Archiving"; + this.locExtender.PrefixForNewItems = null; + // + // ArchivingDlg + // + this.AcceptButton = this._buttonLaunchRamp; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this._buttonCancel; + this.ClientSize = new System.Drawing.Size(379, 432); + this.Controls.Add(this._tableLayoutPanel); + this.locExtender.SetLocalizableToolTip(this, null); + this.locExtender.SetLocalizationComment(this, "Parameter is application name"); + this.locExtender.SetLocalizingId(this, "DialogBoxes.ArchivingDlg.WindowTitle"); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(355, 320); + this.Name = "ArchivingDlg"; + this.Padding = new System.Windows.Forms.Padding(12); + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; + this.Text = "{0}: Archive using {1}"; + this._tableLayoutPanel.ResumeLayout(false); + this._tableLayoutPanel.PerformLayout(); + this._flowLayoutExtra.ResumeLayout(false); + this._flowLayoutExtra.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.locExtender)).EndInit(); + this.ResumeLayout(false); } diff --git a/SIL.Windows.Forms.Archiving/ArchivingDlg.cs b/SIL.Windows.Forms.Archiving/ArchivingDlg.cs index d727da43d..1bc5a16db 100644 --- a/SIL.Windows.Forms.Archiving/ArchivingDlg.cs +++ b/SIL.Windows.Forms.Archiving/ArchivingDlg.cs @@ -254,8 +254,10 @@ private async Task CreatePackageAsync() } finally { - _progressBar.Visible = false; - WaitCursor.Hide(); + if (InvokeRequired) + Invoke(new Action (ResetUIForUserInteraction)); + else + ResetUIForUserInteraction(); try { @@ -269,6 +271,12 @@ private async Task CreatePackageAsync() } } + private void ResetUIForUserInteraction() + { + _progressBar.Visible = false; + WaitCursor.Hide(); + } + private void CompleteCancellation() { // American spelling for the ID. British spelling for the string :-) @@ -283,7 +291,11 @@ private void CompleteCancellation() protected virtual void PackageCreationComplete(string result) { - _buttonLaunchRamp.Enabled = true; + + if (InvokeRequired) + Invoke(new Action(() => { _buttonLaunchRamp.Enabled = true; })); + else + _buttonLaunchRamp.Enabled = true; } protected virtual void DisableControlsDuringPackageCreation() @@ -308,7 +320,10 @@ protected void UpdateOverviewText() public void IncrementProgress() { - _progressBar.Increment(1); + if (InvokeRequired) + Invoke(new Action(() => { _progressBar.Increment(1); })); + else + _progressBar.Increment(1); } /// ------------------------------------------------------------------------------------ @@ -487,7 +502,6 @@ protected override void OnLoad(EventArgs e) Text = Format(Text, _viewModel.AppName, ArchiveTypeForTitleBar ?? ArchiveTypeName); UpdateLaunchButtonText(); - _buttonLaunchRamp.Enabled = false; //!string.IsNullOrEmpty(model.PathToProgramToLaunch); _linkOverview.Text = InformativeText; _linkOverview.Links.Clear(); @@ -508,21 +522,20 @@ protected override void OnShown(EventArgs e) { base.OnShown(e); Initialize(); - WaitCursor.Show(); - _buttonCreatePackage.Enabled = false; } /// ------------------------------------------------------------------------------------ protected async void Initialize() { _cts = new CancellationTokenSource(); + WaitCursor.Show(); try { - _buttonCreatePackage.Enabled = await _viewModel.Initialize(this, _cts.Token); + _buttonCreatePackage.Enabled = _chkMetadataOnly.Enabled = + await _viewModel.Initialize(this, _cts.Token); _logBox.ScrollToTop(); _progressBar.Maximum = _viewModel.CalculateMaxProgressBarValue(); - _buttonCreatePackage.Enabled = true; } catch (OperationCanceledException) { @@ -535,7 +548,10 @@ protected async void Initialize() } finally { - WaitCursor.Hide(); + if (InvokeRequired) + Invoke(new Action (ResetUIForUserInteraction)); + else + ResetUIForUserInteraction(); try { diff --git a/SIL.Windows.Forms.Archiving/ArchivingDlg.resx b/SIL.Windows.Forms.Archiving/ArchivingDlg.resx index b0ea264f8..3c8fb332c 100644 --- a/SIL.Windows.Forms.Archiving/ArchivingDlg.resx +++ b/SIL.Windows.Forms.Archiving/ArchivingDlg.resx @@ -120,9 +120,6 @@ 17, 17 - - 17, 17 - 42 diff --git a/SIL.Windows.Forms.Archiving/IMDI/IMDIArchivingDlg.cs b/SIL.Windows.Forms.Archiving/IMDI/IMDIArchivingDlg.cs index 8b316583d..50ccb56ca 100644 --- a/SIL.Windows.Forms.Archiving/IMDI/IMDIArchivingDlg.cs +++ b/SIL.Windows.Forms.Archiving/IMDI/IMDIArchivingDlg.cs @@ -37,8 +37,8 @@ public class IMDIArchivingDlg : ArchivingDlg /// dialog box to appear (can be null) /// ------------------------------------------------------------------------------------ public IMDIArchivingDlg(IMDIArchivingDlgViewModel model, - string appSpecificArchivalProcessInfo, string localizationManagerId, - Font programDialogFont, FormSettings settings) + string appSpecificArchivalProcessInfo, string localizationManagerId = null, + Font programDialogFont = null, FormSettings settings = null) : base(model, appSpecificArchivalProcessInfo, localizationManagerId, programDialogFont, settings, LocalizationManager.GetString( "DialogBoxes.ArchivingDlg.IsleMetadataInitiative", "Isle Metadata Initiative", @@ -46,6 +46,7 @@ public IMDIArchivingDlg(IMDIArchivingDlgViewModel model, { // DO NOT SHOW THE LAUNCH OPTION AT THIS TIME model.PathToProgramToLaunch = null; + model.InitializationFailed += Model_InitializationFailed; InitializeNewControls(); @@ -56,6 +57,11 @@ public IMDIArchivingDlg(IMDIArchivingDlgViewModel model, SetControlProperties(); } + private void Model_InitializationFailed(object sender, EventArgs e) + { + _browseDestinationFolder.Enabled = false; + } + private void InitializeNewControls() { AddDestinationFolder(); @@ -153,13 +159,21 @@ protected override void PackageCreationComplete(string result) if (mainExportFile != null) { - // copy the path to the imdi file to the clipboard + void PutIMDIPackagePathOnClipboard() + { + // copy the path to the imdi file to the clipboard - // SP-818: Crash in IMDI export when dialog tries to put string on clipboard - // 18 FEB 2014, Phil Hopper: I found this possible solution using retries on StackOverflow - // https://stackoverflow.com/questions/5707990/requested-clipboard-operation-did-not-succeed - //Clipboard.SetData(DataFormats.Text, _imdiData.MainExportFile); - Clipboard.SetDataObject(mainExportFile, true, 3, 500); + // SP-818: Crash in IMDI export when dialog tries to put string on clipboard + // 18 FEB 2014, Phil Hopper: I found this possible solution using retries on StackOverflow + // https://stackoverflow.com/questions/5707990/requested-clipboard-operation-did-not-succeed + //Clipboard.SetData(DataFormats.Text, _imdiData.MainExportFile); + Clipboard.SetDataObject(mainExportFile, true, 3, 500); + } + + if (InvokeRequired) + Invoke(new Action(PutIMDIPackagePathOnClipboard)); + else + PutIMDIPackagePathOnClipboard(); var successMsg = LocalizationManager.GetString("DialogBoxes.ArchivingDlg.ReadyToCallIMDIMsg", "Exported to {0}. This path is now on your clipboard. If you are using Arbil, go to File, Import, then paste this path in."); @@ -171,6 +185,11 @@ public override string GetMessage(ArchivingDlgViewModel.StringId msgId) { switch (msgId) { + case ArchivingDlgViewModel.StringId.IMDIPackageInvalid: + return LocalizationManager.GetString( + "DialogBoxes.ArchivingDlg.IMDIPackageInvalid", "The IMDI package is invalid.", + "This is displayed in the Archive Using IMDI dialog box if the calling " + + "program fails to initialize the IMDI package with valid settings."); case ArchivingDlgViewModel.StringId.IMDIActorsGroup: return LocalizationManager.GetString( "DialogBoxes.ArchivingDlg.IMDIActorsGroup", "Actors", @@ -275,7 +294,6 @@ private void SelectIMDIProgramOnClick(object sender, EventArgs eventArgs) { ((IMDIArchivingDlgViewModel)_viewModel).OtherProgramPath = chooseIMDIProgram.FileName; SetControlProperties(); - } } }