mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-23 16:09:17 +00:00
Update Notes by double tapping
This commit is contained in:
@@ -1,14 +1,37 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Acr.UserDialogs;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace qController
|
namespace qController
|
||||||
{
|
{
|
||||||
|
public class CueEditArgs : EventArgs
|
||||||
|
{
|
||||||
|
public string CueID
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
public string Property
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
public string NewValue
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class QSelectedCueCell : Frame
|
public class QSelectedCueCell : Frame
|
||||||
{
|
{
|
||||||
|
public delegate void SelectedCueEditedHandler(object source, CueEditArgs args);
|
||||||
|
public event SelectedCueEditedHandler SelectedCueEdited;
|
||||||
|
|
||||||
Label name;
|
Label name;
|
||||||
Label number;
|
Label number;
|
||||||
Label type;
|
Label type;
|
||||||
Label notes;
|
public Label notes;
|
||||||
public QCue activeCue;
|
public QCue activeCue;
|
||||||
public QSelectedCueCell()
|
public QSelectedCueCell()
|
||||||
{
|
{
|
||||||
@@ -97,24 +120,33 @@ namespace qController
|
|||||||
notes.VerticalOptions = LayoutOptions.FillAndExpand;
|
notes.VerticalOptions = LayoutOptions.FillAndExpand;
|
||||||
notes.HorizontalOptions = LayoutOptions.FillAndExpand;
|
notes.HorizontalOptions = LayoutOptions.FillAndExpand;
|
||||||
|
|
||||||
|
var notesDoubleTap = new TapGestureRecognizer();
|
||||||
|
notesDoubleTap.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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
notes.GestureRecognizers.Add(notesDoubleTap);
|
||||||
|
|
||||||
notes.BackgroundColor = Color.FromHex("FF0000");
|
notes.BackgroundColor = Color.FromHex("FF0000");
|
||||||
number.BackgroundColor = Color.Red;
|
number.BackgroundColor = Color.Red;
|
||||||
name.BackgroundColor = Color.Red;
|
name.BackgroundColor = Color.Red;
|
||||||
type.BackgroundColor = Color.Red;
|
type.BackgroundColor = Color.Red;
|
||||||
|
|
||||||
var notesDoubleTap = new TapGestureRecognizer();
|
|
||||||
notesDoubleTap.NumberOfTapsRequired = 2;
|
|
||||||
notesDoubleTap.Tapped += (s, e) =>
|
|
||||||
{
|
|
||||||
Console.WriteLine("Notes double tapped");
|
|
||||||
};
|
|
||||||
|
|
||||||
number.GestureRecognizers.Add(notesDoubleTap);
|
|
||||||
type.GestureRecognizers.Add(notesDoubleTap);
|
|
||||||
name.GestureRecognizers.Add(notesDoubleTap);
|
|
||||||
notes.GestureRecognizers.Add(notesDoubleTap);
|
|
||||||
|
|
||||||
topGrid.Children.Add(number, 0, 0);
|
topGrid.Children.Add(number, 0, 0);
|
||||||
topGrid.Children.Add(type, 4, 0);
|
topGrid.Children.Add(type, 4, 0);
|
||||||
Grid.SetColumnSpan(number, 3);
|
Grid.SetColumnSpan(number, 3);
|
||||||
@@ -144,9 +176,13 @@ namespace qController
|
|||||||
number.Text = cue.number;
|
number.Text = cue.number;
|
||||||
type.Text = cue.getIconString();
|
type.Text = cue.getIconString();
|
||||||
notes.Text = cue.notes;
|
notes.Text = cue.notes;
|
||||||
if(notes.Text == ""){
|
}
|
||||||
notes.Text = " ";
|
|
||||||
}
|
protected virtual void OnSelectedCueEdited(string prop, string value)
|
||||||
|
{
|
||||||
|
if (SelectedCueEdited != null)
|
||||||
|
SelectedCueEdited(this, new CueEditArgs() { CueID = activeCue.uniqueID, Property = prop, NewValue = value }) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,9 +99,17 @@ namespace qController
|
|||||||
|
|
||||||
|
|
||||||
qCell = new QSelectedCueCell();
|
qCell = new QSelectedCueCell();
|
||||||
|
|
||||||
|
|
||||||
|
qCell.SelectedCueEdited += OnSelectedCueEdited;
|
||||||
sLayout.Children.Add(qCell);
|
sLayout.Children.Add(qCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnSelectedCueEdited(object source, CueEditArgs args)
|
||||||
|
{
|
||||||
|
string address = "/workspace/" + qController.qWorkspace.workspace_id + "/cue_id/" + args.CueID + "/" + args.Property
|
||||||
|
qController.qClient.sendArgsUDP(address, args.NewValue);
|
||||||
|
}
|
||||||
void FinishUI()
|
void FinishUI()
|
||||||
{
|
{
|
||||||
string workspace_prefix = "/workspace/" + qController.qWorkspace.workspace_id;
|
string workspace_prefix = "/workspace/" + qController.qWorkspace.workspace_id;
|
||||||
|
|||||||
Reference in New Issue
Block a user