Relocate files

This commit is contained in:
2020-11-29 14:51:18 -06:00
parent 31a10d9b16
commit 60e03f2203
28 changed files with 6 additions and 6770 deletions
@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
using qController.UI.Buttons;
namespace qController.UI.Cells
{
public class QControlsBlock : Frame
{
Grid mainG;
EventHandler callback;
public QControlsBlock(EventHandler callback)
{
this.callback = callback;
Margin = new Thickness(10);
Padding = new Thickness(0);
IsVisible = true;
BackgroundColor = Color.Transparent;
//highlight Button Grid
//BackgroundColor = Color.FromHex("FF0000");
List<QCommand> commands = new List<QCommand>();
commands.Add(QCommands.PREVIOUS);
commands.Add(QCommands.PAUSE);
commands.Add(QCommands.NEXT);
commands.Add(QCommands.PREVIEW);
commands.Add(QCommands.PANIC);
commands.Add(QCommands.RESUME);
//setCustomButtons(commands);
setDefaultButtons();
}
void setDefaultButtons()
{
List<QButton> buttons = new List<QButton>();
buttons.Add(new QButton(QCommands.PREVIOUS));
buttons.Add(new QButton(QCommands.PANIC));
buttons.Add(new QButton(QCommands.NEXT));
buttons.Add(new QButton(QCommands.PREVIEW));
buttons.Add(new QButton(QCommands.PAUSE));
buttons.Add(new QButton(QCommands.RESUME));
mainG = new Grid
{
Padding = new Thickness(0),
RowDefinitions = {
new RowDefinition{Height = GridLength.Star},
new RowDefinition{Height = GridLength.Star},
new RowDefinition{Height = GridLength.Star}
},
ColumnDefinitions = {
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
},
Margin = new Thickness(0)
};
int row = 0;
int column = 0;
for (int i = 0; i < buttons.Count; i++)
{
QButton b = buttons[i];
b.Clicked += callback;
mainG.Children.Add(b, column, row);
row++;
if (row == 3)
{
row = 0;
column = 2;
}
}
QButton goButton = new QButton(QCommands.GO);
goButton.Clicked += callback;
mainG.Children.Add(goButton, 1, 0);
Grid.SetRowSpan(goButton, 3);
Content = mainG;
}
public void setCustomButtons(List<QCommand> commands)
{
mainG = new Grid
{
Padding = new Thickness(0),
RowDefinitions = {
new RowDefinition{Height = GridLength.Auto},
new RowDefinition{Height = GridLength.Auto},
new RowDefinition{Height = GridLength.Auto}
},
ColumnDefinitions = {
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
},
Margin = new Thickness(0)
};
int row = 0;
int column = 0;
for (int i = 0; i < commands.Count; i++)
{
QButton b = new QButton(commands[i]);
b.Clicked += callback;
mainG.Children.Add(b, column, row);
row++;
if (row == 3)
{
row = 0;
column = 2;
}
}
QButton goButton = new QButton(QCommands.GO);
goButton.Clicked += callback;
mainG.Children.Add(goButton, 1, 0);
Grid.SetRowSpan(goButton, 3);
Content = mainG;
}
}
}
@@ -0,0 +1,122 @@
using System.Collections.ObjectModel;
using Xamarin.Forms;
using qController.QItems;
namespace qController.UI.Cells
{
public class QCueListCell : Frame
{
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 = 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 });
var icon = new Label();
icon.FontFamily = App.QFont;
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, "Text");
if (label.Text == "Disconnect")
{
label.TextColor = Color.DarkRed;
}
switch (Device.RuntimePlatform)
{
case Device.iOS:
label.FontSize = App.HeightUnit * 3;
break;
case Device.Android:
label.FontSize = App.HeightUnit * 2.2;
break;
}
grid.Children.Add(icon);
grid.Children.Add(label, 1, 0);
return new ViewCell { View = grid };
})
};
StackLayout layout = new StackLayout();
closeButton = new Button
{
BackgroundColor = Color.Gray,
Text = "Close",
TextColor = Color.White
};
layout.Children.Add(closeButton);
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,120 @@
using System;
using Xamarin.Forms;
using Serilog;
namespace qController.UI.Cells
{
public class QInstanceCell : ViewCell
{
public QInstanceCell()
{
Label nameLabel = new Label();
Label addressLabel = new Label();
Label connectLabel = new Label();
Label deleteLabel = new Label();
var connectTapGesture = new TapGestureRecognizer();
var deleteTapGesture = new TapGestureRecognizer();
connectTapGesture.Tapped += Connect;
connectLabel.GestureRecognizers.Add(connectTapGesture);
deleteTapGesture.Tapped += Delete;
deleteLabel.GestureRecognizers.Add(deleteTapGesture);
InitItems();
//SET BINDINGS
nameLabel.SetBinding(Label.TextProperty, new Binding("name"));
addressLabel.SetBinding(Label.TextProperty,new Binding("address"));
Grid mainG = new Grid
{
//Padding = new Thickness(10),
RowDefinitions = {
new RowDefinition{Height = GridLength.Auto},
new RowDefinition{Height = GridLength.Auto}
},
ColumnDefinitions = {
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(4,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
}
};
mainG.Children.Add(nameLabel, 1, 0);
mainG.Children.Add(addressLabel,1,1);
mainG.Children.Add(connectLabel,2,0);
Grid.SetRowSpan(connectLabel,2);
mainG.Children.Add(deleteLabel, 0, 0);
Grid.SetRowSpan(deleteLabel,2);
Frame f = new Frame
{
Content = mainG,
BorderColor = Color.Black,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Padding = 0,
Margin = new Thickness(10,10,10,10),
CornerRadius=20
};
f.SetDynamicResource(Frame.BackgroundColorProperty, "WorkspaceCellBackgroundColor");
View = f;
void InitItems()
{
nameLabel.HorizontalTextAlignment = TextAlignment.Center;
nameLabel.VerticalTextAlignment = TextAlignment.End;
nameLabel.FontAttributes = FontAttributes.Bold;
nameLabel.FontSize = App.HeightUnit * 3;
nameLabel.Margin = new Thickness(0, 20, 0, 0);
nameLabel.SetDynamicResource(Label.TextColorProperty, "PrimaryTextColor");
addressLabel.HorizontalTextAlignment = TextAlignment.Center;
addressLabel.VerticalTextAlignment = TextAlignment.Start;
addressLabel.FontSize = App.HeightUnit * 2.5;
addressLabel.Margin = new Thickness(0, 0, 0, 20);
addressLabel.SetDynamicResource(Label.TextColorProperty, "PrimaryTextColor");
connectLabel.HorizontalOptions = LayoutOptions.StartAndExpand;
connectLabel.VerticalOptions = LayoutOptions.CenterAndExpand;
connectLabel.Text = QIcon.WIFI;
connectLabel.FontSize = App.HeightUnit * 5;
connectLabel.TextColor = Color.LimeGreen;
deleteLabel.HorizontalOptions = LayoutOptions.CenterAndExpand;
deleteLabel.VerticalOptions = LayoutOptions.CenterAndExpand;
deleteLabel.Text = QIcon.TRASH_EMPTY;
deleteLabel.FontSize = App.HeightUnit * 5;
deleteLabel.TextColor = Color.Red;
connectLabel.FontFamily = App.QFont;
deleteLabel.FontFamily = App.QFont;
}
void Delete(object sender, EventArgs e)
{
Log.Debug("QINSTANCECELL - Delete " + nameLabel.Text + "," + addressLabel.Text + " Pressed");
QStorage.RemoveInstance(nameLabel.Text,addressLabel.Text);
}
void Connect(object sender, EventArgs e)
{
App.NavigationPage.Navigation.PushAsync(new ControlPage(nameLabel.Text,addressLabel.Text));
Log.Debug("QINSTANCECELL - Connect To " + nameLabel.Text + " Pressed");
}
}
}
}
@@ -0,0 +1,121 @@
using System.Collections.Generic;
using Xamarin.Forms;
namespace qController.UI.Cells
{
public class QLevelsCell : Frame
{
public List<double> levels;
public string activeCue;
public Slider mainSlider;
public Slider leftSlider;
public Slider rightSlider;
public Label mainLabel;
public Label rightLabel;
public Label leftLabel;
public QLevelsCell()
{
Padding = new Thickness(5);
CornerRadius = 20;
BorderColor = Color.Black;
HasShadow = true;
BackgroundColor = Color.FromHex("D8D8D8");
IsVisible = false;
//highlight for testing
//BackgroundColor = Color.Red;
Grid mainG = new Grid
{
Padding = new Thickness(0),
RowDefinitions = {
new RowDefinition{Height = GridLength.Star},
new RowDefinition{Height = GridLength.Star},
new RowDefinition{Height = GridLength.Star}
},
ColumnDefinitions = {
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
}
};
mainSlider = new Slider
{
Minimum = -60,
Maximum = 12
};
leftSlider = new Slider
{
Minimum = -60,
Maximum = 12
};
rightSlider = new Slider
{
Minimum = -60,
Maximum = 12
};
mainLabel = new Label
{
Text = "MAIN:",
VerticalTextAlignment = TextAlignment.Center,
HorizontalTextAlignment = TextAlignment.Center
};
leftLabel = new Label
{
Text = "1:",
VerticalTextAlignment = TextAlignment.Center,
HorizontalTextAlignment = TextAlignment.Center
};
rightLabel = new Label
{
Text = "2:",
VerticalTextAlignment = TextAlignment.Center,
HorizontalTextAlignment = TextAlignment.Center
};
mainG.Children.Add(mainSlider, 1, 0);
mainG.Children.Add(leftSlider, 1, 1);
mainG.Children.Add(rightSlider, 1, 2);
Grid.SetColumnSpan(mainSlider, 4);
Grid.SetColumnSpan(leftSlider, 4);
Grid.SetColumnSpan(rightSlider, 4);
mainG.Children.Add(mainLabel, 0, 0);
mainG.Children.Add(leftLabel, 0, 1);
mainG.Children.Add(rightLabel, 0, 2);
Content = mainG;
Margin = new Thickness(10);
}
public void UpdateLevels(List<double> lin_levels)
{
levels = lin_levels;
if (mainSlider != null)
{
mainSlider.Value = levels[0];
}
if (leftSlider != null)
{
leftSlider.Value = levels[1];
}
if (rightSlider != null)
{
rightSlider.Value = levels[2];
}
}
}
}
@@ -0,0 +1,222 @@
//NEEDS migrated to QSelectedCueGrid
using System;
using Acr.UserDialogs;
using Xamarin.Forms;
using qController.QItems;
using qController.Events;
namespace qController.UI.Cells
{
public class QSelectedCueCell : Frame
{
public event SelectedCueEditedHandler SelectedCueEdited;
Label name;
Label number;
Label type;
public Label notes;
public QCue activeCue;
public QSelectedCueCell()
{
Grid mainG = new Grid
{
Padding = new Thickness(0),
RowDefinitions =
{
new RowDefinition{Height = GridLength.Star},
new RowDefinition{Height = new GridLength(2, GridUnitType.Star)}
},
ColumnDefinitions =
{
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
}
};
Grid topGrid = new Grid
{
Padding = new Thickness(0),
RowDefinitions =
{
new RowDefinition{Height = GridLength.Auto}
},
ColumnDefinitions =
{
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
}
};
Grid bottomGrid = new Grid
{
Padding = new Thickness(0),
RowDefinitions =
{
new RowDefinition{Height = new GridLength(1,GridUnitType.Star)},
new RowDefinition{Height = new GridLength(2,GridUnitType.Star)}
},
ColumnDefinitions =
{
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
}
};
number = new Label {
Text = "",
FontAttributes = FontAttributes.Bold,
FontSize = App.HeightUnit * 5
};
name = new Label {
Text = "Loading Workspace....",
FontAttributes = FontAttributes.Bold,
HorizontalTextAlignment = TextAlignment.Center,
FontSize = App.HeightUnit * 3.5,
Margin = new Thickness(0)
};
type = new Label {
Text = QIcon.SPIN3,
FontFamily = App.QFont,
VerticalTextAlignment = TextAlignment.Center,
HorizontalTextAlignment = TextAlignment.End,
FontSize = App.HeightUnit * 5
};
notes = new Label {
Text = "Loading Cue Lists and Playhead Position",
HorizontalTextAlignment = TextAlignment.Center,
Margin = new Thickness(0,0,0,10),
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand
};
//BACKGROUND COLORS FOR TESTING ONLY
//notes.BackgroundColor = Color.Red;
//number.BackgroundColor = Color.Red;
//name.BackgroundColor = Color.Red;
//type.BackgroundColor = Color.Red;
//topGrid.BackgroundColor = Color.Green;
//bottomGrid.BackgroundColor = Color.Green;
topGrid.Children.Add(number, 0, 0);
topGrid.Children.Add(type, 4, 0);
Grid.SetColumnSpan(number, 3);
Grid.SetColumnSpan(type, 1);
bottomGrid.Children.Add(name, 0, 0);
bottomGrid.Children.Add(notes, 0, 1);
Grid.SetColumnSpan(name, 5);
Grid.SetColumnSpan(notes,5);
mainG.Children.Add(topGrid, 0, 0);
Grid.SetColumnSpan(topGrid, 5);
mainG.Children.Add(bottomGrid, 0, 1);
Grid.SetColumnSpan(bottomGrid, 5);
CornerRadius = 20;
BackgroundColor = Color.FromHex("D8D8D8");
HeightRequest = App.HeightUnit * 25;
Margin = new Thickness(10);
Content = mainG;
SetupDoubleTapEdit();
}
void SetupDoubleTapEdit()
{
var notesDoubleTap = new TapGestureRecognizer();
var nameDoubleTap = new TapGestureRecognizer();
var numberDoubleTap = new TapGestureRecognizer();
notesDoubleTap.NumberOfTapsRequired = 2;
nameDoubleTap.NumberOfTapsRequired = 2;
numberDoubleTap.NumberOfTapsRequired = 2;
notesDoubleTap.Tapped += (s, e) =>
{
UserDialogs.Instance.Prompt(new PromptConfig
{
Title = "Update Notes",
Message = "Changes notes to update",
OkText = "Update",
Text = notes.Text,
OnAction = (qNotes) =>
{
if (!qNotes.Ok)
return;
OnSelectedCueEdited("notes", qNotes.Text);
}
});
};
nameDoubleTap.Tapped += (s, e) =>
{
UserDialogs.Instance.Prompt(new PromptConfig
{
Title = "Update Name",
Message = "Change name to update",
OkText = "Update",
Text = name.Text,
OnAction = (qName) =>
{
if (!qName.Ok)
return;
OnSelectedCueEdited("name", qName.Text);
}
});
};
numberDoubleTap.Tapped += (s, e) =>
{
UserDialogs.Instance.Prompt(new PromptConfig
{
Title = "Update Number",
Message = "Change number to update",
OkText = "Update",
Text = number.Text,
OnAction = (qNumber) =>
{
if (!qNumber.Ok)
return;
OnSelectedCueEdited("number", qNumber.Text);
}
});
};
notes.GestureRecognizers.Add(notesDoubleTap);
name.GestureRecognizers.Add(nameDoubleTap);
number.GestureRecognizers.Add(numberDoubleTap);
}
public void UpdateSelectedCue(QCue cue)
{
activeCue = cue;
name.Text = cue.listName;
number.Text = cue.number;
type.Text = cue.getIconString();
notes.Text = cue.notes;
}
protected virtual void OnSelectedCueEdited(string prop, string value)
{
if (SelectedCueEdited != null)
SelectedCueEdited(this, new CueEditArgs() { CueID = activeCue.uniqueID, Property = prop, NewValue = value }) ;
}
}
}