public ConfigureSampleDataDialog(DataSchemaNodePath schemaPath, IMessageDisplayService messageService)
        {
            this.Title      = StringTable.SampleDataConfigurationDialogTitle;
            this.MinWidth   = ConfigureSampleDataDialog.dialogSize.Width;
            this.MinHeight  = ConfigureSampleDataDialog.dialogSize.Height;
            this.Height     = ConfigureSampleDataDialog.dialogSize.Height;
            this.Width      = ConfigureSampleDataDialog.dialogSize.Width;
            this.ResizeMode = ResizeMode.CanResize;
            this.Model      = new SampleDataEditorModel(schemaPath, messageService);
            FrameworkElement element = Microsoft.Expression.DesignSurface.FileTable.GetElement("Resources\\DataPane\\ConfigureSampleDataDialog.xaml");

            this.DialogContent            = (UIElement)element;
            this.sampleDataGrid           = (DataGrid)LogicalTreeHelper.FindLogicalNode((DependencyObject)element, "SampleDataGrid");
            this.rowsSlider               = (NumberEditor)LogicalTreeHelper.FindLogicalNode((DependencyObject)element, "RowsSlider");
            this.acceptButton             = (Button)LogicalTreeHelper.FindLogicalNode((DependencyObject)element, "AcceptButton");
            this.rowsSlider.KeyDown      += new KeyEventHandler(this.HandleEnterPressOnRowsSlider);
            this.sampleDataGrid.GotFocus += new RoutedEventHandler(this.sampleDataGrid_GotFocus);
            if (this.sampleDataGrid != null)
            {
                this.Columns = (IList <SampleDataDialogColumn>) new List <SampleDataDialogColumn>();
                foreach (SampleDataProperty property in (IEnumerable <SampleDataProperty>) this.Model.SampleDataProperties)
                {
                    SampleDataDialogColumn column = new SampleDataDialogColumn(property, this);
                    this.Columns.Add(column);
                    this.StyleColumnHeader(column);
                    this.sampleDataGrid.Columns.Add((DataGridColumn)column);
                }
            }
            element.DataContext = (object)this.Model;
        }
Ejemplo n.º 2
0
 private SnapDialog()
 {
     this.DialogContent         = (UIElement)FileTable.GetElement("Resources\\Timeline\\SnapDialog.xaml");
     this.Title                 = StringTable.SnapDialogTitle;
     this.SizeToContent         = SizeToContent.WidthAndHeight;
     this.snapEntryNumberEditor = (NumberEditor)ElementUtilities.FindElement((FrameworkElement)this, "SnapResolution");
 }
Ejemplo n.º 3
0
 public RepeatDialog()
 {
     this.DialogContent           = (UIElement)FileTable.GetElement("Resources\\Timeline\\RepeatDialog.xaml");
     this.Title                   = StringTable.RepeatDialogTitle;
     this.SizeToContent           = SizeToContent.WidthAndHeight;
     this.repeatCountNumberEditor = ElementUtilities.FindElement((FrameworkElement)this, "RepeatCount") as NumberEditor;
 }
        public string FilterStringValue(object instance, string stringValue)
        {
            if (stringValue == null)
            {
                return((string)null);
            }
            string       str          = (string)null;
            NumberEditor numberEditor = instance as NumberEditor;

            if (numberEditor != null)
            {
                str = numberEditor.Format;
            }
            if (str != null && str.IndexOf('%') != -1 && stringValue.EndsWith("%", StringComparison.OrdinalIgnoreCase))
            {
                stringValue = stringValue.Substring(0, stringValue.Length - 1);
            }
            return(stringValue);
        }
Ejemplo n.º 5
0
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.codeOptionsControl = (CodeOptionsControl)target;
                break;

            case 2:
                this.CurrentSettings = (ComboBox)target;
                break;

            case 3:
                this.FontFamily = (ChoiceEditor)target;
                break;

            case 4:
                this.FontSize = (ChoiceEditor)target;
                break;

            case 5:
                this.TabSize = (NumberEditor)target;
                break;

            case 6:
                this.InsertSpacesCheckBox = (WorkaroundRadioButton)target;
                break;

            case 7:
                this.KeepTabsCheckBox = (WorkaroundRadioButton)target;
                break;

            default:
                this._contentLoaded = true;
                break;
            }
        }
