mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
rearrange and add new editor button
This commit is contained in:
parent
802ae6a613
commit
4aee0a33f1
@ -43,10 +43,16 @@
|
||||
SyntaxHighlighting="XML"
|
||||
TextChanged="OnCodeChanged" />
|
||||
|
||||
<ui:Button
|
||||
Grid.Row="2"
|
||||
Margin="10"
|
||||
Command="{Binding Path=OpenThemeFolderCommand, Mode=OneTime}"
|
||||
Content="Open Theme Folder" />
|
||||
|
||||
<Grid
|
||||
Grid.Row="2"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Center">
|
||||
HorizontalAlignment="Right">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@ -54,15 +60,14 @@
|
||||
|
||||
<ui:Button
|
||||
Grid.Column="0"
|
||||
Margin="0,0,5,0"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,0,4,0"
|
||||
Command="{Binding Path=PreviewCommand, Mode=OneTime}"
|
||||
Content="Preview" />
|
||||
|
||||
<ui:Button
|
||||
Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="4,0,0,0"
|
||||
Appearance="Primary"
|
||||
Command="{Binding Path=SaveCommand, Mode=OneTime}"
|
||||
Content="Save" />
|
||||
</Grid>
|
||||
|
@ -136,10 +136,13 @@ namespace Bloxstrap.UI.Elements.Editor
|
||||
{
|
||||
CustomBootstrapperSchema.ParseSchema();
|
||||
|
||||
string themeContents = File.ReadAllText(Path.Combine(Paths.CustomThemes, name, "Theme.xml"));
|
||||
string directory = Path.Combine(Paths.CustomThemes, name);
|
||||
|
||||
string themeContents = File.ReadAllText(Path.Combine(directory, "Theme.xml"));
|
||||
themeContents = ToCRLF(themeContents); // make sure the theme is in CRLF. a function expects CRLF.
|
||||
|
||||
var viewModel = new BootstrapperEditorWindowViewModel();
|
||||
viewModel.Directory = directory;
|
||||
viewModel.Name = name;
|
||||
viewModel.Title = $"Editing \"{name}\"";
|
||||
viewModel.Code = themeContents;
|
||||
|
@ -16,6 +16,9 @@ namespace Bloxstrap.UI.ViewModels.Editor
|
||||
|
||||
public ICommand PreviewCommand => new RelayCommand(Preview);
|
||||
public ICommand SaveCommand => new RelayCommand(Save);
|
||||
public ICommand OpenThemeFolderCommand => new RelayCommand(OpenThemeFolder);
|
||||
|
||||
public string Directory { get; set; } = "";
|
||||
|
||||
public string Name { get; set; } = "";
|
||||
public string Title { get; set; } = "Editing \"Custom Theme\"";
|
||||
@ -66,5 +69,10 @@ namespace Bloxstrap.UI.ViewModels.Editor
|
||||
Frontend.ShowMessageBox($"Failed to save theme: {ex.Message}", MessageBoxImage.Error, MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenThemeFolder()
|
||||
{
|
||||
Process.Start("explorer.exe", Directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user