Determines whether the specified settings can be saved.
public virtual bool CanSaveObjectSettings(
Leadtools.Multimedia.PlaySettings flags
)
Public Overridable Function CanSaveObjectSettings( _
ByVal flags As Leadtools.Multimedia.PlaySettings _
) As Boolean
public:
virtual bool CanSaveObjectSettings(
Leadtools.Multimedia.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 files
string 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 file
if (SaveFileSettings())
{
// now clear the selected processors again
_playctrl.SelectedVideoProcessors.Clear();
// check whether a stream file exists
if (File.Exists(_fileSettings))
{
// load the saved settings from a file
// and check whether the processor is selected again
LoadFileSettings();
// set the result
_result = _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy);
}
}
// save the settings to a stream
if (SaveStreamSettings())
{
// now clear the selected processors again
_playctrl.SelectedVideoProcessors.Clear();
// check whether a stream file exists
if (File.Exists(_streamSettings))
{
// load the saved settings from a stream
// and check whether the processor is selected again
LoadStreamSettings();
// 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 settings
if (_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 settings
if (_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 19\Media";
}
Imports Leadtools
Imports Leadtools.Multimedia
Imports LeadtoolsMultimediaExamples.Fixtures
Public _result As Boolean = False
Public _form As PlayCtrlForm = New PlayCtrlForm()
Public _playctrl As PlayCtrl
Public _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 files
Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi")
Try
Dim pVideoDizzy As Processor = _playctrl.VideoProcessors.EFXDizzy
' set a video processor
_playctrl.SelectedVideoProcessors.Add(pVideoDizzy)
' save the settings to a file
If SaveFileSettings() Then
' now clear the selected processors again
_playctrl.SelectedVideoProcessors.Clear()
' check if stream file exists
If File.Exists(_fileSettings) Then
' load the saved settings from a file
' and check if the processor is selected again
LoadFileSettings()
' set the result
_result = _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy)
End If
End If
' save the settings to a stream
If SaveStreamSettings() Then
' now clear the selected processors again
_playctrl.SelectedVideoProcessors.Clear()
' check if stream file exists
If File.Exists(_streamSettings) Then
' load the saved settings from a stream
' and check if the processor is selected again
LoadStreamSettings()
' set the result
_result = _result And _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy)
End If
End If
Catch e1 As Exception
_result = False
End Try
End Sub
Private Sub LoadFileSettings()
_playctrl.LoadSettingsFromFile(_fileSettings, PlaySettings.Processors)
End Sub
Private Function SaveFileSettings() As Boolean
' check if we can save the processors settings
If _playctrl.CanSaveObjectSettings(PlaySettings.Processors) Then
_playctrl.SaveSettingsToFile(_fileSettings, PlaySettings.Processors)
Return True
End If
Return False
End Function
Private Sub LoadStreamSettings()
Dim settings As Stream = New StreamReader(_streamSettings).BaseStream
_playctrl.LoadSettingsFromStream(settings, PlaySettings.Processors)
settings.Close()
End Sub
Private Function SaveStreamSettings() As Boolean
' check if we can save the processors settings
If _playctrl.CanSaveObjectSettings(PlaySettings.Processors) Then
Dim settings As Stream = New StreamWriter(_streamSettings, False).BaseStream
_playctrl.SaveSettingsToStream(settings, PlaySettings.Processors)
settings.Close()
Return True
End If
Return False
End Function
Public NotInheritable Class LEAD_VARS
Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"
End Class
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 files
string 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 file
if (SaveFileSettings())
{
// now clear the selected processors again
_playctrl.SelectedVideoProcessors.Clear();
// check whether a stream file exists
if (File.Exists(_fileSettings))
{
// load the saved settings from a file
// and check whether the processor is selected again
LoadFileSettings();
// set the result
_result = _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy);
}
}
// save the settings to a stream
if (SaveStreamSettings())
{
// now clear the selected processors again
_playctrl.SelectedVideoProcessors.Clear();
// check whether a stream file exists
if (File.Exists(_streamSettings))
{
// load the saved settings from a stream
// and check whether the processor is selected again
LoadStreamSettings();
// 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 settings
if (_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 settings
if (_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 19\Media";
}
Imports Leadtools
Imports Leadtools.Multimedia
Imports LeadtoolsMultimediaExamples.Fixtures
Public _result As Boolean = False
Public _form As PlayCtrlForm = New PlayCtrlForm()
Public _playctrl As PlayCtrl
Public _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 files
Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi")
Try
Dim pVideoDizzy As Processor = _playctrl.VideoProcessors.EFXDizzy
' set a video processor
_playctrl.SelectedVideoProcessors.Add(pVideoDizzy)
' save the settings to a file
If SaveFileSettings() Then
' now clear the selected processors again
_playctrl.SelectedVideoProcessors.Clear()
' check if stream file exists
If File.Exists(_fileSettings) Then
' load the saved settings from a file
' and check if the processor is selected again
LoadFileSettings()
' set the result
_result = _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy)
End If
End If
' save the settings to a stream
If SaveStreamSettings() Then
' now clear the selected processors again
_playctrl.SelectedVideoProcessors.Clear()
' check if stream file exists
If File.Exists(_streamSettings) Then
' load the saved settings from a stream
' and check if the processor is selected again
LoadStreamSettings()
' set the result
_result = _result And _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy)
End If
End If
Catch e1 As Exception
_result = False
End Try
End Sub
Private Sub LoadFileSettings()
_playctrl.LoadSettingsFromFile(_fileSettings, PlaySettings.Processors)
End Sub
Private Function SaveFileSettings() As Boolean
' check if we can save the processors settings
If _playctrl.CanSaveObjectSettings(PlaySettings.Processors) Then
_playctrl.SaveSettingsToFile(_fileSettings, PlaySettings.Processors)
Return True
End If
Return False
End Function
Private Sub LoadStreamSettings()
Dim settings As Stream = New StreamReader(_streamSettings).BaseStream
_playctrl.LoadSettingsFromStream(settings, PlaySettings.Processors)
settings.Close()
End Sub
Private Function SaveStreamSettings() As Boolean
' check if we can save the processors settings
If _playctrl.CanSaveObjectSettings(PlaySettings.Processors) Then
Dim settings As Stream = New StreamWriter(_streamSettings, False).BaseStream
_playctrl.SaveSettingsToStream(settings, PlaySettings.Processors)
settings.Close()
Return True
End If
Return False
End Function
Public NotInheritable Class LEAD_VARS
Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"
End Class
Products |
Support |
Feedback: CanSaveObjectSettings Method (PlayCtrl) - Leadtools.Multimedia |
Introduction |
Help Version 19.0.2017.6.16
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.