This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
-
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
Showing
8 changed files
with
216 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Docdown.Model | ||
{ | ||
public class NewFile | ||
{ | ||
public string Extension { get; set; } | ||
public byte[] Content { get; set; } | ||
public string Name { 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@book{Sample.2019, | ||
year = {2019}, | ||
title = {A sample book name}, | ||
address = {Cham}, | ||
publisher = {{Springer International Publishing}}, | ||
isbn = {178-2-389-02895-1}, | ||
doi = {10.1007/178-2-389-02895-1} | ||
} |
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,24 @@ | ||
--- | ||
lang: de-DE | ||
disable-arabic-start: true | ||
... | ||
|
||
\section*{List of Abbreviations} | ||
\addcontentsline{toc}{section}{List of Abbreviations} | ||
\markright{List of Abbreviations} | ||
|
||
\begin{acronym}[List of Abbreviations] | ||
\acro{SE}{Software Engineering} | ||
\acro{JSON}{Java Script Object Notation} | ||
\acro{HTML}{Hypertext Markup Language} | ||
\end{acronym} | ||
|
||
\pagenumbering{arabic} | ||
|
||
\pagebreak | ||
# Introduction | ||
|
||
\pagebreak | ||
\pagenumbering{roman} | ||
\setcounter{page}{3} | ||
# References |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using Docdown.Model; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Docdown.ViewModel | ||
{ | ||
public class NewFileViewModel : ObservableList<NewFile> | ||
{ | ||
public NewFile Selected | ||
{ | ||
get => selected; | ||
set => Set(ref selected, value); | ||
} | ||
|
||
public string Name | ||
{ | ||
get => name; | ||
set => Set(ref name, value); | ||
} | ||
|
||
private NewFile selected; | ||
private string name; | ||
|
||
|
||
public NewFileViewModel() | ||
{ | ||
|
||
} | ||
|
||
[ChangeListener(nameof(Selected))] | ||
private void SelectedChanged() | ||
{ | ||
if (selected != null) | ||
{ | ||
Name = $"{selected.Name.ToLower()}.{selected.Extension}"; | ||
} | ||
} | ||
|
||
public async Task LoadAsync() | ||
{ | ||
var asm = typeof(NewFileViewModel).Assembly; | ||
var names = asm.GetManifestResourceNames().Where(e => e.StartsWith("Docdown.Resources.Templates.")); | ||
|
||
foreach (var name in names) | ||
{ | ||
var extension = Path.GetExtension(name).Substring(1); | ||
var pre = Path.GetFileNameWithoutExtension(name); | ||
var fileName = Path.GetExtension(pre).Substring(1); | ||
|
||
var file = new NewFile | ||
{ | ||
Name = fileName, | ||
Extension = extension | ||
}; | ||
|
||
using (var ms = new MemoryStream()) | ||
{ | ||
using (var rs = asm.GetManifestResourceStream(name)) | ||
{ | ||
await rs.CopyToAsync(ms); | ||
} | ||
file.Content = ms.ToArray(); | ||
} | ||
Add(file); | ||
} | ||
if (Count > 0) | ||
{ | ||
Selected = this[0]; | ||
} | ||
} | ||
} | ||
} |
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,47 @@ | ||
<Metro:MetroWindow x:Class="Docdown.Windows.NewFileWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:Docdown.Windows" | ||
xmlns:Metro="http://metro.mahapps.com/winfx/xaml/controls" | ||
mc:Ignorable="d" | ||
Style="{StaticResource SlimWindowStyle}" | ||
TitleTemplate="{StaticResource DefaultTitleTemplate}" | ||
IconTemplate="{x:Null}" | ||
Title="Create New File" Height="450" Width="400" Background="{DynamicResource WhiteBrush}"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<ListView Grid.Row="0" ItemsSource="{Binding}" SelectedItem="{Binding Selected}"> | ||
<ListView.ItemsPanel> | ||
<ItemsPanelTemplate> | ||
<StackPanel Orientation="Vertical"/> | ||
</ItemsPanelTemplate> | ||
</ListView.ItemsPanel> | ||
<ListView.ItemTemplate> | ||
<DataTemplate> | ||
<Grid Margin="4 8"> | ||
<TextBlock Text="{Binding Name}" HorizontalAlignment="Left"/> | ||
<TextBlock Text="{Binding Extension}" HorizontalAlignment="Right"/> | ||
</Grid> | ||
</DataTemplate> | ||
</ListView.ItemTemplate> | ||
</ListView> | ||
<Grid Grid.Row="1"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="*"/> | ||
</Grid.ColumnDefinitions> | ||
<TextBlock Grid.Column="0" Text="Name: " VerticalAlignment="Center" Margin="4" Foreground="{DynamicResource BlackBrush}"/> | ||
<TextBox Grid.Column="1" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Margin="4"/> | ||
</Grid> | ||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right"> | ||
<Button Content="OK" Style="{StaticResource MetroFlatButton}" Margin="4" Click="OKClicked"/> | ||
<Button Content="Close" Style="{StaticResource MetroFlatButton}" Margin="4" Click="CloseClicked"/> | ||
</StackPanel> | ||
</Grid> | ||
</Metro:MetroWindow> |
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,22 @@ | ||
using System.Windows; | ||
|
||
namespace Docdown.Windows | ||
{ | ||
public partial class NewFileWindow | ||
{ | ||
public NewFileWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void OKClicked(object sender, RoutedEventArgs e) | ||
{ | ||
DialogResult = true; | ||
} | ||
|
||
private void CloseClicked(object sender, RoutedEventArgs e) | ||
{ | ||
DialogResult = false; | ||
} | ||
} | ||
} |