代码拉取完成,页面将自动刷新
同步操作将从 cygsd/Chess 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using Chess.OpenSource;
namespace Chess
{
/// <summary>
/// QiPanPage.xaml 的交互逻辑
/// </summary>
public partial class CanJuSheJi : Page
{
public CanJuSheJi()
{
InitializeComponent();
}
/// <summary>
/// 主窗口载入时,初始化自定义控件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MainFormLoaded(object sender, RoutedEventArgs e)
{
GlobalValue.yuanWeiZhi = new QiZi(); // 棋子原位置图片
_ = qiziCanvas.Children.Add(GlobalValue.yuanWeiZhi);
for (int i = 0; i < 32; i++)
{
GlobalValue.qiZiArray[i] = new QiZi(i); // 初始化32个棋子
_ = qiziCanvas.Children.Add(GlobalValue.qiZiArray[i]);
}
for (int i = 0; i <= 8; i++)
{
for (int j = 0; j <= 9; j++)
{
GlobalValue.pathPointImage[i, j] = new PathPoint(i, j); // 走棋路径
_ = qiziCanvas.Children.Add(GlobalValue.pathPointImage[i, j]);
}
}
GlobalValue.IsQiPanFanZhuan = false; // 棋盘翻转,初始为未翻转,黑方在上,红方在下
for (int i = 0; i <= 8; i++)
{
for (int j = 0; j <= 9; j++)
{
GlobalValue.QiPan[i, j] = -1; // 棋盘数据清空
GlobalValue.pathPointImage[i, j].HasPoint = false; // 走棋路径点清空
}
}
}
/// <summary>
/// 保存残局棋谱
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SaveCanJu(object sender, RoutedEventArgs e)
{
string fenstr = Engine.XQEngine.QiPanDataToFenStr_header();
Dictionary<string, object> dic = new()
{
{ "Name", CanJuName.Text },
{ "Comment", Comment.Text },
{ "FENstring", fenstr }
};
int rows = SqliteHelper.Insert("CanJuKu", dic);
if (rows > 0)
{
SaveOk.Visibility = Visibility.Visible;
}
else
{
SaveNotOk.Visibility = Visibility.Visible;
}
GlobalValue.Delay(1000);
SaveOk.Visibility = Visibility.Hidden;
SaveNotOk.Visibility = Visibility.Hidden;
}
/// <summary>
/// 清空棋盘
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ClearQiPan(object sender, RoutedEventArgs e)
{
CanJuName.Text = "";
Comment.Text = "";
for (int i = 0; i < 32; i++)
{
GlobalValue.qiZiArray[i].SetInitPosition();
}
for (int i = 0; i <= 8; i++)
{
for (int j = 0; j <= 9; j++)
{
GlobalValue.QiPan[i, j] = -1; // 棋盘数据清空
GlobalValue.pathPointImage[i, j].HasPoint = false; // 走棋路径点清空
}
}
}
private void CanJuName_GotFocus(object sender, RoutedEventArgs e)
{
TextBox tbx = sender as TextBox;
tbx.SelectAll();
e.Handled = true;
}
private void OnKeyUp(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == System.Windows.Input.Key.Delete)
{
if (GlobalValue.CurrentQiZi is >=0 and < 32)
{
GlobalValue.qiZiArray[GlobalValue.CurrentQiZi].SetInitPosition();
}
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。