-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67b6536
commit 2cdcc86
Showing
12 changed files
with
164 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Cross-Platform/SignalGoTest.Desktop/Helpers/CommandsHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
|
||
namespace SignalGoTest.Desktop.Helpers | ||
{ | ||
public class CommandsHelper : AvaloniaObject | ||
{ | ||
public static readonly AvaloniaProperty<string> AttachCommandProperty = AvaloniaProperty.Register<CommandsHelper, string>(nameof(AttachCommand), notifying: (obj, value) => | ||
{ | ||
|
||
}); | ||
|
||
public string AttachCommand | ||
{ | ||
get { return GetValue(AttachCommandProperty); } | ||
set { SetValue(AttachCommandProperty, value); } | ||
} | ||
|
||
public static string GetAttachCommand(Control control) | ||
{ | ||
return (string)control.GetValue(AttachCommandProperty); | ||
} | ||
|
||
public static void SetAttachCommand(Control control, bool value) | ||
{ | ||
control.SetValue(AttachCommandProperty, value); | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
Cross-Platform/SignalGoTest.Desktop/Helpers/CommandsViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using MvvmGo.Commands; | ||
|
||
namespace SignalGoTest.Desktop.Helpers | ||
{ | ||
public class CommandsViewModel | ||
{ | ||
public CommandsViewModel() | ||
{ | ||
CopyCommand = new Command<ContextMenu>(async (contextMenu) => | ||
{ | ||
TextBox textBox = contextMenu.Parent.Parent as TextBox; | ||
await Application.Current.Clipboard.SetTextAsync(textBox.Text); | ||
}); | ||
CutCommand = new Command<ContextMenu>(async (contextMenu) => | ||
{ | ||
TextBox textBox = contextMenu.Parent.Parent as TextBox; | ||
await Application.Current.Clipboard.SetTextAsync(textBox.Text); | ||
textBox.Text = ""; | ||
}); | ||
SelctAllCommand = new Command<ContextMenu>((contextMenu) => | ||
{ | ||
TextBox textBox = contextMenu.Parent.Parent as TextBox; | ||
textBox.SelectionStart = 0; | ||
textBox.SelectionEnd = textBox.Text.Length; | ||
}); | ||
PasteCommand = new Command<ContextMenu>(async (contextMenu) => | ||
{ | ||
TextBox textBox = contextMenu.Parent.Parent as TextBox; | ||
|
||
textBox.Text = await Application.Current.Clipboard.GetTextAsync(); | ||
}); | ||
|
||
ClearCommand = new Command<ContextMenu>((contextMenu) => | ||
{ | ||
TextBox textBox = contextMenu.Parent.Parent as TextBox; | ||
|
||
textBox.Text = ""; | ||
}); | ||
} | ||
public Command<ContextMenu> CutCommand { get; set; } | ||
public Command<ContextMenu> CopyCommand { get; set; } | ||
public Command<ContextMenu> PasteCommand { get; set; } | ||
public Command<ContextMenu> ClearCommand { get; set; } | ||
public Command<ContextMenu> SelctAllCommand { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
Cross-Platform/SignalGoTest.Desktop/SignalGoTest.Desktop.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
Cross-Platform/SignalGoTest.Desktop/Views/JsonTemplateWindow.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<Window xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
Title="JsonTemplateWindow" Width="500" MaxHeight="500"> | ||
<TextBox x:Name="TxtJson" AcceptsReturn="True" TextWrapping="Wrap" IsReadOnly="True"> | ||
Title="JsonTemplateWindow" Width="500" MaxHeight="500" FontFamily="Tahoma"> | ||
<TextBox x:Name="TxtJson" AcceptsReturn="True" TextWrapping="Wrap" IsReadOnly="True" > | ||
|
||
</TextBox> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters