public MainForm() { try { IList <Emp> lst = new List <Emp>(); int cnt = lst.Count(a => a.Age == 0); string plaintext = UserDefinedFunctions.fnGetOriginalCode("N/a\\").Value; int passwordCode = UserDefinedFunctions.fnGetHashCode(plaintext); StringComparer sc = StringComparer.OrdinalIgnoreCase; int pc = sc.GetHashCode(plaintext); string result = string.Format("属于{0},定额 {1:0.00} 元(费用已超定额)。", "PIC", 12345); string wrong1 = string.Format("{0:yyyy-MM-dd hh:MM}", System.DateTime.Now); string wrong2 = string.Format("{0:yyyy-MM-dd HH:MM}", System.DateTime.Now); string correct = string.Format("{0:yyyy-MM-dd HH:mm}", System.DateTime.Now); Console.WriteLine("{0}\t{1}\t{2}", wrong1, wrong2, correct); foreach (SchedulerElement item in ConfigHelper.SchedulerCollection) { SetFilesWritable(Path.Combine(item.BasePath, @"bin\Resources")); SetFilesWritable(Path.Combine(item.BasePath, @"\DataModel\Oracle")); } //NetworkCredential credential = new NetworkCredential("guoshaoyue", "netboy", "hissoft.com");//初始化用户 //TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(ConfigHelper.TeamFoundationServerURL), credential); TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(ConfigHelper.TeamFoundationServerURL), CredentialCache.DefaultCredentials); tpc.Authenticate(); WorkItemStore workItemStore = tpc.GetService <WorkItemStore>(); ////特有的Wilq查询,2008和2010还不一样 //// WorkItemCollection queryResults = workItemStore.Query( ////"Select * From WorkItems Where [System.Teamproject]='ClinicalManagement'" + ////" and [System.WorkItemType] = 'Bug' and [System.State]='活动的' " + ////"Order By [System.State] Asc, [System.ChangedDate] Desc"); //WorkItem workItem = queryResults[1]; //Debug.Print(workItem.Fields["标题"].Value.ToString()); //workItem.Fields["指派给"].Value = "宁美玲"; ////验证工作项的各字段是否有效,如果save出错,则可通过此方式验证哪出错 //ArrayList ar = workItem.Validate(); //foreach (var item in ar) //{ // Debug.Print(item.ToString()); //} //workItem.Save(); ////工作项的字段信息 //FieldCollection fl = workItem.Fields; //foreach (Field item in fl) //{ // Debug.Print(item.Name); //} bool newMutexCreated = false; string mutexName = "Global\\" + Assembly.GetExecutingAssembly().GetName().Name; Mutex mutex = null; try { mutex = new Mutex(false, mutexName, out newMutexCreated); } catch (Exception ex) { Debug.Print(ex.ToString()); Environment.Exit(1); } if (newMutexCreated) { InitializeComponent(); CreateCustomerRadioButtons(); BindControlEvents(Controls); // 注意:this.Width和this.Height只有在InitializeComponent()初始化UI控件之后才能正确获取 this.Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height; this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width; lblCurState.Text = "作业已启动,启动时间:" + DateTime.Now; _batch = new HandleMask(); _starting = DateTime.Now; _batch.Start(); } else { Environment.Exit(1); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); Environment.Exit(1); } LoadResources(); OnReceivedTaskFinishedMessage(); GlobalEventManager.JobWasExecuted += GlobalEventManager_JobWasExecuted; _timer = new System.Threading.Timer(new TimerCallback(ResetTrayIcon)); _timer.Change(0, 1000); }