コード例 #1
0
        private void ProgressForm_Load(object sender, EventArgs e)
        {
            _logServices.TraceEnter();
            try
            {
                _logServices.Trace("Creating view model...");
                var invokerParameter = new ConstructorArgument("invoker", this);
                var viewModel        = Services.Kernel.Get <ProgressFormViewModel>(invokerParameter);

                _logServices.Trace("Binding to form...");
                bindingSourceForm.DataSource = viewModel;

                _logServices.Trace("Starting password testing...");
                viewModel.Start(_windowHandle);
            }
            catch (Exception ex)
            {
                _logServices.Error(ex);

                MessageBox.Show(Properties.Resources.ERROR_MESSAGE_TEXT, Properties.Resources.ERROR_MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                _logServices.TraceExit();
            }
        }
コード例 #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            _logServices.TraceEnter();
            try
            {
                // creating view model
                _logServices.Trace("Creating view model...");
                var invokerParameter = new ConstructorArgument("invoker", this);
                var viewModel        = Services.Kernel.Get <MainFormViewModel>(invokerParameter);

                _logServices.Trace("Assigning it to the data source...");
                bindingSourceForm.DataSource = viewModel;
            }
            catch (Exception ex)
            {
                _logServices.Error(ex);

                MessageBox.Show(Properties.Resources.ERROR_MESSAGE_TEXT, Properties.Resources.ERROR_MESSAGE_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                _logServices.TraceExit();
            }
        }