public void Run(IBackgroundTaskInstance taskInstance) { //initialize the led matrix matrix = new RgbMatrix(); //Don't need await Windows.System.Threading.ThreadPool.RunAsync(matrix.updateDisplay, Windows.System.Threading.WorkItemPriority.High); //draw on the led matrix drawSomething(); }
public RgbMatrix GetWorkspaceRgbMatrix(string Id, string WorkspaceName) { var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/Workspaces", WorkspaceName); XDocument doc = WorkspaceDictionary[WorkspaceName].Content; if (doc == null) { doc = XDocument.Load(path); } XNamespace ns = "http://www.qlcplus.org/Workspace"; var value = doc.Root .Element(ns + "Engine") .Elements(ns + "Function") .Where(item => (string)item.Attribute("Type") == "RGBMatrix" && (string)item.Attribute("ID") == Id) .FirstOrDefault(); List <RgbMatrix> rgbMatrices = new List <RgbMatrix>(); var rgbMatrixPath = value.Attribute("Path").Value; var scriptId = doc.Root .Element(ns + "Engine") .Elements(ns + "Function") .Where(item => (string)item.Attribute("Type") == "Script" && (string)item.Attribute("Name") == rgbMatrixPath) .Select(x => x.Attribute("ID")) .FirstOrDefault(); RgbMatrix rgbMatrix = new RgbMatrix { Name = value.Attribute("Name").Value, Id = value.Attribute("ID").Value, Type = value.Attribute("Type").Value, SpeedFadeInAttribute = value.Element(ns + "Speed").Attribute("FadeIn").Value, SpeedFadeOutAttribute = value.Element(ns + "Speed").Attribute("FadeOut").Value, SpeedDurationAttribute = value.Element(ns + "Speed").Attribute("Duration").Value, Direction = value.Element(ns + "Direction").Value, RunOrder = value.Element(ns + "RunOrder").Value, //Path = GetWorkspaceScript(scriptId?.Attribute("ID")?.Value, WorkspaceName) ?? new Script { }, AlgorithmName = value.Element(ns + "Algorithm").Value, MonoColor = value.Element(ns + "MonoColor").Value, FixtureGroup = value.Element(ns + "FixtureGroup").Value }; if (scriptId == null) { return(rgbMatrix); } else { rgbMatrix.Path = GetWorkspaceScript(scriptId.Value, WorkspaceName); return(rgbMatrix); } }
public RgbMatrix GenerateNewRgbMatrix(string WorkspaceName, string ScriptName, string fixtureGroup, int i) { string newId = GetNewId(WorkspaceName, i); RgbMatrix rm = new RgbMatrix { Id = newId, Name = ScriptName + "_" + newId, Type = "RGBMatrix", AlgorithmName = ScriptName + "_U" + i.ToString(), FixtureGroup = fixtureGroup, Path = new Script { Name = ScriptName } }; return(rm); }
private XElement CreateRgbMatrixNode(RgbMatrix matrix) { XNamespace ns = "http://www.qlcplus.org/Workspace"; XElement root = new XElement(ns + "Function"); root.Add( new XAttribute("ID", matrix.Id), new XAttribute("Type", matrix.Type), new XAttribute("Name", matrix.Name), new XAttribute("Path", matrix.Path.Name), new XElement(ns + "Speed", new XAttribute("FadeIn", matrix.SpeedFadeInAttribute), new XAttribute("FadeOut", matrix.SpeedFadeOutAttribute), new XAttribute("Duration", matrix.SpeedDurationAttribute)), new XElement(ns + "Direction", matrix.Direction), new XElement(ns + "RunOrder", matrix.RunOrder), new XElement(ns + "Algorithm", new XAttribute("Type", matrix.AlgorithmTypeAttribute), matrix.AlgorithmName), new XElement(ns + "DimmerControl", matrix.DimmerControl), new XElement(ns + "MonoColor", ""), new XElement(ns + "FixtureGroup", matrix.FixtureGroup) ); return(root); }