mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-15 04:13:52 +00:00
Clean up legacy control classes and code
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace qController.UI.Buttons
|
||||
{
|
||||
public class QButton : Button
|
||||
{
|
||||
public QCommand qCommand
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public QButton(QCommand command)
|
||||
{
|
||||
|
||||
qCommand = command;
|
||||
Text = qCommand.text;
|
||||
TextColor = Color.Black;
|
||||
FontSize = App.HeightUnit * 2.5;
|
||||
if (qCommand.osc.Contains("go"))
|
||||
{
|
||||
BackgroundColor = Color.SeaGreen;
|
||||
switch (Device.RuntimePlatform)
|
||||
{
|
||||
case Device.iOS:
|
||||
FontSize = App.HeightUnit * 4;
|
||||
FontAttributes = FontAttributes.Bold;
|
||||
break;
|
||||
case Device.Android:
|
||||
FontSize = App.HeightUnit * 4;
|
||||
FontAttributes = FontAttributes.Bold;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (qCommand.osc.Contains("panic"))
|
||||
{
|
||||
BackgroundColor = Color.IndianRed;
|
||||
}
|
||||
else
|
||||
{
|
||||
BackgroundColor = Color.FromHex("D8D8D8");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using Xamarin.Forms;
|
||||
namespace qController.UI.Buttons
|
||||
{
|
||||
public class QLevelsButton : ShadowButton
|
||||
{
|
||||
public Button button;
|
||||
public QLevelsButton()
|
||||
{
|
||||
button = new Button
|
||||
{
|
||||
Text = QIcon.SLIDERS,
|
||||
TextColor = Color.Black,
|
||||
FontFamily = (OnPlatform<string>)Application.Current.Resources["QFontFamily"],
|
||||
FontSize = App.HeightUnit * 4,
|
||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
||||
HorizontalOptions = LayoutOptions.FillAndExpand,
|
||||
HeightRequest = App.HeightUnit * 8,
|
||||
WidthRequest = App.HeightUnit * 8,
|
||||
CornerRadius = (int)(App.HeightUnit * 4),
|
||||
BackgroundColor = Color.LightBlue
|
||||
};
|
||||
|
||||
HeightRequest = button.Height;
|
||||
WidthRequest = button.Width;
|
||||
CornerRadius = button.CornerRadius;
|
||||
Content = button;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
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 = (OnPlatform<string>)Application.Current.Resources["QFontFamily"];
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
using Serilog;
|
||||
using qController.Helpers;
|
||||
|
||||
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 = IconConstants.Wifi;
|
||||
connectLabel.FontSize = App.HeightUnit * 5;
|
||||
connectLabel.TextColor = Color.LimeGreen;
|
||||
|
||||
deleteLabel.HorizontalOptions = LayoutOptions.CenterAndExpand;
|
||||
deleteLabel.VerticalOptions = LayoutOptions.CenterAndExpand;
|
||||
deleteLabel.Text = IconConstants.Delete;
|
||||
deleteLabel.FontSize = App.HeightUnit * 5;
|
||||
deleteLabel.TextColor = Color.Red;
|
||||
|
||||
connectLabel.FontFamily = (OnPlatform<string>)Application.Current.Resources["MaterialFontFamily"];
|
||||
deleteLabel.FontFamily = (OnPlatform<string>)Application.Current.Resources["MaterialFontFamily"];
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
//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 = (OnPlatform<string>)Application.Current.Resources["QFontFamily"],
|
||||
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 }) ;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using Acr.UserDialogs;
|
||||
using qController.Communication;
|
||||
using qController.Helpers;
|
||||
|
||||
namespace qController.UI.Dialogs
|
||||
{
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using Acr.UserDialogs;
|
||||
|
||||
namespace qController.UI.Dialogs
|
||||
{
|
||||
public class NoWorkspacesConfig : ConfirmConfig
|
||||
{
|
||||
public NoWorkspacesConfig(Action<bool> action)
|
||||
{
|
||||
Message = "QLab doesn't have any workspaces open?";
|
||||
OkText = "Disconnect";
|
||||
OnAction = action;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Acr.UserDialogs;
|
||||
using qController.QItems;
|
||||
using Serilog;
|
||||
using QControlKit;
|
||||
|
||||
namespace qController.UI.Dialogs
|
||||
{
|
||||
public class WorkspacePromptArgs : EventArgs
|
||||
{
|
||||
public QOldWorkspace SelectedWorkspace
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public class WorkspacePrompt
|
||||
{
|
||||
public delegate void WorkspaceSelectedHandler(object source, WorkspacePromptArgs args);
|
||||
public event WorkspaceSelectedHandler WorkspaceSelected;
|
||||
|
||||
public WorkspacePrompt()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ActionSheetConfig getActionSheetConfigForWorkspaces(List<QWorkspaceInfo> workspaces)
|
||||
{
|
||||
ActionSheetConfig actionSheetConfig = new ActionSheetConfig();
|
||||
actionSheetConfig.SetTitle("Select Workspace");
|
||||
for (int i = 0; i < workspaces.Count; i++)
|
||||
{
|
||||
QWorkspaceInfo workspace = workspaces[i];
|
||||
actionSheetConfig.Add(workspace.displayName, new Action(() => {
|
||||
Log.Debug("WorkspacePrompt - Workspace Selected " + workspace.displayName);
|
||||
|
||||
|
||||
if (!workspace.hasPasscode)
|
||||
{
|
||||
OnWorkspaceSelected(new QOldWorkspace(workspace.uniqueID));
|
||||
}
|
||||
else
|
||||
{
|
||||
promptWorkspacePasscode(workspace.uniqueID);
|
||||
}
|
||||
}));
|
||||
}
|
||||
return actionSheetConfig;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void promptWorkspacePasscode(string workspace_id)
|
||||
{
|
||||
UserDialogs.Instance.Prompt(new PromptConfig
|
||||
{
|
||||
InputType = InputType.Number,
|
||||
MaxLength = 4,
|
||||
Title = "Enter Workspace Passcode",
|
||||
OkText = "Connect",
|
||||
IsCancellable = true,
|
||||
OnAction = (resp) =>
|
||||
{
|
||||
if (resp.Ok)
|
||||
{
|
||||
OnWorkspaceSelected(new QOldWorkspace(workspace_id,resp.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnWorkspaceSelected(null);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected virtual void OnWorkspaceSelected(QOldWorkspace workspace)
|
||||
{
|
||||
if (WorkspaceSelected != null)
|
||||
WorkspaceSelected(this, new WorkspacePromptArgs() { SelectedWorkspace = workspace });
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using Acr.UserDialogs;
|
||||
using qController.Helpers;
|
||||
using qController.ViewModels;
|
||||
using Serilog;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace qController.UI
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
using Acr.UserDialogs;
|
||||
using qController.ViewModels;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace qController.UI
|
||||
{
|
||||
public class QSelectedCueGrid : Grid
|
||||
{
|
||||
public QSelectedCueGrid()
|
||||
{
|
||||
RowSpacing = 0;
|
||||
ColumnSpacing = 0;
|
||||
BackgroundColor = Color.FromHex("#D8D8D8");
|
||||
|
||||
RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });
|
||||
RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });
|
||||
RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });
|
||||
|
||||
ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
|
||||
ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
|
||||
ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
|
||||
ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
|
||||
ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
|
||||
|
||||
Frame border = new Frame
|
||||
{
|
||||
BorderColor = Color.Black,
|
||||
BackgroundColor = Color.Transparent
|
||||
};
|
||||
|
||||
Children.Add(border);
|
||||
|
||||
SetRowSpan(border, 3);
|
||||
SetColumnSpan(border, 5);
|
||||
|
||||
Label number = new Label
|
||||
{
|
||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
||||
HorizontalOptions = LayoutOptions.FillAndExpand,
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
VerticalTextAlignment = TextAlignment.Center,
|
||||
Margin = 0,
|
||||
Padding = 0,
|
||||
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
|
||||
};
|
||||
number.SetBinding(Label.TextProperty, "number", BindingMode.OneWay);
|
||||
Children.Add(number,0,0);
|
||||
|
||||
Label type = new Label
|
||||
{
|
||||
VerticalOptions = LayoutOptions.CenterAndExpand,
|
||||
HorizontalOptions = LayoutOptions.CenterAndExpand,
|
||||
VerticalTextAlignment = TextAlignment.Center,
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
Margin = 0,
|
||||
Padding = 0,
|
||||
FontSize = App.HeightUnit * 4,
|
||||
FontFamily = (OnPlatform<string>)Application.Current.Resources["QFontFamily"]
|
||||
};
|
||||
type.SetBinding(Label.TextProperty, "type", BindingMode.OneWay);
|
||||
Children.Add(type, 4, 0);
|
||||
|
||||
|
||||
Label name = new Label
|
||||
{
|
||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
||||
HorizontalOptions = LayoutOptions.FillAndExpand,
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
VerticalTextAlignment = TextAlignment.Center,
|
||||
BackgroundColor = Color.Transparent,
|
||||
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
|
||||
};
|
||||
name.SetBinding(Label.TextProperty, "name", BindingMode.TwoWay);
|
||||
Children.Add(name, 0, 1);
|
||||
SetColumnSpan(name, 5);
|
||||
|
||||
Editor notes = new Editor
|
||||
{
|
||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
||||
HorizontalOptions = LayoutOptions.FillAndExpand,
|
||||
Margin = 5,
|
||||
BackgroundColor = Color.Transparent,
|
||||
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Editor))
|
||||
};
|
||||
notes.SetBinding(Editor.TextProperty, "notes", BindingMode.TwoWay);
|
||||
|
||||
Children.Add(notes, 0, 2);
|
||||
SetColumnSpan(notes, 5);
|
||||
|
||||
//Double tap to edit name/number
|
||||
|
||||
var nameDoubleTap = new TapGestureRecognizer();
|
||||
nameDoubleTap.NumberOfTapsRequired = 2;
|
||||
|
||||
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;
|
||||
name.Text = qName.Text;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
name.GestureRecognizers.Add(nameDoubleTap);
|
||||
|
||||
var numberDoubleTap = new TapGestureRecognizer();
|
||||
numberDoubleTap.NumberOfTapsRequired = 2;
|
||||
|
||||
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;
|
||||
//This bypasses the label .Text property because the number might not be valid (no duplicates)
|
||||
((QCueViewModel)BindingContext).number = qNumber.Text;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
number.GestureRecognizers.Add(numberDoubleTap);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user