new note window
This commit is contained in:
parent
da302af8bf
commit
ec98d53f48
5 changed files with 167 additions and 0 deletions
11
Sledgemapper.Shared/Entities/Note.cs
Normal file
11
Sledgemapper.Shared/Entities/Note.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace Sledgemapper.Shared.Entities
|
||||
{
|
||||
|
||||
|
||||
public class Note :BaseMapEntity
|
||||
{
|
||||
public string Text { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -197,6 +197,55 @@ namespace Sledgemapper
|
|||
}
|
||||
}
|
||||
|
||||
if (mouseState.RightButton == ButtonState.Released && mouseState.RightButton != oldMouseState.RightButton)
|
||||
{
|
||||
var contextMenu = new TextButton { Text = "New Note" };
|
||||
contextMenu.Click += (s, e) =>
|
||||
{
|
||||
_desktop.HideContextMenu();
|
||||
var noteWindow = new NoteWindow();
|
||||
Window window = new()
|
||||
{
|
||||
Title = "Note"
|
||||
};
|
||||
|
||||
// var content = new LoginRegisterWindow();
|
||||
// content.RdoLogin.IsPressed = true;
|
||||
// content.RdoLogin.Click += (s, e) =>
|
||||
// {
|
||||
// content.TxtFirstname.Visible = false;
|
||||
// content.TxtLastname.Visible = false;
|
||||
// content.TxtInitials.Visible = false;
|
||||
// content.LblFirstname.Visible = false;
|
||||
// content.LblLastname.Visible = false;
|
||||
// content.LblInitials.Visible = false;
|
||||
// content.BtnLogin.Visible = true;
|
||||
// content.BtnRegister.Visible = false;
|
||||
// window.Title = "Login";
|
||||
// };
|
||||
|
||||
// content.RdoRegister.Click += (s, e) =>
|
||||
// {
|
||||
// content.TxtFirstname.Visible = true;
|
||||
// content.TxtLastname.Visible = true;
|
||||
// content.TxtInitials.Visible = true;
|
||||
// content.LblFirstname.Visible = true;
|
||||
// content.LblLastname.Visible = true;
|
||||
// content.LblInitials.Visible = true;
|
||||
// content.BtnLogin.Visible = false;
|
||||
// content.BtnRegister.Visible = true;
|
||||
// window.Title = "Register";
|
||||
// };
|
||||
|
||||
// content.BtnRegister.Click += OnButtonRegisterClick;
|
||||
// content.BtnLogin.Click += OnButtonLoginClick;
|
||||
|
||||
window.Content = noteWindow;
|
||||
window.ShowModal(_desktop);
|
||||
};
|
||||
_desktop.ShowContextMenu(contextMenu, mouseState.Position);
|
||||
}
|
||||
|
||||
if (newState.IsKeyDown(Keys.LeftControl)
|
||||
&& mouseState.LeftButton == ButtonState.Pressed
|
||||
&& ((mouseState.LeftButton != oldMouseState.LeftButton) || (_state.SelectedTile.X != _state.HoveredTile.X && _state.SelectedTile.Y != _state.HoveredTile.Y)))
|
||||
|
|
77
Sledgemapper/UI/NoteWindow.Generated.cs
Normal file
77
Sledgemapper/UI/NoteWindow.Generated.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
/* Generated by MyraPad at 29/11/2020 23:51:26 */
|
||||
using Myra.Graphics2D;
|
||||
using Myra.Graphics2D.TextureAtlases;
|
||||
using Myra.Graphics2D.UI;
|
||||
using Myra.Graphics2D.Brushes;
|
||||
|
||||
#if !STRIDE
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
#else
|
||||
using Stride.Core.Mathematics;
|
||||
#endif
|
||||
|
||||
namespace Sledgemapper.UI
|
||||
{
|
||||
partial class NoteWindow: Grid
|
||||
{
|
||||
private void BuildUI()
|
||||
{
|
||||
NoteText = new TextBox();
|
||||
NoteText.Multiline = true;
|
||||
NoteText.Wrap = true;
|
||||
NoteText.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
|
||||
NoteText.Id = "NoteText";
|
||||
|
||||
var scrollViewer1 = new ScrollViewer();
|
||||
scrollViewer1.Content = NoteText;
|
||||
|
||||
BtnCancel = new TextButton();
|
||||
BtnCancel.Text = "Cancel";
|
||||
BtnCancel.Width = 70;
|
||||
BtnCancel.Height = 20;
|
||||
BtnCancel.Padding = new Thickness(5);
|
||||
BtnCancel.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
|
||||
BtnCancel.Id = "BtnCancel";
|
||||
|
||||
BtnOk = new TextButton();
|
||||
BtnOk.Text = "Ok";
|
||||
BtnOk.Width = 70;
|
||||
BtnOk.Height = 20;
|
||||
BtnOk.Padding = new Thickness(5);
|
||||
BtnOk.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
|
||||
BtnOk.Id = "BtnOk";
|
||||
|
||||
var horizontalStackPanel1 = new HorizontalStackPanel();
|
||||
horizontalStackPanel1.Spacing = 10;
|
||||
horizontalStackPanel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Right;
|
||||
horizontalStackPanel1.GridRow = 1;
|
||||
horizontalStackPanel1.Widgets.Add(BtnCancel);
|
||||
horizontalStackPanel1.Widgets.Add(BtnOk);
|
||||
|
||||
|
||||
RowSpacing = 13;
|
||||
ColumnsProportions.Add(new Proportion
|
||||
{
|
||||
Type = Myra.Graphics2D.UI.ProportionType.Fill,
|
||||
});
|
||||
RowsProportions.Add(new Proportion
|
||||
{
|
||||
Type = Myra.Graphics2D.UI.ProportionType.Fill,
|
||||
});
|
||||
RowsProportions.Add(new Proportion
|
||||
{
|
||||
Type = Myra.Graphics2D.UI.ProportionType.Auto,
|
||||
});
|
||||
Width = 400;
|
||||
Height = 300;
|
||||
Widgets.Add(scrollViewer1);
|
||||
Widgets.Add(horizontalStackPanel1);
|
||||
}
|
||||
|
||||
|
||||
public TextBox NoteText;
|
||||
public TextButton BtnCancel;
|
||||
public TextButton BtnOk;
|
||||
}
|
||||
}
|
11
Sledgemapper/UI/NoteWindow.cs
Normal file
11
Sledgemapper/UI/NoteWindow.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* Generated by MyraPad at 29/11/2020 23:50:42 */
|
||||
namespace Sledgemapper.UI
|
||||
{
|
||||
public partial class NoteWindow
|
||||
{
|
||||
public NoteWindow()
|
||||
{
|
||||
BuildUI();
|
||||
}
|
||||
}
|
||||
}
|
19
Sledgemapper/UI/noteWindow.xml
Normal file
19
Sledgemapper/UI/noteWindow.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<Project>
|
||||
<Project.ExportOptions Namespace="Sledgemapper.UI" Class="NoteWindow" OutputPath="C:\dev\Map\Sledgemapper\UI" />
|
||||
<Grid RowSpacing="13" Width="400" Height="300">
|
||||
<Grid.ColumnsProportions>
|
||||
<Proportion Type="Fill" />
|
||||
</Grid.ColumnsProportions>
|
||||
<Grid.RowsProportions>
|
||||
<Proportion Type="Fill" />
|
||||
<Proportion Type="Auto" />
|
||||
</Grid.RowsProportions>
|
||||
<ScrollViewer>
|
||||
<TextBox Multiline="True" Wrap="True" VerticalAlignment="Stretch" Id="NoteText" />
|
||||
</ScrollViewer>
|
||||
<HorizontalStackPanel Spacing="10" HorizontalAlignment="Right" GridRow="1">
|
||||
<TextButton Text="Cancel" Width="70" Height="20" Padding="5" HorizontalAlignment="Center" Id="BtnCancel" />
|
||||
<TextButton Text="Ok" Width="70" Height="20" Padding="5" HorizontalAlignment="Center" Id="BtnOk" />
|
||||
</HorizontalStackPanel>
|
||||
</Grid>
|
||||
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue