public IDockPanel Add(Control control, string key, PluginIdentity identity)
        {
            if (control == null)
            {
                throw new NullReferenceException();
            }

            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ApplicationException("Dock panel must have a unique key.");
            }

            if (_dict.ContainsKey(control))
            {
                throw new ApplicationException("This control has been already added as a docking window.");
            }

            control.Name = key;     // to save / restore layout each dock panel must have a key

            _dockingManager.SetEnableDocking(control, true);

            _dict.Add(control, new DockPanelInfo(identity, key));

            _styleService.ApplyStyle(control);

            return(GetDockPanel(control));
        }
        /// <summary>
        /// Generates controls for driver options.
        /// </summary>
        private void GenerateDriverControls(Panel panel, DatasourceDriver driver)
        {
            var options = driver.GetMainOptions().ToList();

            if (options.Any())
            {
                // options in 2 different section for drivers like GTiff
                var parameters = _driverOptions.Where(o => !options.Contains(o.Name));
                _generator.GenerateIntoPanel(panel, driver.Name + " Other Options", parameters);

                parameters = _driverOptions.Where(o => options.Contains(o.Name));
                _generator.GenerateIntoPanel(panel, driver.Name + " Main Options", parameters);
            }
            else
            {
                // one section for all the others
                _generator.GenerateIntoPanel(panel, driver.Name + " Options", _driverOptions);
            }

            _driverOptions.SetControlDefaults();

            panel.AddVerticalPadding();

            _styleService.ApplyStyle(panel);
        }
Beispiel #3
0
        public bool ShowChildView(Form form, IWin32Window parent, bool modal = true)
        {
            if (form == null)
            {
                throw new ArgumentNullException("parent");
            }

            if (form is Office2010Form || form is MetroForm)
            {
                _styleService.ApplyStyle(form);
            }

            if (form is RibbonForm || form is XtraForm)
            {
                _styleService.ApplyStyle(form);
            }

            if (form is IViewInternal)
            {
                var view  = form as IViewInternal;
                var style = view.Style;

                if (style != null)
                {
                    ApplyStyle(form, style);
                    modal = style.Modal;
                }
            }

            if (parent == null)
            {
                parent = _parent as IWin32Window;
            }
            if (modal)
            {
                return(form.ShowDialog(parent) == DialogResult.OK);
            }

            form.Show(parent);
            return(true);
        }
Beispiel #4
0
 private void OnPageShown()
 {
     _styleService.ApplyStyle(View as Form);
 }