Example #1
0
        private void AddItemButton_Click(object sender, EventArgs e)
        {
            var contextmenu = presentation.AddSourceContextMenu();

            contextmenu.ItemClicked += (o, args) =>
            {
                var tag    = (Tuple <string, string>)args.ClickedItem.Tag;
                var source = presentation.CreateSource(tag.Item1, tag.Item2);
                var item   = presentation.CreateItem(source);
                if (new TestProperties(source).ShowDialog() == DialogResult.OK)
                {
                    presentation.AddSource(source);

                    presentation.AddItem(item);

                    ItemListBox.SelectedIndex   = 0;
                    SourceListBox.SelectedIndex = 0;
                }
                else
                {
                    item.Remove();
                    item.Dispose();
                    source.Remove();
                    source.Dispose();
                }
            };
            contextmenu.Show(this, PointToClient(Cursor.Position));
        }
Example #2
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            if (Environment.Is64BitProcess)
            {
                Text += " (64-bit)";
            }
            else
            {
                Text += " (32-bit)";
            }

            presentation = new Presentation();

            // Bindings
            // Scene
            SceneListBox.DisplayMember = "Name";
            SceneListBox.ValueMember   = "Items";
            SceneListBox.DataSource    = presentation.Scenes;

            // Item
            ItemListBox.DisplayMember = "Name";

            // Source
            SourceListBox.DisplayMember = "Name";
            SourceListBox.DataSource    = presentation.Sources;


            presentation.AddScene();

            ItemListBox.DataSource = SceneListBox.SelectedValue;

            var source = presentation.CreateSource("random", "some random source");

            presentation.AddSource(source);
            var item = presentation.CreateItem(source);

            presentation.AddItem(item);

            presentation.SetScene(SceneListBox.SelectedIndex);
            presentation.SetItem(ItemListBox.SelectedIndex);
            presentation.SetSource(SourceListBox.SelectedIndex);

            HideItemCheckBox.DataBindings.Add(
                new Binding("Checked", presentation.SelectedItem, "Visible", false, DataSourceUpdateMode.OnPropertyChanged));

            EnableSourceCheckBox.DataBindings.Add(
                new Binding("Checked", presentation.SelectedSource, "Enabled", false, DataSourceUpdateMode.OnPropertyChanged));

            MuteSourceCheckBox.DataBindings.Add(
                new Binding("Checked", presentation.SelectedSource, "Muted", false, DataSourceUpdateMode.OnPropertyChanged));


            // setup scene preview panel
            previewPanel      = new PreviewPanel();
            previewPanel.Dock = DockStyle.Fill;

            topPanel.Controls.Add(previewPanel);
            previewPanel.Show();

            previewPanel.SetScene(presentation.SelectedScene);
        }