sc 4 years ago
parent
commit
c5a8f7a8f8
  1. 6
      View/StuffView.xaml
  2. 2
      View/StuffView.xaml.cs
  3. 12
      ViewModel/StuffViewModel.cs

6
View/StuffView.xaml

@ -150,12 +150,6 @@
<Button Content="存储" HorizontalAlignment="Left" Height="65" Margin="795,0,0,60"
VerticalAlignment="Bottom" Width="145" FontSize="40" BorderBrush="{x:Null}" Background="#FFCECECE"
Click="Button_Preservation">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseUp">
<i:InvokeCommandAction Command="{Binding CommandToBindTo}"
CommandParameter="{Binding CommandParameterToBindTo}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<!--删除按钮-->
<Button Content="删除" HorizontalAlignment="Left" Height="65" Margin="975,0,0,60"

2
View/StuffView.xaml.cs

@ -111,7 +111,7 @@ namespace Audit.View
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
if (showProductName == MessageBoxResult.Yes)//判断是否删除原料
{
var count = new ProductProvider().Delete(product);//删除数据库目标信息。
var count = new ProductProvider().Delete(product_temp);//删除数据库目标信息。
if (count == 0) System.Windows.MessageBox.Show("ERR.C0110-2:删除失败", "错误");//判断执行是否成功
else Button_sql = true;
}

12
ViewModel/StuffViewModel.cs

@ -44,18 +44,18 @@ namespace Audit.ViewModel
{
products = new ProductProvider().Select();
DispatcherTimer timer = new DispatcherTimer();//每0.5秒调用一次Tick_Event
timer.Interval = TimeSpan.FromSeconds(0.5);
timer.Interval = TimeSpan.FromSeconds(0.1);
timer.Tick += Tick_Event;
timer.Start();
}
void Tick_Event(object sender, EventArgs e)
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
if (StuffView.Button_sql == true)
if (StuffView.Button_sql == true)//获取按钮状态
{
Product = new ProductProvider().Select();
StuffView.Button_sql = false;
}//扫描数据库
Product = new ProductProvider().Select();//扫描数据库
StuffView.Button_sql = false;//清除按钮状态
}
}
}
}

Loading…
Cancel
Save