예제 #1
0
        //========================================================================
        private void toolBar_ButtonClick(
            object sender,
            System.Windows.Forms.ToolBarButtonClickEventArgs e
            )
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                ToolBar tb           = (ToolBar)sender;
                int     which_button = (int)tb.Buttons.IndexOf(e.Button);

                switch (which_button)
                {
                case 1:
                    // Insert code to call the component.
                    this.behind_.on_test_requested(this.last_selected_progid_, this.selectedNode);
                    break;

                case 3:
                    // open config file and exit the app
                    if (this.behind_.open_config_file())
                    {
                        this.behind_ = null;
                        Application.Exit();
                    }
                    break;

                case 5:
                    // Insert code to copy the output to the clipboard.
                    this.behind_.copy_output(sender, e);
                    break;

                case 7:
                    // results browser
                    this.behind_.open_result_file();
                    break;

                case 9:
                    // EXIT
                    this.behind_ = null;
                    Application.Exit();
                    break;

                case 11:
                    // About modal dialog
                    (new dbj.about.AboutDialog()).ShowDialog(this);
                    break;

                default:
                    // an separator button ...
                    break;
                }
            }
            catch (System.Exception x) {
                writeln(x.GetType().Name + " : " + x.Message);
            }
            finally {
                this.Cursor = Cursors.Default;
            }
        }
예제 #2
0
        //==================================================================
        private void on_loaded(object sender, System.EventArgs e)
        {
            /**/
            var /*Rectangle*/ sr = Screen.GetWorkingArea(this);

            this.Width  = Convert.ToInt32(sr.Width * 0.8);
            this.Height = Convert.ToInt32(sr.Height * 0.8);
            int left = 1; // (sr.Width/2) - (this.Width/2);
            int top  = 1; // (sr.Height/2) - (this.Height/2);

            // Center the Form on the user's screen
            this.SetBounds(
                left, top, this.Width, this.Height, BoundsSpecified.All
                );
            this.Location = new Point(left, top);
            /**/

            // Add buttons to the tool bar
            ToolBarButton button1 = new ToolBarButton();
            ToolBarButton button2 = new ToolBarButton();
            ToolBarButton button3 = new ToolBarButton();
            ToolBarButton button4 = new ToolBarButton();
            ToolBarButton button5 = new ToolBarButton();
            ToolBarButton button6 = new ToolBarButton();

            ToolBarButton separator = new ToolBarButton();

            // Set the Text properties of the button controls.
            button1.Text = "&CAll";
            button2.Text = "Con&figure";
            button3.Text = "&Copy Output";
            button4.Text = "&Results";
            button5.Text = "&Exit";
            button6.Text = "&About";

            separator.Style = ToolBarButtonStyle.Separator;

            // Add the button controls to the ToolBar.
            toolBar.Buttons.Add(separator);
            toolBar.Buttons.Add(button1);               // 1
            toolBar.Buttons.Add(separator);
            toolBar.Buttons.Add(button2);               // 3 == Re-Configuration
            toolBar.Buttons.Add(separator);
            toolBar.Buttons.Add(button3);               // 5
            toolBar.Buttons.Add(separator);
            toolBar.Buttons.Add(button4);               // 7 == Result browser
            toolBar.Buttons.Add(separator);
            toolBar.Buttons.Add(button5);               // 9 == Exit
            toolBar.Buttons.Add(separator);
            toolBar.Buttons.Add(button6);               // 11 == About

            this.behind_ = new dbjept.Behind(this);
            this.behind_.on_form_activated(sender, e);

            Util.tooltip_to_control(this.output, "Double-click to erase this text");
            Util.tooltip_to_control(this.treeView1, "Test configuration");
            Util.tooltip_to_control(this.toolBar, "(c) 2003-2006 by DBJSOLUTIONS.COM\n\rAll rights reserved");
            Util.tooltip_to_control(this.toolBar, "(c) 2018 by DBJ.Systems \n\rAll rights reserved");

            // initial info for the output
            this.writeln(
                Environment.NewLine +
                System.Reflection.Assembly.GetExecutingAssembly().FullName +
                Environment.NewLine +
                "Corelib Version : " +
                dbj.fm.util.version() + Environment.NewLine +
                ".NET environment : " +
                System.Environment.Version.ToString(4)
                );
#if DEBUG
            string debug_info = string.Format(
                "AppDomain friendly name : [{0}]" + NL +
                "Base directory : [{2}]" + NL +
                "Files shadow copied : [{4}]" + NL +
                "Relative search path : [{1}]" + NL +
                "Dynamic directory : [{3}]" + NL,
                AppDomain.CurrentDomain.FriendlyName,
                AppDomain.CurrentDomain.RelativeSearchPath,
                AppDomain.CurrentDomain.BaseDirectory,
                AppDomain.CurrentDomain.DynamicDirectory,
                (AppDomain.CurrentDomain.ShadowCopyFiles ? "YES" : "NO"));
            // System.Diagnostics.Debug.WriteLine("") ;
            // System.Diagnostics.Debug.WriteLine( debug_info ) ;
            Behind.trace.info("Loaded and initialized the main form");
            this.writeln(debug_info);
#endif
        }