Exemplo n.º 1
0
        public FrmMain(string file)
        {
            InitializeComponent();

            _fileToChange = new FileToChange(_heidenhainFile = new FileInfo(file));

            ToolRangeNumericUpDown.Value = 0; ToolRangeNumericUpDown.Value = _fileToChange.OriginalToolRange;

            this.FileNameTextBox.Text = _fileToChange.NoteText;

            this.Text = AboutApp;

            if (_fileToChange.IsToolRangeConsistent != true)
            {
                FileNameTextBox.ForeColor = System.Drawing.Color.Red;

                ChangeButton.BackColor = System.Drawing.Color.Red;

                ToolRangeNumericUpDown.ForeColor = System.Drawing.Color.Red;
            }

            ToolTip tt = new ToolTip();

            tt.ShowAlways = true;
            tt.SetToolTip(this, _fileToChange.ToString());
            foreach (Control c in this.Controls)
            {
                tt.SetToolTip(c, _fileToChange.ToString());
            }

            if (_fileToChange.MatchesOfToolCalls.Count < 1 | _fileToChange.OnlyRestrictiveToolValues)
            {
                ChangeButton.Enabled = false; ToolRangeNumericUpDown.Enabled = false;
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AutoStartMultiselectedFiles = true;

            if (args.Length != 0)
            {
                if (AutoStartMultiselectedFiles)
                {
                    if (System.IO.File.Exists(args[0]))
                    {
                        Application.Run(new FrmMain(args[0]));
                    }
                    if (ExitMainFrmWithOk == true)
                    {
                        for (var i = 1; i < args.Length; i++)
                        {
                            if (System.IO.File.Exists(args[i]))
                            {
                                FileToChange ftc = new FileToChange(new System.IO.FileInfo(args[i]));
                                ftc.ChangeToolRange(SelectedToolRange, true);
                            }
                        }
                    }
                }
                else
                {
                    foreach (var file in args)
                    {
                        if (System.IO.File.Exists(file))
                        {
                            Application.Run(new FrmMain(file));
                        }
                    }
                }
            }
            else
            {
                OpenFileDialog fd = new OpenFileDialog()
                {
                    Multiselect = true,
                    Filter      = "*.h files (*.h)|*.h|All files (*.*)|*.*",
                    Title       = "HEINDENHAIN-Programm bzw. *.h-Datei wählen... " + FrmMain.AboutApp
                };

                if (fd.ShowDialog() == DialogResult.OK)
                {
                    if (AutoStartMultiselectedFiles)
                    {
                        Application.Run(new FrmMain(fd.FileNames[0]));
                        if (ExitMainFrmWithOk == true)
                        {
                            for (var i = 1; i < fd.FileNames.Length; i++)
                            {
                                FileToChange ftc = new FileToChange(new System.IO.FileInfo(fd.FileNames[i]));
                                ftc.ChangeToolRange(SelectedToolRange, true);
                            }
                        }
                    }
                    else
                    {
                        foreach (var file in fd.FileNames)
                        {
                            Application.Run(new FrmMain(file));
                        }
                    }
                }
            }
        }