private void buttonDeleteController_Click(object sender, EventArgs e) { string message, title; if (listViewControllers.SelectedItems.Count > 1) { message = "Are you sure you want to delete the selected previews?"; title = "Delete previews?"; } else { message = "Are you sure you want to delete the selected preview?"; title = "Delete preview?"; } if (listViewControllers.SelectedItems.Count > 0) { if (MessageBox.Show(message, title, MessageBoxButtons.OKCancel) == DialogResult.OK) { foreach (ListViewItem item in listViewControllers.SelectedItems) { OutputPreview oc = item.Tag as OutputPreview; VixenSystem.Previews.Remove(oc); } _PopulateControllerList(); _changesMade = true; } } }
private void buttonAddController_Click(object sender, EventArgs e) { List <KeyValuePair <string, object> > outputModules = new List <KeyValuePair <string, object> >(); var availableModules = ApplicationServices.GetAvailableModules <IPreviewModuleInstance>(); foreach (KeyValuePair <Guid, string> kvp in availableModules) { outputModules.Add(new KeyValuePair <string, object>(kvp.Value, kvp.Key)); } Common.Controls.ListSelectDialog addForm = new Common.Controls.ListSelectDialog("Add Preview", (outputModules)); if (addForm.ShowDialog() == DialogResult.OK) { IModuleDescriptor moduleDescriptor = ApplicationServices.GetModuleDescriptor((Guid)addForm.SelectedItem); string name = moduleDescriptor.TypeName; PreviewFactory previewFactory = new PreviewFactory(); OutputPreview preview = (OutputPreview)previewFactory.CreateDevice((Guid)addForm.SelectedItem, name); VixenSystem.Previews.Add(preview); // In the case of a controller that has a form, the form will not be shown // until this event handler completes. To make sure it's in a visible state // before evaluating if it's running or not, we're calling DoEvents. // I hate DoEvents calls, so if you know of a better way... Application.DoEvents(); // select the new controller, and then repopulate the list -- it will make sure the currently // displayed controller is selected. _PopulateFormWithController(preview); _PopulateControllerList(); _changesMade = true; Refresh(); } }
private void _PopulateFormWithController(OutputPreview oc) { _displayedController = oc; if (oc == null) { textBoxName.Text = string.Empty; buttonDeleteController.Enabled = false; textBoxName.Enabled = false; buttonUpdate.Enabled = false; buttonUpdate.ForeColor = ThemeColorTable.ForeColorDisabled; buttonConfigureController.Enabled = false; buttonDeleteController.ForeColor = ThemeColorTable.ForeColorDisabled; buttonConfigureController.ForeColor = ThemeColorTable.ForeColorDisabled; label1.ForeColor = ThemeColorTable.ForeColorDisabled; label2.ForeColor = ThemeColorTable.ForeColorDisabled; } else { textBoxName.Text = oc.Name; buttonDeleteController.Enabled = true; textBoxName.Enabled = true; buttonUpdate.Enabled = true; buttonUpdate.ForeColor = ThemeColorTable.ForeColor; buttonConfigureController.Enabled = true; buttonDeleteController.ForeColor = ThemeColorTable.ForeColor; buttonConfigureController.ForeColor = ThemeColorTable.ForeColor; label1.ForeColor = ThemeColorTable.ForeColor; label2.ForeColor = ThemeColorTable.ForeColor; } }
private void buttonDuplicateSelected_Click(object sender, EventArgs e) { if (listViewControllers.SelectedItems.Count > 0) { foreach (ListViewItem item in listViewControllers.SelectedItems) { OutputPreview op = item.Tag as OutputPreview; PreviewFactory previewFactory = new PreviewFactory(); OutputPreview preview = (OutputPreview)previewFactory.CreateDevice(op.ModuleId, op.Name + "-copy"); if (preview.PreviewModule is IPreviewModuleInstance newInstance) { if (op.PreviewModule is IPreviewModuleInstance origInstance) { var md = origInstance.ModuleData.Clone(); //The new module will have it's own instance data. If we want to replace it we need to replace it in the //ModuleStore as well so it will be saved. So remove it and then assign it and then update it in the store md.ModuleDataSet.RemoveModuleInstanceData(newInstance); newInstance.ModuleData = md; md.ModuleDataSet.AssignModuleInstanceData(newInstance); } } VixenSystem.Previews.Add(preview); _PopulateFormWithController(preview); } _PopulateControllerList(); _changesMade = true; Refresh(); } }
private async void listViewControllers_ItemCheck(object sender, ItemCheckEventArgs e) { OutputPreview preview = (listViewControllers.Items[e.Index].Tag as OutputPreview); if (e.NewValue == CheckState.Unchecked) { if (preview != null && preview.IsRunning) { VixenSystem.Previews.Stop(preview); } } else if (e.NewValue == CheckState.Checked) { if (preview != null && !preview.IsRunning) { VixenSystem.Previews.Start(preview); //A bit of a kludge, but need a bit of delay to give the preview a chance to load //before we force ourselves back on top. await Task.Delay(250); TopMost = true; TopMost = false; } } }
public IOutputDevice ReadObject(XElement element) { string name = XmlHelper.GetAttribute(element, ATTR_NAME); if (name == null) { return(null); } Guid?typeId = XmlHelper.GetGuidAttribute(element, ATTR_TYPE_ID); if (typeId == null) { return(null); } Guid?instanceId = XmlHelper.GetGuidAttribute(element, ATTR_INSTANCE_ID); if (instanceId == null) { return(null); } PreviewFactory previewFactory = new PreviewFactory(); OutputPreview preview = (OutputPreview)previewFactory.CreateDevice(typeId.Value, instanceId.Value, name); _Populate(preview, element); return(preview); }
public IOutputDevice ReadObject(XElement element) { try { string name = XmlHelper.GetAttribute(element, ATTR_NAME); if (name == null) { return(null); } Guid?typeId = XmlHelper.GetGuidAttribute(element, ATTR_TYPE_ID); if (typeId == null) { return(null); } Guid?instanceId = XmlHelper.GetGuidAttribute(element, ATTR_INSTANCE_ID); if (instanceId == null) { return(null); } PreviewFactory previewFactory = new PreviewFactory(); OutputPreview preview = (OutputPreview)previewFactory.CreateDevice(typeId.Value, instanceId.Value, name); _Populate(preview, element); return(preview); } catch (Exception e) { logging.Error("Error loading Preview from XML", e); return(null); } }
private void buttonDeleteController_Click(object sender, EventArgs e) { string message, title; if (listViewControllers.SelectedItems.Count > 1) { message = "Are you sure you want to delete the selected previews?"; title = "Delete previews?"; } else { message = "Are you sure you want to delete the selected preview?"; title = "Delete preview?"; } if (listViewControllers.SelectedItems.Count > 0) { //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible) MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form. var messageBox = new MessageBoxForm(message, title, false, true); messageBox.ShowDialog(); if (messageBox.DialogResult == DialogResult.OK) { foreach (ListViewItem item in listViewControllers.SelectedItems) { OutputPreview oc = item.Tag as OutputPreview; VixenSystem.Previews.Remove(oc); } _PopulateControllerList(); _changesMade = true; } } }
public ConfigPreviews() { InitializeComponent(); Icon = Resources.Icon_Vixen3; ThemeUpdateControls.UpdateControls(this); this.ShowInTaskbar = false; _displayedController = null; buttonDeleteController.Enabled = buttonDuplicateSelected.Enabled = false; }
public ConfigPreviews() { InitializeComponent(); Icon = Resources.Icon_Vixen3; ForeColor = ThemeColorTable.ForeColor; BackColor = ThemeColorTable.BackgroundColor; ThemeUpdateControls.UpdateControls(this); this.ShowInTaskbar = false; _displayedController = null; }
public XElement WriteObject(IOutputDevice value) { OutputPreview preview = (OutputPreview)value; XElement element = new XElement(ELEMENT_PREVIEW, new XAttribute(ATTR_NAME, preview.Name), new XAttribute(ATTR_TYPE_ID, preview.ModuleId), new XAttribute(ATTR_INSTANCE_ID, preview.ModuleInstanceId)); return(element); }
private void _PopulateFormWithController(OutputPreview oc) { _displayedController = oc; if (oc == null) { textBoxName.Text = string.Empty; buttonDeleteController.Enabled = false; groupBoxSelectedController.Enabled = false; } else { textBoxName.Text = oc.Name; buttonDeleteController.Enabled = true; groupBoxSelectedController.Enabled = true; } }
private void _PopulateFormWithController(OutputPreview oc) { _displayedController = oc; if (oc == null) { textBoxName.Text = string.Empty; textBoxName.Enabled = false; buttonUpdate.Enabled = false; buttonConfigureController.Enabled = label1.Enabled = label2.Enabled = false; } else { textBoxName.Text = oc.Name; textBoxName.Enabled = true; buttonUpdate.Enabled = true; buttonConfigureController.Enabled = label1.Enabled = label2.Enabled = true; } }
private void listViewControllers_ItemCheck(object sender, ItemCheckEventArgs e) { OutputPreview preview = (listViewControllers.Items[e.Index].Tag as OutputPreview); if (e.NewValue == CheckState.Unchecked) { if (preview != null && preview.IsRunning) { VixenSystem.Previews.Stop(preview); } } else if (e.NewValue == CheckState.Checked) { if (preview != null && !preview.IsRunning) { VixenSystem.Previews.Start(preview); } } }
private void _Populate(OutputPreview preview, XElement element) { //XmlModuleLocalDataSetSerializer dataSetSerializer = new XmlModuleLocalDataSetSerializer(); //preview.ModuleDataSet = dataSetSerializer.ReadObject(element); }
public ConfigPreviews() { InitializeComponent(); Icon = Resources.Icon_Vixen3; _displayedController = null; }
public ConfigPreviews() { InitializeComponent(); _displayedController = null; }