Пример #1
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            if (CWAFilenames.Length != SelectedPlugin.NumberOfInputFiles)
            {
                MessageBox.Show("Incorrect number of CWA files provided to plugin.\nPlugin requires " + SelectedPlugin.NumberOfInputFiles + " files", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DialogResult = System.Windows.Forms.DialogResult.Abort;
                return;
            }

            //See now if we want the dataViewer selection.
            if (BlockCount > -1 && BlockStart > -1)
            {
                SelectedPlugin.SelectionBlockStart = BlockStart;
                SelectedPlugin.SelectionBlockCount = BlockCount;
            }

            if (StartTime != null && EndTime != null)
            {
                SelectedPlugin.SelectionDateTimeStart = StartTime;
                SelectedPlugin.SelectionDateTimeEnd   = EndTime;
            }

            //Want to pop up Input and Run Window.
            rpf = new RunPluginForm(SelectedPlugin, CWAFilenames);
            rpf.ShowDialog();

            if (rpf.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                SelectedParameters = rpf.SelectedParameters;

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                DialogResult = System.Windows.Forms.DialogResult.Cancel;
            }
        }
Пример #2
0
        //Click event handler for the tool strip default plugins that comes from the profile file...
        void tsb_Click(object sender, EventArgs e)
        {
            ToolStripButton tsb = sender as ToolStripButton;

            if (tsb != null && tsb.Tag != null)
            {
                if (filesListView.SelectedItems.Count > 0)
                {
                    string[] CWAFilenames = new string[filesListView.SelectedItems.Count];

                    for (int i = 0; i < filesListView.SelectedItems.Count; i++)
                    {
                        OmReader reader = (OmReader)filesListView.SelectedItems[0].Tag;

                        CWAFilenames[i] = reader.Filename;
                    }

                    Plugin p = (Plugin)tsb.Tag;

                    float blockStart = -1;
                    float blockCount = -1;
                    float blockEnd = -1;

                    DateTime startDateTime;
                    DateTime endDateTime;

                    if (dataViewer.HasSelection)
                    {
                        blockStart = dataViewer.SelectionBeginBlock + dataViewer.OffsetBlocks;
                        blockCount = dataViewer.SelectionEndBlock - dataViewer.SelectionBeginBlock;
                        blockEnd = blockStart + blockCount;

                        startDateTime = dataViewer.TimeForBlock(blockStart);
                        endDateTime = dataViewer.TimeForBlock(blockEnd);
                        string startDateTimeString = startDateTime.ToString("dd/MM/yyyy/_HH:mm:ss.000");
                        string endDateTimeString = endDateTime.ToString("dd/MM/yyyy/_HH:mm:ss.000");

                        //See now if we want the dataViewer selection.
                        if (blockCount > -1 && blockStart > -1)
                        {
                            p.SelectionBlockStart = blockStart;
                            p.SelectionBlockCount = blockCount;
                        }

                        if (startDateTimeString != null && endDateTimeString != null)
                        {
                            p.SelectionDateTimeStart = startDateTimeString;
                            p.SelectionDateTimeEnd = endDateTimeString;
                        }
                    }

                    RunPluginForm rpf = new RunPluginForm(p, CWAFilenames);
                    rpf.ShowDialog();

                    if (rpf.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        //if the plugin has an output file
                        RunProcess2(rpf.ParameterString, p, rpf.OriginalOutputName, CWAFilenames);

                        //Change index to the queue
                        tabControlFiles.SelectedIndex = 1;
                    }
                }
                else
                {
                    MessageBox.Show("Please choose a file to run a plugin on.");
                }
            }
        }
Пример #3
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            if (CWAFilenames.Length != SelectedPlugin.NumberOfInputFiles)
            {
                MessageBox.Show("Incorrect number of CWA files provided to plugin.\nPlugin requires " + SelectedPlugin.NumberOfInputFiles + " files", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DialogResult = System.Windows.Forms.DialogResult.Abort;
                return;
            }

            //See now if we want the dataViewer selection.
            if (BlockCount > -1 && BlockStart > -1)
            {
                SelectedPlugin.SelectionBlockStart = BlockStart;
                SelectedPlugin.SelectionBlockCount = BlockCount;
            }

            if (StartTime != null && EndTime != null)
            {
                SelectedPlugin.SelectionDateTimeStart = StartTime;
                SelectedPlugin.SelectionDateTimeEnd = EndTime;
            }

            //Want to pop up Input and Run Window.
            rpf = new RunPluginForm(SelectedPlugin, CWAFilenames);
            rpf.ShowDialog();

            if (rpf.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                SelectedParameters = rpf.SelectedParameters;

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                DialogResult = System.Windows.Forms.DialogResult.Cancel;
            }
        }