提交窗口功能完成

This commit is contained in:
yzx 2024-10-31 15:48:08 +08:00
parent 704ebc12d8
commit 0698dce205
22 changed files with 233 additions and 62 deletions

View File

@ -8,10 +8,11 @@
</component>
<component name="ChangeListManager">
<list default="true" id="0ae961c9-2aa8-4465-9e53-e04d62044e0d" name="更改" comment="">
<change afterPath="$PROJECT_DIR$/ToolsForm/Assets/img/UploadExperiment/提交.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.ToolsForm/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.ToolsForm/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ToolsForm/Models/IdeModel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Models/IdeModel.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ToolsForm/Views/IDEWindow2.axaml.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Views/IDEWindow2.axaml.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ToolsForm/Views/OverviewWindow.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Views/OverviewWindow.axaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ToolsForm/Assets/img/检测中-悬浮.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/ToolsForm/Views/ExperimentWindow.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Views/ExperimentWindow.axaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ToolsForm/Views/ExperimentWindow.axaml.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Views/ExperimentWindow.axaml.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentWindow.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentWindow.axaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentWindow.axaml.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentWindow.axaml.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/ToolsForm.dll" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/ToolsForm.dll" afterDir="false" />
@ -143,7 +144,7 @@
<workItem from="1729819752329" duration="7261000" />
<workItem from="1729835370931" duration="39273000" />
<workItem from="1730253804607" duration="6537000" />
<workItem from="1730270228361" duration="23639000" />
<workItem from="1730270228361" duration="29342000" />
</task>
<servers />
</component>
@ -195,6 +196,32 @@
</properties>
<option name="timeStamp" value="5" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/ToolsForm/Views/ExperimentWindow.axaml.cs</url>
<line>178</line>
<properties documentPath="E:\Unity Projects\GitLab\2024\ICT_ToolsForm\ToolsForm\ToolsForm\Views\ExperimentWindow.axaml.cs" containingFunctionPresentation="方法 'UpdateButtonImages'">
<startOffsets>
<option value="6147" />
</startOffsets>
<endOffsets>
<option value="6186" />
</endOffsets>
</properties>
<option name="timeStamp" value="7" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/ToolsForm/Views/ExperimentWindow.axaml.cs</url>
<line>220</line>
<properties documentPath="E:\Unity Projects\GitLab\2024\ICT_ToolsForm\ToolsForm\ToolsForm\Views\ExperimentWindow.axaml.cs" containingFunctionPresentation="方法 'FindImagesInVisualTree'">
<startOffsets>
<option value="7481" />
</startOffsets>
<endOffsets>
<option value="7530" />
</endOffsets>
</properties>
<option name="timeStamp" value="8" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -173,26 +173,45 @@
</Button>
<!-- <Button -->
<!-- Canvas.Left="1" -->
<!-- Canvas.Top="500" -->
<!-- Click="UploadButton_OnClick" -->
<!-- Name="ExperimentButton"> -->
<!-- <Button.Template> -->
<!-- <ControlTemplate> -->
<!-- <Grid x:Name="TemplateRoot"> -->
<!-- <Image Source="../Assets/img/提交实验-默认.png" x:Name="DefaultImage" /> -->
<!-- <Image -->
<!-- IsVisible="False" -->
<!-- Source="../Assets/img/提交实验-悬浮.png" -->
<!-- x:Name="HoverImage" /> -->
<!-- <Image -->
<!-- IsVisible="False" -->
<!-- Source="../Assets/img/提交实验-点击.png" -->
<!-- x:Name="ClickedImage" /> -->
<!-- </Grid> -->
<!-- </ControlTemplate> -->
<!-- </Button.Template> -->
<!-- </Button> -->
<Button
Canvas.Left="1"
Canvas.Top="500"
Click="UploadButton_OnClick"
IsVisible="True"
x:Name="ExperimentButton">
<Button.Template>
<ControlTemplate>
<Grid x:Name="TemplateRoot">
<Image Source="../Assets/img/提交实验-默认.png" x:Name="DefaultImage" />
<Image
IsVisible="False"
Source="../Assets/img/提交实验-悬浮.png"
x:Name="HoverImage" />
<Image
IsVisible="False"
Source="../Assets/img/提交实验-点击.png"
x:Name="ClickedImage" />
</Grid>
</ControlTemplate>
</Button.Template>
<Image Source="../Assets/img/提交实验-默认.png" />
</Button>
<Button
Canvas.Left="1"
Canvas.Top="500"
IsVisible="False"
x:Name="SubmittedButton">
<Image Source="../Assets/img/提交实验-点击.png" />
</Button>
</Canvas>
</Window>

