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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to New file....
|
/// Looks up a localized string similar to _File....
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string DocumentCreateCommand_DisplayText {
|
internal static string DocumentCreateCommand_DisplayText {
|
||||||
get {
|
get {
|
||||||
|
@ -121,7 +121,7 @@
|
|||||||
<value>Utility</value>
|
<value>Utility</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="DocumentCreateCommand_DisplayText" xml:space="preserve">
|
<data name="DocumentCreateCommand_DisplayText" xml:space="preserve">
|
||||||
<value>New file...</value>
|
<value>_File...</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="DocumentCreateCommand_ToolTip" xml:space="preserve">
|
<data name="DocumentCreateCommand_ToolTip" xml:space="preserve">
|
||||||
<value>Creates a new file</value>
|
<value>Creates a new file</value>
|
||||||
|
@ -27,17 +27,14 @@
|
|||||||
<Menu Grid.Row="0" Grid.ColumnSpan="10">
|
<Menu Grid.Row="0" Grid.ColumnSpan="10">
|
||||||
<MenuItem Header="_File">
|
<MenuItem Header="_File">
|
||||||
<MenuItem Header="_New">
|
<MenuItem Header="_New">
|
||||||
<MenuItem Header="_File..."
|
<MenuItem DataContext="{Binding DocumentCreateCommand}"
|
||||||
DataContext="{DynamicResource DocumentCreateCommand}"
|
Command="{Binding}" Header="{Binding DisplayText}" ToolTip="{Binding Tooltip}"
|
||||||
Command="{Binding}"
|
|
||||||
ToolTip="{Binding Tooltip}"
|
|
||||||
InputGestureText="{Binding ShortcutText}">
|
InputGestureText="{Binding ShortcutText}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<Image DataContext="{DynamicResource DocumentCreateCommand}"
|
<Image Source="{Binding Icon}" />
|
||||||
Source="{Binding Icon}" />
|
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="_Project..." Command="{DynamicResource CreateFileCommand}">
|
<MenuItem Header="_Project..." Command="{Binding DocumentCreateCommand}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<Image Source="/Resources/Icons/project_star_16.png" />
|
<Image Source="/Resources/Icons/project_star_16.png" />
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
@ -62,6 +59,10 @@
|
|||||||
<Image Width="16" Height="16" Source="/Resources/Icons/arrow_forward_16.png" />
|
<Image Width="16" Height="16" Source="/Resources/Icons/arrow_forward_16.png" />
|
||||||
</Button>
|
</Button>
|
||||||
<Separator />
|
<Separator />
|
||||||
|
<Button DataContext="{Binding DocumentCreateCommand}"
|
||||||
|
Command="{Binding}" ToolTip="{Binding Tooltip}">
|
||||||
|
<Image Source="{Binding Icon}" />
|
||||||
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
|
|
||||||
|
@ -24,29 +24,24 @@ namespace RainmeterEditor.UI
|
|||||||
{
|
{
|
||||||
private DocumentController documentController;
|
private DocumentController documentController;
|
||||||
|
|
||||||
private IEnumerable<Command> Commands
|
public Command DocumentCreateCommand { get { return documentController.DocumentCreateCommand; } }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
yield return documentController.DocumentCreateCommand;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.DataContext = this;
|
||||||
|
|
||||||
documentController = new DocumentController();
|
documentController = new DocumentController();
|
||||||
documentController.OwnerWindow = this;
|
documentController.OwnerWindow = this;
|
||||||
documentController.DocumentOpened += documentController_DocumentOpened;
|
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));
|
||||||
if (c.Shortcut != null)
|
|
||||||
InputBindings.Add(new KeyBinding(c, c.Shortcut));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void documentController_DocumentOpened(object sender, DocumentOpenedEventArgs e)
|
void documentController_DocumentOpened(object sender, DocumentOpenedEventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user