Esempio n. 1
0
 private void init(UIEntity owner)
 {
     Fill                = Brushes.Red;
     bound               = new Rect(new Size(7.5, 7.5));
     this.owner          = owner;
     this.LayoutUpdated += UIEntity_LayoutUpdated;
 }
Esempio n. 2
0
 public LineDefinition(UIEntity from, UIEntity to)
 {
     if (from is Resource || to is Resource)
     {
         thickness = 3;
         brush     = from is Resource && to is Resource ? Brushes.DeepSkyBlue : Brushes.Violet;
     }
 }
Esempio n. 3
0
        public Port(UIEntity owner, Canvas canvas, PortType portType, double xPos, double yPos) : base(canvas)
        {
            init(owner);
            this.canvas   = canvas;
            this.portType = portType;

            Canvas.SetLeft(this, xPos);
            Canvas.SetTop(this, yPos);
        }
Esempio n. 4
0
        public Label(UIEntity owner, Canvas canvas, double xPos, double yPos, string text) : base(canvas)
        {
            init(owner, text);

            name.Value  = text;
            this.canvas = canvas;

            Canvas.SetLeft(this, xPos);
            Canvas.SetTop(this, yPos);
        }
Esempio n. 5
0
        public Entities.Entity transform(sapr_sim.Figures.UIEntity entity)
        {
            Procedure p = entity as Procedure;

            return(new Entities.impl.Procedure()
            {
                manHour = TimeConverter.fromHumanToModel(new TimeWithMeasure(p.Time, p.TimeMeasure)),
                name = p.EntityName,
                id = p.Id
            });
        }
Esempio n. 6
0
 private void init(UIEntity owner, string text)
 {
     ft = new FormattedText(text,
                            CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                            new Typeface("Arial"), 12, Brushes.Black);
     label            = this;
     this.owner       = owner;
     ft.MaxTextHeight = 100;
     ft.MaxLineCount  = 2;
     ft.MaxTextWidth  = 70;
 }
Esempio n. 7
0
        public ParameterDialog(List <UIParam> param, sapr_sim.Figures.UIEntity owner)
        {
            InitializeComponent();
            this.parameters = param;
            this.owner      = owner;

            image.Source     = new BitmapImage(new Uri(@"pack://application:,,,/" + owner.iconPath(), UriKind.Absolute));
            description.Text = owner.description();

            ParameterProccesor.drawParameters(owner, sp, true);
        }
Esempio n. 8
0
        public static void drawParameters(sapr_sim.Figures.UIEntity owner, StackPanel drawPanel, bool paramsEnabled)
        {
            drawPanel.Children.Clear();
            if (owner != null && owner.getParams() != null)
            {
                entity = owner;
                panel  = drawPanel;
                foreach (UIParam entry in owner.getParams())
                {
                    DockPanel sprow = new DockPanel()
                    {
                        LastChildFill = true, Margin = new Thickness(0, 2, 0, 5), Height = 28
                    };
                    System.Windows.Controls.Label l = new System.Windows.Controls.Label()
                    {
                        Content = entry.DisplayedText
                    };
                    ParameterInput input     = entry.ContentControl;
                    UIElement      uiControl = null;

                    if (input == null)
                    {
                        input     = new ParameterTextBox(entry.RawValue, paramsEnabled);
                        uiControl = input as UIElement;
                    }
                    else
                    {
                        input.setValue(entry.RawValue);
                        input               = input.Clone() as ParameterInput;
                        uiControl           = input as UIElement;
                        uiControl.IsEnabled = paramsEnabled;
                    }

                    if (!paramsEnabled)
                    {
                        (uiControl as FrameworkElement).MinWidth = ParameterConstants.QUICK_PANEL_WIDTH;
                        (uiControl as FrameworkElement).MaxWidth = ParameterConstants.QUICK_PANEL_WIDTH;
                    }

                    if (entry.DisplayedText == "Тип ресурса" && input is ParameterComboBox)
                    {
                        (input as ComboBox).SelectionChanged += ParameterProccesor_SelectionChanged;
                    }

                    sprow.Children.Add(l);
                    sprow.Children.Add(uiControl);

                    if (paramsEnabled)
                    {
                        l.Width = 150;
                        Image tooltip = new Image()
                        {
                            Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/param_tooltip.png", UriKind.Absolute))
                        };

                        tooltip.ToolTip = new ToolTip()
                        {
                            Content = new TextBox()
                            {
                                Text = entry.ToolTip, TextWrapping = TextWrapping.Wrap, Width = 250
                            }
                        };
                        tooltip.MouseEnter += tooltip_MouseEnter;
                        tooltip.MouseLeave += tooltip_MouseLeave;

                        sprow.Children.Add(tooltip);
                    }

                    drawPanel.Children.Add(sprow);
                }
            }
        }