Skip to content

Commit

Permalink
持续改进 dp2ssl 各项功能
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalPlatform committed Jan 18, 2024
1 parent 38ea942 commit 8d8a968
Show file tree
Hide file tree
Showing 32 changed files with 854 additions and 664 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 41 additions & 3 deletions DigitalPlatform.CommonControl/FloatingMessageForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Threading;

namespace DigitalPlatform.CommonControl
{
Expand All @@ -16,7 +18,9 @@ namespace DigitalPlatform.CommonControl
/// </summary>
public partial class FloatingMessageForm : Form
{
#if REMOVED
DateTime _clearTime = new DateTime(0);
#endif

// 是否允许感知 Click 清除文字
public bool Closeable = false;
Expand Down Expand Up @@ -80,7 +84,7 @@ protected override CreateParams CreateParams

const int WS_EX_NOACTIVATE = 0x08000000;
// const int WS_EX_TOOLWINDOW = 0x00000080;
cp.ExStyle |= (int)(WS_EX_NOACTIVATE
cp.ExStyle |= (int)(WS_EX_NOACTIVATE
// | WS_EX_TOOLWINDOW
);

Expand Down Expand Up @@ -120,7 +124,7 @@ public bool Clickable
windowLong |= 0x20;
API.SetWindowLong(this.Handle, API.GWL_EXSTYLE, windowLong);
}
catch(ObjectDisposedException)
catch (ObjectDisposedException)
{

}
Expand Down Expand Up @@ -512,21 +516,51 @@ protected override void WndProc(ref Message m)
}
}

int _inDelay = 0;
CancellationTokenSource _cancelDelay = new CancellationTokenSource();


// 设定延时 Clear 时间长度
public void DelayClear(TimeSpan delta)
{
_cancelDelay?.Cancel();
_cancelDelay = new CancellationTokenSource();
var token = _cancelDelay.Token;
_ = Task.Run(async () =>
{
_inDelay++;
try
{
await Task.Delay(delta, token);
token.ThrowIfCancellationRequested();
this.TryInvoke(() =>
{
base.Text = "";
this.Invalidate();
});
}
finally
{
_inDelay--;
}
});
#if REMOVED
this._clearTime = DateTime.Now + delta;
timer1.Start();
#endif
}

public bool InDelay()
{
return _inDelay > 0;
#if REMOVED
if (this._clearTime == new DateTime(0))
return false;
return true;
#endif
}

#if REMOVED
private void timer1_Tick(object sender, EventArgs e)
{
if (this._clearTime != new DateTime(0)
Expand All @@ -538,13 +572,17 @@ private void timer1_Tick(object sender, EventArgs e)
StopDelayClear();
}
}
#endif

public void StopDelayClear()
{
_cancelDelay?.Cancel();
_cancelDelay = null;
#if REMOVED
timer1.Stop();
this._clearTime = new DateTime(0);
#endif
}

}

/// <summary>
Expand Down
18 changes: 17 additions & 1 deletion DigitalPlatform.IO/BarcodeCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private struct EventMsg

static bool _shift = false;
static bool _alt = false;
static bool _ctrl = false;

private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)
{
Expand All @@ -172,6 +173,13 @@ private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)
goto END1;
}

if (key == Keys.LControlKey || key == Keys.RControlKey)
{
_ctrl = false;
Debug.WriteLine("Ctrl keyup");
goto END1;
}

// 检查是否属于禁用的键
is_stop_key = IsStopKey(key);
}
Expand All @@ -197,6 +205,13 @@ private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)
goto END1;
}

if (key == Keys.LControlKey || key == Keys.RControlKey)
{
_ctrl = true;
Debug.WriteLine("Ctrl keydown");
goto END1;
}

// 检查是否属于禁用的键
is_stop_key = IsStopKey(key);

Expand Down Expand Up @@ -320,7 +335,8 @@ public bool IsStopKey(Keys key)

if (_alt)
key |= Keys.Alt;

if (_ctrl)
key |= Keys.Control;
return _stopKeys.Where(o => o == key).Any();
}

Expand Down
4 changes: 4 additions & 0 deletions DigitalPlatform.LibraryServer/AppCirculation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16958,6 +16958,10 @@ void AppendWarning(ref string warning, string text)
return -1;
}
}
else
{
// 其余情况,是否要把当前位置修改为 ?xxx:xxx 形态?
}

// 2020/3/27
// 最近一次借还本册操作的时间。用于同步借还请求判断先后关系
Expand Down
38 changes: 38 additions & 0 deletions DigitalPlatform.RFID.Manager/RfidManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,44 @@ public static void ClearChannels()
{
Base.ClearChannels();
}

