|  |  |  | using LiveChartsCore; | 
					
						
							|  |  |  | using SunlightCentralizedControlManagement_SCCM_.UserClass; | 
					
						
							|  |  |  | using SunlightCentralizedControlManagement_SCCM_.WindowsView; | 
					
						
							|  |  |  | using System; | 
					
						
							|  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  | using System.Data; | 
					
						
							|  |  |  | using System.Data.Entity; | 
					
						
							|  |  |  | using System.Data.SQLite; | 
					
						
							|  |  |  | using System.Diagnostics.Eventing.Reader; | 
					
						
							|  |  |  | using System.Linq; | 
					
						
							|  |  |  | using System.Net; | 
					
						
							|  |  |  | using System.Net.NetworkInformation; | 
					
						
							|  |  |  | using System.Security.Cryptography; | 
					
						
							|  |  |  | using System.Text; | 
					
						
							|  |  |  | using System.Threading.Tasks; | 
					
						
							|  |  |  | using System.Windows; | 
					
						
							|  |  |  | using System.Windows.Controls; | 
					
						
							|  |  |  | using System.Windows.Controls.Primitives; | 
					
						
							|  |  |  | using System.Windows.Data; | 
					
						
							|  |  |  | using System.Windows.Documents; | 
					
						
							|  |  |  | using System.Windows.Input; | 
					
						
							|  |  |  | using System.Windows.Media; | 
					
						
							|  |  |  | using System.Windows.Media.Animation; | 
					
						
							|  |  |  | using System.Windows.Media.Imaging; | 
					
						
							|  |  |  | using System.Windows.Navigation; | 
					
						
							|  |  |  | using System.Windows.Shapes; | 
					
						
							|  |  |  | using System.Drawing.Drawing2D; | 
					
						
							|  |  |  | using System.Xml.Linq; | 
					
						
							|  |  |  | using System.Drawing; | 
					
						
							|  |  |  | using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; | 
					
						
							|  |  |  | using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep; | 
					
						
							|  |  |  | using static System.Windows.Forms.VisualStyles.VisualStyleElement; | 
					
						
							|  |  |  | using SunlightCentralizedControlManagement_SCCM_.ViewModel; | 
					
						
							|  |  |  | using LiveChartsCore.SkiaSharpView.WPF; | 
					
						
							|  |  |  | using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder; | 
					
						
							|  |  |  | using nGantt.GanttChart; | 
					
						
							|  |  |  | using nGantt; | 
					
						
							|  |  |  | using nGantt.PeriodSplitter; | 
					
						
							|  |  |  | using ScottPlot.TickGenerators.TimeUnits; | 
					
						
							|  |  |  | using System.Runtime.Serialization; | 
					
						
							|  |  |  | using System.Windows.Markup; | 
					
						
							|  |  |  | using System.Collections.ObjectModel; | 
					
						
							|  |  |  | using SkiaSharp; | 
					
						
							|  |  |  | using System.Windows.Threading; | 
					
						
							|  |  |  | using SunlightCentralizedControlManagement_SCCM_.ConvertMoels; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace SunlightCentralizedControlManagement_SCCM_.View | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /// <summary>
 | 
					
						
							|  |  |  |     /// ProgramgroupView.xaml 的交互逻辑
 | 
					
						
							|  |  |  |     /// </summary>
 | 
					
						
							|  |  |  |     public partial class ProductionPlanningView : UserControl | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         public ProductionPlanningView() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             InitializeComponent(); | 
					
						
							|  |  |  |             Sdatepicker.Language = XmlLanguage.GetLanguage(Configini.IniReadvalue("SYS", "Language")); | 
					
						
							|  |  |  |             CountDown(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); | 
					
						
							|  |  |  |         private SQLiteHelper SQLiteHelpers = null;  //定义数据库
 | 
					
						
							|  |  |  |         private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db";  //数据库路径
 | 
					
						
							|  |  |  |         DataTable WorkOrder; | 
					
						
							|  |  |  |         private DateTime minDate; | 
					
						
							|  |  |  |         private DateTime maxDate; | 
					
						
							|  |  |  |         private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面时的操作
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd  HH:mm:ss"); | 
					
						
							|  |  |  |             minDate = DateTime.Now.Date; | 
					
						
							|  |  |  |             maxDate = minDate.AddDays(1); | 
					
						
							|  |  |  |             //添加表右键功能
 | 
					
						
							|  |  |  |             ganttTaskContextMenuItems.Add(new ContextMenuItem(DyelotClicked, Properties.Resources.Dyelot + "...")); | 
					
						
							|  |  |  |             ganttTaskContextMenuItems.Add(new ContextMenuItem(ViewClicked, Properties.Resources.View + "...")); | 
					
						
							|  |  |  |             ganttTaskContextMenuItems.Add(new ContextMenuItem(DelayedClicked, Properties.Resources.State + "...")); | 
					
						
							|  |  |  |             ganttTaskContextMenuItems.Add(new ContextMenuItem(EditClicked, Properties.Resources.edit + "..."));  | 
					
						
							|  |  |  |             ganttTaskContextMenuItems.Add(new ContextMenuItem(DeleteClicked, Properties.Resources.Delete + "..."));  | 
					
						
							|  |  |  |             GanttChart.GanttTaskContextMenuItems = ganttTaskContextMenuItems; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             GanttChartNEW(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         private ObservableCollection<ContextMenuItem> ganttTaskContextMenuItems = new ObservableCollection<ContextMenuItem>(); | 
					
						
							|  |  |  |         public void GanttChartNEW() | 
					
						
							|  |  |  |         {                | 
					
						
							|  |  |  |             SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
 | 
					
						
							|  |  |  |             SQLiteHelpers.Open();  //打开数据库                       
 | 
					
						
							|  |  |  |             WorkOrder = SQLiteHelpers.ExecuteDataSet( | 
					
						
							|  |  |  |                 "select * from WorkOrder where StartTime>'" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd  HH:mm:ss") | 
					
						
							|  |  |  |                  + "'or EndTime>'" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd  HH:mm:ss") + "'Order by StartTime", null).Tables[0];  //读取表写入缓存           
 | 
					
						
							|  |  |  |             SQLiteHelpers.Close(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             //生成表
 | 
					
						
							|  |  |  |             GanttChart.ClearGantt(); | 
					
						
							|  |  |  |             GanttChart.Initialize(minDate, maxDate); | 
					
						
							|  |  |  |             var gridLineTimeLine = GanttChart.CreateTimeLine(new PeriodDaySplitter(minDate, maxDate), FormatDay); | 
					
						
							|  |  |  |             GanttChart.CreateTimeLine(new PeriodHourSplitter(minDate, maxDate), FormatHour); | 
					
						
							|  |  |  |             // Set the timeline to atatch gridlines to
 | 
					
						
							|  |  |  |             GanttChart.SetGridLinesTimeline(gridLineTimeLine, DetermineBackground); | 
					
						
							|  |  |  |             var rowgroup = GanttChart.CreateGanttRowGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             //生成表信息
 | 
					
						
							|  |  |  |             List<string> Chart_machines = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换列名为机台                                                                                                                            
 | 
					
						
							|  |  |  |             for (int i = 0; i < Chart_machines.Count(); i++)//列表机台号
 | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 var row = GanttChart.CreateGanttRow(rowgroup, Chart_machines[i]); | 
					
						
							|  |  |  |                 DataRow[] dataRows = WorkOrder.Select("Machines='" + Chart_machines[i] + "'"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 for (int j = 0; j < dataRows.Count(); j++) //列表排程
 | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     System.Windows.Media.Color colorBackground = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#FF336FA8"); | 
					
						
							|  |  |  |                     System.Windows.Media.Color colorStatus = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#FF336FA8"); | 
					
						
							|  |  |  |                     if (dataRows[j].Field<int>("State") == 100) colorStatus = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("red"); | 
					
						
							|  |  |  |                     try | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         colorBackground = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(dataRows[j].Field<string>("color")); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     catch (Exception) { } | 
					
						
							|  |  |  |                     //FF336FA8
 | 
					
						
							|  |  |  |                     GanttChart.AddGanttTask(row, new GanttTask() | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         Start = DateTime.Parse(dataRows[j].Field<string>("StartTime")), | 
					
						
							|  |  |  |                         End = DateTime.Parse(dataRows[j].Field<string>("EndTime")), | 
					
						
							|  |  |  |                         Name = Properties.Resources.ProcessName + ": " + dataRows[j].Field<string>("ProgramName"), | 
					
						
							|  |  |  |                         Background = colorBackground, | 
					
						
							|  |  |  |                         Status = colorStatus, | 
					
						
							|  |  |  |                         WorkOrder = dataRows[j].Field<string>("WorkOrder").ToString(), | 
					
						
							|  |  |  |                         ID = Properties.Resources.WorkOrder + ": " + dataRows[j].Field<string>("WorkOrder").ToString(), | 
					
						
							|  |  |  |                         Dyelot = Properties.Resources.Dyelot + ": " + dataRows[j].Field<string>("Dyelot"), | 
					
						
							|  |  |  |                         Remark = Properties.Resources.Remark + ": " + dataRows[j].Field<string>("Remark"), | 
					
						
							|  |  |  |                         ColorNumber = Properties.Resources.ColorNumber + ": " + dataRows[j].Field<string>("ColorNumber"), | 
					
						
							|  |  |  |                         ColorName = Properties.Resources.ColorName + ": " + dataRows[j].Field<string>("ColorName"), | 
					
						
							|  |  |  |                         Client = Properties.Resources.Client + ": " + dataRows[j].Field<string>("Client"), | 
					
						
							|  |  |  |                         ClothSpecies = Properties.Resources.ClothSpecies + ": " + dataRows[j].Field<string>("ClothSpecies"), | 
					
						
							|  |  |  |                         ClothWeight = Properties.Resources.ClothWeight + ": " + dataRows[j].Field<string>("ClothWeight"), | 
					
						
							|  |  |  |                         BathRatio = Properties.Resources.BathRatio + ": " + dataRows[j].Field<string>("BathRatio"), | 
					
						
							|  |  |  |                         Total = Properties.Resources.Total + ": " + dataRows[j].Field<string>("Total"),   | 
					
						
							|  |  |  |                         USER = Properties.Resources.USER + ": " + dataRows[j].Field<string>("user"), | 
					
						
							|  |  |  |                         STATE = Properties.Resources.State + ": " +StatenClassConvert.Convert( dataRows[j].Field<Int32 >("State").ToString()), | 
					
						
							|  |  |  |                         TaskProgressVisibility = System.Windows.Visibility.Hidden | 
					
						
							|  |  |  |                     }); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }//创建日程图        
 | 
					
						
							|  |  |  |         private void ViewClicked(GanttTask ganttTask) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Picture.Content = null; | 
					
						
							|  |  |  |             Picture.Width = 600; | 
					
						
							|  |  |  |             Picture.Content = new ProductionPlanningEdit(ganttTask.WorkOrder,false); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private void DyelotClicked(GanttTask ganttTask)//领料单查看
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             UserMessage userMessage = new UserMessage(); | 
					
						
							|  |  |  |             userMessage.Dyelots(ganttTask.WorkOrder); | 
					
						
							|  |  |  |             userMessage.ShowDialog(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private void DelayedClicked(GanttTask ganttTask) | 
					
						
							|  |  |  |         {  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private void EditClicked(GanttTask ganttTask) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             if (MainWindowViewModel.USER_Capacity[6]) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
 | 
					
						
							|  |  |  |                 SQLiteHelpers.Open();  //打开数据库                       
 | 
					
						
							|  |  |  |                 DataTable WorkOrder_dt = SQLiteHelpers.ExecuteDataSet( | 
					
						
							|  |  |  |                     "select * from WorkOrder where WorkOrder='" + ganttTask.WorkOrder + "'Order by StartTime", null).Tables[0];  //读取表写入缓存           
 | 
					
						
							|  |  |  |                 SQLiteHelpers.Close(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 if (DateTime.Now > DateTime.Parse(WorkOrder_dt.Select().First().Field<object>("EndTime").ToString())) | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     MessageBox.Show(Properties.Resources.EHCIP, "SCCM", MessageBoxButton.OK, MessageBoxImage.Warning);//禁止编辑历史工艺
 | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 else | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     string wdt = WorkOrder_dt.Select().First().Field<object>("State").ToString(); | 
					
						
							|  |  |  |                     if (wdt == "101" || wdt == "100") | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         Picture.Content = null; | 
					
						
							|  |  |  |                         Picture.Width = 600; | 
					
						
							|  |  |  |                         Picture.Content = new ProductionPlanningEdit(ganttTask.WorkOrder, true); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         MessageBox.Show(Properties.Resources.ENWOIP, "SCCM", MessageBoxButton.OK, MessageBoxImage.Warning);//禁止编辑非等待中的工单
 | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }//编辑
 | 
					
						
							|  |  |  |         private void DeleteClicked(GanttTask ganttTask)//删除
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             if (MainWindowViewModel.USER_Capacity[7]) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + ganttTask.Name, "Delete ", | 
					
						
							|  |  |  |                    System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     ///执行删除
 | 
					
						
							|  |  |  |                     SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
 | 
					
						
							|  |  |  |                     SQLiteHelpers.Open();  //打开数据库                       
 | 
					
						
							|  |  |  |                     SQLiteHelpers.Delete("WorkOrder", "WorkOrder='" + ganttTask.WorkOrder + "'", null); | 
					
						
							|  |  |  |                     SQLiteHelpers.Delete("WorkOrderSteps", "WorkOrder='" + ganttTask.WorkOrder + "'", null); | 
					
						
							|  |  |  |                     SQLiteHelpers.Close(); | 
					
						
							|  |  |  |                     GanttChartNEW(); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private string FormatYear(Period period) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return period.Start.Year.ToString(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private string FormatMonth(Period period) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return period.Start.Month.ToString(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private string FormatDay(Period period) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return period.Start.Day.ToString(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private string FormatDayName(Period period) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return period.Start.DayOfWeek.ToString(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private string FormatHour(Period period) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return period.Start.Hour.ToString(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private System.Windows.Media.Brush DetermineBackground(TimeLineItem timeLineItem) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             if (timeLineItem.End.Date.DayOfWeek == DayOfWeek.Saturday || timeLineItem.End.Date.DayOfWeek == DayOfWeek.Sunday) | 
					
						
							|  |  |  |                 return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.LightBlue); | 
					
						
							|  |  |  |             else | 
					
						
							|  |  |  |                 return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Transparent); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private void ListViewItem_Plan(object sender, System.Windows.Input.MouseButtonEventArgs e)//计划事件
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Picture.Content = null; | 
					
						
							|  |  |  |             Picture.Width = 1100; | 
					
						
							|  |  |  |             Picture.Content = new DyeingPlanView(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private void ListViewItem_New(object sender, System.Windows.Input.MouseButtonEventArgs e)//新建事件
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Picture.Content = null; | 
					
						
							|  |  |  |             Picture.Width = 600; | 
					
						
							|  |  |  |             Picture.Content = new ProductionPlanningEdit(null, true); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private void WorkOrderNumder_Click(object sender, RoutedEventArgs e) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Picture.Content = null; | 
					
						
							|  |  |  |             SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
 | 
					
						
							|  |  |  |             SQLiteHelpers.Open();  //打开数据库                       
 | 
					
						
							|  |  |  |             int con = SQLiteHelpers.ExecuteDataSet( | 
					
						
							|  |  |  |                 "select * from WorkOrder where WorkOrder='" + Select_WorkOrderNumder.Text + | 
					
						
							|  |  |  |                 "'Order by StartTime", null).Tables[0].Rows.Count;           | 
					
						
							|  |  |  |             SQLiteHelpers.Close(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if (con > 0) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 Picture.Content = null; | 
					
						
							|  |  |  |                 Picture.Width = 600; | 
					
						
							|  |  |  |                 Picture.Content = new ProductionPlanningEdit(Select_WorkOrderNumder.Text, true); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             else  | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 MessageBox.Show(Properties.Resources.WorkOrderNumder+ Select_WorkOrderNumder.Text + Properties.Resources.DoesNotExist,  | 
					
						
							|  |  |  |                     "SCCM", MessageBoxButton.OK, MessageBoxImage.Warning); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }//搜索并打开
 | 
					
						
							|  |  |  |         private void ListViewItem_Before(object sender, MouseButtonEventArgs e)//前一天
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Picture.Content = null; | 
					
						
							|  |  |  |             Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(-1).ToString("yyyy/MM/dd  HH:mm:ss"); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private void ListViewItem_Today(object sender, MouseButtonEventArgs e)//今天
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Picture.Content = null; | 
					
						
							|  |  |  |             Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd"); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private void ListViewItem_DayAfter(object sender, MouseButtonEventArgs e)//后一天
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Picture.Content = null; | 
					
						
							|  |  |  |             Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd  HH:mm:ss"); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         private void Sdatepicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)//时间控件
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Picture.Content = null; | 
					
						
							|  |  |  |             minDate = DateTime.Parse(sender.ToString()); | 
					
						
							|  |  |  |             maxDate = DateTime.Parse(sender.ToString()).AddDays(1); | 
					
						
							|  |  |  |             GanttChartNEW(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         public void CountDown() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
 | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 Interval = TimeSpan.FromSeconds(1)//秒
 | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  |             timer1s.Tick += Tick_Event_1S; | 
					
						
							|  |  |  |             timer1s.Start(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         public static bool UI; | 
					
						
							|  |  |  |         void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
 | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             if (UI)  | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 GanttChartNEW(); | 
					
						
							|  |  |  |                 UI= false; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |