public static void Main()
 {
     try {
         RemotingConfiguration.Configure("EmployeeTrainingClient.exe.config", false);
         WellKnownClientTypeEntry[] client_types      = RemotingConfiguration.GetRegisteredWellKnownClientTypes();
         IEmployeeTraining          employee_training = (IEmployeeTraining)Activator.GetObject(typeof(IEmployeeTraining), client_types[0].ObjectUrl);
         EmployeeTrainingClient     client            = new EmployeeTrainingClient(employee_training);
         Application.Run(client);
     }catch (Exception e) {
         Console.WriteLine(e);
     }
 }
Пример #2
0
    private void InitializeComponent(EmployeeTrainingClient externalHandler)
    {
        _mainTablePanel             = new TableLayoutPanel();
        _mainTablePanel.RowCount    = 2;
        _mainTablePanel.ColumnCount = 2;
        _mainTablePanel.Anchor      = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left;
        _mainTablePanel.Height      = 500;
        _mainTablePanel.Width       = 700;
        _infoTablePanel             = new TableLayoutPanel();
        _infoTablePanel.Anchor      = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left;
        _infoTablePanel.RowCount    = 2;
        _infoTablePanel.ColumnCount = 2;
        _infoTablePanel.Height      = 200;
        _infoTablePanel.Width       = 400;
        _buttonPanel        = new FlowLayoutPanel();
        _buttonPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left;
        _buttonPanel.Width  = 500;
        _buttonPanel.Height = 200;

        _pictureBox        = new PictureBox();
        _pictureBox.Height = 200;
        _pictureBox.Width  = 200;
        _pictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left;

        _firstNameLabel          = new Label();
        _firstNameLabel.Text     = "First Name:";
        _middleNameLabel         = new Label();
        _middleNameLabel.Text    = "Middle Name:";
        _lastNameLabel           = new Label();
        _lastNameLabel.Text      = "Last Name:";
        _birthdayLabel           = new Label();
        _birthdayLabel.Text      = "Birthday";
        _genderLabel             = new Label();
        _genderLabel.Text        = "Gender";
        _firstNameTextBox        = new TextBox();
        _firstNameTextBox.Width  = 200;
        _middleNameTextBox       = new TextBox();
        _middleNameTextBox.Width = 200;
        _lastNameTextBox         = new TextBox();
        _lastNameTextBox.Width   = 200;
        _birthdayPicker          = new DateTimePicker();
        _genderBox                  = new GroupBox();
        _genderBox.Text             = "Gender";
        _genderBox.Height           = 75;
        _genderBox.Width            = 200;
        _maleRadioButton            = new RadioButton();
        _maleRadioButton.Text       = "Male";
        _maleRadioButton.Checked    = true;
        _maleRadioButton.Location   = new Point(10, 20);
        _femaleRadioButton          = new RadioButton();
        _femaleRadioButton.Text     = "Female";
        _femaleRadioButton.Location = new Point(10, 40);
        _genderBox.Controls.Add(_maleRadioButton);
        _genderBox.Controls.Add(_femaleRadioButton);
        _clearButton                = new Button();
        _clearButton.Text           = "Clear";
        _clearButton.Click         += this.ClearButtonHandler;
        _loadPictureButton          = new Button();
        _loadPictureButton.Text     = "Load Picture";
        _loadPictureButton.AutoSize = true;
        _loadPictureButton.Click   += this.LoadPictureButtonHandler;
        _submitButton               = new Button();
        _submitButton.Text          = "Submit";
        _submitButton.Click        += externalHandler.EmployeeSubmitButtonHandler;
        _submitButton.Enabled       = false;

        _infoTablePanel.SuspendLayout();
        _infoTablePanel.Controls.Add(_firstNameLabel);
        _infoTablePanel.Controls.Add(_firstNameTextBox);
        _infoTablePanel.Controls.Add(_middleNameLabel);
        _infoTablePanel.Controls.Add(_middleNameTextBox);
        _infoTablePanel.Controls.Add(_lastNameLabel);
        _infoTablePanel.Controls.Add(_lastNameTextBox);
        _infoTablePanel.Controls.Add(_birthdayLabel);
        _infoTablePanel.Controls.Add(_birthdayPicker);
        _infoTablePanel.Controls.Add(_genderLabel);
        _infoTablePanel.Controls.Add(_genderBox);
        _infoTablePanel.Dock = DockStyle.Top;

        _buttonPanel.SuspendLayout();
        _buttonPanel.Controls.Add(_clearButton);
        _buttonPanel.Controls.Add(_loadPictureButton);
        _buttonPanel.Controls.Add(_submitButton);

        _mainTablePanel.SuspendLayout();
        _mainTablePanel.Controls.Add(_pictureBox);
        _mainTablePanel.Controls.Add(_infoTablePanel);
        _mainTablePanel.Controls.Add(_buttonPanel);
        _mainTablePanel.SetColumnSpan(_buttonPanel, 2);

        this.SuspendLayout();
        this.Controls.Add(_mainTablePanel);
        this.Width  = WINDOW_WIDTH;
        this.Height = WINDOW_HEIGHT;
        this.Text   = "Employee Form";
        _infoTablePanel.ResumeLayout();
        _buttonPanel.ResumeLayout();
        _mainTablePanel.ResumeLayout();
        this.ResumeLayout();
        _dialog         = new OpenFileDialog();
        _dialog.FileOk += this.LoadPicture;
    }