Ejemplo n.º 6
0
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.RotationTabGrid = (RotationTab)target;
                break;

            case 2:
                this.RotationSpinner = (PropertyContainer)target;
                break;

            case 3:
                this.ArcBall = (PropertyContainer)target;
                break;

            case 4:
                this.RotationPropertyContainer = (PropertyContainer)target;
                break;

            case 5:
                this.ZInputTextBox = (NumberEditor)target;
                break;

            case 6:
                this.XInputTextBox = (NumberEditor)target;
                break;

            case 7:
                this.YInputTextBox = (NumberEditor)target;
                break;

            default:
                this._contentLoaded = true;
                break;
            }
        }
        private Func <string> GetParameterEditorAction(string paramType, string currentValue)
        {
            DataType2 dt2;

            if (Enum.TryParse(paramType, out dt2))
            {
                switch (dt2)
                {
                case DataType2.Boolean:
                case DataType2.Bold:
                case DataType2.Italic:
                case DataType2.Overlined:
                case DataType2.Underlined:
                    return(() =>
                    {
                        using (var ed = new BooleanEditor())
                        {
                            bool b = default(bool);
                            bool.TryParse(currentValue, out b);
                            ed.SetDataType(dt2, b);
                            if (ed.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                return ed.Result ? "true" : "false";     //NOXLATE
                            }
                        }
                        return null;
                    });

                case DataType2.Integer:
                case DataType2.Real:
                case DataType2.Angle:
                case DataType2.EndOffset:
                case DataType2.FontHeight:
                case DataType2.LineSpacing:
                case DataType2.LineWeight:
                case DataType2.ObliqueAngle:
                case DataType2.RepeatX:
                case DataType2.RepeatY:
                case DataType2.TrackSpacing:
                case DataType2.StartOffset:
                    return(() =>
                    {
                        using (var ed = new NumberEditor())
                        {
                            decimal d = default(decimal);
                            decimal.TryParse(currentValue, out d);
                            ed.SetDataType(dt2, d);
                            if (ed.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                decimal result = ed.Value;
                                if (dt2 == DataType2.Integer)
                                {
                                    return Convert.ToInt32(result).ToString(CultureInfo.InvariantCulture);
                                }
                                else
                                {
                                    return Convert.ToDouble(result).ToString(CultureInfo.InvariantCulture);
                                }
                            }
                        }
                        return null;
                    });

                case DataType2.Color:
                case DataType2.FillColor:
                case DataType2.FrameFillColor:
                case DataType2.FrameLineColor:
                case DataType2.GhostColor:
                case DataType2.LineColor:
                case DataType2.TextColor:
                {
                    return(() =>
                        {
                            using (var picker = new ColorPickerDialog())
                            {
                                try
                                {
                                    picker.SelectedColor = Utility.ParseHTMLColorARGB((currentValue ?? "").Replace("0x", ""));
                                }
                                catch { }
                                if (picker.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                {
                                    return "0x" + Utility.SerializeHTMLColorARGB(picker.SelectedColor, true);
                                }
                            }
                            return null;
                        });
                }

                case DataType2.Justification:
                {
                    var values = Enum.GetValues(typeof(OSGeo.MapGuide.ObjectModels.SymbolDefinition.Justification));
                    return(GetEnumPicker(dt2, values));
                }

                case DataType2.HorizontalAlignment:
                {
                    var values = Enum.GetValues(typeof(OSGeo.MapGuide.ObjectModels.SymbolDefinition.HorizontalAlignment));
                    return(GetEnumPicker(dt2, values));
                }

                case DataType2.VerticalAlignment:
                {
                    var values = Enum.GetValues(typeof(OSGeo.MapGuide.ObjectModels.SymbolDefinition.VerticalAlignment));
                    return(GetEnumPicker(dt2, values));
                }
                }
            }
            return(null);
        }
Ejemplo n.º 8
0
 public void EndDrag(NumberEditor sender)
 {
     this.activeNumberEditor = (NumberEditor)null;
 }
Ejemplo n.º 9
0
 public double GetDragOffsetAmount(NumberEditor sender, Vector offset)
 {
     return(this.CalculateDeltaFixedSpeed(offset));
 }
Ejemplo n.º 10
0
 public void BeginDrag(NumberEditor sender)
 {
     this.activeNumberEditor = sender;
     this.timeLast           = DateTime.Now;
 }
Ejemplo n.º 11
0
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.showGridCheckBox = (CheckBox)target;
                break;

            case 2:
                this.snapToGridCheckBox = (CheckBox)target;
                break;

            case 3:
                this.gridSpacingLabel = (Label)target;
                break;

            case 4:
                this.gridSpacingTextBox = (NumberEditor)target;
                break;

            case 5:
                this.snapToSnapLinesCheckBox = (CheckBox)target;
                break;

            case 6:
                this.snapLineMarginLabel = (Label)target;
                break;

            case 7:
                this.snapLineMarginTextBox = (NumberEditor)target;
                break;

            case 8:
                this.snapLinePaddingLabel = (Label)target;
                break;

            case 9:
                this.snapLinePaddingTextBox = (NumberEditor)target;
                break;

            case 10:
                this.isInGridDesignModeCheckBox = (CheckBox)target;
                break;

            case 11:
                this.ColorPopupButton = (ToggleButton)target;
                break;

            case 12:
                this.ZoomGestureChoiceEditor = (ChoiceEditor)target;
                break;

            case 13:
                this.EffectsEnabled = (CheckBox)target;
                break;

            case 14:
                this.ZoomThresholdComboBox = (NumberComboBox)target;
                break;

            default:
                this._contentLoaded = true;
                break;
            }
        }
