Exemplo n.º 1
0
        private async void FormViewer_Shown(object sender, EventArgs e)
        {
            ToolStripMenuItem defaultDevice = null;

            foreach (var item in Program.GetDevices())
            {
                var _item = new ToolStripMenuItem(item.Value)
                {
                    Tag = item.Key
                };
                _item.Click += Item_Click;
                _item.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.videocam, 48, toolStripMenu.BackColor);
                toolStripButtonDevices.DropDownItems.Add(_item);

                if (Properties.Settings.Default.AutoStart && item.Key == Properties.Settings.Default.DefaultDevice)
                {
                    defaultDevice = _item;
                }
            }

            labelPreview.Visible = defaultDevice == null;

            if (defaultDevice != null)
            {
                defaultDevice.PerformClick();
            }

            if (Properties.Settings.Default.CheckForUpdates)
            {
                await GitHubInfo.CheckForUpdateAsync();
            }
        }