示例#1
0
        /// <summary>
        /// 获取Recipe
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGetRecipeFile_Click(object sender, EventArgs e)
        {
            try
            {
                using (FolderBrowserDialog dialog = new FolderBrowserDialog())
                {
                    dialog.Description = "Save folder of recipe file.";

                    if (!string.IsNullOrWhiteSpace(this.txtGetRecipeFile.Text) &&
                        (Directory.Exists(this.txtGetRecipeFile.Text)))
                    {
                        dialog.SelectedPath = this.txtGetRecipeFile.Text;
                    }

                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        this.txtGetRecipeFile.Text = dialog.SelectedPath;

                        var tasks = new List <Task>();

                        foreach (var iixServer in Global.ListIIXSerevr)
                        {
                            if (iixServer.IsEnable == false)
                            {
                                continue;
                            }

                            tasks.Add(Task.Factory.StartNew(() =>
                            {
                                IIXExecute.GetRecipe(iixServer, dialog.SelectedPath);
                            }));
                        }

                        Task.WaitAll(tasks.ToArray());
                    }
                }
            }
            catch (Exception ex)
            {
                Log.GetInstance().ErrorWrite("系统错误,请查询日志文件检查。");
                Log.WriterExceptionLog(ex.ToString());
            }
        }