init
This commit is contained in:
commit
68c6bead0a
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Chapplication/bin/
|
||||||
|
Chapplication/obj/
|
||||||
|
.idea
|
13
.idea/.idea.Chapplication/.idea/.gitignore
vendored
Normal file
13
.idea/.idea.Chapplication/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/.idea.Chapplication.iml
|
||||||
|
/contentModel.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/modules.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
10
.idea/.idea.Chapplication/.idea/avalonia.xml
Normal file
10
.idea/.idea.Chapplication/.idea/avalonia.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AvaloniaProject">
|
||||||
|
<option name="projectPerEditor">
|
||||||
|
<map>
|
||||||
|
<entry key="Chapplication/MainWindow.axaml" value="Chapplication/Chapplication.csproj" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/.idea.Chapplication/.idea/indexLayout.xml
Normal file
8
.idea/.idea.Chapplication/.idea/indexLayout.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
4
.idea/.idea.Chapplication/.idea/vcs.xml
Normal file
4
.idea/.idea.Chapplication/.idea/vcs.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings" defaultProject="true" />
|
||||||
|
</project>
|
16
Chapplication.sln
Normal file
16
Chapplication.sln
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chapplication", "Chapplication\Chapplication.csproj", "{B0B9217D-8FE2-4D94-BC88-45D59963AC6D}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{B0B9217D-8FE2-4D94-BC88-45D59963AC6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B0B9217D-8FE2-4D94-BC88-45D59963AC6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B0B9217D-8FE2-4D94-BC88-45D59963AC6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B0B9217D-8FE2-4D94-BC88-45D59963AC6D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
10
Chapplication/App.axaml
Normal file
10
Chapplication/App.axaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Application xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
x:Class="Chapplication.App"
|
||||||
|
RequestedThemeVariant="Default">
|
||||||
|
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||||
|
|
||||||
|
<Application.Styles>
|
||||||
|
<FluentTheme />
|
||||||
|
</Application.Styles>
|
||||||
|
</Application>
|
23
Chapplication/App.axaml.cs
Normal file
23
Chapplication/App.axaml.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace Chapplication;
|
||||||
|
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnFrameworkInitializationCompleted()
|
||||||
|
{
|
||||||
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
|
{
|
||||||
|
desktop.MainWindow = new MainWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnFrameworkInitializationCompleted();
|
||||||
|
}
|
||||||
|
}
|
26
Chapplication/Chapplication.csproj
Normal file
26
Chapplication/Chapplication.csproj
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Avalonia" Version="11.2.1"/>
|
||||||
|
<PackageReference Include="Avalonia.Desktop" Version="11.2.1"/>
|
||||||
|
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.1"/>
|
||||||
|
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.1"/>
|
||||||
|
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||||
|
<PackageReference Include="Avalonia.Diagnostics" Version="11.2.1">
|
||||||
|
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||||
|
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Views\" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
53
Chapplication/MainWindow.axaml
Normal file
53
Chapplication/MainWindow.axaml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<Window 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"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="Chapplication.MainWindow"
|
||||||
|
Title="Chapplication">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<ListBox
|
||||||
|
x:Name="ChatBox"
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Margin="10" />
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
x:Name="ChatInputBox"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="0"
|
||||||
|
Height="30"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
Margin="10,0,5,10"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
KeyDown="ChatInputBox_OnKeyDown"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="SendButton"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
Content="Send"
|
||||||
|
Width="80"
|
||||||
|
Height="30"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
Margin="5,0,10,10"
|
||||||
|
Click="SubmitButton_OnClick"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</Window>
|
50
Chapplication/MainWindow.axaml.cs
Normal file
50
Chapplication/MainWindow.axaml.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Controls.Primitives;
|
||||||
|
using Avalonia.Input;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using Chapplication.Models;
|
||||||
|
|
||||||
|
namespace Chapplication;
|
||||||
|
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
|
||||||
|
private ObservableCollection<string> _messages = new();
|
||||||
|
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
ChatBox.ItemsSource = _messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SubmitButton_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SendMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChatInputBox_OnKeyDown(object? sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
SendMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SendMessage()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(ChatInputBox.Text))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// _messages.Add(ChatInputBox.Text);
|
||||||
|
// ChatInputBox.Text = string.Empty;
|
||||||
|
// ChatInputBox.Focus();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
6
Chapplication/Models/Conversation.cs
Normal file
6
Chapplication/Models/Conversation.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace Chapplication.Models;
|
||||||
|
|
||||||
|
public class Conversation
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
6
Chapplication/Models/Friend.cs
Normal file
6
Chapplication/Models/Friend.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace Chapplication.Models;
|
||||||
|
|
||||||
|
public class Friend
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
6
Chapplication/Models/Message.cs
Normal file
6
Chapplication/Models/Message.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace Chapplication.Models;
|
||||||
|
|
||||||
|
public class Message
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
6
Chapplication/Models/User.cs
Normal file
6
Chapplication/Models/User.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace Chapplication.Models;
|
||||||
|
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
21
Chapplication/Program.cs
Normal file
21
Chapplication/Program.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Chapplication;
|
||||||
|
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||||
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
|
// yet and stuff might break.
|
||||||
|
[STAThread]
|
||||||
|
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||||
|
.StartWithClassicDesktopLifetime(args);
|
||||||
|
|
||||||
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
|
=> AppBuilder.Configure<App>()
|
||||||
|
.UsePlatformDetect()
|
||||||
|
.WithInterFont()
|
||||||
|
.LogToTrace();
|
||||||
|
}
|
18
Chapplication/app.manifest
Normal file
18
Chapplication/app.manifest
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<!-- This manifest is used on Windows only.
|
||||||
|
Don't remove it as it might cause problems with window transparency and embedded controls.
|
||||||
|
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="Chapplication.Desktop"/>
|
||||||
|
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- A list of the Windows versions that this application has been tested on
|
||||||
|
and is designed to work with. Uncomment the appropriate elements
|
||||||
|
and Windows will automatically select the most compatible environment. -->
|
||||||
|
|
||||||
|
<!-- Windows 10 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
</assembly>
|
Loading…
Reference in New Issue
Block a user