public override string ToString() { // overridden version of toString() method that uses identity hash code // (to prevent hashCode() recursion due to logging!) return GetType().Name + "@" + NInteger.ToHexString(NSystem.IdentityHashCode(this)); // Integer.toHexString(System.identityHashCode(this)); }
protected override NShapeInfo CreateShapeInfo(int index) { GroupShapes shape = (GroupShapes)index; string name = NSystem.InsertSpacesBeforeUppers(shape.ToString()); NShapeInfo info = new NShapeInfo(name); return(info); }
/// <summary> /// Creates a custom appointment edit dialog. /// </summary> /// <returns></returns> public override NTopLevelWindow CreateEditDialog() { NSchedule schedule = (NSchedule)GetFirstAncestor(NSchedule.NScheduleSchema); NWindow window = schedule != null ? schedule.OwnerWindow : null; // Create a dialog window NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(NWindow.GetFocusedWindowIfNull(window)); dialog.SetupDialogWindow("Appointment with Image Editor", true); NStackPanel stack = new NStackPanel(); stack.FillMode = ENStackFillMode.Last; stack.FitMode = ENStackFitMode.Last; // Add an image box with the image NImageBox imageBox = new NImageBox((NImage)NSystem.SafeDeepClone(Image)); stack.Add(imageBox); // Add property editors for some of the appointment properties NDesigner designer = NDesigner.GetDesigner(this); NList <NPropertyEditor> editors = designer.CreatePropertyEditors(this, SubjectProperty, StartProperty, EndProperty); for (int i = 0; i < editors.Count; i++) { stack.Add(editors[i]); } // Add a button strip with OK and Cancel buttons NButtonStrip buttonStrip = new NButtonStrip(); buttonStrip.InitOKCancelButtonStrip(); stack.Add(buttonStrip); dialog.Content = new NUniSizeBoxGroup(stack); return(dialog); }
} // convertColumnType() public static ColumnType valueOf(string fieldName) { try { FieldInfo column_type_field = NTypeUtils.getField(typeof(ColumnType), fieldName); if (column_type_field != null) { // columnTypeField.setAccessible(true); object o = new object(); column_type_field.GetValue(o); ColumnType columnType = NSystem.Cast(o, typeof(ColumnType)); return((ColumnType)columnType); } } catch (Exception e) { logger.error("Failed to resolve JDBC type in ColumnType constants: " + fieldName, e); } return(null); } // valueOf()
public override NWidget CreateWidget(NCountry country) { // Create a dock panel NStackPanel stack = new NStackPanel(); stack.Padding = new NMargins(3); stack.Tag = country; // Create the flag image box and the country name label NLabel countryLabel = new NLabel(country.Name); countryLabel.VerticalPlacement = ENVerticalPlacement.Center; countryLabel.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Bold); NImageBox imageBox = new NImageBox((NImage)NSystem.SafeDeepClone(country.Flag)); imageBox.VerticalPlacement = ENVerticalPlacement.Center; imageBox.HorizontalPlacement = ENHorizontalPlacement.Left; NPairBox pairBox = new NPairBox(imageBox, countryLabel); pairBox.Spacing = 3; stack.Add(pairBox); // Create the capital label NLabel capitalLabel = new NLabel("Capital: " + country.Capital); stack.Add(capitalLabel); // Create the currency label NLabel currencyLabel = new NLabel("Currency: " + country.CurrencyName + ", " + country.CurrencyCode); stack.Add(currencyLabel); return(stack); }
void NThinDiagramControl1_Postback(object sender, ThinWeb.NPostbackEventArgs e) { NThinDiagramControl diagramControl = (NThinDiagramControl)sender; NNodeList allShapes = diagramControl.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D); NNodeList hitNodes = diagramControl.HitTest(e.MousePosition.ToNPointF()); hitNodes = hitNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D); foreach (NShape shape in allShapes) { if (NSystem.SafeEquals(shape.Tag, true)) { shape.Style.FillStyle = new NColorFillStyle(Color.LightBlue); } } foreach (NShape shape in hitNodes) { if (NSystem.SafeEquals(shape.Tag, true)) { shape.Style.FillStyle = new NColorFillStyle(Color.Red); } } }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Gauge Custom Labels"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage)); radialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); radialGauge.PaintEffect = new NGlassEffectStyle(); radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); NAdvancedGradientFillStyle advGradient = new NAdvancedGradientFillStyle(); advGradient.BackgroundColor = Color.Black; advGradient.Points.Add(new NAdvancedGradientPoint(Color.White, 10, 10, 0, 100, AGPointShape.Circle)); radialGauge.BackgroundFillStyle = advGradient; radialGauge.SweepAngle = 360; radialGauge.BeginAngle = -90; nChartControl1.Panels.Add(radialGauge); NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0]; axis.Range = new NRange1DD(0, 60); axis.Anchor.RulerOrientation = RulerOrientation.Right; axis.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, RulerOrientation.Right, 0, 100); NLinearScaleConfigurator scale = (NLinearScaleConfigurator)axis.ScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(20, Color.LightGray)), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.Interlaced = true; scale.StripStyles.Add(stripStyle); scale.MinorTickCount = 4; scale.MajorTickMode = MajorTickMode.CustomStep; scale.CustomStep = 5.0f; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Watch); scale.OuterMajorTickStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Beige); scale.OuterMajorTickStyle.LineStyle = new NStrokeStyle(Color.DarkGray); scale.OuterMajorTickStyle.Length = new NLength(14); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Silver)); scale.RulerStyle.BorderStyle = new NStrokeStyle(Color.Beige); axis.UpdateScale(); axis.SynchronizeScaleWithConfigurator = false; NTextStyle textStyle1 = new NTextStyle(); textStyle1.FillStyle = new NColorFillStyle(Color.White); textStyle1.BorderStyle = new NStrokeStyle(1, Color.Beige); textStyle1.FontStyle.Style = System.Drawing.FontStyle.Bold; textStyle1.FontStyle.EmSize = new NLength(22); NScaleLabelAngle angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); NTextStyle textStyle2 = new NTextStyle(); textStyle2.FillStyle = new NColorFillStyle(Color.White); textStyle2.BorderStyle = new NStrokeStyle(1, Color.Beige); textStyle2.FontStyle.Style = System.Drawing.FontStyle.Bold; textStyle2.FontStyle.EmSize = new NLength(12); NCustomScaleDecorator customDecorator = new NCustomScaleDecorator(); NValueScaleLabelStyle style1 = new NValueScaleLabelStyle(textStyle1, ContentAlignment.MiddleCenter, angle, new NLength(0)); NValueScaleLabelStyle style2 = new NValueScaleLabelStyle(textStyle2, ContentAlignment.MiddleCenter, angle, new NLength(0)); for (int i = 12; i > 0; i--) { string text = NSystem.IntToRoman(i); NValueScaleLabel hourLabel; if (i % 3 == 0) { hourLabel = new NValueScaleLabel(new NScaleValueDecorationAnchor(i * 5), text, (NValueScaleLabelStyle)style1.Clone()); } else { hourLabel = new NValueScaleLabel(new NScaleValueDecorationAnchor(i * 5), text, (NValueScaleLabelStyle)style2.Clone()); } customDecorator.Decorations.Add(hourLabel); } NScaleLevel textLevel = (NScaleLevel)axis.Scale.Levels[1]; textLevel.Decorators.Clear(); textLevel.Decorators.Add(customDecorator); m_HoursArrow = new NNeedleValueIndicator(); m_HoursArrow.Value = 79; m_HoursArrow.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_HoursArrow.Shape.StrokeStyle.Color = Color.Red; m_HoursArrow.OffsetOriginMode = IndicatorOffsetOriginMode.ScaleEnd; m_HoursArrow.OffsetFromScale = new NLength(30); m_HoursArrow.Width = new NLength(8); radialGauge.Indicators.Add(m_HoursArrow); m_MinituesArrow = new NNeedleValueIndicator(); m_MinituesArrow.Value = 79; m_MinituesArrow.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_MinituesArrow.Shape.StrokeStyle.Color = Color.Red; m_MinituesArrow.OffsetOriginMode = IndicatorOffsetOriginMode.ScaleEnd; m_MinituesArrow.OffsetFromScale = new NLength(30); m_MinituesArrow.Width = new NLength(5); radialGauge.Indicators.Add(m_MinituesArrow); m_SecondsArrow = new NNeedleValueIndicator(); m_SecondsArrow.Value = 79; m_SecondsArrow.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_MinituesArrow.OffsetOriginMode = IndicatorOffsetOriginMode.ScaleEnd; m_SecondsArrow.Shape.StrokeStyle.Color = Color.Red; m_SecondsArrow.OffsetFromScale = new NLength(10); m_SecondsArrow.Width = new NLength(1); radialGauge.Indicators.Add(m_SecondsArrow); //nChartControl1.AutoRefresh = true; SynchronizeWithTime(); m_Timer = new DispatcherTimer(); m_Timer.Interval = new TimeSpan(1000); m_Timer.Tick += m_Timer_Tick; m_Timer.IsEnabled = true; m_Timer.Start(); }