Beispiel #1
0
        private void _importButton_Click(object sender, EventArgs e)
        {
            CheckNeedToSaveChanges();
            if (!SelectedPlugin.IsConfigured())
            {
                MessageBox.Show("Please complete the plugin configuration of the selected plugin first.", "Incompletely configured plugin", MessageBoxButtons.OK);
                return;
            }

            SetFormMode(FormMode.Importing);
            DisableAllButtons();
            try
            {
                _importProgressBar.Value = 0;
                _feedBackLabel.Text      = String.Empty;
                _hoster.Import(SelectedPlugin.Name, ProgressUpdate, FeedbackUpdate);
            }
            catch (Exception ex)
            {
                ShowException(ex, "Import error");
            }
            finally
            {
                Thread.Sleep(500);
                SetFormMode(FormMode.Normal);
                DoButtonEnabling();
            }
        }
Beispiel #2
0
        private void DoButtonEnabling()
        {
            bool hasAvailableChannels        = _availableChannelsListBox.Items.Count > 0;
            bool hasAvailableChannelSelected = hasAvailableChannels && _availableChannelsListBox.SelectedIndices.Count > 0;
            bool hasChannelsToSkip           = _channelsToSkipListBox.Items.Count > 0;
            bool hasChannelsToSkipSelected   = hasChannelsToSkip && _channelsToSkipListBox.SelectedItems.Count > 0;
            bool hasSelectedPlugin           = SelectedPlugin != null;
            bool hasConfiguredPlugin         = SelectedPlugin != null && SelectedPlugin.IsConfigured();

            _addChannelButton.Enabled       = hasAvailableChannelSelected;
            _removeChannelButton.Enabled    = hasChannelsToSkipSelected;
            _addAllChannelButton.Enabled    = hasAvailableChannels;
            _removeAllChannelButton.Enabled = hasChannelsToSkip;
            _importButton.Enabled           = hasSelectedPlugin && hasAvailableChannels;
            _configureButton.Enabled        = hasSelectedPlugin;
            _refreshButton.Enabled          = hasConfiguredPlugin;
            _saveButton.Enabled             = _needToSaveChanges;
        }
Beispiel #3
0
        private void FillChannelListBoxes(bool forceChannelsReload)
        {
            _availableChannelsListBox.Items.Clear();
            _channelsToSkipListBox.Items.Clear();

            if (_pluginComboBox.SelectedIndex >= 0)
            {
                if (SelectedPlugin != null && SelectedPlugin.IsConfigured())
                {
                    try
                    {
                        List <ImportGuideChannel> guideChannels = SelectedPlugin.GetAllImportChannels(forceChannelsReload, ProgressUpdate, FeedbackUpdate);
                        foreach (ImportGuideChannel guideChannel in guideChannels)
                        {
                            if (!SelectedPluginSetting.ChannelsToSkip.Contains(guideChannel))
                            {
                                _availableChannelsListBox.Items.Add(guideChannel);
                            }
                            else
                            {
                                // if the ChannelName format was changed, make sure that ChannelNames in ChannelsToSkip reflect this change
                                ImportGuideChannel importGuideChannel = SelectedPluginSetting.ChannelsToSkip.Find(a => a.ExternalId == guideChannel.ExternalId);
                                if (importGuideChannel != null && !importGuideChannel.ChannelName.Equals(guideChannel.ChannelName))
                                {
                                    importGuideChannel.ChannelName = guideChannel.ChannelName;
                                    _needToSaveChanges             = true;
                                }
                            }
                        }

                        foreach (ImportGuideChannel channel in SelectedPluginSetting.ChannelsToSkip)
                        {
                            _channelsToSkipListBox.Items.Add(channel);
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowException(ex, "Import error");
                    }
                }
            }
        }
Beispiel #4
0
 private void _refreshButton_Click(object sender, EventArgs e)
 {
     if (!SelectedPlugin.IsConfigured())
     {
         MessageBox.Show("Please complete the plugin configuration of the selected plugin first.", "Incompletely configured plugin", MessageBoxButtons.OK);
         return;
     }
     SetFormMode(FormMode.RefreshingChannels);
     DisableAllButtons();
     try
     {
         _needToSaveChanges = false;
         FillChannelListBoxes(true);
     }
     catch (Exception ex)
     {
         ShowException(ex, "Error refreshing channels");
     }
     finally
     {
         SetFormMode(FormMode.Normal);
         DoButtonEnabling();
     }
 }