还空瓶弹窗添加延时

This commit is contained in:
maqiao 2025-01-17 14:31:28 +08:00
parent b7cdb760ec
commit db08aa7e79
5 changed files with 47 additions and 11 deletions

View File

@ -136,6 +136,13 @@ namespace DM_Weight.ViewModels
SetProperty(ref _machineRecords, value);
}
}
private MachineRecord _machineRecord = new();
public MachineRecord _MachineRecord
{
get => _machineRecord;
set => SetProperty(ref _machineRecord, value);
}
private ChannelStock _channelStock;
@ -170,13 +177,13 @@ namespace DM_Weight.ViewModels
{
// 取消消息订阅
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
_eventAggregator.GetEvent<CheckBoxCheckEvent>().Unsubscribe(CheckboxChecked);
//_eventAggregator.GetEvent<CheckBoxCheckEvent>().Unsubscribe(CheckboxChecked);
}
public void OnDialogOpened(IDialogParameters parameters)
{
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
_eventAggregator.GetEvent<CheckBoxCheckEvent>().Subscribe(CheckboxChecked);
//_eventAggregator.GetEvent<CheckBoxCheckEvent>().Subscribe(CheckboxChecked);
ChannelStock _record = parameters.GetValue<ChannelStock>("channel");
ChannelStock = _record;
@ -205,6 +212,27 @@ namespace DM_Weight.ViewModels
.ToList();
MachineRecords = queryData;
}
public DelegateCommand RowSelected
{
get => new DelegateCommand(() =>
{
if (MachineRecords != null && MachineRecords.Count > 0)
{
MachineRecords = MachineRecords.Select(x =>
{
if (x.Id == _MachineRecord.Id)
{
x.IsSelected = !x.IsSelected;
CheckboxChecked();
}
return x;
}).ToList();
//DialogParameters dialogParameters = new DialogParameters();
//dialogParameters.Add("channel", Channel);
//DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
}
});
}
//选中药品将要返还的数量添加到文本框
private void CheckboxChecked()
{

View File

@ -46,9 +46,11 @@ namespace DM_Weight.ViewModels
public DelegateCommand RowSelected
{
get => new DelegateCommand(() =>
{
get => new DelegateCommand(async () =>
{
// 此处延时1毫秒等待页面渲染(规避工控机上手指点击弹出的页面上的按钮无效问题)
await Task.Delay(TimeSpan.FromMilliseconds(1));
if (Channel != null &&string.IsNullOrEmpty(Channel.DrugId))
{
DialogParameters dialogParameters = new DialogParameters();

View File

@ -26,9 +26,9 @@ namespace DM_Weight.ViewModels
{
public static List<UseFor> SelectUseList = new()
{
new UseFor { UseId = 96, UseName = "不入账册" },
new UseFor{UseId=0,UseName="入账册"},
new UseFor { UseId = 96, UseName = "不入账册" }
new UseFor{UseId=0,UseName="入账册"}
};
private List<UseFor> _selects = SelectUseList;

View File

@ -140,6 +140,7 @@
<ListView
Grid.Row="2"
ItemsSource="{Binding MachineRecords}"
SelectedItem="{Binding _MachineRecord}"
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
materialDesign:ListViewAssist.ListViewItemPadding="13">
@ -152,12 +153,17 @@
<Setter Property="VerticalScrollBarVisibility" Value="Visible"/>
</Style>
</ListView.Resources>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding RowSelected}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListView.View>
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
<GridViewColumn Header="选择" Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSelected}" Click="CheckBox_Click" />
<CheckBox IsChecked="{Binding IsSelected}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>

View File

@ -22,16 +22,16 @@ namespace DM_Weight.Views.Dialog
/// </summary>
public partial class ReturnEmptyDialog : UserControl
{
IEventAggregator _eventAggregator;
//IEventAggregator _eventAggregator;
public ReturnEmptyDialog(IEventAggregator eventAggregator)
{
InitializeComponent();
this._eventAggregator= eventAggregator;
//this._eventAggregator= eventAggregator;
}
private void CheckBox_Click(object sender, RoutedEventArgs e)
{
_eventAggregator.GetEvent<CheckBoxCheckEvent>().Publish();
//_eventAggregator.GetEvent<CheckBoxCheckEvent>().Publish();
}
}
}