Add Double Tap editing to new screen

This commit is contained in:
2020-09-10 13:24:48 -05:00
parent 27fb706d36
commit 0fa5085410
7 changed files with 111 additions and 24 deletions
@@ -1,33 +1,17 @@
//NEEDS migrated to QSelectedCueGrid
using System;
using Acr.UserDialogs;
using qController.QItems;
using Xamarin.Forms;
using qController.QItems;
using qController.Events;
namespace qController.Cell
{
public class CueEditArgs : EventArgs
{
public string CueID
{
get;
set;
}
public string Property
{
get;
set;
}
public string NewValue
{
get;
set;
}
}
public class QSelectedCueCell : Frame
{
public delegate void SelectedCueEditedHandler(object source, CueEditArgs args);
public event SelectedCueEditedHandler SelectedCueEdited;
Label name;
@@ -0,0 +1,22 @@
using System;
namespace qController.Events
{
public class CueEditArgs : EventArgs
{
public string CueID
{
get;
set;
}
public string Property
{
get;
set;
}
public string NewValue
{
get;
set;
}
}
}
@@ -0,0 +1,6 @@
using System;
namespace qController.Events
{
public delegate void SelectedCueEditedHandler(object source, CueEditArgs args);
}
@@ -1,4 +1,5 @@
using Xamarin.Forms;
using Acr.UserDialogs;
using Xamarin.Forms;
namespace qController.UI
{
@@ -40,7 +41,7 @@ namespace qController.UI
Padding = 0,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
};
number.SetBinding(Label.TextProperty, "number", BindingMode.OneWay);
number.SetBinding(Label.TextProperty, "number", BindingMode.TwoWay);
Children.Add(number,0,0);
Label type = new Label
@@ -64,7 +65,7 @@ namespace qController.UI
HorizontalOptions = LayoutOptions.CenterAndExpand,
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
};
name.SetBinding(Label.TextProperty, "name", BindingMode.OneWay);
name.SetBinding(Label.TextProperty, "name", BindingMode.TwoWay);
Children.Add(name, 0, 1);
SetColumnSpan(name, 5);
@@ -75,10 +76,73 @@ namespace qController.UI
HorizontalOptions = LayoutOptions.CenterAndExpand,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
};
notes.SetBinding(Label.TextProperty, "notes", BindingMode.OneWay);
notes.SetBinding(Label.TextProperty, "notes", BindingMode.TwoWay);
Children.Add(notes, 0, 2);
SetColumnSpan(notes, 5);
//Double Tap to Edit
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;
notes.Text = 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;
name.Text = 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;
number.Text = qNumber.Text;
}
});
};
notes.GestureRecognizers.Add(notesDoubleTap);
name.GestureRecognizers.Add(nameDoubleTap);
number.GestureRecognizers.Add(numberDoubleTap);
}
}
}
@@ -3,10 +3,12 @@ using System.Collections.Generic;
using Xamarin.Forms;
using Serilog;
using Acr.UserDialogs;
using qController.Dialogs;
using qController.QItems;
using qController.Cell;
using qController.Communication;
using qController.Events;
namespace qController
{
@@ -77,6 +77,14 @@ namespace qController.ViewModels
}
}
public string uid
{
get
{
return cue.uid;
}
}
public string number
{
get
+1
View File
@@ -92,6 +92,7 @@
<Folder Include="Classes\Dialogs\" />
<Folder Include="Classes\Buttons\" />
<Folder Include="Classes\UI\" />
<Folder Include="Classes\Events\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="Pages\RootPageMaster.xaml" />