/// <summary>
		/// Constructor
		/// </summary>
		public DHtmlComponentControl(DHtmlComponent component)
			: base(component)
		{
			InitializeComponent();
			_component = component;

#if DEBUG
			// in dev, show script error dialogs and browser context menu
			_webBrowser.ScriptErrorsSuppressed = false;
			_webBrowser.IsWebBrowserContextMenuEnabled = true;
#else
			// in production, suppress script error dialogs and browser context menu
			_webBrowser.ScriptErrorsSuppressed = true;
			_webBrowser.IsWebBrowserContextMenuEnabled = false;
#endif

			_component.AllPropertiesChanged += AllPropertiesChangedEventHandler;

			//_webBrowser.DataBindings.Add("Url", _component, "HtmlPageUrl", true, DataSourceUpdateMode.OnPropertyChanged);
			_webBrowser.ObjectForScripting = _component.ScriptObject;
			_webBrowser.Navigating += NavigatingEventHandler;
			_webBrowser.ScrollBarsEnabled = _component.ScrollBarsEnabled;
			if (_component.HtmlPageUrl != null)
			{
				_webBrowser.Navigate(_component.HtmlPageUrl);
			}


			_component.Validation.Add(new ValidationRule("DUMMY_PROPERTY",
				delegate
				{
					var result = _webBrowser.Document != null ? _webBrowser.Document.InvokeScript("hasValidationErrors") : null;

					// if result == null, the hasValidationErrors method is not implemented by the page
					// in this case, assume there are no errors
					var hasErrors = (result == null) ? false : (bool)result;
					return new ValidationResult(!hasErrors, "");
				}));

			_component.ValidationVisibleChanged += _component_ValidationVisibleChanged;
			_component.DataSaving += _component_DataSaving;

			_component.PrintDocumentRequested += _component_PrintDocument;
			_component.AsyncInvocationCompleted += _component_AsyncInvocationCompleted;
			_component.AsyncInvocationError += _component_AsyncInvocationError;

			_webBrowser.Disposed += delegate
			{
				_component.ValidationVisibleChanged -= _component_ValidationVisibleChanged;
				_component.DataSaving -= _component_DataSaving;
				_component.PrintDocumentRequested -= _component_PrintDocument;
				_component.AsyncInvocationCompleted -= _component_AsyncInvocationCompleted;
				_component.AsyncInvocationError -= _component_AsyncInvocationError;
			};
		}
        /// <summary>
        /// Constructor
        /// </summary>
        public DHtmlComponentControl(DHtmlComponent component)
            : base(component)
        {
            InitializeComponent();
            _component = component;

#if DEBUG
            // in dev, show script error dialogs and browser context menu
            _webBrowser.ScriptErrorsSuppressed         = false;
            _webBrowser.IsWebBrowserContextMenuEnabled = true;
#else
            // in production, suppress script error dialogs and browser context menu
            _webBrowser.ScriptErrorsSuppressed         = true;
            _webBrowser.IsWebBrowserContextMenuEnabled = false;
#endif

            _component.AllPropertiesChanged += AllPropertiesChangedEventHandler;

            //_webBrowser.DataBindings.Add("Url", _component, "HtmlPageUrl", true, DataSourceUpdateMode.OnPropertyChanged);
            _webBrowser.ObjectForScripting = _component.ScriptObject;
            _webBrowser.Navigating        += NavigatingEventHandler;
            _webBrowser.ScrollBarsEnabled  = _component.ScrollBarsEnabled;
            if (_component.HtmlPageUrl != null)
            {
                _webBrowser.Navigate(_component.HtmlPageUrl);
            }


            _component.Validation.Add(new ValidationRule("DUMMY_PROPERTY",
                                                         delegate
            {
                var result = _webBrowser.Document != null ? _webBrowser.Document.InvokeScript("hasValidationErrors") : null;

                // if result == null, the hasValidationErrors method is not implemented by the page
                // in this case, assume there are no errors
                var hasErrors = (result == null) ? false : (bool)result;
                return(new ValidationResult(!hasErrors, ""));
            }));

            _component.ValidationVisibleChanged += _component_ValidationVisibleChanged;
            _component.DataSaving += _component_DataSaving;

            _component.PrintDocumentRequested   += _component_PrintDocument;
            _component.AsyncInvocationCompleted += _component_AsyncInvocationCompleted;
            _component.AsyncInvocationError     += _component_AsyncInvocationError;

            _webBrowser.Disposed += delegate
            {
                _component.ValidationVisibleChanged -= _component_ValidationVisibleChanged;
                _component.DataSaving               -= _component_DataSaving;
                _component.PrintDocumentRequested   -= _component_PrintDocument;
                _component.AsyncInvocationCompleted -= _component_AsyncInvocationCompleted;
                _component.AsyncInvocationError     -= _component_AsyncInvocationError;
            };
        }
        public override void Start()
        {
            InitialisePaging();
            InitialiseFormData();

            _previewComponent     = new QueueItemPreviewComponent(this);
            _previewComponentHost = new ChildComponentHost(this.Host, _previewComponent);
            _previewComponentHost.StartComponent();

            base.Start();
        }
Пример #4
0
 public void SetComponent(IApplicationComponent component)
 {
     _component = (DHtmlComponent) component;
 }
Пример #5
0
 public void SetComponent(IApplicationComponent component)
 {
     _component = (DHtmlComponent)component;
 }