mirror of
https://onedev.site.tesses.net/crosslang/crosslangdevstudio
synced 2026-02-08 09:15:45 +00:00
First Commit
This commit is contained in:
17
Views/FileEditorView.axaml
Normal file
17
Views/FileEditorView.axaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:vm="clr-namespace:CrossLangDevStudio.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="CrossLangDevStudio.Views.FileEditorView"
|
||||
x:DataType="vm:FileEditorViewModel">
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:FileEditorViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<TextBox FontSize="24" FontFamily="{StaticResource AardvarkFont}" Text="{Binding Text}" AcceptsReturn="True" AcceptsTab="True" TextWrapping="Wrap"/>
|
||||
|
||||
</UserControl>
|
||||
12
Views/FileEditorView.axaml.cs
Normal file
12
Views/FileEditorView.axaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
using CrossLangDevStudio.ViewModels;
|
||||
|
||||
namespace CrossLangDevStudio.Views;
|
||||
|
||||
public partial class FileEditorView : UserControl
|
||||
{
|
||||
public FileEditorView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
86
Views/MainWindow.axaml
Normal file
86
Views/MainWindow.axaml
Normal file
@@ -0,0 +1,86 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:CrossLangDevStudio.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="CrossLangDevStudio.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Icon="/Assets/crosslang.ico"
|
||||
Title="CrossLang DevStudio"
|
||||
xmlns:controls="clr-namespace:Tabalonia.Controls;assembly=Tabalonia">
|
||||
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:MainWindowViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Menu Grid.Row="0">
|
||||
<MenuItem Header="_File">
|
||||
<MenuItem Header="_New Project" HotKey="Ctrl+N" Command="{Binding NewProjectCommand}"/>
|
||||
<MenuItem Header="_Open Project" HotKey="Ctrl+O" Command="{Binding OpenProjectCommand}"/>
|
||||
<MenuItem Header="_Save" HotKey="Ctrl+S" Command="{Binding SaveCommand}"/>
|
||||
<MenuItem Header="Save All" HotKey="Ctrl+Shift+S" Command="{Binding SaveAllCommand}"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="_Exit" HotKey="Alt+F4"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Project">
|
||||
<MenuItem Header="Build" Command="{Binding BuildCommand}" />
|
||||
<MenuItem Header="Build And Run" HotKey="F5" Command="{Binding BuildAndRunCommand}" />
|
||||
<MenuItem Header="Open In File Manager" Command="{Binding OpenProjectInFileManagerCommand}" />
|
||||
<MenuItem Header="Open In Terminal" HotKey="CTRL+T" Command="{Binding OpenProjectInTerminalCommand}" />
|
||||
<MenuItem Header="Refresh" HotKey="CTRL+R" Command="{Binding RefreshListingCommand}" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Grid Grid.Row="1" ColumnDefinitions="300, 4, *">
|
||||
<TreeView Grid.Column="0" ItemsSource="{Binding ProjectFiles}" SelectedItem="{Binding SelectedProjectFile}">
|
||||
<!--Thanks to https://stackoverflow.com/a/77362693 -->
|
||||
<TreeView.ItemContainerTheme>
|
||||
<ControlTheme TargetType="TreeViewItem" BasedOn="{StaticResource {x:Type TreeViewItem}}">
|
||||
<Setter Property="IsExpanded" Value="True" />
|
||||
</ControlTheme>
|
||||
</TreeView.ItemContainerTheme>
|
||||
<TreeView.ItemTemplate>
|
||||
<TreeDataTemplate ItemsSource="{Binding SubNodes}">
|
||||
<TextBlock Text="{Binding Title}"/>
|
||||
</TreeDataTemplate>
|
||||
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
|
||||
<GridSplitter Grid.Column="1" Background="Black" ResizeDirection="Columns"/>
|
||||
|
||||
<controls:TabsControl SelectedItem="{Binding SelectedTab}" Grid.Column="2" ItemsSource="{Binding TabItems}"
|
||||
NewItemFactory="{Binding NewItemFactory}"
|
||||
LastTabClosedAction="{Binding Closed}"
|
||||
ShowDefaultAddButton="True"
|
||||
ShowDefaultCloseButton="True"
|
||||
Margin="0 8 0 0"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<TabControl.ContentTemplate>
|
||||
<DataTemplate DataType="vm:TabItemViewModel">
|
||||
|
||||
<Grid Background="{DynamicResource SelectedTabItemBackgroundBrush}">
|
||||
<TransitioningContentControl Content="{Binding Body}" Grid.Column="2"/>
|
||||
</Grid>
|
||||
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:TabItemViewModel">
|
||||
<TextBlock Text="{Binding Header}" />
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
|
||||
</controls:TabsControl>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
38
Views/MainWindow.axaml.cs
Normal file
38
Views/MainWindow.axaml.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using CrossLangDevStudio.Messages;
|
||||
using CrossLangDevStudio.ViewModels;
|
||||
|
||||
namespace CrossLangDevStudio.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Design.IsDesignMode)
|
||||
return;
|
||||
|
||||
// Whenever 'Send(new PurchaseAlbumMessage())' is called, invoke this callback on the MainWindow instance:
|
||||
WeakReferenceMessenger.Default.Register<MainWindow, NewProjectMessage>(this, static (w, m) =>
|
||||
{
|
||||
// Create an instance of MusicStoreWindow and set MusicStoreViewModel as its DataContext.
|
||||
var dialog = new NewProjectDialog
|
||||
{
|
||||
DataContext = new NewProjectDialogViewModel()
|
||||
};
|
||||
// Show dialog window and reply with returned AlbumViewModel or null when the dialog is closed.
|
||||
m.Reply(dialog.ShowDialog<string?>(w));
|
||||
});
|
||||
WeakReferenceMessenger.Default.Register<MainWindow, GetWindowMessage>(this, static (w, m) =>
|
||||
{
|
||||
m.Reply(w);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
69
Views/NewProjectDialog.axaml
Normal file
69
Views/NewProjectDialog.axaml
Normal file
@@ -0,0 +1,69 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:CrossLangDevStudio.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
Width="640"
|
||||
Height="480"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
x:Class="CrossLangDevStudio.Views.NewProjectDialog"
|
||||
x:DataType="vm:NewProjectDialogViewModel"
|
||||
Icon="/Assets/crosslang.ico"
|
||||
Title="New Project">
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:NewProjectDialogViewModel/>
|
||||
</Design.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox Grid.Row="0" ItemsSource="{Binding CrossLangTemplates}" SelectedItem="{Binding SelectedTemplate}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="64" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" Source="{Binding Icon}" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="Name: " />
|
||||
<TextBox Grid.Column="1" Text="{Binding Name}" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="Parent Directory: " />
|
||||
<TextBox Grid.Column="1" Text="{Binding ParentDirectory}"/>
|
||||
<Button Grid.Column="2" Content="Browse..." />
|
||||
</Grid>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="1" Content="OK" Command="{Binding OKCommand}" />
|
||||
<Button Grid.Column="2" Content="Cancel" Command="{Binding CancelCommand}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
21
Views/NewProjectDialog.axaml.cs
Normal file
21
Views/NewProjectDialog.axaml.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Diagnostics;
|
||||
using Avalonia.Controls;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using CrossLangDevStudio.Messages;
|
||||
|
||||
namespace CrossLangDevStudio.Views;
|
||||
|
||||
public partial class NewProjectDialog : Window
|
||||
{
|
||||
public NewProjectDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
if (Design.IsDesignMode) return;
|
||||
|
||||
WeakReferenceMessenger.Default.Register<NewProjectDialog, NewProjectCloseMessage>(this, static (w, m) =>
|
||||
{
|
||||
w.Close(m.Path);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
27
Views/NewTabView.axaml
Normal file
27
Views/NewTabView.axaml
Normal file
@@ -0,0 +1,27 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:vm="clr-namespace:CrossLangDevStudio.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="CrossLangDevStudio.Views.NewTabView"
|
||||
x:DataType="vm:NewTabViewModel">
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:NewTabViewModel />
|
||||
</Design.DataContext>
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Margin="0 5" >Path:</TextBlock>
|
||||
<TextBox Watermark="Path" Text="{Binding FilePath}"/>
|
||||
|
||||
<Button Content="New File" Command="{Binding CreateFileCommand}" />
|
||||
<Button Content="New Folder" Command="{Binding CreateDirectoryCommand}" />
|
||||
<TextBlock Margin="0 5" >Url:</TextBlock>
|
||||
<TextBox Watermark="Url" Text="{Binding Url}"/>
|
||||
<Button Content="Download File" Command="{Binding DownloadFileCommand}" />
|
||||
<ProgressBar Margin="0 10" Height="20"
|
||||
Minimum="0.0" Maximum="1.0" Value="{Binding Progress}"
|
||||
ShowProgressText="True"/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
12
Views/NewTabView.axaml.cs
Normal file
12
Views/NewTabView.axaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
using CrossLangDevStudio.ViewModels;
|
||||
|
||||
namespace CrossLangDevStudio.Views;
|
||||
|
||||
public partial class NewTabView : UserControl
|
||||
{
|
||||
public NewTabView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
56
Views/ProjectConfigurationView.axaml
Normal file
56
Views/ProjectConfigurationView.axaml
Normal file
@@ -0,0 +1,56 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:vm="clr-namespace:CrossLangDevStudio.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="CrossLangDevStudio.Views.ProjectConfigurationView"
|
||||
x:DataType="vm:ProjectConfigurationViewModel">
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:ProjectConfigurationViewModel />
|
||||
</Design.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer>
|
||||
|
||||
<StackPanel Grid.Row="0" Margin="20">
|
||||
<TextBlock Margin="0 5" >Name:</TextBlock>
|
||||
<TextBox Watermark="Project Name" Text="{Binding Name}"/>
|
||||
<TextBlock Margin="0 5" >Version:</TextBlock>
|
||||
<TextBox Watermark="Project Version" Text="{Binding Version}"/>
|
||||
<TextBlock Margin="0 5" >Icon:</TextBlock>
|
||||
<TextBox Watermark="Project Icon" Text="{Binding Icon}"/>
|
||||
<TextBlock Margin="0 5" >Type:</TextBlock>
|
||||
<ComboBox SelectedIndex="{Binding Type}" MaxDropDownHeight="100" HorizontalAlignment="Stretch">
|
||||
<ComboBoxItem>Console Application</ComboBoxItem>
|
||||
<ComboBoxItem>Library</ComboBoxItem>
|
||||
<ComboBoxItem>Web Application</ComboBoxItem>
|
||||
<ComboBoxItem>Template</ComboBoxItem>
|
||||
<ComboBoxItem>Compile Tool</ComboBoxItem>
|
||||
<ComboBoxItem>Tool</ComboBoxItem>
|
||||
<ComboBoxItem>Archive</ComboBoxItem>
|
||||
</ComboBox>
|
||||
<TextBlock Margin="0 5" >Maintainer:</TextBlock>
|
||||
<TextBox Watermark="Project Maintainer" Text="{Binding Maintainer}"/>
|
||||
<TextBlock Margin="0 5" >Repository:</TextBlock>
|
||||
<TextBox Watermark="Project Repository" Text="{Binding Repository}"/>
|
||||
<TextBlock Margin="0 5" >Homepage:</TextBlock>
|
||||
<TextBox Watermark="Project Homepage" Text="{Binding Homepage}"/>
|
||||
<TextBlock Margin="0 5" >License:</TextBlock>
|
||||
<TextBox Watermark="Project License" Text="{Binding License}"/>
|
||||
<TextBlock Margin="0 5" >Template Name (Shown in crosslang new --list):</TextBlock>
|
||||
<TextBox Watermark="Project Template Name" Text="{Binding TemplateName}"/>
|
||||
<TextBlock Margin="0 5" >Template Pretty Name (Shown in new project):</TextBlock>
|
||||
<TextBox Watermark="Project Template Pretty Name" Text="{Binding TemplateNamePretty}"/>
|
||||
<TextBlock Margin="0 15 0 5">Description:</TextBlock>
|
||||
<TextBox Height="100" Text="{Binding Description}" AcceptsReturn="True" AcceptsTab="True" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<Button Margin="20" Grid.Row="1" Content="Save" Command="{Binding SaveCommand}" HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
11
Views/ProjectConfigurationView.axaml.cs
Normal file
11
Views/ProjectConfigurationView.axaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace CrossLangDevStudio.Views;
|
||||
|
||||
public partial class ProjectConfigurationView : UserControl
|
||||
{
|
||||
public ProjectConfigurationView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
46
Views/WelcomeView.axaml
Normal file
46
Views/WelcomeView.axaml
Normal file
@@ -0,0 +1,46 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:vm="clr-namespace:CrossLangDevStudio.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="CrossLangDevStudio.Views.WelcomeView"
|
||||
x:DataType="vm:WelcomeViewModel">
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:WelcomeViewModel />
|
||||
</Design.DataContext>
|
||||
<Border
|
||||
Padding="100">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<StackPanel Grid.Row="0">
|
||||
<TextBlock FontSize="32" FontWeight="Bold" Text="CrossLang DevStudio" />
|
||||
|
||||
<TextBlock FontSize="16" FontWeight="Bold" Text="Start" />
|
||||
|
||||
|
||||
<HyperlinkButton Content="New Project" Command="{Binding NewProjectCommand}"/>
|
||||
<HyperlinkButton Content="Open Project" Command="{Binding OpenProjectCommand}"/>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1">
|
||||
<TextBlock FontSize="16" FontWeight="Bold" Text="Recent" />
|
||||
<ItemsControl ItemsSource="{Binding RecentProjects}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<HyperlinkButton Content="{Binding Name}" Command="{Binding ClickCommand}"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
11
Views/WelcomeView.axaml.cs
Normal file
11
Views/WelcomeView.axaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace CrossLangDevStudio.Views;
|
||||
|
||||
public partial class WelcomeView : UserControl
|
||||
{
|
||||
public WelcomeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user