Example #1
0
        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();
            }
        }
Example #2
0
        private void buttonAddController_Click(object sender, EventArgs e)
        {
            List<KeyValuePair<string, object>> outputModules = new List<KeyValuePair<string, object>>();
            foreach (KeyValuePair<Guid, string> kvp in ApplicationServices.GetAvailableModules<IControllerModuleInstance>()) {
                outputModules.Add(new KeyValuePair<string, object>(kvp.Value, kvp.Key));
            }
            Common.Controls.ListSelectDialog addForm = new Common.Controls.ListSelectDialog("Add Controller", (outputModules));
            if (addForm.ShowDialog() == DialogResult.OK) {
                IModuleDescriptor moduleDescriptor = ApplicationServices.GetModuleDescriptor((Guid) addForm.SelectedItem);
                string name = moduleDescriptor.TypeName;
                ControllerFactory controllerFactory = new ControllerFactory();
                OutputController oc = (OutputController) controllerFactory.CreateDevice((Guid) addForm.SelectedItem, name);
                VixenSystem.OutputControllers.Add(oc);
                // 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(oc);
                _PopulateControllerList();

                //We added a controller so set the _changesMade to true
                _changesMade = true;
            }
        }
Example #3
0
        private void buttonAddProperty_Click(object sender, EventArgs e)
        {
            List<KeyValuePair<string, object>> properties = new List<KeyValuePair<string, object>>();
            foreach (KeyValuePair<Guid, string> kvp in ApplicationServices.GetAvailableModules<IPropertyModuleInstance>()) {
                properties.Add(new KeyValuePair<string, object>(kvp.Value, kvp.Key));
            }
            using (ListSelectDialog addForm = new ListSelectDialog("Add Property", (properties))) {
                addForm.SelectionMode = SelectionMode.MultiExtended;
                if (addForm.ShowDialog() == DialogResult.OK) {
                    foreach(KeyValuePair<string,object> item in addForm.SelectedItems){

                        _displayedNode.Properties.Add((Guid) item.Value);
                    }

                    PopulatePropertiesArea(_displayedNode);
                    _changesMade = true;
                }
            }
        }
Example #4
0
        private void buttonAddFilter_Click(object sender, EventArgs e)
        {
            List<KeyValuePair<string, object>> filters = new List<KeyValuePair<string, object>>();
            foreach (KeyValuePair<Guid, string> kvp in ApplicationServices.GetAvailableModules<IOutputFilterModuleInstance>()) {
                filters.Add(new KeyValuePair<string, object>(kvp.Value, kvp.Key));
            }
            using (ListSelectDialog addForm = new ListSelectDialog("Add Filter", (filters))) {
                addForm.SelectionMode = SelectionMode.One;
                if (addForm.ShowDialog() == DialogResult.OK) {
                    List<IOutputFilterModuleInstance> newModuleInstances = new List<IOutputFilterModuleInstance>();
                    foreach (KeyValuePair<string, object> item in addForm.SelectedItems) {
                        IOutputFilterModuleInstance moduleInstance = ApplicationServices.Get<IOutputFilterModuleInstance>((Guid)item.Value);
                        FilterShape shape = _CreateShapeFromFilter(moduleInstance);
                        VixenSystem.Filters.AddFilter(moduleInstance);

                        shape.Width = SHAPE_MAX_WIDTH;
                        shape.Height = SHAPE_DEFAULT_HEIGHT;

                        shape.X = (diagramDisplay.Width/2) - diagramDisplay.GetDiagramPosition().X;
                        shape.Y = diagramDisplay.GetDiagramOffset().Y + (diagramDisplay.Height/2);

                        newModuleInstances.Add(moduleInstance);
                    }

                    OnFiltersAdded(new FiltersEventArgs(newModuleInstances));
                }
            }
        }
Example #5
0
		private void buttonGenerateSubmarks_Click(object sender, EventArgs e)
		{
			if (listViewMarks.SelectedItems.Count < 2)
			{
				//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("Select at least two marks to generate times between.", "Select more marks", false, false);
				messageBox.ShowDialog();
				return;
			}

			Common.Controls.TextDialog prompt =
				new Common.Controls.TextDialog("Break each interval into how many equal segments?");
			if (prompt.ShowDialog() == DialogResult.OK) {
				int divisions;
				if (int.TryParse(prompt.Response, out divisions))
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Question; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("Do you want to put the new marks into a different collection?", "Add to new collection?", true, true);
					messageBox.ShowDialog();
					if (messageBox.DialogResult == DialogResult.Cancel)
					{
						return;
					}

					List<TimeSpan> sourceTimes = new List<TimeSpan>();
					foreach (ListViewItem item in listViewMarks.SelectedItems) {
						sourceTimes.Add((TimeSpan) item.Tag);
					}
					sourceTimes.Sort();

					List<TimeSpan> newTimes = new List<TimeSpan>();
					for (int i = 1; i < sourceTimes.Count; i++) {
						TimeSpan interval = TimeSpan.FromTicks((sourceTimes[i] - sourceTimes[i - 1]).Ticks/divisions);
						for (int j = 0; j < divisions; j++) {
							newTimes.Add(sourceTimes[i - 1] + TimeSpan.FromTicks(interval.Ticks*j));
						}
					}
					newTimes.Add(sourceTimes.Last());

					MarkCollection destination = _displayedCollection;

					if (messageBox.DialogResult == DialogResult.OK)
					{
						List<KeyValuePair<string, object>> options = new List<KeyValuePair<string, object>>();
						foreach (MarkCollection mc in MarkCollections)
						{
							options.Add(new KeyValuePair<string, object>(mc.Name, mc));
						}
						ListSelectDialog selector = new ListSelectDialog("Destination Mark Collection?", options);
						if (selector.ShowDialog() == DialogResult.OK)
						{
							destination = selector.SelectedItem as MarkCollection;
						}
					}
					foreach (TimeSpan time in newTimes) {
						if (!destination.Marks.Contains(time))
							destination.Marks.Add(time);
					}

					destination.Marks.Sort();

					if (destination == _displayedCollection) {
						PopulateMarkListFromMarkCollection(_displayedCollection);
					}
					UpdateMarkCollectionInList(destination);
				}
				else
				{
					//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("Error parsing number: please enter a whole number for the number of divisions.", "Error parsing number", false, false);
					messageBox.ShowDialog();
				}
			}
		}
Example #6
0
        private void buttonAddProperty_Click(object sender, EventArgs e)
        {
            List<KeyValuePair<string, object>> properties = new List<KeyValuePair<string, object>>();
            foreach (KeyValuePair<Guid, string> kvp in ApplicationServices.GetAvailableModules<IPropertyModuleInstance>()) {
                properties.Add(new KeyValuePair<string, object>(kvp.Value, kvp.Key));
            }
            using (ListSelectDialog addForm = new ListSelectDialog("Add Property", (properties))) {
                addForm.SelectionMode = SelectionMode.One;
                if (addForm.ShowDialog() == DialogResult.OK) {

                    // TODO: something smarter about picking subelements vs. applying it to the groups. For now, will just apply it to the actual selected items.

                    foreach (ElementNode node in elementTree.SelectedElementNodes) {
                        node.Properties.Add((Guid)addForm.SelectedItem);
                    }

                    UpdateFormWithNode();
                    OnElementsChanged();
                }
            }
        }