Gets or sets a character string that represents the name of the profile.
Syntax
Visual Basic (Declaration) | |
---|
Public Property Name As String |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As WMProfile
Dim value As String
instance.Name = value
value = instance.Name |
C# | |
---|
public string Name {get; set;} |
Property Value
A character string that represents the name of the profile.
Example
Visual Basic | Copy Code |
---|
Public _result As Boolean = False
Public _form As ConvertCtrlForm = New ConvertCtrlForm()
Public _subform As TestCtrlSubForm = New TestCtrlSubForm()
' this demo for enumerates system profiles and displays profile info
Public Sub SaveProfileExample()
Dim convertctrl As ConvertCtrl = _form.ConvertCtrl
Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_Source.avi")
Try
' create the profile manager
Dim manager As WMProfileManager = New WMProfileManager()
' build a list of system profiles
BuildSystemProfileList(_subform.List)
' show the dialog
_subform.ShowDialog(_form)
Dim idx As Integer = _subform.List.SelectedIndex
' load the selected profile
Dim profile As WMProfile = LoadSystemProfile(manager, idx)
' convert to string
Dim sprof As String = ProfileToString(manager, profile)
' display the string
If profile.Version = WMT_Version.V8 Then
MessageBox.Show("Profile " & profile.Name & " Content: " & sprof & "This profile contains " & profile.StreamCount.ToString() & " streams and " & profile.MutualExclusionCount.ToString() & " mutex")
End If
' convert string to profile
profile = ProfileFromString(manager, sprof)
' dispose the manager
manager.Dispose()
' set the result
_result = True
Catch e1 As Exception
_result = False
End Try
' we'll loop on the state and pump messages for this example.
' but you should not need to if running from a Windows Forms application.
Do While convertctrl.State = ConvertState.Running
Application.DoEvents()
Loop
End Sub
Private Sub BuildSystemProfileList(ByVal lbSysProfiles As ListBox)
' create the profile manager
Dim manager As WMProfileManager = New WMProfileManager()
Dim profile As WMProfile
' set the version to show Windows Media 8.0 system profiles
manager.SystemProfileVersion = WMT_Version.V8
' walk the list of system profiles and add the name to the combo box
lbSysProfiles.Items.Clear()
' enumerate the system profiles
Dim i As Integer = 0
Do While i < manager.SystemProfileCount - 1
profile = manager.LoadSystemProfile(i)
lbSysProfiles.Items.Add(profile.Name)
i += 1
Loop
End Sub
Private Function LoadSystemProfile(ByVal manager As WMProfileManager, ByVal idx As Integer) As WMProfile
' set the version to load Windows Media 8.0 system profiles
manager.SystemProfileVersion = WMT_Version.V8
' load the the specified profile
Return manager.LoadSystemProfile(idx)
End Function
Private Function ProfileToString(ByVal manager As WMProfileManager, ByVal profile As WMProfile) As String
' convert the profile to string
Return manager.SaveProfile(profile)
End Function
Private Function ProfileFromString(ByVal manager As WMProfileManager, ByVal profilestr As String) As WMProfile
' load profile from string data
Return manager.LoadProfileByData(profilestr)
End Function
Public NotInheritable Class LEAD_VARS
Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\Media"
End Class |
C# | Copy Code |
---|
public bool _result = false;
public ConvertCtrlForm _form = new ConvertCtrlForm();
public TestCtrlSubForm _subform = new TestCtrlSubForm();
// this demo for enumerates system profiles and displays profile info
public void SaveProfileExample()
{
ConvertCtrl convertctrl = _form.ConvertCtrl;
string inFile = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_Source.avi");
try
{
// create the profile manager
WMProfileManager manager = new WMProfileManager();
// build a list of system profiles
BuildSystemProfileList(_subform.List);
// show the dialog
_subform.ShowDialog(_form);
int idx = _subform.List.SelectedIndex;
// load the selected profile
WMProfile profile = LoadSystemProfile(manager, idx);
// convert to string
string sprof = ProfileToString(manager, profile);
// display the string
if (profile.Version == WMT_Version.V8)
{
MessageBox.Show( "Profile " + profile.Name + " Content: " + sprof + "This profile contains " + profile.StreamCount.ToString() + " streams and " + profile.MutualExclusionCount.ToString() + " mutex");
}
// convert string to profile
profile = ProfileFromString(manager, sprof);
// dispose the manager
manager.Dispose();
// set the result
_result = true;
}
catch (Exception)
{
_result = false;
}
// we'll loop on the state and pump messages for this example.
// but you should not need to if running from a Windows Forms application.
while (convertctrl.State == ConvertState.Running)
Application.DoEvents();
}
private void BuildSystemProfileList(ListBox lbSysProfiles)
{
// create the profile manager
WMProfileManager manager = new WMProfileManager();
WMProfile profile;
// set the version to show Windows Media 8.0 system profiles
manager.SystemProfileVersion = WMT_Version.V8;
// walk the list of system profiles and add the name to the combo box
lbSysProfiles.Items.Clear();
// enumerate the system profiles
for (int i = 0; i < manager.SystemProfileCount - 1; i++)
{
profile = manager.LoadSystemProfile(i);
lbSysProfiles.Items.Add(profile.Name);
}
}
private WMProfile LoadSystemProfile(WMProfileManager manager, int idx)
{
// set the version to load Windows Media 8.0 system profiles
manager.SystemProfileVersion = WMT_Version.V8;
// load the the specified profile
return manager.LoadSystemProfile(idx);
}
private string ProfileToString(WMProfileManager manager, WMProfile profile)
{
// convert the profile to string
return manager.SaveProfile(profile);
}
private WMProfile ProfileFromString(WMProfileManager manager, string profilestr)
{
// load profile from string data
return manager.LoadProfileByData(profilestr);
}
static class LEAD_VARS
{
public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\Media";
} |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7
See Also