Esempio n. 1
0
        private void bOk_Click(object sender, EventArgs e)
        {
            Screen = Screen ?? new PlayerScreen
            {
                Guid = Guid.NewGuid().ToString()
            };

            Screen.FriendlyName = Name = tbScreenName.Text;
            Screen.ScreenDevice = cbScreenDevice.SelectedItem as ScreenDevice;
            Screen.AudioDevice = cbAudioDevice.SelectedItem as AudioDevice;
            Screen.ColourName = tbColour.Text;
            Screen.DefaultScreen = cbDefault.Checked;

            DialogResult = DialogResult.OK;
            Close();
        }
Esempio n. 2
0
        public FNewScreenDialogue(PlayerScreen screen)
        {
            InitializeComponent();
            _audioDeviceService = new AudioDeviceService();
            _screenService = new ScreenService();

            if (screen != null)
            {
                Screen = screen;
                tbScreenName.Text = Screen.FriendlyName;
                tbColour.Text = Screen.ColourName;
                cbDefault.Checked = Screen.DefaultScreen;
                _selectedColour = ColorTranslator.FromHtml(screen.ColourName);
            }

            LoadComboBoxes();
        }
Esempio n. 3
0
        private void LoadScreens(PlayerScreen screen)
        {
            //For some reason, binding the combobox below to the items var didn't update the cb.items).
            //had to use a bindinglist and source. Strange.
            var items = _screenService.Get();
            var bindinglist = new BindingList<PlayerScreen>(items.ToList());
            var bSource = new BindingSource {DataSource = bindinglist};
            cbScreen.DataSource = bSource;
            cbScreen.DisplayMember = "FriendlyName";
            cbScreen.ValueMember = "Guid";

            if (cbScreen.Items.Count > 0)
            {
                foreach (var item in cbScreen.Items.Cast<PlayerScreen>())
                {
                    if (screen == null || item.FriendlyName == screen.FriendlyName)
                    {
                        cbScreen.SelectedItem = item;
                        break;
                    }
                }
            }
        }
Esempio n. 4
0
 public void Delete(PlayerScreen screen)
 {
     ScreenCache.Screens.Remove(screen);
 }
Esempio n. 5
0
 public void Insert(PlayerScreen screen)
 {
     ScreenCache.Screens.Add(screen);
 }
Esempio n. 6
0
 public void Update(PlayerScreen screen)
 {
     Delete(screen);
     Insert(screen);
 }