Beispiel #1
0
        private void LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string            path    = (string)(sender as Control).Tag;
            LogFileViewerForm logForm = new LogFileViewerForm();

            logForm.Show();
            AppContext.Instance.Register(logForm);
            logForm.OpenFile(path);
        }
        public LogFileViewerForm()
        {
            InitializeComponent();

            newViewerToolStripMenuItem.Click += new EventHandler((sender, args) =>
            {
                LogFileViewerForm newForm = new LogFileViewerForm();
                AppContext.Instance.Register(newForm);
                newForm.Show();
            });

            openToolStripMenuItem.Click += new EventHandler((sender, args) => OpenFile());
            exitToolStripMenuItem.Click += new EventHandler((sender, args) => Close());
            infoToolStripMenuItem.Click += new EventHandler((sender, args) => new AboutDialog().ShowDialog(this));
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (args.Length == 0)
            {
                MainForm mainForm = new MainForm();
                mainForm.Show();
                AppContext.Instance.Register(mainForm);
            }
            else
            {
                LogFileViewerForm logForm = new LogFileViewerForm();
                logForm.Show();
                AppContext.Instance.Register(logForm);
                logForm.OpenFile(args[0]);
            }

            Application.Run(AppContext.Instance);
        }
Beispiel #4
0
        public MainForm()
        {
            InitializeComponent();

            // Event handler for the start button
            startButton.Click += new EventHandler((object sender, EventArgs args) => StartTest());

            // Remove empty file group rows when possible. The RowLeave event would be better, but
            // it does not permit concurrent modification of the grid.
            fileGroupGrid.Leave += new EventHandler((object sender, EventArgs args) =>
            {
                for (int i = 0; i < fileGroupGrid.RowCount - 1; i++)
                {
                    DataGridViewRow row = fileGroupGrid.Rows[i];
                    if (WinForms.RowIsEmpty(row))
                    {
                        fileGroupGrid.Rows.RemoveAt(i--);
                    }
                }
            });

            // Disable sorting in the file group table
            foreach (DataGridViewColumn column in fileGroupGrid.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            // Add default file groups
            fileGroupGrid.Rows.Add("1000", "256K");
            fileGroupGrid.Rows.Add("100", "2M");
            fileGroupGrid.Rows.Add("10", "400M");

            // Add verification modes
            IDictionary <VerificationMode, string> vModes = new Dictionary <VerificationMode, string>()
            {
                { VerificationMode.NONE, "Nein" },
                { VerificationMode.SIMPLE, "Einfach" },
                { VerificationMode.BOTH, "Doppelt" }
            };

            verifyModeComboBox.DataSource            = new BindingSource(vModes, null);
            verifyModeComboBox.SelectedIndexChanged += new EventHandler(UpdateVerificationModeDescription);
            verifyModeComboBox.SelectedIndex         = 1;
            verifyModeComboBox.DisplayMember         = "Value";
            verifyModeComboBox.ValueMember           = "Key";

            // Enable browsing
            targetDirInput.Browse   += new EventHandler(BrowseForTargetDirectory);
            testFileDirInput.Browse += new EventHandler(BrowseForTargetDirectory);
            logDirInput.Browse      += new EventHandler(BrowseForTargetDirectory);

            // We will use a single instance of the connection dialog to preserve its state
            connectionDialog = new ConnectionDialog();
            nasConnToolStripMenuItem.Click += new EventHandler((sender, args) => ShowConnectionDialog());

            logFileToolStripMenuItem.Click += new EventHandler((sender, args) =>
            {
                LogFileViewerForm logViewer = new LogFileViewerForm();
                AppContext.Instance.Register(logViewer);
                logViewer.Show();
                logViewer.OpenFile();
            });

            infoToolStripMenuItem.Click += new EventHandler((sender, args) => new AboutDialog().ShowDialog(this));

            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Interval = 60000;
            timer.Tick    += new EventHandler((sender, args) => logBox.Log("Heartbeat"));
            timer.Start();
        }