mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-09 17:33:50 +00:00
e97f9a7382
* qfont.ttf: * QIcon.cs: Add LIST and LEFT_DIR icons * Info.plist: * AndroidManifest.xml: Update Version Numbers * App.xaml.cs: * QCue.cs: * MenuPage.xaml.cs: * QCueList.cs: * ControlPage.xaml.cs: * QWorkSpace.cs: * QCueListCell.cs: * qConnectionPage.xaml.cs: * QParser.cs: * QUpdater.cs: * QController.cs: Android v1.0.8 / iOS v2.0.8
109 lines
3.0 KiB
C#
109 lines
3.0 KiB
C#
//Class pertains to the local copy of a workspace, with methods for fetching/updating information inside
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace qController
|
|
{
|
|
public class QWorkspace
|
|
{
|
|
public string status { get; set; }
|
|
public List<QCueList> data { get; set; }
|
|
public string workspace_id { get; set; }
|
|
public string address { get; set; }
|
|
public bool IsPopulated { get; set; }
|
|
|
|
//ONLY FOR PASSING A WORKSPACE LOAD ERROR
|
|
public QWorkspace(string id)
|
|
{
|
|
workspace_id = id;
|
|
}
|
|
|
|
public QCue GetCue(string cue_id)
|
|
{
|
|
foreach (var cueList in data)
|
|
{
|
|
foreach (var cue in cueList.cues)
|
|
{
|
|
if(cue.uniqueID == cue_id)
|
|
{
|
|
return cue;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public QCueList GetCueList(string id)
|
|
{
|
|
foreach (var cueList in data)
|
|
{
|
|
if(cueList.uniqueID == id)
|
|
{
|
|
return cueList;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public void UpdateCue(QCue cue)
|
|
{
|
|
for (int i = 0; i < data.Count; i++)
|
|
{
|
|
for (int j = 0; j < data[i].cues.Count; j++)
|
|
{
|
|
if(data[i].cues[j].uniqueID == cue.uniqueID)
|
|
{
|
|
//Console.WriteLine("Cue found and updated in workspace: " + cue.uniqueID);
|
|
data[i].cues[j] = cue;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void UpdateChildren(string cue_id, List<QCue> children)
|
|
{
|
|
for (int i = 0; i < data.Count; i++)
|
|
{
|
|
for (int j = 0; j < data[i].cues.Count; j++)
|
|
{
|
|
if (data[i].cues[j].uniqueID == cue_id)
|
|
{
|
|
if(data[i].cues[j].type == "Group")
|
|
{
|
|
data[i].cues[j].cues = children;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool CheckPopulated()
|
|
{
|
|
for (int i = 0; i < data.Count; i++)
|
|
{
|
|
for (int j = 0; j < data[i].cues.Count; j++)
|
|
{
|
|
if (data[i].cues[j].type == "Group" && data[i].cues[j].cues == null)
|
|
{
|
|
IsPopulated = false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
IsPopulated = true;
|
|
return true;
|
|
}
|
|
|
|
public void PrintStats()
|
|
{
|
|
foreach (var cueList in data)
|
|
{
|
|
Console.WriteLine(cueList.listName + "("+ cueList.cues.Count + " cues)");
|
|
}
|
|
}
|
|
}
|
|
}
|