mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Work on UI (commands)
This commit is contained in:
parent
1d44d69b94
commit
3d0a028920
2
RainmeterEditor/Resources/Strings.Designer.cs
generated
2
RainmeterEditor/Resources/Strings.Designer.cs
generated
@ -70,7 +70,7 @@ namespace RainmeterEditor.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New file....
|
||||
/// Looks up a localized string similar to _File....
|
||||
/// </summary>
|
||||
internal static string DocumentCreateCommand_DisplayText {
|
||||
get {
|
||||
|
@ -121,7 +121,7 @@
|
||||
<value>Utility</value>
|
||||
</data>
|
||||
<data name="DocumentCreateCommand_DisplayText" xml:space="preserve">
|
||||
<value>New file...</value>
|
||||
<value>_File...</value>
|
||||
</data>
|
||||
<data name="DocumentCreateCommand_ToolTip" xml:space="preserve">
|
||||
<value>Creates a new file</value>
|
||||
|
@ -27,17 +27,14 @@
|
||||
<Menu Grid.Row="0" Grid.ColumnSpan="10">
|
||||
<MenuItem Header="_File">
|
||||
<MenuItem Header="_New">
|
||||
<MenuItem Header="_File..."
|
||||
DataContext="{DynamicResource DocumentCreateCommand}"
|
||||
Command="{Binding}"
|
||||
ToolTip="{Binding Tooltip}"
|
||||
<MenuItem DataContext="{Binding DocumentCreateCommand}"
|
||||
Command="{Binding}" Header="{Binding DisplayText}" ToolTip="{Binding Tooltip}"
|
||||
InputGestureText="{Binding ShortcutText}">
|
||||
<MenuItem.Icon>
|
||||
<Image DataContext="{DynamicResource DocumentCreateCommand}"
|
||||
Source="{Binding Icon}" />
|
||||
<Image Source="{Binding Icon}" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Project..." Command="{DynamicResource CreateFileCommand}">
|
||||
<MenuItem Header="_Project..." Command="{Binding DocumentCreateCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="/Resources/Icons/project_star_16.png" />
|
||||
</MenuItem.Icon>
|
||||
@ -62,6 +59,10 @@
|
||||
<Image Width="16" Height="16" Source="/Resources/Icons/arrow_forward_16.png" />
|
||||
</Button>
|
||||
<Separator />
|
||||
<Button DataContext="{Binding DocumentCreateCommand}"
|
||||
Command="{Binding}" ToolTip="{Binding Tooltip}">
|
||||
<Image Source="{Binding Icon}" />
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
|
||||
|
@ -24,30 +24,25 @@ namespace RainmeterEditor.UI
|
||||
{
|
||||
private DocumentController documentController;
|
||||
|
||||
private IEnumerable<Command> Commands
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return documentController.DocumentCreateCommand;
|
||||
}
|
||||
}
|
||||
public Command DocumentCreateCommand { get { return documentController.DocumentCreateCommand; } }
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = this;
|
||||
|
||||
documentController = new DocumentController();
|
||||
documentController.OwnerWindow = this;
|
||||
documentController.DocumentOpened += documentController_DocumentOpened;
|
||||
AddKeyBinding(documentController.DocumentCreateCommand);
|
||||
}
|
||||
|
||||
foreach (var c in Commands)
|
||||
private void AddKeyBinding(Command c)
|
||||
{
|
||||
Resources.Add(c.Name, c);
|
||||
|
||||
if (c.Shortcut != null)
|
||||
InputBindings.Add(new KeyBinding(c, c.Shortcut));
|
||||
}
|
||||
}
|
||||
|
||||
void documentController_DocumentOpened(object sender, DocumentOpenedEventArgs e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user