Ejemplo n.º 1
0
        static StyleSettings()
        {
            Font mainUIFont = new Font("Segoe UI", 9);

            var darkgroup = new StyleGroup();
            darkgroup.LabelStyle = new Style(Color.FromArgb(64, 64, 64), Color.White, mainUIFont);
            darkgroup.PanelStyle = new Style(Color.FromArgb(127, 127, 127), null, mainUIFont);
            darkgroup.MenuBarStyle = darkgroup.LabelStyle;
            darkgroup.ToolBarStyle = darkgroup.PanelStyle;
            darkgroup.SecondaryStyle = new Style(Color.LightGray, null, mainUIFont);

            var lightgroup = new StyleGroup();
            lightgroup.LabelStyle = new Style(Color.LightGray, Color.Black, mainUIFont);
            lightgroup.PanelStyle = new Style(Color.White, null, mainUIFont);
            lightgroup.StatusBarStyle = lightgroup.PanelStyle;
            lightgroup.MenuBarStyle = lightgroup.LabelStyle;
            lightgroup.ToolBarStyle = lightgroup.PanelStyle;
            lightgroup.SecondaryStyle = lightgroup.PanelStyle;

            var bluegroup = new StyleGroup();
            bluegroup.LabelStyle = new Style(Color.FromArgb(100, 120, 200), Color.DarkBlue, mainUIFont);
            bluegroup.PanelStyle = new Style(Color.FromArgb(192, 192, 255), null, mainUIFont);
            bluegroup.MenuBarStyle = bluegroup.LabelStyle;
            bluegroup.ToolBarStyle = bluegroup.PanelStyle;
            bluegroup.SecondaryStyle = new Style(Color.FromArgb(230, 230, 255), null, mainUIFont);

            var greengroup = new StyleGroup();
            greengroup.LabelStyle = new Style(Color.FromArgb(0, 88, 38), Color.LightYellow, mainUIFont);
            greengroup.PanelStyle = new Style(Color.FromArgb(135, 185, 80), null, mainUIFont);
            greengroup.MenuBarStyle = greengroup.LabelStyle;
            greengroup.ToolBarStyle = greengroup.PanelStyle;
            greengroup.SecondaryStyle = new Style(Color.FromArgb(225, 237, 197), null, mainUIFont);

            var orangegroup = new StyleGroup();
            orangegroup.LabelStyle = new Style(Color.FromArgb(255, 192, 104), Color.Black, mainUIFont);
            orangegroup.PanelStyle = new Style(Color.FromArgb(254, 230, 173), null, mainUIFont);
            orangegroup.MenuBarStyle = orangegroup.LabelStyle;
            orangegroup.ToolBarStyle = orangegroup.PanelStyle;
            orangegroup.SecondaryStyle = new Style(Color.LightYellow, null, mainUIFont);

            AddStyle("Dark", darkgroup);
            AddStyle("Light", lightgroup);
            AddStyle("Blue", bluegroup);
            AddStyle("Green", greengroup);
            AddStyle("Orange", orangegroup);
        }
        public IndicatedMultiComboBoxCellElement(GridViewColumn column, GridRowElement row)
            : base(column, row)
        {
            //this code adds a registration for RadDropDownListArrowButtonElement in order to allow its usage in other controls
            Theme      theme = ThemeRepository.ControlDefault;
            StyleGroup sg    = theme.FindStyleGroup("Telerik.WinControls.UI.RadDropDownList");

            sg.Registrations.Add(new StyleRegistration("Telerik.WinControls.UI.RadDropDownListArrowButtonElement"));

            indicator = new RadDropDownListArrowButtonElement();

            indicator.MaxSize   = new System.Drawing.Size(18, 20);
            indicator.Alignment = ContentAlignment.MiddleRight;
            indicator.NotifyParentOnMouseInput = false;
            indicator.Click += indicator_Click;

            this.Children.Add(indicator);
        }
