public void UpdateVideoSupplierDeviceName() { AccessProtocolTypeInfo info = AccessProtocol.First(item => item.Type == NewVideoSupplierDevice.ProtocolType); NewVideoSupplierDevice.DeviceName = string.Format("{0}【{1}:{2}】", info.Name, NewVideoSupplierDevice.IP, NewVideoSupplierDevice.Port); RaisePropertyChangedEvent("DeviceName"); }
internal static string ToSerializedValue(this AccessProtocol value) { switch (value) { case AccessProtocol.SMB: return("SMB"); case AccessProtocol.NFS: return("NFS"); } return(null); }
/// ------------------------------------------------------------------------------------ public void Save() { var project = new XElement("Project"); project.Add(new XElement("Iso639Code", Iso639Code.NullTrim())); project.Add(!TranscriptionFont.Equals(Program.DialogFont) ? new XElement("transcriptionFont", FontHelper.FontToString(TranscriptionFont)) : new XElement("transcriptionFont", null)); project.Add(!FreeTranslationFont.Equals(Program.DialogFont) ? new XElement("freeTranslationFont", FontHelper.FontToString(FreeTranslationFont)) : new XElement("freeTranslationFont", null)); var autoSegmenterSettings = new XElement("AutoSegmentersettings"); project.Add(autoSegmenterSettings); if (AutoSegmenterMinimumSegmentLengthInMilliseconds != Settings.Default.DefaultAutoSegmenterMinimumSegmentLengthInMilliseconds || AutoSegmenterMaximumSegmentLengthInMilliseconds != Settings.Default.DefaultAutoSegmenterMaximumSegmentLengthInMilliseconds || AutoSegmenterPreferrerdPauseLengthInMilliseconds != Settings.Default.DefaultAutoSegmenterPreferrerdPauseLengthInMilliseconds || !AutoSegmenterOptimumLengthClampingFactor.Equals(Settings.Default.DefaultAutoSegmenterOptimumLengthClampingFactor)) { autoSegmenterSettings.Add(new XAttribute("minSegmentLength", AutoSegmenterMinimumSegmentLengthInMilliseconds)); autoSegmenterSettings.Add(new XAttribute("maxSegmentLength", AutoSegmenterMaximumSegmentLengthInMilliseconds)); autoSegmenterSettings.Add(new XAttribute("preferrerdPauseLength", AutoSegmenterPreferrerdPauseLengthInMilliseconds)); autoSegmenterSettings.Add(new XAttribute("optimumLengthClampingFactor", AutoSegmenterOptimumLengthClampingFactor)); } else { autoSegmenterSettings.Add(new XAttribute("minSegmentLength", "0")); autoSegmenterSettings.Add(new XAttribute("maxSegmentLength", "0")); autoSegmenterSettings.Add(new XAttribute("preferrerdPauseLength", "0")); autoSegmenterSettings.Add(new XAttribute("optimumLengthClampingFactor", "0")); } // metadata for archiving project.Add(new XElement("Title", Title.NullTrim())); project.Add(new XElement("FundingProjectTitle", FundingProjectTitle.NullTrim())); project.Add(new XElement("ProjectDescription", ProjectDescription.NullTrim())); project.Add(new XElement("VernacularISO3CodeAndName", VernacularISO3CodeAndName.NullTrim())); project.Add(new XElement("Location", Location.NullTrim())); project.Add(new XElement("Region", Region.NullTrim())); project.Add(new XElement("Country", Country.NullTrim() ?? "Unspecified")); project.Add(new XElement("Continent", Continent.NullTrim() ?? "Unspecified")); project.Add(new XElement("ContactPerson", ContactPerson.NullTrim())); project.Add(new XElement("AccessProtocol", AccessProtocol.NullTrim())); project.Add(new XElement("DateAvailable", DateAvailable.NullTrim())); project.Add(new XElement("RightsHolder", RightsHolder.NullTrim())); project.Add(new XElement("Depositor", Depositor.NullTrim())); project.Add(new XElement("IMDIOutputDirectory", IMDIOutputDirectory.NullTrim())); int retryCount = 1; Exception error; do { try { error = null; project.Save(SettingsFilePath); break; } catch (Exception e) { error = e; if (retryCount-- == 0) { break; } Thread.Sleep(250); } } while (true); if (error != null) { ErrorReport.NotifyUserOfProblem(error, LocalizationManager.GetString("MainWindow.ProblemSavingSayMoreProject", "There was a problem saving the SayMore project:\r\n\r\n{0}"), SettingsFilePath); } if (_accessProtocolChanged) { foreach (var editor in Program.GetControlsOfType <SessionBasicEditor>(Program.ProjectWindow)) { editor.SetAccessProtocol(); } _accessProtocolChanged = false; } }
/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param> /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param> /// <param name="formatProvider">not used by this TypeConverter.</param> /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param> /// <returns> /// an instance of <see cref="AccessProtocol" />, or <c>null</c> if there is no suitable conversion. /// </returns> public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AccessProtocol.CreateFrom(sourceValue);