How can I select in the code for an earlier event and do without selecting an event in the event list?From this video:https://www.youtube.com/watch?v=4Glx88DsWWs&list=PL6KbBiYxpwh0kEIDkHjXehevYEZNRR4WK&index=8

Hello ! I made this example, now I

I would like to redo it a bit so as not to select an event (without selecting an event), that is, write in the code for what is then “Event”.

video 1:46 :https://www.youtube.com/watch?v=4Glx88DsWWs&list=PL6KbBiYxpwh0kEIDkHjXehevYEZNRR4WK&index=8

Part of the code:

private void button1\_Click(object sender, EventArgs e)

{

  ItemPickerForm picker = new ItemPickerForm();

  picker.KindFilter = Kind.TriggerEvent;

  picker.Init(Configuration.Instance.GetItems());

  if (picker.ShowDialog() == DialogResult.OK)

  {

    \_selectedItem = picker.SelectedItem;

    label2.Text = \_selectedItem.Name;

    button2.Enabled = true;

  }

 }

Your code snippet work fine for me in finding the user-defined events I have configured in the Management Client.

Maybe you do not want to use the picker (UI component)?

If you already know the Guid (ObjectId) of the “event”..

_selectedItem = Configuration.Instance.GetItem(selectedItemGuid, Kind.TriggerEvent);

Hello, thanks for the answer, this example works fine for me too, but I want to ask earlier for what is “_selectedItem”. I have an event “Event1” in the “Management Client” previously configured, and I want to implement it through the code:

_selectedItem = Event1 to,

private void button2_Click(object sender, EventArgs e)

{

EnvironmentManager.Instance.PostMessage(newVideoOS.Platform.Messaging.Message(MessageId.Control.TriggerCommand), _selectedItem.FQID);

}

do without :

private void button1\_Click(object sender, EventArgs e)

{

  ItemPickerForm picker = new ItemPickerForm();

  picker.KindFilter = Kind.TriggerEvent;

  picker.Init(Configuration.Instance.GetItems());

  if (picker.ShowDialog() == DialogResult.OK)

  {

    \_selectedItem = picker.SelectedItem;

    label2.Text = \_selectedItem.Name;

     button2.Enabled = true;

  }

 }

If you do not have the id (Guid) you can use traverse the configuration, see the example (recursive) method FindCamera in the CameraStreamResolution sample.

Alternatively use the GetItemsBySearch method, let me show you a snippet on how to use this.-

string searchName = "test";
SearchResult searchResult = new SearchResult();
var list = Configuration.Instance.GetItemsBySearch(searchName, 30, 3, out searchResult);
if (searchResult == SearchResult.OK)
{
    foreach (var item in list)
    {
        if (item.FQID.Kind==Kind.TriggerEvent && item.Name == searchName)
        {
            _selectedItem = item;
        }
    }
}
if(_selectedItem!=null && _selectedItem.FQID!=null)
{
    MessageBox.Show(_selectedItem.Name+" "+ _selectedItem.FQID.ObjectId.ToString());
}

Thank you very much, you helped me a lot!