int CreateFillsAndDescriptions(out NFill[] fills, out string[] texts) { Array gradientStyles = NEnum.GetValues(typeof(ENGradientStyle)); Array gradientVariants = NEnum.GetValues(typeof(ENGradientVariant)); int styleCount = gradientStyles.Length; int variantCount = gradientVariants.Length; int count = styleCount * variantCount; int index = 0; fills = new NFill[count]; texts = new string[count]; // Create the gradient fills for (int i = 0; i < variantCount; i++) { ENGradientVariant variant = (ENGradientVariant)gradientVariants.GetValue(i); for (int j = 0; j < styleCount; j++) { ENGradientStyle style = (ENGradientStyle)gradientStyles.GetValue(j); fills[index] = new NStockGradientFill(style, variant, defaultBeginColor, defaultEndColor); texts[index] = style.ToString() + " " + variant.ToString(); index++; } } return(styleCount); }
/// <summary> /// Adds rich formatted text to the specified text block content /// </summary> /// <param name="content"></param> private void AddFormattedTextToContent(NTextBlockContent content) { content.Blocks.Add(GetTitleParagraph("Bullet lists allow you to apply automatic numbering on paragraphs or groups of blocks.", 1)); // setting bullet list template type { content.Blocks.Add(GetTitleParagraph("Following are bullet lists with different formatting", 2)); ENBulletListTemplateType[] values = NEnum.GetValues <ENBulletListTemplateType>(); string[] names = NEnum.GetNames <ENBulletListTemplateType>(); string itemText = "Bullet List Item"; for (int i = 0; i < values.Length - 1; i++) { NGroupBlock group = new NGroupBlock(); content.Blocks.Add(group); group.MarginTop = 10; group.MarginBottom = 10; NBulletList bulletList = new NBulletList(values[i]); content.BulletLists.Add(bulletList); for (int j = 0; j < 3; j++) { NParagraph paragraph = new NParagraph(itemText + j.ToString()); NBulletInline bullet = new NBulletInline(); bullet.List = bulletList; paragraph.Bullet = bullet; group.Blocks.Add(paragraph); } } } // nested bullet lists { content.Blocks.Add(GetTitleParagraph("Following is an example of bullets with different bullet level", 2)); NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Decimal); content.BulletLists.Add(bulletList); NGroupBlock group = new NGroupBlock(); content.Blocks.Add(group); for (int i = 0; i < 3; i++) { NParagraph par = new NParagraph("Bullet List Item" + i.ToString(), bulletList, 0); group.Blocks.Add(par); for (int j = 0; j < 2; j++) { NParagraph nestedPar = new NParagraph("Nested Bullet List Item" + i.ToString(), bulletList, 1); nestedPar.MarginLeft = 10; group.Blocks.Add(nestedPar); } } } }
private void RecreateSymbols() { NColor color = m_ColorBox.SelectedColor; double length = InitialSize * Math.Pow(2, m_RadioGroup.SelectedIndex); NSize size = new NSize(length, length); m_SymbolsTable.Clear(); ENSymbolShape[] symbolShapes = NEnum.GetValues <ENSymbolShape>(); int count = symbolShapes.Length / 2 + symbolShapes.Length % 2; for (int i = 0; i < count; i++) { // Add a symbol box to the first column int column1Index = i; AddSymbolBox(symbolShapes[column1Index], size, color); // Add a symbol box to the second column int column2Index = count + i; if (column2Index < symbolShapes.Length) { NSymbolBox symbolBox = AddSymbolBox(symbolShapes[column2Index], size, color); symbolBox.Margins = new NMargins(NDesign.HorizontalSpacing * 10, 0, 0, 0); } } }
/// <summary> /// 语法分析树结点的构造函数 /// </summary> /// <param name="isLeaf">是否是叶子结点</param> /// <param name="tSymbol">如果是叶子结点,则是TokenSymbol的值,否则为default</param> /// <param name="nSymbol">如果是非叶子结点,则是NSymbol的值,否则为deault</param> public ParseTreeNode(bool isLeaf, TerminalType tSymbol, NEnum nSymbol) { this.IsLeaf = isLeaf; this.TSymbol = tSymbol; this.NSymbol = nSymbol; this.Childs = new List <ParseTreeNode>(); }
protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); stack.FillMode = ENStackFillMode.Last; stack.FitMode = ENStackFitMode.Last; // Create the tool bar button type radio group NStackPanel buttonTypeStack = new NStackPanel(); ENToolBarButtonType[] buttonTypes = NEnum.GetValues <ENToolBarButtonType>(); for (int i = 0, count = buttonTypes.Length; i < count; i++) { // Get the current button type and its string representation ENToolBarButtonType buttonType = buttonTypes[i]; string text = NStringHelpers.InsertSpacesBeforeUppersAndDigits(buttonType.ToString()); // Create a radio button for the current button type NRadioButton radioButton = new NRadioButton(text); buttonTypeStack.Add(radioButton); } NRadioButtonGroup buttonTypeGroup = new NRadioButtonGroup(buttonTypeStack); buttonTypeGroup.SelectedIndexChanged += OnButtonTypeGroupSelectedIndexChanged; buttonTypeGroup.SelectedIndex = 2; stack.Add(new NGroupBox("Button Type", buttonTypeGroup)); // Create the events log m_EventsLog = new NExampleEventsLog(); stack.Add(m_EventsLog); return(stack); }
protected override NWidget CreateExampleContent() { Array predefinedCursors = NEnum.GetValues(typeof(ENPredefinedCursor)); NStackPanel stack = new NStackPanel(); NGroupBox predefinedGroupBox = new NGroupBox("Predefined"); stack.Add(predefinedGroupBox); NSplitter splitter = new NSplitter(); splitter.SplitMode = ENSplitterSplitMode.Proportional; splitter.SplitFactor = 0.5d; predefinedGroupBox.Content = splitter; for (int i = 0; i < 2; i++) { NStackPanel pstack = new NStackPanel(); pstack.VerticalSpacing = 1; switch (i) { case 0: splitter.Pane1.Content = new NGroupBox("Use Native If Possible", pstack); break; case 1: splitter.Pane2.Content = new NGroupBox("Use Built-In", pstack); break; default: throw new Exception("More cases?"); } for (int j = 0; j < predefinedCursors.Length; j++) { ENPredefinedCursor predefinedCursor = (ENPredefinedCursor)predefinedCursors.GetValue(j); NWidget element = CreateDemoElement(NStringHelpers.InsertSpacesBeforeUppersAndDigits(predefinedCursor.ToString())); element.Cursor = new NCursor(predefinedCursor, i == 0); pstack.Add(element); } } NWidget customElement = CreateDemoElement("Custom"); customElement.Cursor = NResources.Cursor_CustomCursor_cur; NGroupBox customGroupBox = new NGroupBox("Custom", customElement); stack.Add(customGroupBox); return(stack); }
/// <summary> /// 为预测分析表设置表项 /// </summary> /// <param name="nEnum">产生式左侧非终结符号</param> /// <param name="tokenTypes">所有需要被设置表项的终结符号</param> /// <param name="treeNodes">构成产生式的语法分析树结点</param> public void SetParsingTable(NEnum nEnum, List <ParseTreeNode> treeNodes , params TerminalType[] tokenTypes) { ParsingTableItem tableItem; // 用于接收新建的预测分析表表项 foreach (TerminalType tEnum in tokenTypes) { // 将树结点添加到产生式中 tableItem = new ParsingTableItem(); tableItem.production.AddRange(treeNodes); this.GetItem(nEnum, tEnum).Add(tableItem); } }
protected override string GetExampleDescription() { int symbolCount = NEnum.GetValues <ENSymbolShape>().Length; string symbolCountStr = symbolCount.ToString(CultureInfo.InvariantCulture); return(@" <p> Nevron Open Vision provides support for drawing of vector based shapes called symbols. The advantage of such vector based shapes over regular raster images is that they do not blur and look nice at any size. This example demonstrates how to create and use predefined symbols. Nevron Open Vision currently provides support for <b>" + symbolCountStr + @" predefined symbols</b>. Use the radio buttons on the right to see the symbols at different sizes. </p> "); }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Bullet Lists", "Bullet lists allow you to apply automatic numbering on paragraphs or groups of blocks.", 1)); section.Blocks.Add(GetDescriptionBlock("Simple bullet list", "Following is a bullet list with default formatting.", 2)); CreateSampleBulletList(section, ENBulletListTemplateType.Bullet, 3, "Bullet List Item"); // setting bullet list template type { section.Blocks.Add(GetDescriptionBlock("Bullet Lists with Different Template", "Following are bullet lists with different formatting", 2)); ENBulletListTemplateType[] values = NEnum.GetValues <ENBulletListTemplateType>(); string[] names = NEnum.GetNames <ENBulletListTemplateType>(); for (int i = 0; i < values.Length - 1; i++) { CreateSampleBulletList(section, values[i], 3, names[i] + " bullet list item "); } } // nested bullet lists { section.Blocks.Add(GetDescriptionBlock("Bullet List Levels", "Following is an example of bullet list levels", 2)); NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Decimal); m_RichText.Content.BulletLists.Add(bulletList); for (int i = 0; i < 3; i++) { NParagraph par1 = new NParagraph("Bullet List Item" + i.ToString()); par1.SetBulletList(bulletList, 0); section.Blocks.Add(par1); for (int j = 0; j < 2; j++) { NParagraph par2 = new NParagraph("Nested Bullet List Item" + i.ToString()); par2.SetBulletList(bulletList, 1); par2.MarginLeft = 20; section.Blocks.Add(par2); } } } }
/// <summary> /// 为预测分析表设置表项(产生式中由一个非终结符号构成) /// </summary> /// <param name="nEnum">产生式左侧非终结符号</param> /// <param name="production">构成产生式的非终结符号</param> /// <param name="tokenTypes">所有需要被设置表项的终结符号</param> public void SetParsingTable(NEnum nEnum, NEnum production, params TerminalType[] tokenTypes) { ParsingTableItem tableItem; // 用于接收新建的预测分析表表项 ParseTreeNode treeNode; // 用于接收新建的语法分析树结点 foreach (TerminalType tEnum in tokenTypes) { // 将树结点添加到产生式中 tableItem = new ParsingTableItem(); treeNode = new ParseTreeNode(false, TerminalType.DEFAULT, production); tableItem.production.Add(treeNode); this.GetItem(nEnum, tEnum).Add(tableItem); } }
public void TestEnum1() { NEnum builder = NEnum.RandomDomain(); var script = builder .CustomUsing() .Namespace("haha") .Access(AccessFlags.Public) .Name("EnumUT1") .EnumField("Apple", 1) .EnumField("Orange", 2) .EnumField("Banana", 4) .Script; Assert.Equal($"namespace haha{{public enum EnumUT1{{{Environment.NewLine}Apple=1,{Environment.NewLine}Orange=2,{Environment.NewLine}Banana=4}}}}", script); Assert.NotNull(builder.GetType()); }
public void TestEnum() { NEnum builder = NEnum.RandomDomain(); var script = builder .CustomUsing() .HiddenNamespace() .Access(Natasha.Reverser.Model.AccessTypes.Public) .DefinedName("EnumUT1") .EnumField("Apple", 1) .EnumField("Orange", 2) .EnumField("Banana", 4) .Script; Assert.Equal($"public enum EnumUT1{{{Environment.NewLine}Apple=1,{Environment.NewLine}Orange=2,{Environment.NewLine}Banana=4}}", script); Assert.NotNull(builder.GetType()); }
protected override void InitDiagram() { base.InitDiagram(); NDrawing drawing = m_DrawingDocument.Content; NPage activePage = drawing.ActivePage; activePage.Layout.ContentPadding = new NMargins(20); // switch selected edit mode to geometry // this instructs the diagram to show geometry handles for the selected shapes. drawing.ScreenVisibility.ShowGrid = false; NConnectorShapeFactory connectorShapes = new NConnectorShapeFactory(); ENArrowheadShape[] arrowheadShapes = NEnum.GetValues <ENArrowheadShape>(); double x = 20; double y = 0; for (int i = 1; i < arrowheadShapes.Length; i++) { ENArrowheadShape arrowheadShape = arrowheadShapes[i]; NShape shape = connectorShapes.CreateShape(ENConnectorShape.Line); drawing.ActivePage.Items.Add(shape); // create geometry arrowheads shape.Geometry.BeginArrowhead = new NArrowhead(arrowheadShape); shape.Geometry.EndArrowhead = new NArrowhead(arrowheadShape); shape.Text = NEnum.GetLocalizedString(arrowheadShape); shape.SetBeginPoint(new NPoint(x, y)); shape.SetEndPoint(new NPoint(x + 350, y)); y += 30; if (i == arrowheadShapes.Length / 2) { // Begin a second column of shapes x += 400; y = 0; } } activePage.SizeToContent(); }
protected override NWidget CreateExampleContent() { // Get the fill styles ENHatchStyle[] hatches = NEnum.GetValues <ENHatchStyle>(); int count = hatches.Length; // Create a table layout panel m_Table = new NTableFlowPanel(); m_Table.HorizontalPlacement = ENHorizontalPlacement.Left; m_Table.VerticalPlacement = ENVerticalPlacement.Top; m_Table.Padding = new NMargins(30); m_Table.HorizontalSpacing = 30; m_Table.VerticalSpacing = 30; m_Table.MaxOrdinal = 6; // Add widgets with the proper filling and names to the panel for (int i = 0; i < count; i++) { NStackPanel stack = new NStackPanel(); m_Table.Add(stack); stack.Direction = ENHVDirection.TopToBottom; stack.FillMode = ENStackFillMode.First; stack.FitMode = ENStackFitMode.First; // Create a widget with the proper filling NCanvas canvas = new NCanvas(); canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight); canvas.Tag = new NHatchFill(hatches[i], defaultForegroundColor, defaultBackgroundColor); stack.Add(canvas); canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint); // Create a label with the corresponding name NLabel label = new NLabel(hatches[i].ToString()); stack.Add(label); label.HorizontalPlacement = ENHorizontalPlacement.Center; } // The table must be scrollable NScrollContent scroll = new NScrollContent(); scroll.Content = m_Table; return(scroll); }
private void OnRadioGroupSelectedIndexChanged(NValueChangeEventArgs args) { if (m_Table == null) { return; } ENAdvancedGradientColorScheme[] predefinedGradientSchemes = NEnum.GetValues <ENAdvancedGradientColorScheme>(); INIterator <NNode> iterator = m_Table.GetSubtreeIterator(ENTreeTraversalOrder.DepthFirstPreOrder, new NInstanceOfSchemaFilter(NCanvas.NCanvasSchema)); int gradientVariant = (int)args.NewValue; int schemeIndex = 0; while (iterator.MoveNext()) { NCanvas canvas = (NCanvas)iterator.Current; canvas.Tag = NAdvancedGradientFill.Create(predefinedGradientSchemes[schemeIndex++], gradientVariant); canvas.InvalidateDisplay(); } }
protected override NWidget CreateExampleContent() { // Create a table panel to hold the canvases and the labels m_Table = new NTableFlowPanel(); m_Table.HorizontalPlacement = ENHorizontalPlacement.Left; m_Table.VerticalPlacement = ENVerticalPlacement.Top; m_Table.Padding = new NMargins(30); m_Table.HorizontalSpacing = 30; m_Table.VerticalSpacing = 30; m_Table.MaxOrdinal = 4; ENAdvancedGradientColorScheme[] predefinedGradientSchemes = NEnum.GetValues <ENAdvancedGradientColorScheme>(); for (int i = 0; i < predefinedGradientSchemes.Length; i++) { NStackPanel stack = new NStackPanel(); m_Table.Add(stack); stack.Direction = ENHVDirection.TopToBottom; stack.FillMode = ENStackFillMode.First; stack.FitMode = ENStackFitMode.First; // Create a widget with the proper filling NCanvas canvas = new NCanvas(); canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight); canvas.Tag = NAdvancedGradientFill.Create(predefinedGradientSchemes[i], 0); stack.Add(canvas); canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint); // Create a label with the corresponding name NLabel label = new NLabel(predefinedGradientSchemes[i].ToString()); stack.Add(label); label.HorizontalPlacement = ENHorizontalPlacement.Center; } // The table must be scrollable NScrollContent scroll = new NScrollContent(); scroll.Content = m_Table; return(scroll); }
public NPersonInfo(string name, ENGender gender) { Name = name; Gender = gender; // random birthday of 20-50 year olds int days = Random.Next(30 * 365) + 20 * 365; Birthday = DateTime.Now - new TimeSpan(days, 0, 0, 0); // random country Country = (ENCountry)Random.Next(NEnum.GetValues(typeof(ENCountry)).Length); // random phone int areaCode = Random.Next(999); int firstPhonePart = Random.Next(999); int secondPhonePart = Random.Next(9999); Phone = String.Format("({0})-{1}-{2}", areaCode.ToString("000"), firstPhonePart.ToString("000"), secondPhonePart.ToString("0000")); // email Email = Name.ToLower().Replace(" ", ".") + "@domain.com"; }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Field Inlines", "The example shows how to use field inlines.", 1)); section.Blocks.Add(GetNoteBlock("Not all field values are always available. Please check the documentation for more information.", 1)); // add numeric fields section.Blocks.Add(GetTitleParagraph("Numeric Fields", 2)); ENNumericFieldName[] numericFields = NEnum.GetValues <ENNumericFieldName>(); string[] numericFieldNames = NEnum.GetNames <ENNumericFieldName>(); for (int i = 0; i < numericFieldNames.Length; i++) { NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(new NTextInline(numericFieldNames[i] + " [")); NFieldInline fieldInline = new NFieldInline(); fieldInline.Value = new NNumericFieldValue(numericFields[i]); fieldInline.Text = "Not Updated"; paragraph.Inlines.Add(fieldInline); paragraph.Inlines.Add(new NTextInline("]")); section.Blocks.Add(paragraph); } // add date time fields section.Blocks.Add(GetTitleParagraph("Date/Time Fields", 2)); ENDateTimeFieldName[] dateTimeFields = NEnum.GetValues <ENDateTimeFieldName>(); string[] dateTimecFieldNames = NEnum.GetNames <ENDateTimeFieldName>(); for (int i = 0; i < dateTimecFieldNames.Length; i++) { NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(new NTextInline(dateTimecFieldNames[i] + " [")); NFieldInline fieldInline = new NFieldInline(); fieldInline.Value = new NDateTimeFieldValue(dateTimeFields[i]); fieldInline.Text = "Not Updated"; paragraph.Inlines.Add(fieldInline); paragraph.Inlines.Add(new NTextInline("]")); section.Blocks.Add(paragraph); } // add string fields section.Blocks.Add(GetTitleParagraph("String Fields", 2)); ENStringFieldName[] stringFields = NEnum.GetValues <ENStringFieldName>(); string[] stringcFieldNames = NEnum.GetNames <ENStringFieldName>(); for (int i = 0; i < stringcFieldNames.Length; i++) { NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(new NTextInline(stringcFieldNames[i] + " [")); NFieldInline fieldInline = new NFieldInline(); fieldInline.Value = new NStringFieldValue(stringFields[i]); fieldInline.Text = "Not Updated"; paragraph.Inlines.Add(fieldInline); paragraph.Inlines.Add(new NTextInline("]")); section.Blocks.Add(paragraph); } }
protected override NWidget CreateExampleControls() { // Create the theme tree view NTheme theme; NTreeViewItem rootItem, themeItem; NTreeView themeTreeView = new NTreeView(); // Add the "Inherit Styles" root tree view item rootItem = new NTreeViewItem("Inherit Styles"); rootItem.Tag = "inherit"; themeTreeView.Items.Add(rootItem); themeTreeView.SelectedItem = rootItem; // Add the image based UI themes to the tree view rootItem = new NTreeViewItem("Part Based"); rootItem.Expanded = true; themeTreeView.Items.Add(rootItem); themeItem = new NTreeViewItem("Windows XP Blue"); themeItem.Tag = new NWindowsXPBlueTheme(); rootItem.Items.Add(themeItem); themeItem = new NTreeViewItem("Windows Aero"); themeItem.Tag = new NWindowsAeroTheme(); rootItem.Items.Add(themeItem); themeItem = new NTreeViewItem("Windows 8"); themeItem.Tag = new NWindows8Theme(); rootItem.Items.Add(themeItem); themeItem = new NTreeViewItem("Mac OS X 10.7 Lion"); themeItem.Tag = new NMacLionTheme(); rootItem.Items.Add(themeItem); themeItem = new NTreeViewItem("Mac OS X 10.11 El Capitan"); themeItem.Tag = new NMacElCapitanTheme(); rootItem.Items.Add(themeItem); themeItem = new NTreeViewItem("Nevron Dark"); themeItem.Tag = new NNevronDarkTheme(); rootItem.Items.Add(themeItem); themeItem = new NTreeViewItem("Nevron Light"); themeItem.Tag = new NNevronLightTheme(); rootItem.Items.Add(themeItem); // Add the windows classic UI themes to the tree view rootItem = new NTreeViewItem("Windows Classic"); rootItem.Expanded = true; themeTreeView.Items.Add(rootItem); ENUIThemeScheme[] windowsClassicSchemes = NEnum.GetValues <ENUIThemeScheme>(); for (int i = 0, count = windowsClassicSchemes.Length; i < count; i++) { ENUIThemeScheme scheme = windowsClassicSchemes[i]; theme = new NWindowsClassicTheme(scheme); themeItem = new NTreeViewItem(NStringHelpers.InsertSpacesBeforeUppersAndDigits(scheme.ToString())); themeItem.Tag = theme; rootItem.Items.Add(themeItem); } // Subscribe to the selected path changed event themeTreeView.SelectedPathChanged += new Function <NValueChangeEventArgs>(OnThemeTreeViewSelectedPathChanged); return(themeTreeView); }
/// <summary> /// 利用非终结符号和终结符号获取预测分析表的表项(产生式) /// </summary> /// <param name="nEnum"></param> /// <param name="tokenType"></param> /// <returns></returns> public List <ParsingTableItem> GetItem(NEnum nEnum, TerminalType tokenType) { return(this.parsingTable[(int)nEnum, (int)tokenType]); }
/// <summary> /// Creates the menu drop down that allows the user to select a theme. /// </summary> /// <returns></returns> protected NMenuDropDown CreateThemesMenuDropDown() { NMenuDropDown themesMenu = new NMenuDropDown("Theme"); // Add the Windows Classic themes NMenuItem windowsClassicMenuItem = new NMenuItem("Windows Classic"); themesMenu.Items.Add(windowsClassicMenuItem); ENUIThemeScheme[] windowsClassicSchemes = NEnum.GetValues <ENUIThemeScheme>(); for (int i = 0, count = windowsClassicSchemes.Length; i < count; i++) { ENUIThemeScheme scheme = (ENUIThemeScheme)windowsClassicSchemes.GetValue(i); NWindowsClassicTheme theme = new NWindowsClassicTheme(scheme); NCheckableMenuItem themeItem = new NCheckableMenuItem(NStringHelpers.InsertSpacesBeforeUppersAndDigits(scheme.ToString())); themeItem.Tag = theme; themeItem.Click += OnThemeMenuItemClick; windowsClassicMenuItem.Items.Add(themeItem); } // Add the touch themes NMenuItem touchThemesMenuItem = new NMenuItem("Touch Themes"); themesMenu.Items.Add(touchThemesMenuItem); // Add the Windows 8 touch theme NCheckableMenuItem windows8ThemeMenuItemTouch = new NCheckableMenuItem("Windows 8 Touch"); windows8ThemeMenuItemTouch.Tag = new NWindows8Theme(true); windows8ThemeMenuItemTouch.Click += OnThemeMenuItemClick; touchThemesMenuItem.Items.Add(windows8ThemeMenuItemTouch); // Add the dark theme NCheckableMenuItem darkThemeTouch = new NCheckableMenuItem("Nevron Dark Touch"); darkThemeTouch.Tag = new NNevronDarkTheme(true); darkThemeTouch.Click += OnThemeMenuItemClick; touchThemesMenuItem.Items.Add(darkThemeTouch); // Add the light theme NCheckableMenuItem lightThemeTouch = new NCheckableMenuItem("Nevron Light Touch"); lightThemeTouch.Tag = new NNevronLightTheme(true); lightThemeTouch.Click += OnThemeMenuItemClick; touchThemesMenuItem.Items.Add(lightThemeTouch); // Add the Windows XP Blue theme NCheckableMenuItem xpBlueMenuItem = new NCheckableMenuItem("Windows XP Blue"); xpBlueMenuItem.Tag = new NWindowsXPBlueTheme(); xpBlueMenuItem.Click += OnThemeMenuItemClick; themesMenu.Items.Add(xpBlueMenuItem); // Add the Windows Aero theme NCheckableMenuItem aeroThemeMenuItem = new NCheckableMenuItem("Windows 7 Aero"); aeroThemeMenuItem.Tag = new NWindowsAeroTheme(); aeroThemeMenuItem.Click += OnThemeMenuItemClick; themesMenu.Items.Add(aeroThemeMenuItem); // Add the Windows 8 theme (the default theme) NCheckableMenuItem windows8ThemeMenuItem = new NCheckableMenuItem("Windows 8"); windows8ThemeMenuItem.Tag = new NWindows8Theme(); windows8ThemeMenuItem.Click += OnThemeMenuItemClick; themesMenu.Items.Add(windows8ThemeMenuItem); windows8ThemeMenuItem.Checked = true; m_CurrentThemeMenuItem = windows8ThemeMenuItem; // Add the Mac Lion theme NCheckableMenuItem macLionThemeMenuItem = new NCheckableMenuItem("Mac OS X Lion"); macLionThemeMenuItem.Tag = new NMacLionTheme(); macLionThemeMenuItem.Click += OnThemeMenuItemClick; themesMenu.Items.Add(macLionThemeMenuItem); // Add the Mac El Capitan theme NCheckableMenuItem macElCapitanTheme = new NCheckableMenuItem("Mac OS X El Capitan"); macElCapitanTheme.Tag = new NMacElCapitanTheme(); macElCapitanTheme.Click += OnThemeMenuItemClick; themesMenu.Items.Add(macElCapitanTheme); // Add the dark theme NCheckableMenuItem darkTheme = new NCheckableMenuItem("Nevron Dark"); darkTheme.Tag = new NNevronDarkTheme(); darkTheme.Click += OnThemeMenuItemClick; themesMenu.Items.Add(darkTheme); // Add the light theme NCheckableMenuItem lightTheme = new NCheckableMenuItem("Nevron Light"); lightTheme.Tag = new NNevronLightTheme(); lightTheme.Click += OnThemeMenuItemClick; themesMenu.Items.Add(lightTheme); return(themesMenu); }
protected override NWidget CreateExampleContent() { // create the host NStackPanel stack = new NStackPanel(); stack.VerticalSpacing = 2; NGroupBox contentGroupBox = new NGroupBox("Content"); stack.Add(contentGroupBox); NStackPanel contentStack = new NStackPanel(); contentStack.VerticalSpacing = 2; contentGroupBox.Content = contentStack; NWidget textTooltip = CreateDemoElement("Text tooltip"); textTooltip.Tooltip = new NTooltip("Tooltip text"); contentStack.Add(textTooltip); NWidget imageTooltip = CreateDemoElement("Image tooltip"); imageTooltip.Tooltip = new NTooltip(NResources.Image__48x48_Book_png); contentStack.Add(imageTooltip); NWidget richTooltip = CreateDemoElement("Rich tooltip"); NStackPanel richTooltipContent = new NStackPanel(); richTooltipContent.Add(new NLabel("The tooltip can contain any type of Nevron Open Vision Content")); richTooltipContent.Add(new NImageBox(NResources.Image__48x48_Book_png)); richTooltip.Tooltip = new NTooltip(richTooltipContent); contentStack.Add(richTooltip); NWidget dynamicContentTooltip = CreateDemoElement("Dynamic content"); dynamicContentTooltip.Tooltip = new NDynamicContentTooltip(); contentStack.Add(dynamicContentTooltip); NGroupBox behaviorGroupBox = new NGroupBox("Behavior"); stack.Add(behaviorGroupBox); NStackPanel behaviorStack = new NStackPanel(); behaviorStack.VerticalSpacing = 2; behaviorGroupBox.Content = behaviorStack; NWidget followMouse = CreateDemoElement("Follow mouse"); followMouse.Tooltip = new NTooltip("I am following the mouse"); followMouse.Tooltip.FollowMouse = true; behaviorStack.Add(followMouse); NWidget instantShowTooltip = CreateDemoElement("Shown instantly"); instantShowTooltip.Tooltip = new NTooltip("I was shown instantly"); instantShowTooltip.Tooltip.FirstShowDelay = 0; instantShowTooltip.Tooltip.NextShowDelay = 0; behaviorStack.Add(instantShowTooltip); NWidget doNotCloseOnClick = CreateDemoElement("Do not close on click"); doNotCloseOnClick.Tooltip = new NTooltip("I am not closed on click"); doNotCloseOnClick.Tooltip.CloseOnMouseDown = false; behaviorStack.Add(doNotCloseOnClick); NGroupBox positionGroupBox = new NGroupBox("Position"); stack.Add(positionGroupBox); NTableFlowPanel positionTable = new NTableFlowPanel(); positionGroupBox.Content = positionTable; positionTable.HorizontalSpacing = 2; positionTable.VerticalSpacing = 2; positionTable.Direction = ENHVDirection.LeftToRight; positionTable.MaxOrdinal = 3; foreach (ENTooltipPosition pos in NEnum.GetValues(typeof(ENTooltipPosition))) { NWidget posElement = CreateDemoElement(pos.ToString()); posElement.Tooltip = new NTooltip(pos.ToString()); posElement.Tooltip.FirstShowDelay = 0; posElement.Tooltip.NextShowDelay = 0; posElement.Tooltip.Position = pos; posElement.Tooltip.FollowMouse = true; posElement.Tooltip.ShowDuration = -1; positionTable.Add(posElement); } return(stack); }
/// <summary> /// 将非终结符号串转换为字符串 /// </summary> /// <param name="N">待转换的非终结符号串</param> /// <returns>终结符号串对应的字符串</returns> public string N2String(NEnum N) { string resultString; switch (N) { case NEnum.program: resultString = "主程序"; break; case NEnum.stmt_sequence: resultString = "语句序列"; break; case NEnum.statement: resultString = "语句"; break; case NEnum.stmt_block: resultString = "语句块"; break; case NEnum.if_stmt: resultString = "if语句"; break; case NEnum.if_stmt_block: resultString = "if语句块"; break; case NEnum.else_stmt_block: resultString = "else语句块"; break; case NEnum.while_stmt: resultString = "while语句块"; break; case NEnum.assign_stmt: resultString = "赋值语句"; break; case NEnum.read_stmt: resultString = "read语句"; break; case NEnum.write_stmt: resultString = "write语句"; break; case NEnum.declare_stmt: resultString = "声明语句"; break; case NEnum.variable: resultString = "变量"; break; case NEnum.exp: resultString = "表达式"; break; case NEnum.addtive_exp: resultString = "加法表达式"; break; case NEnum.term: resultString = "term"; break; case NEnum.factor: resultString = "表达式计算因子"; break; case NEnum.logical_op: resultString = "逻辑表达式符号"; break; case NEnum.add_op: resultString = "加减运算符号"; break; case NEnum.mul_op: resultString = "乘法符号"; break; case NEnum.DEFAULT: resultString = "默认"; break; default: resultString = ""; break; } return(resultString); }