View File

@ -64,14 +64,14 @@ public partial class ExperimentWindow : Window
private void OnPositionChanged(object? sender, PixelPointEventArgs pixelPointEventArgs)
{
AppWindowManager.UpdateWindowPosition(AppWindowManager.OverviewWindow, 0, 0,MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.IdeWindow, 0, 0,MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.ResetSceneWindow, 0, 0,MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.TemporaryStorageWindow, 0, 0,MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.TemporaryStorageMessage, 0, 300,MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.DownCodeWindow, 0, 0,MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.ReadCodeWindow, 0, 0,MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.UploadExperimentWindow, 0, 0,MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.OverviewWindow, 0, 0, MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.IdeWindow, 0, 0, MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.ResetSceneWindow, 0, 0, MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.TemporaryStorageWindow, 0, 0, MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.TemporaryStorageMessage, 0, 300, MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.DownCodeWindow, 0, 0, MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.ReadCodeWindow, 0, 0, MainType.);
AppWindowManager.UpdateWindowPosition(AppWindowManager.UploadExperimentWindow, 0, 0, MainType.);
}
// 打开总览窗口
@ -79,7 +79,7 @@ public partial class ExperimentWindow : Window
{
ResetOtherButtons("Overview");
AppWindowManager.ToggleWindow(ref AppWindowManager.OverviewWindow, () => new OverviewWindow(), true, true,MainType.);
AppWindowManager.ToggleWindow(ref AppWindowManager.OverviewWindow, () => new OverviewWindow(), true, true, MainType.);
}
// 打开 IDE 窗口
@ -87,7 +87,7 @@ public partial class ExperimentWindow : Window
{
ResetOtherButtons("AI");
AppWindowManager.ToggleWindow(ref AppWindowManager.IdeWindow, () => new IDEWindow(), true, true,MainType.);
AppWindowManager.ToggleWindow(ref AppWindowManager.IdeWindow, () => new IDEWindow(), true, true, MainType.);
}
// 打开重置窗口
@ -117,7 +117,7 @@ public partial class ExperimentWindow : Window
{
ResetOtherButtons("TemporaryStorage");
AppWindowManager.ToggleWindow(ref AppWindowManager.TemporaryStorageWindow, () => new TemporaryStorageWindow(), true, true,MainType.);
AppWindowManager.ToggleWindow(ref AppWindowManager.TemporaryStorageWindow, () => new TemporaryStorageWindow(), true, true, MainType.);
}
@ -126,7 +126,7 @@ public partial class ExperimentWindow : Window
{
ResetOtherButtons("Recording");
AppWindowManager.ToggleWindow(ref AppWindowManager.RecordingWindow, () => new RecordingWindow(), false,true, MainType.);
AppWindowManager.ToggleWindow(ref AppWindowManager.RecordingWindow, () => new RecordingWindow(), false, true, MainType.);
var mainWindowPosition = Position;
AppWindowManager.RecordingWindow.Position = new PixelPoint(mainWindowPosition.X, mainWindowPosition.Y);
AppWindowManager.MainWindow.Hide();
@ -137,7 +137,7 @@ public partial class ExperimentWindow : Window
private void ReadCodeButton6_OnClick(object? sender, RoutedEventArgs e)
{
ResetOtherButtons("ReadCode");
AppWindowManager.ToggleWindow(ref AppWindowManager.ReadCodeWindow, () => new ReadCodeWindow(), true, true,MainType.);
AppWindowManager.ToggleWindow(ref AppWindowManager.ReadCodeWindow, () => new ReadCodeWindow(), true, true, MainType.);
}
//切换
@ -170,12 +170,7 @@ public partial class ExperimentWindow : Window
private void UploadButton_OnClick(object? sender, RoutedEventArgs e)
{
// 当按钮被点击时,设置点击状态,并禁用悬浮状态
_isClicked = true; // 设置点击状态
_isHovering = false; // 禁用悬浮状态
UpdateButtonImages((Button)sender, ButtonState.Clicked);
AppWindowManager.ToggleWindow(ref AppWindowManager.UploadExperimentWindow, () => new UploadExperimentWindow(), true, true,MainType.);
AppWindowManager.ToggleWindow(ref AppWindowManager.UploadExperimentWindow, () => new UploadExperimentWindow(), true, true, MainType.);
}
private void UpdateButtonImages(Button button, ButtonState state)
@ -255,4 +250,14 @@ public partial class ExperimentWindow : Window
{
WebSocketManager.GetInstance().SendMessage(ToolsEventEnum.MiniModel, null);
}
public void Submit()
{
var ExperimentButton = this.FindControl<Button>("ExperimentButton");
var SubmittedButton = this.FindControl<Button>("SubmittedButton");
ExperimentButton.IsVisible = false;
SubmittedButton.IsVisible = true;
}
}

