示例#1
0
        /// <summary>
        /// Creates a new incstance of the StringOption.
        /// </summary>
        /// <param name="xmlNode">The xmlnode containing the data.</param>
        /// <param name="xsdNode">The corresponding xsdNode.</param>
        /// <param name="panel">The panel on which this option should be placed.</param>
        /// <param name="parentForm">The form of which this option is a part.</param>
        /// <param name="metaname">Whether this option can be filled with metadata. And if so, whether it will get the name or the value of the metadata.</param>
        public DocUIString(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
            base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
        {
            string regex = XmlSchemaUtilities.tryGetPatternRestriction(xsdNode);

            if (regex == null) { regex = ""; }

            string watermark = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "watermark");
            string req = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "required");
            bool required = req == "true" ? true : false;

            Control = new ExtendedTextBox("", watermark, regex, required, parentForm);
            (Control as ExtendedTextBox).TextBlock.TextChanged += (s, e) => { hasPendingChanges(); };
            Setup();
        }
示例#2
0
        /// <summary>
        /// Creates a new instance of the BigTextOption
        /// </summary>
        /// <param name="xmlNode">The node containing the data for the textbox</param>
        /// <param name="xsdNode">The corresponding xsdNode</param>
        /// <param name="panel">the panel on which this option should be placed</param>
        /// <param name="parentForm">the form of which this option is a part</param>
        public DocUIBigTextBox(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm)
            : base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
        {
            ScrollViewer scroll = new ScrollViewer();

            string req = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "required");
            bool required = req == "true" ? true : false;

            box = new ExtendedTextBox("", "", "", required, parentForm);
            box.TextBlock.AcceptsReturn = true;
            box.TextBlock.TextWrapping = TextWrapping.Wrap;
            box.Height = 200;

            scroll.Content = box;
            Control = scroll;

            setup();
        }
示例#3
0
        /// <summary>
        /// Creates a new instance of the FileOption
        /// </summary>
        /// <param name="xmlNode">The xmlNode containing the data.</param>
        /// <param name="xsdNode">The corresponding xsdNode</param>
        /// <param name="panel">The panel on which this option should be placed.</param>
        /// <param name="parentForm">The form of which this option is a part.</param>
        /// <param name="isMetaName">Whether metadata data is allowed and meta name or value should be chosen.</param>
        public DocUIFile(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicProjectForm parentForm)
            : base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
        {
            //init variables
            this.parentForm = parentForm;

            _projectpath = parentForm.ProjectSystem.WorkingDirectory.FullName;
            _ext = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "ext");
            _folder = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "folder");
            string tmprel = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "relative");
            _relative = tmprel == "true" ? true : false;
            string tmpreq = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "required");
            _required = tmpreq == "true" ? true : false;

            DockPanel panel = new DockPanel();
            StackPanel buttons = new StackPanel();
            //panel.Orientation = Orientation.Horizontal;
            panel.HorizontalAlignment = HorizontalAlignment.Stretch;
            buttons.Orientation = Orientation.Horizontal;
            buttons.HorizontalAlignment = HorizontalAlignment.Right;

            // init the Components
            menu = new ContextMenu();
            MenuItem OpenMenu = new MenuItem();
            OpenMenu.Icon = ModernImageLibrary.GetImage((int)ModernImageLibrary.FileIcons.Open, 16);
            OpenMenu.Click += OpenMenu_Click;
            OpenMenu.Header = "Open";
            menu.Items.Add(OpenMenu);

            if (_folder != "")
            {
                MenuItem EditMenu = new MenuItem();
                EditMenu.Click += EditMenu_Click;
                EditMenu.Icon = ModernImageLibrary.GetImage((int)ModernImageLibrary.FileIcons.Edit, 16);
                EditMenu.Header = "Edit";
                menu.Items.Add(EditMenu);
            }

            MenuItem RemoveMenu = new MenuItem();
            RemoveMenu.Click += RemoveMenu_Click;
            RemoveMenu.Icon = ModernImageLibrary.GetImage((int)ModernImageLibrary.FileIcons.Close, 16);
            RemoveMenu.Header = "Remove";
            menu.Items.Add(RemoveMenu);

            Image DropMenuImage = ModernImageLibrary.GetImage((int)ModernImageLibrary.FileIcons.Shortcut, 16);
            DropMenuImage.ContextMenu = menu;
            DropMenuImage.MouseEnter += DropMenuImage_MouseEnter;

            _tb = new ExtendedTextBox("", "", "", _required, parentForm);
            _tb.TextBlock.TextChanged += (s, e) => { hasPendingChanges(); };

            //positioning
            DockPanel.SetDock(_tb, Dock.Left);
            DockPanel.SetDock(DropMenuImage, Dock.Right);
            panel.LastChildFill = true;
            _tb.HorizontalAlignment = HorizontalAlignment.Stretch;

            panel.Children.Add(DropMenuImage);
            panel.Children.Add(_tb);

            //init drag en drop extras
            _tb.TextBlock.PreviewDragEnter += DropTextBox_Drag;
            _tb.TextBlock.PreviewDrop += DropTextBox_Drop;
            _tb.TextBlock.PreviewDragOver += DropTextBox_Drag;
            _tb.AllowDrop = true;

            Control = panel;
            setup();
        }