* MainActivity.cs:

* AndroidManifest.xml: Android: Bind to WIFI

* ControlPage.xaml.cs:
* QCueListCell.cs:
* OSCListItem.cs: Add sub-cues in cue listing

* qController.csproj: Update
This commit is contained in:
2019-08-04 15:57:25 -05:00
parent a2d96d2985
commit 5deb4fd084
6 changed files with 96 additions and 20 deletions
@@ -8,34 +8,37 @@ namespace qController
{
public ListView cueListView;
public Button closeButton;
public ObservableCollection<OSCListItem> items;
public QCueListCell(QCueList qCueList)
{
Margin = new Thickness(10);
Padding = new Thickness(10);
items = new ObservableCollection<OSCListItem>();
cueListView = new ListView
{
ItemsSource = qCueList.cues,
ItemsSource = items,
RowHeight = (int)(App.HeightUnit * 6),
ItemTemplate = new DataTemplate(() =>
{
var grid = new Grid { Padding = new Thickness(5, 10) };
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(30) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(30) });
var icon = new Label();
icon.FontFamily = App.QFont;
icon.SetBinding(Label.TextProperty, "IconText");
icon.SetBinding(Label.TextProperty, "Icon");
icon.HorizontalTextAlignment = TextAlignment.Center;
icon.VerticalTextAlignment = TextAlignment.Center;
icon.FontSize = App.HeightUnit * 3;
var label = new Label { VerticalOptions = LayoutOptions.FillAndExpand };
label.SetBinding(Label.TextProperty, "listName");
label.SetBinding(Label.TextProperty, "Text");
if (label.Text == "Disconnect")
{
label.TextColor = Color.DarkRed;
}
switch (Device.RuntimePlatform)
{
case Device.iOS:
@@ -45,17 +48,8 @@ namespace qController
label.FontSize = App.HeightUnit * 2.2;
break;
}
var selectedLabel = new Label {
VerticalOptions = LayoutOptions.FillAndExpand,
FontFamily = App.QFont,
Text = QIcon.LEFT_DIR,
TextColor = Color.Green,
FontSize = App.HeightUnit * 3
};
grid.Children.Add(icon, 0, 0);
grid.Children.Add(icon);
grid.Children.Add(label, 1, 0);
//grid.Children.Add(selectedLabel, 2, 0);
return new ViewCell { View = grid };
})
@@ -72,6 +66,57 @@ namespace qController
layout.Children.Add(cueListView);
Content = layout;
for(int j=0; j < qCueList.cues.Count; j++)
{
var cue = qCueList.cues[j];
AddSubCues(cue, 0);
}
}
public void AddSubCues(QCue cue, int level)
{
var cueIcon = cue.getIconString();
var cueTitle = "";
for (int i = 0; i < level; i++)
{
cueTitle += " ";
}
if (cue.number != "")
{
cueTitle += cue.number + " - " + cue.listName;
}
else
{
cueTitle += cue.listName;
}
if (cue.cues != null)
{
items.Add(new OSCListItem
{
Text = cueTitle,
Icon = cueIcon,
Command = "/select_id/" + cue.uniqueID
});
//uncomment to load nested group cues
for (int i = 0; i < cue.cues.Count; i++)
{
var sub_cue = cue.cues[i];
AddSubCues(sub_cue, level + 1);
}
}
else
{
items.Add(new OSCListItem
{
Text = cueTitle,
Icon = cueIcon,
Command = "/select_id/" + cue.uniqueID
});
}
}
}
}
@@ -0,0 +1,11 @@
namespace qController
{
public class OSCListItem
{
public string Text { get; set; }
public string Icon { get; set; }
public string Command { get; set; }
}
}
@@ -385,8 +385,8 @@ namespace qController
private void OnCueListItemSelected(object sender, SelectedItemChangedEventArgs e)
{
QCue cue = (QCue)e.SelectedItem;
string selectCueOSC = "/workspace/" + qController.qWorkspace.workspace_id + "/select_id/" + cue.uniqueID;
OSCListItem cue = (OSCListItem)e.SelectedItem;
string selectCueOSC = "/workspace/" + qController.qWorkspace.workspace_id + cue.Command;
qController.qClient.sendStringUDP(selectCueOSC);
CloseCueList();
}
+1 -1
View File
@@ -55,7 +55,7 @@
<ItemGroup>
<PackageReference Include="Acr.UserDialogs" Version="7.0.4" />
<PackageReference Include="Zeroconf" Version="3.0.30" />
<PackageReference Include="Xamarin.Forms" Version="4.1.0.581479" />
<PackageReference Include="Xamarin.Forms" Version="4.1.0.618606" />
<PackageReference Include="Acr.Settings" Version="9.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Xamarin.Essentials" Version="1.2.0" />