예제 #1
0
        /// <summary>
        /// Builds application forms.
        /// </summary>
        /// <returns>Main form.</returns>
        private static FormMain BuildApplicationForms()
        {
            _formMain = new FormMain();
            _formOptions = new FormOptions();
            _formProperties = new FormProperties();

            _presenterBuilder = new PresenterBuilder(_formMain,
                                                     _formMain,
                                                     _formOptions,
                                                     _formProperties);

            try
            {
                // Builds presenters and applies configuration.
                _presenterBuilder.Build();
            }
            catch (InvalidDataException ex)
            {
                MessageBox.Show(ex.Message,
                                Resources.MessageBoxCaptionApplication,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1,
                                0);
                Dispose();
                Environment.Exit(255);
            }
            catch (XmlException ex)
            {
                MessageBox.Show(ex.Message,
                                Resources.MessageBoxCaptionApplication,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1,
                                0);
                Dispose();
                Environment.Exit(255);
            }

            return _formMain;
        }
예제 #2
0
 /// <summary>
 /// Dispose.
 /// </summary>
 private static void Dispose()
 {
     if (_presenterBuilder != null)
     {
         _presenterBuilder.Dispose();
         _presenterBuilder = null;
     }
     if (_formMain != null)
     {
         _formMain.Dispose();
         _formMain = null;
     }
     if (_formOptions != null)
     {
         _formOptions.Dispose();
         _formOptions = null;
     }
     if (_formProperties != null)
     {
         _formProperties.Dispose();
         _formProperties = null;
     }
 }