Ejemplo n.º 3
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        var story = target as Story;

        if (story == null || story.Output == null)
        {
            return;
        }

        EditorGUILayout.Separator();

        EditorGUILayout.LabelField("Story State", story.State.ToString());
        EditorGUILayout.LabelField("Current Passage", story.CurrentPassage == null ? "(none)" : story.CurrentPassage.Name);

        EditorGUILayout.Separator();

        int defaultIndent = EditorGUI.indentLevel;

        for (int i = 0; i < story.Output.Count; i++)
        {
            StoryOutput output = story.Output[i];

            if (output is Embed)
            {
                continue;
            }

            int        groupCount = 0;
            StyleGroup group      = output.StyleGroup;
            while (group != null)
            {
                groupCount++;
                group = group.StyleGroup;
            }
            EditorGUI.indentLevel = defaultIndent + groupCount;
            EditorGUILayout.LabelField(output.ToString());
        }

        EditorGUI.indentLevel = defaultIndent;
    }
        public IndicatedBrowseCellElement(GridViewColumn column, GridRowElement row) : base(column, row)
        {
            indicator = new BrowseEditorButton();

            //this code adds a registration for RadDropDownListArrowButtonElement in order to allow its usage in other controls
            Theme      theme = ThemeRepository.ControlDefault;
            StyleGroup sg    = theme.FindStyleGroup("Telerik.WinControls.UI.RadBrowseEditor");

            sg.Registrations.Add(new StyleRegistration("Telerik.WinControls.UI.BrowseEditorButton"));

            indicator.Alignment = ContentAlignment.MiddleRight;
            indicator.ShouldHandleMouseInput   = true;
            indicator.NotifyParentOnMouseInput = false;

            indicator.FitToSizeMode = Telerik.WinControls.RadFitToSizeMode.FitToParentBounds;
            indicator.MaxSize       = new System.Drawing.Size(30, 15);
            indicator.Margin        = new System.Windows.Forms.Padding(0, 1, 4, 1);
            indicator.Click        += indicator_Click;

            this.Children.Add(indicator);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 加载本地XML保存的预设
        /// </summary>
        /// <param name="presetPath"></param>
        public static void LoadStylePreset(string presetPath)
        {
            if (!Directory.Exists(presetPath))
            {
                Directory.CreateDirectory(presetPath);
                return;
            }
            // 加载目录下的所有xml文件
            DirectoryInfo dir = new DirectoryInfo(presetPath);

            FileInfo[] files = dir.GetFiles();
            ArrayList  presetsFilePathList = new ArrayList();

            foreach (FileInfo f in files)
            {
                if (f.FullName.EndsWith(".xml"))
                {
                    presetsFilePathList.Add(f.FullName);
                }
            }

            // 反序列化为对象,同时捕获异常,如果存在非规范化的xml文件则跳过
            foreach (string path in presetsFilePathList)
            {
                try
                {
                    string           presetName = path.Substring(path.LastIndexOf("\\") + 1);
                    ParagraphStyle[] styles     = XMLManager.DeserializeXmlFromFile <ParagraphStyle[]>(path, Encoding.UTF8);
                    StyleGroup       group      = new StyleGroup(presetName, styles);
                    PresetList.Add(group);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    continue;
                }
            }

            // 加载完成,向界面更新
        }
Ejemplo n.º 6
0
        public static CallMessagesResultVoid Apply(IUnitOfWork db,
                                                   ISystemActionService actionService,
                                                   InventoryGroupViewModel model,
                                                   DateTime when,
                                                   long?by)
        {
            var existGroup = db.StyleGroups.GetAll().FirstOrDefault(sg => sg.Name == model.Name);

            if (existGroup == null)
            {
                existGroup = new StyleGroup()
                {
                    Name       = model.Name,
                    CreateDate = when,
                    CreatedBy  = by,
                };
                db.StyleGroups.Add(existGroup);
                db.Commit();
            }

            foreach (var groupItem in model.GroupItems)
            {
                var existGroupItem = db.StyleToGroups.GetAllAsDTO().FirstOrDefault(sgi => sgi.StyleGroupId == existGroup.Id &&
                                                                                   sgi.StyleId == groupItem.StyleId);
                if (existGroupItem == null)
                {
                    var newStyleItem = new StyleToGroup()
                    {
                        StyleGroupId = existGroup.Id,
                        StyleId      = groupItem.StyleId,
                        CreateDate   = when,
                        CreatedBy    = by
                    };
                    db.StyleToGroups.Add(newStyleItem);
                }
            }
            db.Commit();

            return(CallMessagesResultVoid.Success());
        }
        private void ParseInnerStyles(StyleGroup group, int grpStart, int grpLen)
        {
            var content    = _str.Substring(grpStart, grpLen);
            var enumerator = new StringEnumerator(content);
            var prev       = _str;

            _str = enumerator;

            while (this.MoveNext())
            {
                if (this._log.ShouldLog(TraceLevel.Verbose))
                {
                    this._log.Add(TraceLevel.Verbose, "CSS", "Found css style for " + this.Current.ToString() + " parsing inner contents");
                }

                if (null != this.Current)
                {
                    group.Styles.Add(this.Current);
                }
            }
            _str = prev;
        }
        public IndicatedDecimalCellElement(GridViewColumn column, GridRowElement row) : base(column, row)
        {
            //this code adds a registration for RadDropDownListArrowButtonElement in order to allow its usage in other controls
            Theme      theme = ThemeRepository.ControlDefault;
            StyleGroup sg    = theme.FindStyleGroup("Telerik.WinControls.UI.RadSpinEditor");

            sg.Registrations.Add(new StyleRegistration("Telerik.WinControls.UI.RadSpinElementUpButton"));
            sg.Registrations.Add(new StyleRegistration("Telerik.WinControls.UI.RadSpinElementDownButton"));

            indicatorUP                   = new RadSpinElementUpButton();
            indicatorUP.Class             = "UpButton";
            indicatorUP.Arrow.Direction   = ArrowDirection.Up;
            indicatorUP.StretchVertically = true;
            indicatorUP.Click            += indicator_Click;
            indicatorUP.Tag               = true;

            indicatorDown                   = new RadSpinElementDownButton();
            indicatorDown.Class             = "DownButton";
            indicatorDown.Arrow.Direction   = ArrowDirection.Down;
            indicatorDown.StretchVertically = true;
            indicatorDown.Click            += indicator_Click;
            indicatorDown.Tag               = false;

            StackLayoutElement layout = new StackLayoutElement();

            layout.Orientation         = System.Windows.Forms.Orientation.Vertical;
            layout.Alignment           = System.Drawing.ContentAlignment.MiddleRight;
            layout.StretchHorizontally = false;
            layout.StretchVertically   = true;
            layout.MaxSize             = new System.Drawing.Size(20, 18);
            layout.FitToSizeMode       = RadFitToSizeMode.FitToParentBounds;
            layout.Children.Add(indicatorUP);
            layout.Children.Add(indicatorDown);
            layout.Margin         = new System.Windows.Forms.Padding(0, 1, 4, 1);
            layout.ElementSpacing = 0;

            this.Children.Add(layout);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Set the style of the console
 /// </summary>
 /// <param name="style"></param>
 /// <param name="group"></param>
 public void Set(Style style, StyleGroup group)
 {
     Console.ForegroundColor = ColorsByStyles[style][group];
 }
Ejemplo n.º 10
0
 public StyleReset(Style style, StyleGroup group, IStyleManager styleMgr)
 {
     this.style = styleMgr;
     this.style.Set(style, group);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Small syntaxic sugar for using the <see cref="StyleReset"/> class.
 /// you can write
 /// <code>
 /// using (The(Style.Primary))
 ///     output.Write("..");
 /// </code>
 /// </summary>
 /// <param name="style"></param>
 /// <param name="group"></param>
 /// <returns></returns>
 private StyleReset The(Style style, StyleGroup group = StyleGroup.Normal)
 {
     return(new StyleReset(style, group, this.style));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Adds the named style to the internal style list.
 /// </summary>
 /// <param name="name">Name of the style.</param>
 /// <param name="group">The style to add.</param>
 public static void AddStyle(string name, StyleGroup group)
 {
     _styles[name] = group;
 }
Ejemplo n.º 13
0
        private void LoadControlDefaultTheme()
        {
            Theme      theme      = new Theme("ControlDefault");
            StyleGroup styleGroup = new StyleGroup();

            styleGroup.Registrations.Add(new StyleRegistration());
            styleGroup.Registrations[0].RegistrationType = "ElementTypeControlType";
            styleGroup.Registrations[0].ElementType      = "Telerik.WinControls.RootRadElement";
            styleGroup.Registrations[0].ControlType      = "Telerik.WinControls.UI.RadCarousel";
            theme.StyleGroups.Add(styleGroup);
            styleGroup.PropertySettingGroups.Add(new PropertySettingGroup()
            {
                Selector         = new ElementSelector(ElementSelectorTypes.ClassSelector, "PreviousButton"),
                PropertySettings =
                {
                    new PropertySetting("BackColor",    (object)Color.Transparent),
                    new PropertySetting("DisplayStyle", (object)DisplayStyle.Image),
                    new PropertySetting("Image",        (object)Telerik\u002EWinControls\u002EUI\u002EResources.previousButton)
                }
            });
            styleGroup.PropertySettingGroups.Add(new PropertySettingGroup()
            {
                Selector         = new ElementSelector(ElementSelectorTypes.ClassSelector, "NextButton"),
                PropertySettings =
                {
                    new PropertySetting("BackColor",    (object)Color.Transparent),
                    new PropertySetting("DisplayStyle", (object)DisplayStyle.Image),
                    new PropertySetting("Image",        (object)Telerik\u002EWinControls\u002EUI\u002EResources.nextButton)
                }
            });
            PropertySettingGroup propertySettingGroup1 = new PropertySettingGroup()
            {
                Selector = new ElementSelector(ElementSelectorTypes.ClassSelector, "NextButton")
            };

            propertySettingGroup1.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.ClassSelector, "ButtonFill");
            propertySettingGroup1.PropertySettings.Add(new PropertySetting("Visibility", (object)ElementVisibility.Hidden));
            styleGroup.PropertySettingGroups.Add(propertySettingGroup1);
            PropertySettingGroup propertySettingGroup2 = new PropertySettingGroup()
            {
                Selector = new ElementSelector(ElementSelectorTypes.ClassSelector, "NextButton")
            };

            propertySettingGroup2.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.ClassSelector, "ButtonBorder");
            propertySettingGroup2.PropertySettings.Add(new PropertySetting("Visibility", (object)ElementVisibility.Collapsed));
            styleGroup.PropertySettingGroups.Add(propertySettingGroup2);
            PropertySettingGroup propertySettingGroup3 = new PropertySettingGroup()
            {
                Selector = new ElementSelector(ElementSelectorTypes.ClassSelector, "PreviousButton")
            };

            propertySettingGroup3.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.ClassSelector, "ButtonFill");
            propertySettingGroup3.PropertySettings.Add(new PropertySetting("Visibility", (object)ElementVisibility.Hidden));
            styleGroup.PropertySettingGroups.Add(propertySettingGroup3);
            PropertySettingGroup propertySettingGroup4 = new PropertySettingGroup()
            {
                Selector = new ElementSelector(ElementSelectorTypes.ClassSelector, "PreviousButton")
            };

            propertySettingGroup4.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.ClassSelector, "ButtonBorder");
            propertySettingGroup4.PropertySettings.Add(new PropertySetting("Visibility", (object)ElementVisibility.Collapsed));
            styleGroup.PropertySettingGroups.Add(propertySettingGroup4);
            PropertySettingGroup propertySettingGroup5 = new PropertySettingGroup()
            {
                Selector = new ElementSelector(ElementSelectorTypes.VisualStateSelector, "CarouselGenericItem")
            };

            propertySettingGroup5.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.TypeSelector, "Telerik.WinControls.Primitives.TextPrimitive");
            propertySettingGroup5.PropertySettings.Add(new PropertySetting("ForeColor", (object)Color.Transparent));
            styleGroup.PropertySettingGroups.Add(propertySettingGroup5);
            PropertySettingGroup propertySettingGroup6 = new PropertySettingGroup()
            {
                Selector = new ElementSelector(ElementSelectorTypes.VisualStateSelector, "CarouselGenericItem")
            };

            propertySettingGroup6.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.TypeSelector, "Telerik.WinControls.Primitives.BorderPrimitive");
            propertySettingGroup6.PropertySettings.Add(new PropertySetting("ForeColor", (object)Color.Transparent));
            propertySettingGroup6.PropertySettings.Add(new PropertySetting("GradientStyle", (object)GradientStyles.Solid));
            propertySettingGroup6.PropertySettings.Add(new PropertySetting("BoxSyle", (object)BorderBoxStyle.SingleBorder));
            styleGroup.PropertySettingGroups.Add(propertySettingGroup6);
            PropertySettingGroup propertySettingGroup7 = new PropertySettingGroup()
            {
                Selector = new ElementSelector(ElementSelectorTypes.VisualStateSelector, "CarouselGenericItem")
            };

            propertySettingGroup7.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.TypeSelector, "Telerik.WinControls.Primitives.FillPrimitive");
            propertySettingGroup7.PropertySettings.Add(new PropertySetting("BackColor", (object)Color.Transparent));
            propertySettingGroup7.PropertySettings.Add(new PropertySetting("ForeColor2", (object)Color.Transparent));
            propertySettingGroup7.PropertySettings.Add(new PropertySetting("GradientStyle", (object)GradientStyles.Radial));
            propertySettingGroup7.PropertySettings.Add(new PropertySetting("ZIndex", (object)10));
            propertySettingGroup7.PropertySettings.Add(new PropertySetting("Visibility", (object)ElementVisibility.Collapsed));
            styleGroup.PropertySettingGroups.Add(propertySettingGroup7);
            PropertySettingGroup propertySettingGroup8 = new PropertySettingGroup()
            {
                Selector = new ElementSelector(ElementSelectorTypes.VisualStateSelector, "CarouselGenericItem.MouseOver")
            };

            propertySettingGroup8.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.TypeSelector, "Telerik.WinControls.Primitives.FillPrimitive");
            propertySettingGroup8.PropertySettings.Add(new PropertySetting("Visibility", (object)ElementVisibility.Visible));
            propertySettingGroup8.PropertySettings.Add(new PropertySetting()
            {
                Name     = "BackColor",
                EndValue = (object)Color.Transparent
            });
            propertySettingGroup8.PropertySettings.Add(new PropertySetting()
            {
                Name     = "BackColor2",
                EndValue = (object)Color.FromArgb(120, (int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue)
            });
            propertySettingGroup8.PropertySettings.Add(new PropertySetting("GradientStyle", (object)GradientStyles.Radial));
            propertySettingGroup8.PropertySettings.Add(new PropertySetting("GradientAngle", (object)90f));
            propertySettingGroup8.PropertySettings.Add(new PropertySetting("GradientPercentage", (object)0.5f));
            propertySettingGroup8.PropertySettings.Add(new PropertySetting("GradientPercentage2", (object)0.666f));
            propertySettingGroup8.PropertySettings.Add(new PropertySetting("NumberOfColors", (object)2));
            styleGroup.PropertySettingGroups.Add(propertySettingGroup8);
            ThemeRepository.Add(theme);
        }