Ejemplo n.º 12
0
        public static Control GetPropertyValueEditor(FastTrackPage page, Type type, PropertyInfo property)
        {
            Control editor = null;

            if (page.IsListProperty(type, property.Name))
            {
                editor = new ListEditor(property.Name);
            }
            else
            {
                Type propertyType = property.PropertyType;

                if (propertyType.IsEnum)
                {
                    editor = new EnumerationEditor(property.Name);
                }

                else if (propertyType.IsPrimitive)
                {
                    if (propertyType == typeof(bool))
                    {
                        editor = new BooleanEditor(property.Name);
                    }


                    else if (propertyType == typeof(Int16) ||
                             propertyType == typeof(Int32) ||
                             propertyType == typeof(Int64) ||
                             propertyType == typeof(Byte))
                    {
                        editor = new NumberEditor(property.Name);
                    }
                }
                else if (propertyType.IsValueType)
                {
                    if (propertyType == typeof(DateTime))
                    {
                        editor = new DateTimeEditor(property.Name);
                    }

                    else if (propertyType == typeof(Decimal))
                    {
                        editor = new NumberEditor(property.Name);
                    }
                }
                else if (propertyType.IsClass)
                {
                    if (propertyType == typeof(string))
                    {
                        editor = new StringEditor(property.Name);
                    }


                    else if (propertyType == typeof(byte[]))
                    {
                        ; //editor = new DateTimeEditor(property.Name);
                    }
                    else
                    {
                        editor = new ReferenceEditor(property.Name);
                    }
                }
            }

            return(editor);
        }
Ejemplo n.º 13
0
        protected virtual EditorItem GetEditorItem(CustomDataType type, string custom, PropertyInfo property)
        {
            RequiredAttribute required = property.GetCustomAttributes(typeof(RequiredAttribute), true).FirstOrDefault() as RequiredAttribute;
            EditorItem        item;

            switch (type)
            {
            case CustomDataType.Boolean:
                item = new BoolEditor(Frame);
                break;

            case CustomDataType.Currency:
                item = new CurrencyEditor(Frame);
                break;

            case CustomDataType.Date:
                item = new DateEditor(Frame);
                break;

            case CustomDataType.DateTime:
                item = new DateTimeEditor(Frame);
                break;

            case CustomDataType.Default:
                item = new DefaultEditor(Frame);
                if (required != null)
                {
                    ((DefaultEditor)item).IsAllowdEmpty = required.AllowEmptyStrings;
                }
                break;

            case CustomDataType.EmailAddress:
                item = new EmailAddressEditor(Frame);
                break;

            case CustomDataType.Html:
                item = new HtmlEditor(Frame);
                break;

            case CustomDataType.ImageUrl:
                item = new ImageUrlEditor(Frame);
                break;

            case CustomDataType.Image:
                item = new ImageEditor(Frame);
                break;

            case CustomDataType.Integer:
                item = new IntegerEditor(Frame);
                break;

            case CustomDataType.MultilineText:
                item = new MultilineTextEditor(Frame);
                if (required != null)
                {
                    ((MultilineTextEditor)item).IsAllowdEmpty = required.AllowEmptyStrings;
                }
                break;

            case CustomDataType.Number:
                item = new NumberEditor(Frame);
                break;

            case CustomDataType.Password:
                item = new PasswordEditor(Frame);
                break;

            case CustomDataType.PhoneNumber:
                item = new PhoneNumberEditor(Frame);
                break;

            case CustomDataType.Sex:
                item = new SexEditor(Frame);
                break;

            case CustomDataType.Text:
                item = new DefaultEditor(Frame);
                break;

            case CustomDataType.Time:
                item = new TimeEditor(Frame);
                break;

            case CustomDataType.Url:
                item = new UrlEditor(Frame);
                break;

            default:
                switch (custom)
                {
                case "Enum":
                    item = GetEnumEditorItem(property.PropertyType);
                    break;

                case "Entity":
                    item = new EntityEditor(Frame, property.PropertyType);
                    break;

                case "Collection":
                    item = new CollectionEditor(Frame, property.PropertyType.GetGenericArguments()[0]);
                    break;

                default:
                    throw new NotSupportedException("不支持自定义类型编辑器。");
                }
                break;
            }
            if (required != null)
            {
                item.IsRequired = true;
            }
            return(item);
        }