添加项目文件。

This commit is contained in:
ShrlAlgo
2025-09-16 16:06:41 +08:00
parent 0e7807b826
commit 98c65ceb3d
922 changed files with 1009489 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
namespace Szmedi.AIScriptRunner.ProgressBarCtrl
{
/// <summary>
///
/// </summary>
public class LoadingManager
{
private Type m_ProgressBarViewType;
private ProgressBarInfo m_ProgressBarInfo = new ProgressBarInfo();
//public static LoadingCtrl LoadingWindow { get; set; }
private Window m_ProgressBarForm;
public Window ProgressBarView { get { return m_ProgressBarForm; } }
public ProgressBarInfo ProgressBarInfo { get { return m_ProgressBarInfo; } }
public string LoadingMessage { get; set; }
public LoadingManager()
{
}
public LoadingManager(string msg)
{
m_ProgressBarInfo.Message = msg;
m_ProgressBarInfo.TipMessage = msg+":";
}
/// <summary>
///
/// </summary>
public void ShowProgressBar(Type progressBarViewType=null)
{
m_ProgressBarViewType = progressBarViewType;
Thread thread = new Thread(ProgressBarStart);
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
}
/// <summary>
///
/// </summary>
public void CloseProgressBar()
{
if (m_ProgressBarForm == null) return;
m_ProgressBarForm.Dispatcher.Invoke(new Action(() =>
{
m_ProgressBarForm.Close();
m_ProgressBarForm = null;
}));
}
private void ProgressBarStart()
{
if (m_ProgressBarForm == null)
{
if (m_ProgressBarViewType != null)
{
m_ProgressBarForm = (Window)Activator.CreateInstance(m_ProgressBarViewType);
}
else
{
m_ProgressBarForm = new ProgressBarCtrl();
}
m_ProgressBarForm.DataContext = m_ProgressBarInfo;
}
//load.Topmost = true;
m_ProgressBarForm.ShowDialog();
//load.Show();
}
}
}

View File

@@ -0,0 +1,10 @@
<Window x:Class="Szmedi.AIScriptRunner.ProgressBarCtrl.ProgressBarCtrl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ProgressBarCtrl" Height="90" Width="574" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
<Grid>
<TextBlock Height="20" HorizontalAlignment="Left" Margin="5,-50,0,0" Text="{Binding Message1}" ></TextBlock>
<ProgressBar HorizontalAlignment="Stretch" Name="progressBar" Height="25" Value="{Binding ProgressValue}" Margin="2" Background="#00FFFFFF"/>
<TextBlock x:Name="txtMessage" Height="20" HorizontalAlignment="Center" Margin="2" Text="{Binding Message}" ></TextBlock>
</Grid>
</Window>

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Threading;
namespace Szmedi.AIScriptRunner.ProgressBarCtrl
{
/// <summary>
/// ProgressBarCtrl.xaml 的交互逻辑
/// </summary>
public partial class ProgressBarCtrl : Window
{
public ProgressBarCtrl()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,175 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Szmedi.AIScriptRunner.ProgressBarCtrl
{
/// <summary>
///
/// </summary>
public class ProgressBarInfo : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string prop)
{
if (this.PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(prop));
}
/// <summary>
///
/// </summary>
public ProgressBarInfo()
{
Percent = 0;
IsOver = false;
}
public double Total { get; set; }
private double m_ProgressStep;
public double ProgressStep
{
get
{
return m_ProgressStep;
}
set
{
m_ProgressStep = value;
Percent = m_ProgressStep / Total;
}
}
private double m_Percent;
/// <summary>
/// 完成百分比
/// </summary>
public double Percent
{
get
{
return m_Percent;
}
set
{
m_Percent = value;
m_Percent= Double.IsNaN(m_Percent) ? 0 : m_Percent;
ProgressValue = m_Percent * 100;
Message = "完成百分比:" + (m_Percent * 100).ToString("#.##") + "%";
OnPropertyChanged("Percent");
}
}
private string m_TipMessage;
/// <summary>
/// 显示信息
/// </summary>
public string TipMessage
{
get
{
return m_TipMessage;
}
set
{
m_TipMessage = value;
OnPropertyChanged("TipMessage");
}
}
private string m_Message;
/// <summary>
/// 显示信息
/// </summary>
public string Message
{
get
{
return m_Message;
}
set
{
m_Message = value;
OnPropertyChanged("Message");
}
}
private string m_Message1;
/// <summary>
/// 显示信息
/// </summary>
public string Message1
{
get
{
return m_Message1;
}
set
{
m_Message1 = value;
OnPropertyChanged("Message1");
}
}
private string m_Message2;
/// <summary>
/// 显示信息
/// </summary>
public string Message2
{
get
{
return m_Message2;
}
set
{
m_Message2 = value;
OnPropertyChanged("Message2");
}
}
private string m_Message3;
/// <summary>
/// 显示信息
/// </summary>
public string Message3
{
get
{
return m_Message3;
}
set
{
m_Message3 = value;
OnPropertyChanged("Message3");
}
}
/// <summary>
/// 是否完成
/// </summary>
public bool IsOver { get; set; }
private double m_ProgressValue;
public double ProgressValue
{
get
{
return m_ProgressValue;
}
set
{
m_ProgressValue = value;
OnPropertyChanged("ProgressValue");
}
}
}
}