mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-19 06:04:12 +00:00
* QStorage.cs: Fix AddInstance to actually check Contains
* MenuPage.xaml.cs: * ControlPage.xaml.cs: * qConnectionPage.xaml.cs: Add ability to change cue name in menu
This commit is contained in:
@@ -19,15 +19,18 @@ namespace qController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddInstance(string name, string address){
|
public static bool AddInstance(string name, string address){
|
||||||
if(!Contains(name,address)){
|
return AddInstance(new QInstance(name, address));
|
||||||
AddInstance(new QInstance(name, address));
|
|
||||||
Console.WriteLine("Adding Instance: " + name + " @ " + address);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public static void AddInstance(QInstance q){
|
|
||||||
qInstances.Add(q);
|
public static bool AddInstance(QInstance q){
|
||||||
updateStorage();
|
if(!Contains(q.name, q.address)){
|
||||||
|
qInstances.Add(q);
|
||||||
|
updateStorage();
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RemoveInstance(string name, string address){
|
public static void RemoveInstance(string name, string address){
|
||||||
@@ -51,7 +54,8 @@ namespace qController
|
|||||||
public static bool Contains(string name, string address){
|
public static bool Contains(string name, string address){
|
||||||
foreach (var item in qInstances)
|
foreach (var item in qInstances)
|
||||||
{
|
{
|
||||||
if (item.name == name && item.address == address)
|
//Console.WriteLine("Item name: " + item.name + " Found Name: " + name);
|
||||||
|
if (item.address == address)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ namespace qController
|
|||||||
public void OnCueUpdateReceived(object sender, CueEventArgs args)
|
public void OnCueUpdateReceived(object sender, CueEventArgs args)
|
||||||
{
|
{
|
||||||
qController.qWorkspace.UpdateCue(args.Cue);
|
qController.qWorkspace.UpdateCue(args.Cue);
|
||||||
|
App.rootPage.MenuPage.ChangeCueName(args.Cue.uniqueID, args.Cue.listName);
|
||||||
if (qController.playbackPosition == null)
|
if (qController.playbackPosition == null)
|
||||||
{
|
{
|
||||||
qController.playbackPosition = args.Cue.uniqueID;
|
qController.playbackPosition = args.Cue.uniqueID;
|
||||||
|
|||||||
@@ -143,6 +143,22 @@ namespace qController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ChangeCueName(string cue_id, string name){
|
||||||
|
for(int i = 0; i < items.Count; i++)
|
||||||
|
{
|
||||||
|
if (items[i].Command.Contains(cue_id))
|
||||||
|
{
|
||||||
|
var item = items[i];
|
||||||
|
items.RemoveAt(i);
|
||||||
|
item.Title = name;
|
||||||
|
items.Insert(i, item);
|
||||||
|
Console.WriteLine("CUE OBJECT FOUND IN MENU TRYING TO UPDATE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangeToHome()
|
public void ChangeToHome()
|
||||||
{
|
{
|
||||||
items.Clear();
|
items.Clear();
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace qController
|
|||||||
|
|
||||||
async void Scan(){
|
async void Scan(){
|
||||||
bool workspacesFound = false;
|
bool workspacesFound = false;
|
||||||
App.showToast("Scanning for Workspaces...");
|
App.showToast("Scanning for Instances...");
|
||||||
Console.WriteLine("Begin Scanning");
|
Console.WriteLine("Begin Scanning");
|
||||||
|
|
||||||
IReadOnlyList<IZeroconfHost> results = await ZeroconfResolver.ResolveAsync("_qlab._udp.local.",TimeSpan.FromSeconds(3));
|
IReadOnlyList<IZeroconfHost> results = await ZeroconfResolver.ResolveAsync("_qlab._udp.local.",TimeSpan.FromSeconds(3));
|
||||||
@@ -122,17 +122,18 @@ namespace qController
|
|||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
QInstance instance = new QInstance(result.DisplayName, result.IPAddress);
|
QInstance instance = new QInstance(result.DisplayName, result.IPAddress);
|
||||||
QStorage.AddInstance(instance);
|
if(QStorage.AddInstance(instance)){
|
||||||
Console.WriteLine(result.DisplayName + " @ " + result.IPAddress + " added");
|
Console.WriteLine(result.DisplayName + " @ " + result.IPAddress + " added");
|
||||||
workspacesFound = true;
|
workspacesFound = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(workspacesFound){
|
if(workspacesFound){
|
||||||
App.showToast("Workspace Found and Added!");
|
App.showToast("Instance Found and Added!");
|
||||||
}else{
|
}else{
|
||||||
App.showToast("No Workspaces Found!");
|
App.showToast("No New Instances Found!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user