public void ShowSettings()
        {
            DebugHelper.AssertUIThread();

            if (this.viewSettings != null)
            {
                HashSet <KStudioEventStreamIdentifier> availableStreamIds = null;

                if (this.availableStreamsGetter != null)
                {
                    switch (this.eventType)
                    {
                    case EventType.Monitor:
                        availableStreamIds = this.availableStreamsGetter.GetAvailableMonitorStreams();
                        break;

                    case EventType.Inspection:
                        availableStreamIds = this.availableStreamsGetter.GetAvailableComboStreams();
                        break;
                    }
                }

                ObservableCollection <PluginViewState> pluginViewStatesCopy = new ObservableCollection <PluginViewState>();

                foreach (PluginViewState pluginViewState in this.pluginViewStates)
                {
                    PluginViewState     pluginViewStateCopy    = new PluginViewState(pluginViewState);
                    IPluginViewSettings pluginViewSettingsCopy = pluginViewStateCopy.PluginViewSettings;

                    if (pluginViewSettingsCopy != null)
                    {
                        pluginViewStatesCopy.Add(pluginViewStateCopy);

                        pluginViewSettingsCopy.CheckRequirementsSatisfied(availableStreamIds);
                    }
                }

                string viewTitle = this.Title;

                using (RenderViewSettings settings = new RenderViewSettings(viewTitle, pluginViewStatesCopy))
                {
                    RenderViewSettingsDialog settingsDialog = new RenderViewSettingsDialog()
                    {
                        DataContext = settings,
                        Owner       = Window.GetWindow(this),
                        Title       = this.SettingsTitle,
                    };

                    XElement viewSettingsElement = viewSettings.ViewSettingsElement;
                    settingsDialog.Width  = settingsDialog.Width = XmlExtensions.GetAttribute(viewSettingsElement, "editWidth", settingsDialog.Width);
                    settingsDialog.Height = settingsDialog.Height = XmlExtensions.GetAttribute(viewSettingsElement, "editHeight", settingsDialog.Height);

                    settingsDialog.ShowDialog();

                    if (settingsDialog.DialogResult == true)
                    {
                        int order = 0;

                        foreach (PluginViewState pluginViewState in pluginViewStatesCopy)
                        {
                            XElement pluginViewElement = new XElement("plugin");

                            if (pluginViewState.PluginViewSettings != null)
                            {
                                XElement pluginViewDataElement = new XElement("data");
                                pluginViewState.PluginViewSettings.WriteTo(pluginViewDataElement);
                                pluginViewElement.Add(pluginViewDataElement);
                            }

                            pluginViewState.Order = order;

                            pluginViewElement.SetAttributeValue("enabled", pluginViewState.IsEnabled.ToString(CultureInfo.InvariantCulture));
                            pluginViewElement.SetAttributeValue("order", pluginViewState.Order.ToString(CultureInfo.InvariantCulture));

                            viewSettings.SetPluginViewSettings(pluginViewState.Plugin.Id, pluginViewElement);
                            ++order;
                        }

                        if (viewSettingsElement != null)
                        {
                            viewSettingsElement.SetAttributeValue("editWidth", settingsDialog.ActualWidth.ToString(CultureInfo.InvariantCulture));
                            viewSettingsElement.SetAttributeValue("editHeight", settingsDialog.ActualHeight.ToString(CultureInfo.InvariantCulture));
                        }

                        this.pluginViewStates.Clear();
                        this.pluginViewStates.AddRange(pluginViewStatesCopy);

                        this.OnSettingsChanged();
                    }
                }
            }
        }
        public void ShowSettings()
        {
            DebugHelper.AssertUIThread();

            if (this.viewSettings != null)
            {
                HashSet<KStudioEventStreamIdentifier> availableStreamIds = null;

                if (this.availableStreamsGetter != null)
                {
                    switch (this.eventType)
                    {
                        case EventType.Monitor:
                            availableStreamIds = this.availableStreamsGetter.GetAvailableMonitorStreams();
                            break;

                        case EventType.Inspection:
                            availableStreamIds = this.availableStreamsGetter.GetAvailableComboStreams();
                            break;
                    }
                }

                ObservableCollection<PluginViewState> pluginViewStatesCopy = new ObservableCollection<PluginViewState>();

                foreach (PluginViewState pluginViewState in this.pluginViewStates)
                {
                    PluginViewState pluginViewStateCopy = new PluginViewState(pluginViewState);
                    IPluginViewSettings pluginViewSettingsCopy = pluginViewStateCopy.PluginViewSettings;

                    if (pluginViewSettingsCopy != null)
                    {
                        pluginViewStatesCopy.Add(pluginViewStateCopy);

                        pluginViewSettingsCopy.CheckRequirementsSatisfied(availableStreamIds);
                    }
                }

                string viewTitle = this.Title;

                using (RenderViewSettings settings = new RenderViewSettings(viewTitle, pluginViewStatesCopy))
                {
                    RenderViewSettingsDialog settingsDialog = new RenderViewSettingsDialog()
                        {
                            DataContext = settings,
                            Owner = Window.GetWindow(this),
                            Title = this.SettingsTitle,
                        };

                    XElement viewSettingsElement = viewSettings.ViewSettingsElement;
                    settingsDialog.Width = settingsDialog.Width = XmlExtensions.GetAttribute(viewSettingsElement, "editWidth", settingsDialog.Width);
                    settingsDialog.Height = settingsDialog.Height = XmlExtensions.GetAttribute(viewSettingsElement, "editHeight", settingsDialog.Height);

                    settingsDialog.ShowDialog();

                    if (settingsDialog.DialogResult == true)
                    {
                        int order = 0;

                        foreach (PluginViewState pluginViewState in pluginViewStatesCopy)
                        {
                            XElement pluginViewElement = new XElement("plugin");

                            if (pluginViewState.PluginViewSettings != null)
                            {
                                XElement pluginViewDataElement = new XElement("data");
                                pluginViewState.PluginViewSettings.WriteTo(pluginViewDataElement);
                                pluginViewElement.Add(pluginViewDataElement);
                            }

                            pluginViewState.Order = order;

                            pluginViewElement.SetAttributeValue("enabled", pluginViewState.IsEnabled.ToString(CultureInfo.InvariantCulture));
                            pluginViewElement.SetAttributeValue("order", pluginViewState.Order.ToString(CultureInfo.InvariantCulture));

                            viewSettings.SetPluginViewSettings(pluginViewState.Plugin.Id, pluginViewElement);
                            ++order;
                        }

                        if (viewSettingsElement != null)
                        {
                            viewSettingsElement.SetAttributeValue("editWidth", settingsDialog.ActualWidth.ToString(CultureInfo.InvariantCulture));
                            viewSettingsElement.SetAttributeValue("editHeight", settingsDialog.ActualHeight.ToString(CultureInfo.InvariantCulture));
                        }

                        this.pluginViewStates.Clear();
                        this.pluginViewStates.AddRange(pluginViewStatesCopy);

                        this.OnSettingsChanged();
                    }
                }
            }
        }