// ------------------------------------------------------------- // // Setup() - called when the user has requested to setup // the plugin instance // // ------------------------------------------------------------- public override bool Setup() { // define/create objects XmlElement newChild; using (var setupForm = new SetupForm()) { this.LoadSetupNodeInfo(); // if our channels from/to are setup then tell the setupForm if (this._pluginChannelsFrom != 0 && this._pluginChannelsTo != 0) { setupForm.PluginChannelCount = this._pluginChannelsTo - this._pluginChannelsFrom + 1; } // for each universe add it to setup form foreach (var uE in this._universeTable) { setupForm.UniverseAdd( uE.Active, uE.Universe, uE.Start + 1, uE.Size, uE.Unicast, uE.Multicast, uE.Ttl); } setupForm.WarningsOption = this._warningsOption; setupForm.StatisticsOption = this._statisticsOption; setupForm.EventRepeatCount = this._eventRepeatCount; if (setupForm.ShowDialog() == DialogResult.OK) { // first get rid of our old children while (_setupNode.ChildNodes.Count > 0) { _setupNode.RemoveChild(_setupNode.ChildNodes[0]); } // add the Guid child newChild = _setupNode.OwnerDocument.CreateElement("Guid"); newChild.SetAttribute("id", this._guid.ToString()); _setupNode.AppendChild(newChild); // add the Options child newChild = _setupNode.OwnerDocument.CreateElement("Options"); newChild.SetAttribute("warnings", setupForm.WarningsOption.ToString()); newChild.SetAttribute("statistics", setupForm.StatisticsOption.ToString()); newChild.SetAttribute("eventRepeatCount", setupForm.EventRepeatCount.ToString()); _setupNode.AppendChild(newChild); // add each of the universes as a child for (int i = 0; i < setupForm.UniverseCount; i++) { bool active = true; int universe = 0; int start = 0; int size = 0; string unicast = string.Empty; string multicast = string.Empty; int ttl = 0; if (setupForm.UniverseGet( i, ref active, ref universe, ref start, ref size, ref unicast, ref multicast, ref ttl)) { newChild = _setupNode.OwnerDocument.CreateElement("Universe"); newChild.SetAttribute("active", active.ToString()); newChild.SetAttribute("number", universe.ToString()); newChild.SetAttribute("start", start.ToString()); newChild.SetAttribute("size", size.ToString()); if (unicast != null) { newChild.SetAttribute("unicast", unicast); } else if (multicast != null) { newChild.SetAttribute("multicast", multicast); } newChild.SetAttribute("ttl", ttl.ToString()); _setupNode.AppendChild(newChild); } } // update in memory table to match xml this.LoadSetupNodeInfo(); } } }
// ------------------------------------------------------------- // // Setup() - called when the user has requested to setup // the plugin instance // // ------------------------------------------------------------- public override bool Setup() { isSetupOpen = true; using (var setupForm = new SetupForm()) { // Tell the setupForm our output count setupForm.PluginChannelCount = this.OutputCount; List <int> initialUniverseList = new List <int>(); setupForm.WarningsOption = _data.Warnings; setupForm.StatisticsOption = _data.Statistics; setupForm.EventRepeatCount = _data.EventRepeatCount; setupForm.EventSuppressCount = _data.EventSuppressCount; setupForm.AutoPopulateStart = _data.AutoPopulate; setupForm.Blind = _data.Blind; setupForm.Priority = _data.Priority; setupForm.SetDestination(_data.Multicast, _data.Unicast); // for each universe add it to setup form foreach (var uE in _data.Universes) { setupForm.UniverseAdd( uE.Active, uE.Universe, uE.Start + 1, uE.Size); initialUniverseList.Add(uE.Universe); } setupForm.Text = (new E131ModuleDescriptor()).TypeName + " Configuration - " + VixenSystem.OutputControllers.Single( controller => controller.ModuleInstanceId == _data.ModuleInstanceId).Name; if (setupForm.ShowDialog() == DialogResult.OK) { running = false; //prevent updates if (running) { this.Stop(); } _data.Warnings = setupForm.WarningsOption; _data.Statistics = setupForm.StatisticsOption; _data.EventRepeatCount = setupForm.EventRepeatCount; _data.EventSuppressCount = setupForm.EventSuppressCount; _data.AutoPopulate = setupForm.AutoPopulateStart; _data.Blind = setupForm.Blind; _data.Priority = setupForm.Priority; _data.Universes.Clear(); var destination = new Tuple <string, string>(null, null); destination = setupForm.GetDestination(); _data.Unicast = destination.Item1; _data.Multicast = destination.Item2; OutputController thisController = VixenSystem.OutputControllers.Single(controller => controller.ModuleInstanceId == _data.ModuleInstanceId); for (int x = 0; x < thisController.Outputs.Length; x++) { thisController.Outputs[x].Name = "Output #" + (x + 1).ToString(); } // add each of the universes as a child for (int i = 0; i < setupForm.UniverseCount; i++) { bool active = true; int universe = 0; int start = 0; int size = 0; if (setupForm.UniverseGet( i, ref active, ref universe, ref start, ref size)) { _data.Universes.Add(new UniverseEntry(i, active, universe, start - 1, size, destination.Item1, destination.Item2)); for (int x = start - 1; x < start + size - 1; x++) { if (x < thisController.Outputs.Length) { if (_data.Unicast == string.Empty || _data.Unicast == null) { thisController.Outputs[x].Name = "#" + (x + 1).ToString() + " " + universe.ToString() + "-" + (x - start + 2).ToString() + ": Multicast"; } else { thisController.Outputs[x].Name = "#" + (x + 1).ToString() + " " + universe.ToString() + "-" + (x - start + 2).ToString() + ": " + _data.Unicast.ToString(); } } } } } this.Start(); } } isSetupOpen = false; return(true); }
// ------------------------------------------------------------- // // Setup() - called when the user has requested to setup // the plugin instance // // ------------------------------------------------------------- public override bool Setup() { //initialize setupNode //Initialize(); isSetupOpen = true; // define/create objects using (var setupForm = new SetupForm()) { // Tell the setupForm our output count setupForm.PluginChannelCount = this.OutputCount; List <int> initialUniverseList = new List <int>(); // for each universe add it to setup form foreach (var uE in _data.Universes) { setupForm.UniverseAdd( uE.Active, uE.Universe, uE.Start + 1, uE.Size, uE.Unicast, uE.Multicast, uE.Ttl); if (!E131OutputPlugin.EmployedUniverses.Contains(uE.Universe)) { E131OutputPlugin.EmployedUniverses.Add(uE.Universe); } initialUniverseList.Add(uE.Universe); } setupForm.WarningsOption = _data.Warnings; setupForm.StatisticsOption = _data.Statistics; setupForm.EventRepeatCount = _data.EventRepeatCount; setupForm.EventSuppressCount = _data.EventSuppressCount; setupForm.Text = (new E131ModuleDescriptor()).TypeName + " Controller Setup - " + VixenSystem.OutputControllers.Single(controller => controller.ModuleInstanceId == _data.ModuleInstanceId).Name; if (setupForm.ShowDialog() == DialogResult.OK) { _data.Warnings = setupForm.WarningsOption; _data.Statistics = setupForm.StatisticsOption; _data.EventRepeatCount = setupForm.EventRepeatCount; _data.EventSuppressCount = setupForm.EventSuppressCount; _data.Universes.Clear(); initialUniverseList.ForEach(u => E131OutputPlugin.EmployedUniverses.RemoveAll(t => u == t)); // add each of the universes as a child for (int i = 0; i < setupForm.UniverseCount; i++) { bool active = true; int universe = 0; int start = 0; int size = 0; string unicast = string.Empty; string multicast = string.Empty; int ttl = 0; if (setupForm.UniverseGet( i, ref active, ref universe, ref start, ref size, ref unicast, ref multicast, ref ttl)) { _data.Universes.Add(new UniverseEntry(i, active, universe, start - 1, size, unicast, multicast, ttl)); //Only add the universe if it doesnt already exist if (!E131OutputPlugin.EmployedUniverses.Contains(universe)) { E131OutputPlugin.EmployedUniverses.Add(universe); } } } hasStarted = false; //prevent updates // update in memory table to match xml this.Shutdown(); this.Start(); } } isSetupOpen = false; return(true); }
// ------------------------------------------------------------- // // Setup() - called when the user has requested to setup // the plugin instance // // ------------------------------------------------------------- public override bool Setup() { //initialize setupNode //Initialize(); isSetupOpen = true; // define/create objects XmlElement newChild; using (var setupForm = new SetupForm()) { this.LoadSetupNodeInfo(); // Tell the setupForm our output count setupForm.PluginChannelCount = this.OutputCount; // for each universe add it to setup form foreach (var uE in this._universeTable) { setupForm.UniverseAdd( uE.Active, uE.Universe, uE.Start + 1, uE.Size, uE.Unicast, uE.Multicast, uE.Ttl); } setupForm.WarningsOption = this._warningsOption; setupForm.StatisticsOption = this._statisticsOption; setupForm.EventRepeatCount = this._eventRepeatCount; if (setupForm.ShowDialog() == DialogResult.OK) { // first get rid of our old children while (_setupNode.ChildNodes.Count > 0) { _setupNode.RemoveChild(_setupNode.ChildNodes[0]); } // add the Guid child newChild = _setupNode.OwnerDocument.CreateElement("Guid"); newChild.SetAttribute("id", this._guid.ToString()); _setupNode.AppendChild(newChild); // add the Options child newChild = _setupNode.OwnerDocument.CreateElement("Options"); newChild.SetAttribute("warnings", setupForm.WarningsOption.ToString()); newChild.SetAttribute("statistics", setupForm.StatisticsOption.ToString()); newChild.SetAttribute("eventRepeatCount", setupForm.EventRepeatCount.ToString()); _setupNode.AppendChild(newChild); // add each of the universes as a child for (int i = 0; i < setupForm.UniverseCount; i++) { bool active = true; int universe = 0; int start = 0; int size = 0; string unicast = string.Empty; string multicast = string.Empty; int ttl = 0; if (setupForm.UniverseGet( i, ref active, ref universe, ref start, ref size, ref unicast, ref multicast, ref ttl)) { newChild = _setupNode.OwnerDocument.CreateElement("Universe"); newChild.SetAttribute("active", active.ToString()); newChild.SetAttribute("number", universe.ToString()); newChild.SetAttribute("start", start.ToString()); newChild.SetAttribute("size", size.ToString()); if (unicast != null) { newChild.SetAttribute("unicast", unicast); } else if (multicast != null) { newChild.SetAttribute("multicast", multicast); } newChild.SetAttribute("ttl", ttl.ToString()); _setupNode.AppendChild(newChild); } } doc.Save("Modules\\Controller\\E131settings.xml"); hasStarted = false; //prevent updates // update in memory table to match xml this.Shutdown(); this.Start(); } } isSetupOpen = false; return(true); }