Beispiel #1
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         btnOk.Enabled = false;
         if (!CheckArgsIsOk())
         {
             return;
         }
         progressBar.Visible = true;
         InputArg arg = new InputArg(_path);
         arg.InputDir       = txtDirName.Text;
         arg.OutputDir      = txtOutDir.Text;
         arg.ValidEnvelopes = _envList.ToArray();
         string[] datasets = GetSelectedDatasets();
         arg.Bands = datasets;
         arg.ToXml(_path);
         runTaskThread = new Thread(new ThreadStart(this.DoProcess));
         runTaskThread.IsBackground = true;
         runTaskThread.Start();
         //文件清理
     }
     catch (SystemException ex)
     {
         MessageBox.Show("处理出错:" + ex.Message);
         btnOk.Enabled = true;
     }
     finally
     {
         this.Activate();
         //btnOk.Enabled = true;
         progressBar.Visible = true;
     }
 }
Beispiel #2
0
        private bool TryProcessfiles()
        {
            bool processd = false;
            Dictionary <string, string> checkband1 = new Dictionary <string, string>();

            foreach (TreeNode node in treeviewdataset.Nodes)
            {
                foreach (TreeNode groupnode in node.Nodes)
                {
                    foreach (TreeNode subnode in groupnode.Nodes)
                    {
                        if (subnode.Checked)    //选中
                        {
                            checkband1.Add(subnode.Text, groupnode.Text);
                        }
                    }
                }
                if (checkband1.Count != 0)
                {
                    processd = true;
                    InputArg arg = new InputArg();
                    arg.ValidEnvelopes = _envList.ToArray();
                    string[] datasets = checkband1.Keys.ToArray();
                    arg.Bands     = datasets;
                    arg.InputDir  = txtInDir.Text;
                    arg.OutputDir = txtOutDir.Text;
                    arg.ToXml(_path);
                    foreach (string filename in _allFiles.Keys)
                    {
                        ProcessGPC2ldf(filename, checkband1);
                    }
                    checkband1.Clear();
                }
            }
            return(processd);
        }