View File

@ -102,7 +102,8 @@
FontFamily="{StaticResource SourceNormal}"
FontSize="13"
Foreground="#B181FF"
Text="202410080926 02:31" />
Text="202410080926 02:31"
x:Name="VideoTextBlockName" />
<Image
Canvas.Left="40"
@ -125,6 +126,7 @@
<Button
Canvas.Left="400"
Canvas.Top="455"
Click="CancelButton_OnClick"
FontFamily="{StaticResource SourceRegular}"
FontSize="18"
FontWeight="Bold"
@ -133,6 +135,19 @@
VerticalAlignment="Top">
<Image Source="../Assets/img/UploadExperiment/取消.png" />
</Button>
<Button
Canvas.Left="482"
Canvas.Top="455"
FontFamily="{StaticResource SourceRegular}"
FontSize="18"
FontWeight="Bold"
HorizontalAlignment="Left"
IsVisible="True"
Margin="0,0,0,0"
VerticalAlignment="Top"
x:Name="CheckingButton">
<Image Source="../Assets/img/UploadExperiment/检测中.png" />
</Button>
<Button
Canvas.Left="482"
@ -142,9 +157,11 @@
FontSize="18"
FontWeight="Bold"
HorizontalAlignment="Left"
IsVisible="False"
Margin="0,0,0,0"
VerticalAlignment="Top">
<Image Source="../Assets/img/UploadExperiment/检测中.png" />
VerticalAlignment="Top"
x:Name="SubmitButton">
<Image Source="../Assets/img/UploadExperiment/提交.png" />
</Button>
<Border
@ -194,14 +211,25 @@
Canvas.Top="148"
IsVisible="False"
Source="../Assets/img/UploadExperiment/完成.png"
x:Name="CheckMarkImage1" />
x:Name="VideoCheckTure" />
<Image
Canvas.Left="520"
Canvas.Top="148"
IsVisible="False"
Source="../Assets/img/UploadExperiment/失败.png"
x:Name="VideoCheckFalse" />
<Image
Canvas.Left="520"
Canvas.Top="194"
IsVisible="False"
Source="../Assets/img/UploadExperiment/完成.png"
x:Name="CheckMarkImage2" />
x:Name="FileCheckTure" />
<Image
Canvas.Left="520"
Canvas.Top="194"
IsVisible="False"
Source="../Assets/img/UploadExperiment/失败.png"
x:Name="FileCheckFalse" />
</Canvas>

View File