// 2024/1/18
public static ListReadersResult ListReaders()
{
try
{
BaseChannel<IRfid> channel = Base.GetChannel();
try
{
var result = channel.Object.ListReaders();
if (result.Value == -1)
Base.TriggerSetError(result,
new SetErrorEventArgs { Error = result.ErrorInfo });
else
Base.TriggerSetError(result,
new SetErrorEventArgs { Error = null }); // 清除以前的报错

return result;
}
finally
{
Base.ReturnChannel(channel);
}
}
catch (Exception ex)
{
// Base.Clear();
_ = Base.ClearAsync();

Base.TriggerSetError(ex,
new SetErrorEventArgs
{
Error = $"RFID 中心出现异常: {ExceptionUtil.GetAutoText(ex)}"
});
return new ListReadersResult { Value = -1, ErrorInfo = ex.Message };
}
}

}

public delegate void ListTagsEventHandler(object sender,
Expand Down
12 changes: 12 additions & 0 deletions DigitalPlatform/4.0/Stop/NewStopManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,18 @@ public void UpdateProgressValue(Stop stop)
{
if (stop == _surfaceStop)
{
// 2024/1/17
if (stop.ProgressMin == -1
|| stop.ProgressMax == -1)
{
InternalSetProgressBar(
stop,
-1,
-1,
-1);
return;
}

if (stop.ProgressMin == -1)
throw new Exception("ProgressMin 尚未初始化");
if (stop.ProgressMax == -1)
Expand Down
1 change: 0 additions & 1 deletion RfidDrivers.First/RfidDriver1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
using DigitalPlatform;
using DigitalPlatform.RFID;
using DigitalPlatform.Text;
using System.Security.Cryptography;

// 锁定全部读卡器靠一个全局锁来实现。锁定一个读卡器靠 RecordLock 来实现。锁定一个读卡器之前,先尝试用 read 方式获得全局锁

Expand Down
9 changes: 5 additions & 4 deletions dp2Circulation/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.96.*")]
[assembly: AssemblyFileVersion("3.96.0.0")]
[assembly: AssemblyVersion("3.94.*")]
[assembly: AssemblyFileVersion("3.94.0.0")]

// V2.6 2015/11/7 MainForm BiblioSearchForm ChannelForm 采用 ChannelPool。注意观察有无通讯通道方面的故障
// V2.7 2015/11/30 EntityForm 大幅度改造,采用 ChannelPool。Stop 类的 BeginLoop() 不再允许嵌套,注意观察是否会抛出异常。固定面板区属性页的显示很多已经改造为 PropertyTaskList 实现
Expand Down Expand Up @@ -232,8 +232,9 @@
// 2023/12/22 当参数为超高频高校联盟格式,不写入 UserBank 时,种册窗册登记对话框写入标签以后,对话框内再次点按钮写入,会报错说 PII 不存在,这个 bug 已经修正
// 2023/12/26 超高频国标格式,既可以把机构代码写入 UII(EPC Bank) 中,也可以特殊指定写入 User Bank(此时 EPC Bank 中的 UII 中不再包含机构代码)。允许这种特殊写入法主要是考虑到它利于在小尺寸 EPC 标签上使用国标格式
// 3.93 2024/1/2 快捷出纳窗的人脸识别增加允许命中多个记录的功能
// 2024/1/4 书目查询窗导出到订购、期、实体、评注查询窗的功能重构为利用多线程。LibraryChannel 通道超时改为 40 秒
// 3.94 2024/1/4 书目查询窗导出到订购、期、实体、评注查询窗的功能重构为利用多线程。LibraryChannel 通道超时改为 40 秒
// 书目查询窗导出下属的订购、期、实体、评注记录到记录路径文件,重构为利用多线程
// 读者查询窗导出借阅历史到实体查询窗的功能,重构为利用多线程
// 2024/1/8 读者查询窗导出借阅历史到实体查询窗的功能,增加了一个询问对话框,询问是每个读者记录的借阅历史导出到一个单独的实体查询窗,还是所有读者记录的都导出到唯一的一个实体查询窗
// 2024/1/16 书目查询窗共享检索时的利用 looping 方式改进。Z39.50 检索时 .ShowMessage() 后来没有清除显示的 bug 被修正
// 2024/1/16 书目查询窗共享检索时的利用 looping 方式改进。Z39.50 检索时 .ShowMessage() 后来没有清除显示的 bug 被修正
// 2024/1/17 重构 AmerceForm 中的两个装载信息的线程为 Task,消除了 NewStop 类抛异常的 bug
Loading

0 comments on commit 8d8a968

Please sign in to comment.