Пример #3
0
 public EmployeeForm(EmployeeTrainingClient externalHandler)
 {
     this.InitializeComponent(externalHandler);
 }
Пример #4
0
 private void InitializeComponent(EmployeeTrainingClient externalHandler){
   _mainTablePanel = new TableLayoutPanel();
   _mainTablePanel.RowCount = 2;
   _mainTablePanel.ColumnCount = 1;
   _mainTablePanel.Height = 400;
   _mainTablePanel.Width = 500;
   _mainTablePanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
   
   _infoTablePanel = new TableLayoutPanel();
   _infoTablePanel.RowCount = 5;
   _infoTablePanel.ColumnCount = 2;
   _infoTablePanel.Height = 200;
   _infoTablePanel.Width = 300;
   _infoTablePanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
   
   _buttonPanel = new FlowLayoutPanel();
   _buttonPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
   
   _titleLabel = new Label();
   _titleLabel.Text = "Title:";
   _descriptionLabel = new Label();
   _descriptionLabel.Text = "Description:";
   _startDateLabel = new Label();
   _startDateLabel.Text = "Start Date:";
   _endDateLabel = new Label();
   _endDateLabel.Text = "End Date";
   _statusLabel = new Label();
   _statusLabel.Text = "Status";
   _titleTextBox = new TextBox();
   _titleTextBox.Width = 300;
   _descriptionTextBox = new TextBox();
   _descriptionTextBox.Width = 300;
   _startDatePicker = new DateTimePicker();
   _endDatePicker = new DateTimePicker();
   _statusGroupBox = new GroupBox();
   _statusGroupBox.Height = 75;
   _statusGroupBox.Width = 300;
   _passedRadioButton = new RadioButton();
   _passedRadioButton.Text = "Passed";
   _passedRadioButton.Checked = true;
   _passedRadioButton.Location = new Point(10, 10);
   _failedRadioButton = new RadioButton();
   _failedRadioButton.Text = "Failed";
   _failedRadioButton.Location = new Point(10, 30);
   _clearButton = new Button();
   _clearButton.Text = "Clear";
   _clearButton.Click += this.ClearButtonHandler;
   _submitButton = new Button();
   _submitButton.Text = "Submit";
   _submitButton.Click += externalHandler.TrainingSubmitButtonHandler;
   
   _statusGroupBox.Controls.Add(_passedRadioButton);
   _statusGroupBox.Controls.Add(_failedRadioButton);
   
   _infoTablePanel.SuspendLayout();
   _infoTablePanel.Controls.Add(_titleLabel);
   _infoTablePanel.Controls.Add(_titleTextBox);
   _infoTablePanel.Controls.Add(_descriptionLabel);
   _infoTablePanel.Controls.Add(_descriptionTextBox);
   _infoTablePanel.Controls.Add(_startDateLabel);
   _infoTablePanel.Controls.Add(_startDatePicker);
   _infoTablePanel.Controls.Add(_endDateLabel);
   _infoTablePanel.Controls.Add(_endDatePicker);
   _infoTablePanel.Controls.Add(_statusLabel);
   _infoTablePanel.Controls.Add(_statusGroupBox);
   
   _buttonPanel.Controls.Add(_clearButton);
   _buttonPanel.Controls.Add(_submitButton);
   
   
   _mainTablePanel.SuspendLayout();
   _mainTablePanel.Controls.Add(_infoTablePanel);
   _mainTablePanel.Controls.Add(_buttonPanel);
  
   this.SuspendLayout();
   this.Controls.Add(_mainTablePanel);
   this.Height = WINDOW_HEIGHT;
   this.Width = WINDOW_WIDTH;
   this.Text = "Training Form";
   _infoTablePanel.ResumeLayout();
   _mainTablePanel.ResumeLayout();
   this.ResumeLayout();
 }