@ -1,9 +1,11 @@
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Documents;
using Avalonia.Interactivity;
using Avalonia.Layout;
using Avalonia.Markup.Xaml;
@ -59,11 +61,14 @@ public partial class UploadExperimentWindow : Window
}
public void LoadDirectoryContents(string path, StackPanel container)
public bool LoadDirectoryContents(string path, StackPanel container)
{
// 检查文件夹是否存在
if (!Directory.Exists(path))
throw new DirectoryNotFoundException("指定的文件夹未找到");
{
Console.WriteLine("指定的文件夹未找到");
return false;
}
// 清空容器
container.Children.Clear();
@ -73,6 +78,8 @@ public partial class UploadExperimentWindow : Window
// 加载目录和文件
LoadContentsRecursively(dirInfo, container, 0);
return true;
}
private void LoadContentsRecursively(DirectoryInfo dirInfo, StackPanel container, int level)
@ -205,22 +212,107 @@ public partial class UploadExperimentWindow : Window
// 模拟加载完成的方法
private async void CompleteLoading()
{
await Task.Delay(2000);
await Task.Delay(1000);
// 停止旋转
_rotationTimer1.Stop();
await Task.Delay(2000);
LoadingImage1.IsVisible = false;
bool isVideo = LoadLatestMp4File(this.FindControl<TextBlock>("VideoTextBlockName"));
if (isVideo)
{
VideoCheckTure.IsVisible = true;
}
else
{
VideoCheckFalse.IsVisible = true;
}
await Task.Delay(1000);
_rotationTimer2.Stop();
LoadDirectoryContents("E:\\Eclipse Workspace\\Upa_Java", StackPanelWord);
LoadingImage2.IsVisible = false;
bool isFile = LoadDirectoryContents("E:\\Eclipse Workspace\\Upa_Java", StackPanelWord);
//LoadDirectoryContents(AppDataManager.IdeModel.FolderPath, StackPanelWord);
LoadingImage1.IsVisible = false;
LoadingImage2.IsVisible = false;
CheckMarkImage1.IsVisible = true;
CheckMarkImage2.IsVisible = true;
if (isFile)
{
FileCheckTure.IsVisible = true;
}
else
{
FileCheckFalse.IsVisible = true;
}
Buttons();
}
public void GetVideo()
{
}
private void Buttons()
{
// 获取按钮引用
var submitButton = this.FindControl<Button>("SubmitButton"); // 假设这是提交按钮
var checkingButton = this.FindControl<Button>("CheckingButton"); // 假设这是检测中按钮
// 控制按钮的可见性
if (submitButton != null && checkingButton != null)
{
submitButton.IsVisible = true; // 隐藏提交按钮
checkingButton.IsVisible = false; // 显示检测中按钮
}
}
private void OnSubmitButtonClick(object sender, RoutedEventArgs e)
{
// 调用加载完成的方法
AppWindowManager.ExperimentWindow.Submit();
AppWindowManager.CloseWindow(ref AppWindowManager.UploadExperimentWindow);
}
public bool LoadLatestMp4File(TextBlock textBlock)
{
// 获取当前 EXE 文件的路径
var exeDirectory = AppDomain.CurrentDomain.BaseDirectory;
var capturesDirectory = Path.Combine(exeDirectory, "Captures");
// 检查 Captures 文件夹是否存在
if (!Directory.Exists(capturesDirectory))
{
textBlock.Text = "";
Console.WriteLine("Captures 文件夹未找到");
return false;
}
// 获取最新创建的 MP4 文件
var latestFile = new DirectoryInfo(capturesDirectory)
.GetFiles("*.mp4")
.OrderByDescending(f => f.CreationTime)
.FirstOrDefault();
// 如果找到文件,则更新 TextBlock 的文本
if (latestFile != null)
{
var creationTime = latestFile.CreationTime.ToString("yyyyMMddHHmm");
var fileName = Path.GetFileNameWithoutExtension(latestFile.Name); // 获取文件名(不带扩展名)
textBlock.Text = $"{creationTime} {fileName}"; // 设置 TextBlock 的文本
}
else
{
textBlock.Text = "没有找到 MP4 文件"; // 如果没有找到文件
return false;
}
return true;
}
private void CancelButton_OnClick(object? sender, RoutedEventArgs e)
{
AppWindowManager.CloseWindow(ref AppWindowManager.UploadExperimentWindow);
}
}

View File

@ -1 +1 @@
e76f595a14d7ab41574f9eac585b1a80a32339df1611162aada8377a10d2bcdd
4f8bc25ec09d514703db0be08bb36ccf0ef7bede5211af7fae4def96df36fcac

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("ToolsForm")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e3d4f719bf17b0d5405927cb05d18368d2f72acb")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+704ebc12d8f15de82f0f089ec9fc95d70a4a97ed")]
[assembly: System.Reflection.AssemblyProductAttribute("ToolsForm")]
[assembly: System.Reflection.AssemblyTitleAttribute("ToolsForm")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
a834706ef20a0cc167aa5e69c7811af9b6b9b9b9c52dff7029ce0449d696aa14
6b847eeaec54d2b71165b694438a55a79155fb71730be52ae068654d1fdd135b