Determines whether the specified settings can be saved.
public virtual bool CanSaveObjectSettings(PlaySettings flags)
Public Overridable Function CanSaveObjectSettings( _ByVal flags As PlaySettings _) As Boolean
public:virtual bool CanSaveObjectSettings(PlaySettings flags)
flags
A combination of PlaySettings enumeration values.
true if the specified settings can be saved; otherwise, false if one or more of the specified settings cannot be saved.
Play object settings can be saved to a stream by calling SaveSettingsToStream. These settings can also be saved to a file by calling SaveSettingsToFile. Settings saved to a file can be loaded using LoadSettingsFromFile. Settings saved to a stream can be loaded using LoadSettingsFromStream. To make sure the settings you want to save can be saved, call CanSaveObjectSettings before calling either SaveSettingsToFile or SaveSettingsToStream. If either SaveSettingsToFile or SaveSettingsToStream is called for settings that cannot be saved, the save function will fail. Multiple settings can be combined in the Flags parameter. If multiple settings are combined in the flags parameter, all of the settings must be capable of being saved in order for this method to return true.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public PlayCtrlForm _form = new PlayCtrlForm();public PlayCtrl _playctrl;public string _streamSettings = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ObjectSettingsExample_Stream.xml");public string _fileSettings = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ObjectSettingsExample.xml");public void ObjectSettingsExample(){// reference the play control_playctrl = _form.PlayCtrl;// input filesstring inFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi");try{Processor pVideoDizzy = _playctrl.VideoProcessors.EFXDizzy;// set a video processor_playctrl.SelectedVideoProcessors.Add(pVideoDizzy);// save the settings to a fileif (SaveFileSettings()){// now clear the selected processors again_playctrl.SelectedVideoProcessors.Clear();// check whether a stream file existsif (File.Exists(_fileSettings)){// load the saved settings from a file// and check whether the processor is selected againLoadFileSettings();// set the result_result = _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy);}}// save the settings to a streamif (SaveStreamSettings()){// now clear the selected processors again_playctrl.SelectedVideoProcessors.Clear();// check whether a stream file existsif (File.Exists(_streamSettings)){// load the saved settings from a stream// and check whether the processor is selected againLoadStreamSettings();// set the result_result &= _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy);}}}catch (Exception){_result = false;}}private void LoadFileSettings(){_playctrl.LoadSettingsFromFile(_fileSettings, PlaySettings.Processors);}private bool SaveFileSettings(){// check whether we can save the processors settingsif (_playctrl.CanSaveObjectSettings(PlaySettings.Processors)){_playctrl.SaveSettingsToFile(_fileSettings, PlaySettings.Processors);return true;}return false;}private void LoadStreamSettings(){Stream settings = new StreamReader(_streamSettings).BaseStream;_playctrl.LoadSettingsFromStream(settings, PlaySettings.Processors);settings.Close();}private bool SaveStreamSettings(){// check whether we can save the processors settingsif (_playctrl.CanSaveObjectSettings(PlaySettings.Processors)){Stream settings = new StreamWriter(_streamSettings, false).BaseStream;_playctrl.SaveSettingsToStream(settings, PlaySettings.Processors);settings.Close();return true;}return false;}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _result As Boolean = FalsePublic _form As PlayCtrlForm = New PlayCtrlForm()Public _playctrl As PlayCtrlPublic _streamSettings As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ObjectSettingsExample_Stream.xml")Public _fileSettings As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ObjectSettingsExample.xml")Public Sub ObjectSettingsExample()' reference the play control_playctrl = _form.PlayCtrl' input filesDim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi")TryDim pVideoDizzy As Processor = _playctrl.VideoProcessors.EFXDizzy' set a video processor_playctrl.SelectedVideoProcessors.Add(pVideoDizzy)' save the settings to a fileIf SaveFileSettings() Then' now clear the selected processors again_playctrl.SelectedVideoProcessors.Clear()' check if stream file existsIf File.Exists(_fileSettings) Then' load the saved settings from a file' and check if the processor is selected againLoadFileSettings()' set the result_result = _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy)End IfEnd If' save the settings to a streamIf SaveStreamSettings() Then' now clear the selected processors again_playctrl.SelectedVideoProcessors.Clear()' check if stream file existsIf File.Exists(_streamSettings) Then' load the saved settings from a stream' and check if the processor is selected againLoadStreamSettings()' set the result_result = _result And _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy)End IfEnd IfCatch e1 As Exception_result = FalseEnd TryEnd SubPrivate Sub LoadFileSettings()_playctrl.LoadSettingsFromFile(_fileSettings, PlaySettings.Processors)End SubPrivate Function SaveFileSettings() As Boolean' check if we can save the processors settingsIf _playctrl.CanSaveObjectSettings(PlaySettings.Processors) Then_playctrl.SaveSettingsToFile(_fileSettings, PlaySettings.Processors)Return TrueEnd IfReturn FalseEnd FunctionPrivate Sub LoadStreamSettings()Dim settings As Stream = New StreamReader(_streamSettings).BaseStream_playctrl.LoadSettingsFromStream(settings, PlaySettings.Processors)settings.Close()End SubPrivate Function SaveStreamSettings() As Boolean' check if we can save the processors settingsIf _playctrl.CanSaveObjectSettings(PlaySettings.Processors) ThenDim settings As Stream = New StreamWriter(_streamSettings, False).BaseStream_playctrl.SaveSettingsToStream(settings, PlaySettings.Processors)settings.Close()Return TrueEnd IfReturn FalseEnd FunctionPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
