Ejemplo n.º 1
0
        private void OnGUI()
        {
            if (Controls == null || Controls.Any() == false)
            {
                OnLoad();
            }

            PrivateDispatcher.DispatchAllStart();
            RendererEngine.Controls   = Controls;
            RendererEngine.Dispatcher = PrivateDispatcher;
            RendererEngine.RenderControls();
            PrivateDispatcher.DispatchAllEnd();
        }
Ejemplo n.º 2
0
 protected override void Drawing(ITerminal <TGlyph, TColor> terminal)
 {
     PrepareContent();
     Drawing(terminal, Left, Top, Width, Height, BorderTheme, ColorTheme);
     if (Title?.Any() == true)
     {
         terminal.DrawString(Left + 1, Top, Title.Fit(Width - 2, Ellipsis),
                             ColorTheme.Foreground, ColorTheme.Background);
     }
     if (Controls.Any())
     {
         Controls.First().Draw(terminal);
     }
 }
Ejemplo n.º 3
0
 private void PrepareContent()
 {
     if (Controls.Any())
     {
         var content = Controls.First();
         content.Left   = Left + 1;
         content.Top    = Top + 1;
         content.Width  = Width - 2;
         content.Height = Height - 2;
         if (OverrideThemes)
         {
             content.ColorTheme = ColorTheme;
         }
     }
 }
Ejemplo n.º 4
0
        private void OnGUI()
        {
            if (GUI.Button(new Rect(position.width - 50, 0, 50, 20), "Reset"))
            {
                Controls = null;
            }

            if (Controls == null || Controls.Any() == false)
            {
                OnLoad();
                InitControls(Controls);
            }

            RendererEngine.RenderControls(Controls);
        }
 private void ControlRemoved(Control control)
 {
     if (focusedControl == control)
     {
         focusedControl.OnLostFocus();
         if (Controls.Any())
         {
             focusedControl = Controls.First();
             focusedControl.OnGotFocus();
         }
         else
         {
             focusedControl = null;
         }
     }
 }
Ejemplo n.º 6
0
        protected override void UpdateLayout()
        {
            outer.Width  = Math.Min(Math.Max(outer.Width, sizeMin.Width), sizeMax.Width);
            outer.Height = Math.Min(Math.Max(outer.Height, sizeMin.Height), sizeMax.Height);
            Inner        = new Rectangle(0, 0, outer.Width, outer.Height);

            TotalSize = new Size(0, 0);
            if (Controls.Any())
            {
                TotalSize.Width  = Controls.Max(c => c.Outer.Right);
                TotalSize.Height = Controls.Max(c => c.Outer.Bottom);
            }

            if (Parent != null && !Parent.AutoSize)             // avoid repeated calls if autosize is true
            {
                Parent.Invalidate();
            }
        }
Ejemplo n.º 7
0
        private void OnGUI()
        {
                        #if UNITY_EDITOR
            if (GUI.Button(new Rect(Screen.width - 50, 0, 50, 20), "Reset"))
            {
                Controls = null;
            }
                        #endif

            if (Controls == null || Controls.Any() == false)
            {
                OnLoad();
            }

            PrivateDispatcher.DispatchAllStart();
            RendererEngine.Controls   = Controls;
            RendererEngine.Dispatcher = PrivateDispatcher;
            RendererEngine.RenderControls();
            PrivateDispatcher.DispatchAllEnd();
        }
Ejemplo n.º 8
0
        protected internal override XElement ToXml(XNamespace ns)
        {
            var element = base.ToXml(ns);

            if (!_dynamicItemsLoading)
            {
                // Add the Items first
                if (_data.Any())
                {
                    element.Add(_data.ToXml(ns));
                }
            }

            // Then the buttons
            if (_controls.Any())
            {
                element.Add(_controls.ToXml(ns));
            }

            return(element);
        }
Ejemplo n.º 9
0
        public IEnumerable <string> PlaceControls(Monitor newMonitor)
        {
            if (!Controls.Any())
            {
                yield break;
            }
            ChooseTransform(newMonitor, out double scale, out Point translation);
            foreach (HeliosVisual visual in Controls)
            {
                // Make sure name is unique
                int    i    = 1;
                string name = visual.Name;
                while (newMonitor.Children.ContainsKey(name))
                {
                    name = visual.Name + " " + i++;
                }
                visual.Name = name;

                newMonitor.Children.Add(visual);

                yield return(UpdateControl(newMonitor, visual, scale, translation, "placed and "));
            }
        }
Ejemplo n.º 10
0
        public ActionResult GetVaidatorControlPanel(FormCollection collection)
        {
            try
            {
                var formId = collection["formId"];
                if (string.IsNullOrEmpty(formId))
                {
                    return(Json(new { Result = false, Value = "" }, JsonRequestBehavior.AllowGet));
                }
                var controls = new Controls();
                controls.AddRange(Extentions.DeSerialize(Utils.ConvertHtmlToString(collection["jsonvalue"].Decompress())));
                var Id = collection["Id"];
                if (!string.IsNullOrEmpty(Id))
                {
                    var firstOrDefault = controls.FindControl(Id);
                    if (firstOrDefault == null)
                    {
                        return(Json(new { Result = false, Value = "" }, JsonRequestBehavior.AllowGet));
                    }
                    this.RadynTryUpdateModel(firstOrDefault);
                    if (((ValidatorControl)firstOrDefault).Enable)
                    {
                        if (controls.Any(x =>
                                         x.GetType().Name == firstOrDefault.GetType().Name&&
                                         ((ValidatorControl)x).Id != ((ValidatorControl)firstOrDefault).Id &&
                                         ((ValidatorControl)x).Enable))
                        {
                            ShowMessage(Resources.FormGenerator.ThisValidationTypalreadyAdded,
                                        Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                            return(Json(new { Result = false, Value = "" }, JsonRequestBehavior.AllowGet));
                        }
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(collection["ValidatorTypeId"]))
                    {
                        return(Content("false"));
                    }
                    var loadFrom = FormGeneratorComponent.Instance.FormStructureFacade.GetValidatorTypes();
                    if (loadFrom == null)
                    {
                        return(Json(new { Result = false, Value = "" }, JsonRequestBehavior.AllowGet));
                    }
                    var type = loadFrom.FirstOrDefault(x => x.Name == collection["ValidatorTypeId"]);
                    if (type == null)
                    {
                        return(Json(new { Result = false, Value = "" }, JsonRequestBehavior.AllowGet));
                    }
                    var obj = Activator.CreateInstance(type);
                    this.RadynTryUpdateModel(obj);
                    FormGeneratorComponent.Instance.FormStructureDesgineFacade.SetValidatorIdAndName(controls, obj, formId.ToGuid());
                    if (((ValidatorControl)obj).Enable)
                    {
                        if (controls.Any(x => x.GetType().Name == obj.GetType().Name&& ((ValidatorControl)x).Id != ((ValidatorControl)obj).Id && ((ValidatorControl)x).Enable))
                        {
                            ShowMessage(Resources.FormGenerator.ThisValidationTypalreadyAdded, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                            return(Json(new { Result = false, Value = "" }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    controls.Add(obj);
                }

                return(Json(new { Result = true, Value = controls.Serialize().Compress() }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                ShowExceptionMessage(exception);
                return(Json(new { Result = false, Value = "" }, JsonRequestBehavior.AllowGet));
            }
        }
 private void CbSelected_Checked(object sender, RoutedEventArgs e)
 => _cbAlleKeine.IsChecked = Controls.Any(x => !x.Remove) ? null : (bool?)true;