still moving code around
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b8d27a2a6f
commit
98e5f6bc89
8 changed files with 168 additions and 218 deletions
56
Sledgemapper/UI/NoteList.Custom.cs
Normal file
56
Sledgemapper/UI/NoteList.Custom.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* Generated by MyraPad at 01/12/2020 11:46:54 */
|
||||
using System.Linq;
|
||||
using Myra.Graphics2D.TextureAtlases;
|
||||
using Myra.Graphics2D.UI;
|
||||
using Sledgemapper.Shared.Entities;
|
||||
using TinyMessenger;
|
||||
|
||||
namespace Sledgemapper.UI
|
||||
{
|
||||
public partial class NoteList
|
||||
{
|
||||
private readonly CommunicationManager CommunicationManager;
|
||||
private readonly Window Window;
|
||||
private readonly TinyMessengerHub Messenger;
|
||||
|
||||
|
||||
public NoteList(CommunicationManager communicationManager, TinyMessengerHub messenger, Window window)
|
||||
{
|
||||
BuildUI();
|
||||
CommunicationManager = communicationManager;
|
||||
Messenger = messenger;
|
||||
Window = window;
|
||||
for (var i = 0; i < CommunicationManager.SessionData.Notes.Values.Count; i++)
|
||||
{
|
||||
var note = CommunicationManager.SessionData.Notes.Values.ElementAt(i);
|
||||
var item = new NoteListItem();
|
||||
item.LblNoteText.Text = $"{note.ToString()} - {note.Text}";
|
||||
item.BtnNoteCenter.Image = new TextureRegion(CachedContent.Instance.Location);
|
||||
item.BtnNoteView.Image = new TextureRegion(CachedContent.Instance.Eye);
|
||||
item.BtnNoteCenter.Click += (s, e) =>
|
||||
{
|
||||
Messenger.Publish(new CenterOnTileMessage(this) { X = note.X, Y = note.Y });
|
||||
};
|
||||
|
||||
item.BtnNoteView.Click += (s, e) => { EditNote(note); window.Close(); };
|
||||
StackNotesList.AddChild(item);
|
||||
}
|
||||
}
|
||||
private void EditNote(Note note)
|
||||
{
|
||||
State.Instance.SelectedNote = new Note { X = note.X, Y = note.Y, Text = note.Text };
|
||||
Window window = new()
|
||||
{
|
||||
Title = $" Note on {note.X}:{note.Y}"
|
||||
};
|
||||
var noteWindow = new NoteWindow(CommunicationManager, window, note);
|
||||
|
||||
|
||||
|
||||
|
||||
window.Content = noteWindow;
|
||||
window.ShowModal(Desktop);
|
||||
//noteWindow.NoteText.SetKeyboardFocus();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue