コード例 #1
0
 private void addOutputHeader(string headerContent, string[] extraInfo)
 {
     OutputHeader = new TextBlock();
     foreach (var item in extraInfo)
     {
         headerContent += " - " + item;
     }
     OutputHeader.Text = AppUtils.CreateDisplayString(headerContent);
     Canvas.SetTop(OutputHeader, CANVAS_MARGIN);
     Canvas.SetLeft(OutputHeader, CANVAS_MARGIN);
     _tabCanvas.Children.Add(OutputHeader);
     _disposableElements.Add(OutputHeader);
 }
コード例 #2
0
        private OutputTab createNewOutputTab(TabControl outputTabControl, ref int tabId, MethodBase callingAction = null)
        {
            tabId++;
            var tabTitle  = (callingAction != null) ? AppUtils.CreateDisplayString(callingAction.Name, 12) : "Output - " + tabId;
            var outputTab = new OutputTab(this, _outputControl, tabId, tabTitle);

            outputTab.PreviousTab = ActiveOutputTab;
            ActiveOutputTab       = outputTab;
            _outputTabItems.Add(outputTab.TabItemControl);
            _outputTabs.Add(outputTab);
            _outputControl.SelectedItem = outputTab.TabItemControl;
            _outputControl.SizeChanged += outputTab.SizeChanged;
            return(outputTab);
        }
コード例 #3
0
        private Button createNewButtonFromAction(MethodInfo action, int buttonId)
        {
            string actionId     = Title + "_" + buttonId;
            var    actionButton = new Button();

            actionButton.Name   = actionId;
            actionButton.Click += clickButton;
            _actionMethods.Add(actionId, action);
            actionButton.Height  = BUTTON_HEIGHT;
            actionButton.Width   = BUTTON_WIDTH;
            actionButton.Content = AppUtils.CreateDisplayString(action.Name);
            placeButtonOnTab(actionButton, buttonId);
            return(actionButton);
        }
コード例 #4
0
        private TextBlock createFieldLabel(ParameterInfo parameter, int fieldId)
        {
            var label     = new TextBlock();
            var labelText = AppUtils.CreateDisplayString(parameter.Name, 25);

            if (parameter.IsMandatory())
            {
                label.FontWeight = FontWeights.Bold;
            }
            label.Text  = labelText + ":";
            label.Width = FIELD_LABEL_WIDTH;
            Canvas.SetLeft(label, CANVAS_MARGIN);
            var top = CANVAS_MARGIN + (fieldId * FIELD_HEIGHT) + 2;

            Canvas.SetTop(label, top);
            _tabCanvas.Children.Add(label);
            return(label);
        }
コード例 #5
0
        private string validateInputFields()
        {
            var invalidFieldMessage = new StringBuilder();

            foreach (var control in _inputControls)
            {
                var controlName = control.Key;
                var isMandatory = _mandatoryControls.Any(c => c.Key == controlName);
                var inputField  = control.Value as TextBox;

                var enteredValue = (inputField != null) ? inputField.Text : "";
                if (!validateField(controlName, enteredValue, isMandatory))
                {
                    //TODO: Maybe add text above each invalid field
                    invalidFieldMessage.Append("Invalid entry in field: " + AppUtils.CreateDisplayString(controlName) + Environment.NewLine);
                }
            }
            return(invalidFieldMessage.ToString());
        }