Beispiel #1
0
        private void ChangeSelectedFormat()
        {
            if (listViewFormats.SelectedItems.Count < 1)
            {
                return;                  // should never happen
            }
            ListViewItem selectedItem = listViewFormats.SelectedItems[0];
            LiveClipboardFormatHandler formatHandler = selectedItem.Tag as LiveClipboardFormatHandler;

            using (LiveClipboardChangeHandlerForm changeHandlerForm = new LiveClipboardChangeHandlerForm(formatHandler))
            {
                if (changeHandlerForm.ShowDialog(FindForm()) == DialogResult.OK)
                {
                    LiveClipboardFormatHandler newFormatHandler = changeHandlerForm.FormatHandler;
                    if (newFormatHandler != null)
                    {
                        LiveClipboardManager.SetContentSourceForFormat(newFormatHandler.Format, newFormatHandler.ContentSource.Id);
                        UpdateListViewItem(selectedItem, newFormatHandler);
                    }
                }
            }
        }
Beispiel #2
0
        public LiveClipboardChangeHandlerForm(LiveClipboardFormatHandler existingHandler)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.columnHeaderHandler.Text = Res.Get(StringId.ChangeLiveClipboardHandlerComponent);
            this.buttonOK.Text            = Res.Get(StringId.OKButtonText);
            this.buttonCancel.Text        = Res.Get(StringId.CancelButton);
            this.labelCaption.Text        = Res.Get(StringId.ChangeLiveClipboardHandlerCaption);
            this.Text = Res.Get(StringId.ChangeLiveClipboardHandlerTitle);

            // save and populate format info
            _targetFormat = existingHandler.Format;
            pictureBoxFormatIcon.Image = existingHandler.ContentSource.Image;
            labelFormatName.Text       = existingHandler.FormatName;
            labelContentType.Text      = existingHandler.FriendlyContentType;
            labelCaption.Text          = String.Format(CultureInfo.CurrentCulture, labelCaption.Text, existingHandler.FormatName);

            // populate the list with content sources that support this format
            ContentSourceInfo[] contentSources = LiveClipboardManager.GetContentSourcesForFormat(existingHandler.Format);
            Array.Sort(contentSources, new ContentSourceInfo.NameComparer());
            foreach (ContentSourceInfo contentSource in contentSources)
            {
                LiveClipboardComponentDisplay componentDisplay = new LiveClipboardComponentDisplay(contentSource);
                imageListComponents.Images.Add(componentDisplay.Icon);
                ListViewItem listViewItem = new ListViewItem();
                listViewItem.Tag        = contentSource;
                listViewItem.ImageIndex = imageListComponents.Images.Count - 1;
                listViewItem.Text       = " " + componentDisplay.Name;
                listViewComponents.Items.Add(listViewItem);
                if (contentSource.Equals(existingHandler.ContentSource))
                {
                    listViewItem.Selected = true;
                }
            }
        }
Beispiel #3
0
        private void UpdateDetailsPane()
        {
            LiveClipboardFormatHandler formatHandler = GetSelectedFormat();

            if (formatHandler != null)
            {
                panelFormatDetails.Visible    = true;
                labelNoFormatSelected.Visible = false;

                groupBoxFormatDetails.Text = String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.LCPrefDetailsGroupBoxFormat), formatHandler.FormatName);
                LiveClipboardComponentDisplay componentDisplay = new LiveClipboardComponentDisplay(formatHandler.ContentSource);
                pictureBoxContentSource.Image = componentDisplay.Icon;
                labelContentSourceName.Text   = componentDisplay.Name;
                labelContentType.Text         = formatHandler.FriendlyContentType;
                buttonChange.Enabled          = LiveClipboardManager.GetContentSourcesForFormat(formatHandler.Format).Length > 1;
                buttonOptions.Visible         = formatHandler.ContentSource.WriterPluginHasEditableOptions;
            }
            else
            {
                labelNoFormatSelected.Visible = true;
                groupBoxFormatDetails.Text    = Res.Get(StringId.LCPrefDetails);
                panelFormatDetails.Visible    = false;
            }
        }