public GUIQuestion(QLMemory memory, string identifier, string label, bool isComputed, ExpressionBase showCondition, ChangedEventHandler changeHandler)
        {
            _hideConditions = new List<ExpressionBase>();
            _showCondition = showCondition;

            _memory = memory;
            _identifier = identifier;
            _isComputed = isComputed;

            _label = new Label
                {
                    Content = label,
                    Width = 300,
                    Margin = new Thickness(0, 0, 25, 0),
                    HorizontalContentAlignment = HorizontalAlignment.Right
                };

            _input = _memory.GetDeclaredValue(_identifier).CreateInputControl(_identifier, _memory, _isComputed);
            _input.OnChanged = changeHandler;

            //ui properties
            Width = 600;
            Margin = new Thickness(0, 10, 0 , 0);
            Orientation = Orientation.Horizontal;
        }
Ejemplo n.º 2
0
        private void DrawBorderStroke(PdfRenderContext context, Thickness thickness, Brush stroke, double actualWidth, double actualHeight)
        {
            if (stroke == null)
            {
                return;
            }

            if (thickness.Left != 0)
            {
                LineRenderer.DrawLine(context, thickness.Left / 2, 0, thickness.Left / 2, actualHeight, thickness.Left, stroke, null);
            }
            if (thickness.Top != 0)
            {
                LineRenderer.DrawLine(context, 0, thickness.Top / 2, actualWidth, thickness.Top / 2, thickness.Top, stroke, null);
            }
            if (thickness.Right != 0)
            {
                double x = actualWidth - (thickness.Right / 2);
                LineRenderer.DrawLine(context, x, 0, x, actualHeight, thickness.Right, stroke, null);
            }
            if (thickness.Bottom != 0)
            {
                double y = actualHeight - (thickness.Bottom / 2);
                LineRenderer.DrawLine(context, 0, y, actualWidth, y, thickness.Bottom, stroke, null);
            }
        }
Ejemplo n.º 3
0
 internal static bool IsNonNegative(Thickness value)
 {
     return DoubleUtil.IsNonNegative(value.Left) &&
            DoubleUtil.IsNonNegative(value.Top) &&
            DoubleUtil.IsNonNegative(value.Right) &&
            DoubleUtil.IsNonNegative(value.Bottom);
 }
Ejemplo n.º 4
0
        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            try
            {
                // desktop window manader must be enabled if it isn't don't bother trying to add glass
                if (!DwmIsCompositionEnabled())
                {
                    return false;
                }

                IntPtr hwnd = new WindowInteropHelper(window).Handle;

                if (hwnd == IntPtr.Zero)
                {
                    throw new InvalidOperationException("The Window must be shown before extending glass.");
                }

                // Set the background to transparent from both the WPF and Win32 perspectives
                //window.Background = Brushes.Transparent;
                HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

                MARGINS margins = new MARGINS(margin);
                DwmExtendFrameIntoClientArea(hwnd, ref margins);
                return true;
            }
            catch
            {
                return false;
            }
        }
Ejemplo n.º 5
0
 public MARGINS(Thickness t)
 {
     this.Left = (int)t.Left;
     this.Right = (int)t.Right;
     this.Top = (int)t.Top;
     this.Bottom = (int)t.Bottom;
 }
Ejemplo n.º 6
0
		public static void AddGeometries(WpfHexView hexView, Collection<VSTF.TextBounds> textBounds, bool isLineGeometry, bool clipToViewport, Thickness padding, double minWidth, ref PathGeometry geo, ref bool createOutlinedPath) {
			foreach (var bounds in textBounds) {
				double left = bounds.Left - padding.Left;
				double right = bounds.Right + padding.Right;
				double top, bottom;
				if (isLineGeometry) {
					top = bounds.Top - padding.Top;
					bottom = bounds.Bottom + padding.Bottom;
				}
				else {
					top = bounds.TextTop - padding.Top;
					bottom = bounds.TextBottom + padding.Bottom;
				}
				if (right - left < minWidth)
					right = left + minWidth;
				if (clipToViewport) {
					left = Math.Max(left, hexView.ViewportLeft);
					right = Math.Min(right, hexView.ViewportRight);
				}
				if (right <= left || bottom <= top)
					continue;
				const double MAX_HEIGHT = 1000000;
				const double MAX_WIDTH = 1000000;
				double width = Math.Min(right - left, MAX_WIDTH);
				double height = Math.Min(bottom - top, MAX_HEIGHT);

				if (geo == null)
					geo = new PathGeometry { FillRule = FillRule.Nonzero };
				else
					createOutlinedPath = true;
				geo.AddGeometry(new RectangleGeometry(new Rect(left, top, width, height)));
			}
		}
 public Margins(Thickness t)
 {
     Left = (int)t.Left;
     Right = (int)t.Right;
     Top = (int)t.Top;
     Bottom = (int)t.Bottom;
 }
Ejemplo n.º 8
0
 public OnScreenKeyboardSection()
 {
     Margin = new Thickness(5);
     _buttonRows = new List<Grid>();
     _keys = new ObservableCollection<OnScreenKey>();
     _keys.CollectionChanged += Keys_CollectionChanged;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Extends the Aero Glass area on a given window.
        /// </summary>
        /// <param name="window">The window to extend glass onto.</param>
        /// <param name="margin">The distances from the border to extend the glass by.</param>
        /// <returns>True if glass was extended successfully, otherwise false.</returns>
        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            if (window == null) {
                throw new ArgumentNullException("window");
            }

            bool result = false;
            try {
                if (DwmIsCompositionEnabled()) {

                    IntPtr hwnd = new WindowInteropHelper(window).Handle;
                    if (hwnd == IntPtr.Zero)
                        throw new InvalidOperationException("The Window must be shown before extending glass.");

                    // Set the background to transparent from both the WPF and Win32 perspectives
                    window.Background = Brushes.Transparent;
                    HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

                    MARGINS margins = new MARGINS(margin);
                    DwmExtendFrameIntoClientArea(hwnd, ref margins);
                    result = true;
                }
            } catch { }
            return result;
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     var isReadOnly = (bool) value;
     var black = new Thickness(1);
     var red = new Thickness(4);
     return isReadOnly ? black : red;
 }
Ejemplo n.º 11
0
 public PrintDocument(Thickness margin)
 {
     PageLayout = new PrintLayout
     {
         Margin = margin,
     };
 }
Ejemplo n.º 12
0
        public AppearanceManager(ISettingsManager manager)
        {
            _manager = manager;

            DefaultMargin = new Thickness(0, 0, 0, 2);
            DefaultPadding = new Thickness(0, 4, 0, 4);
        }
Ejemplo n.º 13
0
        public FileListItem(string captionText, string imagePath)
            : base()
        {
            Margin = new Thickness(13);

            var panel = new StackPanel();
            var imageSource = new BitmapImage();
            var image = new Image();
            var caption = new TextBlock();

            imageSource.BeginInit();
            imageSource.UriSource = new Uri(imagePath, UriKind.Relative);
            imageSource.EndInit();

            image.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            image.Source = imageSource;
            image.Height = 64;
            image.Width = 64;
            image.ToolTip = "Select & click on 'Table' for data view.";

            caption.TextAlignment = TextAlignment.Center;
            caption.TextWrapping = TextWrapping.Wrap;
            caption.Text = captionText;

            Caption = captionText;

            if (caption.Text.Length <= 18)
                caption.Text += "\n ";

            panel.Children.Add(image);
            panel.Children.Add(caption);

            Child = panel;
        }
Ejemplo n.º 14
0
 private void SetTextBoxStyle()
 {
     // Background = null;
     BorderThickness = new Thickness(1);
     Padding = new Thickness(-3, -2, -3, -2);
     IsReadOnly = false;
 }
Ejemplo n.º 15
0
        public static Thickness LogicalThicknessToDevice(Thickness logicalThickness)
        {
            Point topLeft = LogicalPixelsToDevice(new Point(logicalThickness.Left, logicalThickness.Top));
            Point bottomRight = LogicalPixelsToDevice(new Point(logicalThickness.Right, logicalThickness.Bottom));

            return new Thickness(topLeft.X, topLeft.Y, bottomRight.X, bottomRight.Y);
        }
        /// <summary>
        /// Convert from A to B.
        /// </summary>
        /// <param name="pValue">The value to convert.</param>
        /// <param name="pTargetType">The target type.</param>
        /// <param name="pExtraParameter">The extra parameter to use (not used by the converter).</param>
        /// <param name="pCulture">The culture to use (not used by the converter).</param>
        /// <returns>The value converted.</returns>
        public object Convert(object[] pValue, Type pTargetType, object pExtraParameter, CultureInfo pCulture)
        {
            if (pValue.Any(lValue => lValue == DependencyProperty.UnsetValue))
            {
                return Binding.DoNothing;
            }

            // First value is the port list count, second is the list.
            int lPortsCount = System.Convert.ToInt32(pValue[0]);
            PortViewModelCollection lPorts = pValue[1] as PortViewModelCollection;

            // Evaluating the padding using the ports.
            Thickness lPadding = new Thickness();
            if (lPorts != null)
            {
                if (lPorts.Any(lPort => lPort.Direction == PortDirection.Input))
                {
                    lPadding.Left = PORT_WIDTH;
                }

                if (lPorts.Any(lPort => lPort.Direction == PortDirection.Output))
                {
                    lPadding.Right = PORT_WIDTH;
                }
            }

            return lPadding;
        }
Ejemplo n.º 17
0
 public BlankPageBase()
 {
     const double defaultMargin = 0.5; // inches
     Margin = new Thickness(defaultMargin*96);
     Width = 8.5*96;
     Height = 11*96;
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Extends the glass frame.
        /// </summary>
        /// <param name="window">The window.</param>
        /// <param name="margin">The margin.</param>
        /// <returns></returns>
        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            if(!DwmIsCompositionEnabled()) {
                return false;
            }

            IntPtr hwnd = new WindowInteropHelper(window).Handle;

            if(hwnd == IntPtr.Zero) {
                throw new InvalidOperationException("The Window must be shown before extending glass.");
            }

            // Set the background to transparent from both the WPF and Win32 perspectives
            SolidColorBrush background = new SolidColorBrush(Colors.Red);

            background.Opacity = 0.5;

            window.Background = Brushes.Transparent;

            HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

            MARGINS margins = new MARGINS(margin);

            DwmExtendFrameIntoClientArea(hwnd, ref margins);

            return true;
        }
 public MARGINS(Thickness t)
 {
     Left = (int)t.Left;
     Right = (int)t.Right;
     Top = (int)t.Top;
     Bottom = (int)t.Bottom;
 }
Ejemplo n.º 20
0
        public Dock(Canvas parent_canvas)
        {
            parentCanvas = parent_canvas;

            emptyDockContents = new StackPanel();
            emptyDockContents.Orientation = Orientation.Horizontal;
            emptyDockContents.Margin = new Thickness(5, 5, 5, 5);

            TextBox dropToAdd = new TextBox();
            dropToAdd.Background = new SolidColorBrush(Colors.Transparent);
            dropToAdd.BorderBrush = new SolidColorBrush(Colors.Transparent);
            dropToAdd.Text = "Drop Here To Add";
            dropToAdd.Foreground = new SolidColorBrush(Colors.White);
            dropToAdd.FontSize = 18;
            dropToAdd.VerticalAlignment = VerticalAlignment.Center;
            emptyDockContents.Children.Add(dropToAdd);

            Image iconImage = new Image();
            //iconImage.Source = "";// guiConfig.getAddToDockImage();
            iconImage.Width = 40;
            iconImage.Height = 40;
            iconImage.Margin = new Thickness(5,0,5,0);
            //emptyDockContents.Children.Add(iconImage);

            MinHeight = 80;
            MaxHeight = 80;
            Background = new SolidColorBrush(Color.FromArgb(200, 0, 0, 0));
            BorderBrush = new SolidColorBrush(Colors.White);
            BorderThickness = new Thickness(2, 2, 2, 0);
            Child = emptyDockContents;
            SizeChanged += Dock_SizeChanged;
        }
Ejemplo n.º 21
0
        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            if (!Native.DwmIsCompositionEnabled())
                return false;

            try
            {
                IntPtr hwnd = new WindowInteropHelper(window).Handle;

                if (hwnd == IntPtr.Zero)
                    throw new InvalidOperationException("The Window must be shown before extending glass.");

                // Set the background to transparent from both the WPF and Win32 perspectives
                window.Background = Brushes.Transparent;
                HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

                Native.MARGINS margins = new Native.MARGINS(margin);
                Native.DwmExtendFrameIntoClientArea(hwnd, ref margins);

                return true;
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Error • Glass");
            }

            return false;
        }
Ejemplo n.º 22
0
 public MARGINS(Thickness thickness)
 {
     Left = (int)thickness.Left;
     Right = (int)thickness.Right;
     Top = (int)thickness.Top;
     Bottom = (int)thickness.Bottom;
 }
Ejemplo n.º 23
0
 protected virtual void OnCloseButtonMarginChanged(Thickness oldValue, Thickness newValue)
 {
     if (newValue != null && closeButton != null)
     {
         closeButton.Margin = newValue;
     }
 }
 protected virtual void UpdateUpBorder()
 {
     if (ShowUpBorder)
         BorderThickness = new Thickness(BorderThickness.Left, 1, BorderThickness.Right, BorderThickness.Bottom);
     else
         BorderThickness = new Thickness(BorderThickness.Left, 0, BorderThickness.Right, BorderThickness.Bottom);
 }
Ejemplo n.º 25
0
 public VisualPaginator(DrawingVisual source, Size printSize, Thickness pageMargins, Thickness originalMargin)
 {
     DrawingVisual = source;
     _printSize = printSize;
     PageMargins = pageMargins;
     _originalMargin = originalMargin;
 }
Ejemplo n.º 26
0
        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            // Get the Operating System From Environment Class
            OperatingSystem os = Environment.OSVersion;

            // Get the version information
            Version vs = os.Version;

            if (vs.Major < 6)
                return false;

            if (!DwmIsCompositionEnabled())
                return false;

            IntPtr hwnd = new WindowInteropHelper(window).Handle;
            if (hwnd == IntPtr.Zero)
                throw new InvalidOperationException("Glass cannot be extended before the window is shown.");

            // Set the background to transparent from both the WPF and Win32 perspectives
            window.Background = Brushes.Transparent;
            HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

            MARGINS margins = new MARGINS(margin);
            DwmExtendFrameIntoClientArea(hwnd, ref margins);

            return true;
        }
Ejemplo n.º 27
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            String Param = parameter as String;
            Double Value = (Double)value;
            Thickness Margin = new Thickness(0);
            if (Param != null)
            {
                if (Param.Equals(String.Empty))
                {
                    Margin = new Thickness(Value);
                }
                else
                {
                    String[] sSides = Param.Replace("x", Value.ToString()).Split(',');
                    Double[] dSides= new Double[sSides.Length];

                    for (int i = 0; i < sSides.Length; ++i)
                        dSides[i] = Parse.TryParse<Double>(sSides[i], 0);

                    switch (sSides.Length)
                    {
                        default: break;

                        case 2:
                            Margin = new Thickness(dSides[0], dSides[1], dSides[0], dSides[1]);
                            break;
                        case 4:
                            Margin = new Thickness(dSides[0], dSides[1], dSides[2], dSides[3]);
                            break;
                    }
                }
            }
            return Margin;
        }
        public MallWindow(Brush bodyimg, Brush OKB, Brush OKBClicked, Datas datas)
        {
            InitializeComponent();

            originalMargin = new Thickness(110, 145, 0, 0);
            duringMargin = new Thickness(140, 145, 0, 0);
            isSearching = false;

            this.Title = "찾는 물건 시세가?";
            this.bodyimg = bodyimg;
            this.Background = bodyimg;
            this.datas = datas;

            this.searchbutton.Background = Brushes.Transparent;
            this.searchbutton.Cursor = Cursors.Hand;

            this.OKB = OKB;
            this.OKBClicked = OKBClicked;
            this.okbut.Background = this.OKB;

            //처음엔 입력을 기다린다.
            readyForInput();

            updateItems();
        }
Ejemplo n.º 29
0
 /// <summary>Creates a new <see cref="ThicknessInterpolation"/> instance with the specified parameters.</summary>
 /// <param name="interpolator">The interpolation function.</param>
 /// <param name="fromValue">The starting value of the animation, or <c>null</c>.</param>
 /// <param name="toValue">The ending value of the animation, or <c>null</c>.</param>
 /// <param name="isAdditive">Indicates whether the interpolation is additive.</param>
 /// <param name="isCumulative">Indicates whether the interpolation is cumulative.</param>
 public ThicknessInterpolation(Interpolator interpolator, Thickness? fromValue, Thickness? toValue, bool isAdditive, bool isCumulative) : this() {
    Interpolator = interpolator;
    if (fromValue.HasValue) base.From = fromValue.Value; else if (isAdditive) base.From = new Thickness();
    if (toValue.HasValue) base.To = toValue.Value; else if (isAdditive) base.To = new Thickness();
    base.IsAdditive = isAdditive;
    base.IsCumulative = isCumulative;
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Constructeur par défaut de la classe.
        /// </summary>
        /// <param name="plat">Un plat.</param>
        /// <param name="nbPersonnes">Le nombre de personnes.</param>
        public FenetreIngredients(Plat plat, int nbPersonnes)
        {
            CultureManager.UICultureChanged += CultureManager_UICultureChanged;

            InitializeComponent();

            PlatCourant = plat;
            NbrPersonnes = nbPersonnes;

            int nbRangees = plat.ListeIngredients.Count + 1;

            GenererRangees(nbRangees);

            Label entete = new Label();
            entete.FontSize = 18;
            entete.FontWeight = FontWeights.Bold;
            entete.Content = plat.Nom;
            grdIngredients.Children.Add(entete);

            AfficherIngredients(new List<Aliment>(PlatCourant.ListeIngredients), nbPersonnes);

            btnCalculatrice = new Button();
            btnCalculatrice.Content = Nutritia.UI.Ressources.Localisation.FenetreIngredient.Calculatrice;
            btnCalculatrice.Width = 150;
            btnCalculatrice.Height = 25;
            btnCalculatrice.FontSize = 16;
            Thickness margin = new Thickness();
            margin.Top = 10;
            btnCalculatrice.Margin = margin;
            btnCalculatrice.Style = FindResource("fontNutritia") as Style;
            btnCalculatrice.Click += new RoutedEventHandler(btnCalculatrice_Click);
            Grid.SetRow(btnCalculatrice, nbRangees);
            grdIngredients.Children.Add(btnCalculatrice);
        }
Ejemplo n.º 31
0
        private PointCollection GetFramePoints_NodeTooltipConnectLeft(double estimatedHeight, double estimatedWidth)
        {
            if (ViewModel.TargetBotRight.X + estimatedWidth > this.ViewModel.DynamoViewModel.WorkspaceActualWidth)
            {
                ViewModel.LimitedDirection = InfoBubbleViewModel.Direction.Right;
                contentMargin = Configurations.NodeTooltipContentMarginRight.AsWindowsType();

                return(GeneratePointCollection_TooltipConnectRight(estimatedHeight, estimatedWidth));
            }
            else
            {
                return(GeneratePointCollection_TooltipConnectLeft(estimatedHeight, estimatedWidth));
            }
        }
Ejemplo n.º 32
0
        private PointCollection GetFramePoints_NodeTooltipConnectRight(double estimatedHeight, double estimatedWidth)
        {
            if (ViewModel.TargetTopLeft.X - estimatedWidth < 0)
            {
                ViewModel.LimitedDirection = InfoBubbleViewModel.Direction.Left;
                contentMargin = Configurations.NodeTooltipContentMarginLeft.AsWindowsType();

                return(GeneratePointCollection_TooltipConnectLeft(estimatedHeight, estimatedWidth));
            }
            else
            {
                return(GeneratePointCollection_TooltipConnectRight(estimatedHeight, estimatedWidth));
            }
        }
Ejemplo n.º 33
0
 public DynamoTextBox(string initialText)
 {
     //turn off the border
     Background         = clear;
     BorderThickness    = new Thickness(1);
     GotFocus          += OnGotFocus;
     LostFocus         += OnLostFocus;
     LostKeyboardFocus += OnLostFocus;
     Padding            = new Thickness(3);
     base.Text          = initialText;
     Pending            = false;
     Style              = (Style)SharedDictionaryManager.DynamoModernDictionary["SZoomFadeTextBox"];
     MinHeight          = 20;
 }
Ejemplo n.º 34
0
            public TemplateSettingValues(double width)
            {
                MaxSideLength = 400;

                if (width <= 40)
                {
                    EllipseDiameter = (width / 10) + 1;
                }
                else
                {
                    EllipseDiameter = width / 10;
                }

                EllipseOffset = new System.Windows.Thickness(0, EllipseDiameter * 2.5, 0, 0);
            }
Ejemplo n.º 35
0
        private PointCollection GetFramePoints_NodeTooltipConnectBottom(double estimatedHeight, double estimatedWidth)
        {
            PointCollection pointCollection = new PointCollection();

            double arrowHeight = Configurations.NodeTooltipArrowHeight_SideConnecting;
            double arrowWidth  = Configurations.NodeTooltipArrowWidth_SideConnecting;

            if (ViewModel.TargetTopLeft.Y - estimatedHeight >= 40)
            {
                arrowHeight = Configurations.NodeTooltipArrowHeight_BottomConnecting;
                arrowWidth  = Configurations.NodeTooltipArrowWidth_BottomConnecting;

                ViewModel.LimitedDirection = InfoBubbleViewModel.Direction.None;
                pointCollection.Add(new Point(estimatedWidth, 0));
                pointCollection.Add(new Point(0, 0));
                pointCollection.Add(new Point(0, estimatedHeight - arrowHeight));
                pointCollection.Add(new Point((estimatedWidth / 2) - arrowWidth / 2, estimatedHeight - arrowHeight));
                pointCollection.Add(new Point(estimatedWidth / 2, estimatedHeight));
                pointCollection.Add(new Point((estimatedWidth / 2) + (arrowWidth / 2), estimatedHeight - arrowHeight));
                pointCollection.Add(new Point(estimatedWidth, estimatedHeight - arrowHeight));
            }
            else if (ViewModel.TargetBotRight.X + estimatedWidth <= this.ViewModel.DynamoViewModel.WorkspaceActualWidth)
            {
                ViewModel.LimitedDirection = InfoBubbleViewModel.Direction.Top;
                contentMargin = Configurations.NodeTooltipContentMarginLeft.AsWindowsType();
                //UpdateContent(Content);

                pointCollection.Add(new Point(estimatedWidth, 0));
                pointCollection.Add(new Point(0, 0));
                pointCollection.Add(new Point(arrowWidth, arrowHeight / 2));
                pointCollection.Add(new Point(arrowWidth, estimatedHeight));
                pointCollection.Add(new Point(estimatedWidth, estimatedHeight));
            }
            else
            {
                ViewModel.LimitedDirection = InfoBubbleViewModel.Direction.TopRight;
                contentMargin = Configurations.NodeTooltipContentMarginRight.AsWindowsType();
                //UpdateContent(Content);

                pointCollection.Add(new Point(estimatedWidth, 0));
                pointCollection.Add(new Point(0, 0));
                pointCollection.Add(new Point(0, estimatedHeight));
                pointCollection.Add(new Point(estimatedWidth - arrowWidth, estimatedHeight));
                pointCollection.Add(new Point(estimatedWidth - arrowWidth, arrowHeight / 2));
            }

            return(pointCollection);
        }
Ejemplo n.º 36
0
        public static void CreateServerList()
        {
            var _Margin = new System.Windows.Thickness(15, 5, 15, 0);

            foreach (Server s in References.serverCollection.Servers)
            {
                ServerControl serverControl = Application.Current.Dispatcher.Invoke(() => new ServerControl());
                serverControl.Dispatcher.Invoke(() => serverControl.Flag.Source = GetFlag(s));
                serverControl.Dispatcher.Invoke(() => { serverControl.Margin = _Margin; });
                serverControl.Dispatcher.Invoke(() => { serverControl.Server = s; });
                serverControl.Dispatcher.Invoke(() => { serverControl.ServerNameLabel.Content = s.Name; });
                serverControl.Dispatcher.Invoke(() => { serverControl.Visibility = Visibility.Hidden; });
                MainWindow.Instance.ServerStackPanel.Dispatcher.Invoke(() => MainWindow.Instance.ServerStackPanel.Children.Add(serverControl));
            }
            RefreshInteface();
        }
Ejemplo n.º 37
0
        public MainWindow()
        {
            InitializeComponent();
            //Create window to viewers
            ViewPanel viewPanel = new ViewPanel();

            viewPanel.Show();
            //Get default coord-s to switch sides
            foreach (Window window in Application.Current.Windows)
            {
                if (window.GetType() == typeof(ViewPanel))
                {
                    default_first_player_name_place = (window as ViewPanel).Player1_Name_small.Margin;
                }
            }
        }
Ejemplo n.º 38
0
        public TextBox()
        {
            Padding           = new System.Windows.Thickness(5);
            base.TextChanged += (o, e) =>
            {
                if (base.Text != currentValue && !(expression == null || expression.IsMatch(base.Text)))
                {
                    base.Text = currentValue;
                    base.Select(currentValue.Length, 0);
                    return;
                }

                string oldValue = currentValue;
                currentValue = base.Text;

                OnPropertyChanged("Text");
                OnPropertyChanged("StringValue");

                var handler = TextChanged;
                if (handler != null)
                {
                    handler(Pair ?? this, new ValueChangedEventArgs <string>(oldValue, currentValue));
                }
            };

            PreviewKeyDown += (o, e) =>
            {
                if (e.Key == System.Windows.Input.Key.Return)
                {
                    var handler = ReturnKeyPressed;
                    if (handler != null)
                    {
                        var args = new EventHandledEventArgs();
                        handler(pair ?? this, args);
                        e.Handled = args.IsHandled;
                    }
                }
            };

            Loaded += (o, e) =>
            {
                if (setFocusOnLoad)
                {
                    base.Focus();
                }
            };
        }
Ejemplo n.º 39
0
        public SchoolProgressViewModel()
        {
            ViewSource        = new CollectionViewSource();
            ViewSource.Source = Schools;

            SelectedYear = Years[0];
            _bigMargin   = new Thickness(26, 0, 26, 0);
            _smallMargin = new Thickness(20, 0, 20, 0);
            Margin       = SmallMargin;
            Schools.Add(School);

            StationManager.RefreshYearListEvent += () =>
            {
                Years = StationManager.DataStorage.GetYears();
                OnPropertyChanged("StYears");
            };
        }
Ejemplo n.º 40
0
 /* Constructor. */
 public SudokuField(int xPos, int yPos, int _index, SudokuC _parent)
 {
     parent                   = _parent;
     myIndex                  = _index;
     Margin                   = new System.Windows.Thickness(xPos, yPos, 10, 10);
     TextAlignment            = System.Windows.TextAlignment.Center;
     Width                    = 25;
     Height                   = 25;
     MaxLength                = 1;
     FontFamily               = new System.Windows.Media.FontFamily("Kristen ITC, Arial");
     FontSize                 = 14;
     VerticalContentAlignment = VerticalAlignment.Center;
     TextAlignment            = TextAlignment.Center;
     Background               = Brushes.White;
     TextChanged             += SetFieldBackColor;
     PreviewKeyDown          += SudokuFieldPKeyDown;
     MouseEnter              += mouseEnterSudokuField;
 }
Ejemplo n.º 41
0
        public BorderColor(System.Windows.Media.Color color)
        {
            BorderBrush     = System.Windows.Media.Brushes.DimGray;
            BorderThickness = new System.Windows.Thickness(1);

            // craete main grid (container) for border (this)
            var grid = new System.Windows.Controls.Grid();

            // create transparent background (white/gray blocks)
            var gridTransparentBackground = new System.Windows.Controls.Grid();

            for (int i = 0; i < TRANSPARENT_BACKGROUND_DENSE; i++)
            {
                gridTransparentBackground.RowDefinitions.Add(new RowDefinition());
                gridTransparentBackground.ColumnDefinitions.Add(new ColumnDefinition());
            }
            for (int column = 0; column < TRANSPARENT_BACKGROUND_DENSE; column++)
            {
                for (int row = 0; row < TRANSPARENT_BACKGROUND_DENSE; row++)
                {
                    var g = new System.Windows.Controls.Grid
                    {
                        Background = ((row + column) % 2 == 0) ? System.Windows.Media.Brushes.LightGray : System.Windows.Media.Brushes.White
                    };
                    gridTransparentBackground.Children.Add(g);
                    System.Windows.Controls.Grid.SetRow(g, row);
                    System.Windows.Controls.Grid.SetColumn(g, column);
                }
            }
            grid.Children.Add(gridTransparentBackground);

            // create grid for actual color
            _gridColor = new System.Windows.Controls.Grid
            {
                Background = System.Windows.Media.Brushes.Transparent,
            };
            grid.Children.Add(_gridColor);

            Child = grid;

            // init color
            Color = color;
        }
Ejemplo n.º 42
0
 public DynamoTextBox(string initialText)
 {
     //turn off the border
     Background         = clear;
     BorderThickness    = new Thickness(1);
     BorderBrush        = new SolidColorBrush(Color.FromArgb(255, 74, 74, 74));
     Foreground         = new SolidColorBrush(Color.FromArgb(255, 238, 238, 238));
     CaretBrush         = new SolidColorBrush(Color.FromArgb(255, 106, 192, 231));
     GotFocus          += OnGotFocus;
     FontSize           = 16;
     LostFocus         += OnLostFocus;
     LostKeyboardFocus += OnLostFocus;
     Padding            = new Thickness(5, 3, 5, 3);
     base.Text          = initialText;
     Pending            = false;
     Style              = (Style)SharedDictionaryManager.DynamoModernDictionary["SZoomFadeTextBox"];
     MinHeight          = 29;
     MinWidth           = 100;
 }
Ejemplo n.º 43
0
        public static bool Parse(string text, out Thickness thickness)
        {
            thickness = new Thickness();

            Match match = Regex.Match(text, @"(\d),(\d),(\d),(\d)");

            if (!match.Success)
            {
                return(false);
            }

            thickness = new System.Windows.Thickness(
                System.Convert.ToDouble(match.Groups[1].Value),
                System.Convert.ToDouble(match.Groups[2].Value),
                System.Convert.ToDouble(match.Groups[3].Value),
                System.Convert.ToDouble(match.Groups[4].Value)
                );

            return(true);
        }
Ejemplo n.º 44
0
        public Button()
        {
            BorderBrush = new UI.Color(172, 172, 172).GetBrush();
            Padding     = new System.Windows.Thickness(5);

            base.Click += (o, e) =>
            {
                e.Handled = true;

                var handler = Clicked;
                if (handler != null)
                {
                    handler(Pair ?? this, EventArgs.Empty);
                }
                else
                {
                    iApp.Navigate(NavigationLink, this.GetParent <MonoCross.Navigation.IMXView>());
                }
            };
        }
Ejemplo n.º 45
0
        private void button1_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Button b = (Button)sender;

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                // Capture the mouse for border
                e.MouseDevice.Capture(b);
                System.Windows.Thickness _margin = new System.Windows.Thickness();
                int _tempX = Convert.ToInt32(e.GetPosition(this).X);
                int _tempY = Convert.ToInt32(e.GetPosition(this).Y);
                _margin = b.Margin;
                // when While moving _tempX get greater than m_MouseX relative to usercontrol
                if (m_MouseX > _tempX)
                {
                    // add the difference of both to Left
                    _margin.Left += (_tempX - m_MouseX);
                    // subtract the difference of both to Left
                    _margin.Right -= (_tempX - m_MouseX);
                }
                else
                {
                    _margin.Left  -= (m_MouseX - _tempX);
                    _margin.Right -= (_tempX - m_MouseX);
                }
                if (m_MouseY > _tempY)
                {
                    _margin.Top    += (_tempY - m_MouseY);
                    _margin.Bottom -= (_tempY - m_MouseY);
                }
                else
                {
                    _margin.Top    -= (m_MouseY - _tempY);
                    _margin.Bottom -= (_tempY - m_MouseY);
                }
                b.Margin = _margin;
                m_MouseX = _tempX;
                m_MouseY = _tempY;
            }
        }
Ejemplo n.º 46
0
        public MenuButton(string title)
        {
            BorderThickness            = new System.Windows.Thickness(0);
            Command                    = new ButtonCommand(this);
            HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
            FontFamily                 = new System.Windows.Media.FontFamily("Segoe UI");
            FontSize                   = 12;
            IsEnabled                  = true;
            MaxHeight                  = 40;
            Margin  = new Thickness(2);
            Padding = new Thickness(5, 5, 35, 5);

            var grid = new System.Windows.Controls.Grid()
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition()
                    {
                        Width = new System.Windows.GridLength(16, System.Windows.GridUnitType.Pixel)
                    },
                    new ColumnDefinition()
                    {
                        Width = new System.Windows.GridLength(1, System.Windows.GridUnitType.Star)
                    }
                }
            };

            Content = grid;

            var textBlock = new TextBlock()
            {
                Margin = new Thickness(8, 0, 0, 0),
                HorizontalAlignment = System.Windows.HorizontalAlignment.Left,
                VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                Text = title
            };

            System.Windows.Controls.Grid.SetColumn(textBlock, 1);
            grid.Children.Add(textBlock);
        }
Ejemplo n.º 47
0
        sw.Thickness GetMargins(int x, int y)
        {
            var margin = new sw.Thickness();

            if (x > 0)
            {
                margin.Left = Math.Floor(spacing.Width / 2.0);
            }
            if (x < Control.ColumnDefinitions.Count - 1)
            {
                margin.Right = Math.Ceiling(spacing.Width / 2.0);
            }
            if (y > 0)
            {
                margin.Top = Math.Floor(spacing.Height / 2.0);
            }
            if (y < Control.RowDefinitions.Count - 1)
            {
                margin.Bottom = Math.Ceiling(spacing.Height / 2.0);
            }
            return(margin);
        }
Ejemplo n.º 48
0
 private void control_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         // Capture the mouse for border
         e.MouseDevice.Capture(_control);
         System.Windows.Thickness margin = new System.Windows.Thickness();
         int tempX = Convert.ToInt32(e.GetPosition(this).X);
         int tempY = Convert.ToInt32(e.GetPosition(this).Y);
         margin = _container.Margin;
         // when While moving _tempX get greater than m_MouseX relative to usercontrol
         if (_mMouseX > tempX)
         {
             // add the difference of both to Left
             margin.Left += (tempX - _mMouseX);
             // subtract the difference of both to Left
             margin.Right -= (tempX - _mMouseX);
         }
         else
         {
             margin.Left  -= (_mMouseX - tempX);
             margin.Right -= (tempX - _mMouseX);
         }
         if (_mMouseY > tempY)
         {
             margin.Top    += (tempY - _mMouseY);
             margin.Bottom -= (tempY - _mMouseY);
         }
         else
         {
             margin.Top    -= (_mMouseY - tempY);
             margin.Bottom -= (tempY - _mMouseY);
         }
         _container.Margin = margin;
         _mMouseX          = tempX;
         _mMouseY          = tempY;
     }
 }
Ejemplo n.º 49
0
    public Progs(string path, string name)
    {
        //Name
        //Content = Image.FromFile(path);

        // Image i =
        IntPtr hBitmap = ExtractIcon.GetIcon(path, false).ToBitmap().GetHbitmap();

        ImageSource wpfBitmap =
            Imaging.CreateBitmapSourceFromHBitmap(
                hBitmap, IntPtr.Zero, Int32Rect.Empty,
                BitmapSizeOptions.FromEmptyOptions());

        // i.Width = 48;
        // i.Height = 48;

        // BitmapImage bi = new BitmapImage();
        // bi.BeginInit();
        // bi = ExtractIcon.GetIcon(path, false);
        // bi.UriSource = new Uri("pack://application:,,,/Resources/close_small_black.ico");
        // bi.EndInit();
        // i.Source = bi;

        this.Source = wpfBitmap;

        //Content = ExtractIcon.GetIcon(path, false).ToBitmap();
        ImagePath = path;

        Width  = 72;
        Height = 64;
        // Background = System.Windows.Media.Brushes.Transparent;
        ToolTip = name;
        Margin  = new System.Windows.Thickness(10);
        Opacity = 0.8;
        this.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(Progs_ClickThread);
        this.MouseEnter        += new System.Windows.Input.MouseEventHandler(Progs_MouseEnter);
        this.MouseLeave        += new System.Windows.Input.MouseEventHandler(Progs_MouseLeave);
    }
Ejemplo n.º 50
0
        public virtual System.Windows.Thickness Parse(Thickness thickness)
        {
            System.Windows.Thickness nativeThickness = new System.Windows.Thickness();

            if (thickness.Left.HasValue)
            {
                nativeThickness.Left = (int)thickness.Left;
            }
            if (thickness.Top.HasValue)
            {
                nativeThickness.Top = (int)thickness.Top;
            }
            if (thickness.Right.HasValue)
            {
                nativeThickness.Right = (int)thickness.Right;
            }
            if (thickness.Bottom.HasValue)
            {
                nativeThickness.Bottom = (int)thickness.Bottom;
            }

            return(nativeThickness);
        }
Ejemplo n.º 51
0
 public EditableTextBox()
     : base()
 {
     Background          = System.Windows.Media.Brushes.Transparent;
     TextAlignment       = System.Windows.TextAlignment.Left;
     BorderThickness     = new System.Windows.Thickness(0.0);
     IsReadOnly          = true;
     Focusable           = false;
     IsTabStop           = false;
     IsHitTestVisible    = true;
     Cursor              = System.Windows.Input.Cursors.Arrow;
     Margin              = new System.Windows.Thickness(5, 0, 5, 0);
     KeyDown            += new System.Windows.Input.KeyEventHandler(ClassTextBox_KeyDown);
     KeyUp              += new KeyEventHandler(EditableTextBox_KeyUp);
     LostFocus          += new System.Windows.RoutedEventHandler(ClassTextBox_LostFocus);
     LostKeyboardFocus  += new KeyboardFocusChangedEventHandler(ClassTextBox_LostKeyboardFocus);
     MouseEnter         += new MouseEventHandler(ClassTextBox_MouseEnter);
     MouseLeave         += new MouseEventHandler(ClassTextBox_MouseLeave);
     ContextMenuOpening += new ContextMenuEventHandler(ClassTextBox_ContextMenuOpening);
     ContextMenuClosing += new ContextMenuEventHandler(ClassTextBox_ContextMenuClosing);
     FocusVisualStyle    = null;
     ResetContextMenu();
 }
        public ClassProgressViewModel()
        {
            Classes      = StationManager.DataStorage.GetClasses(SelectedYear);
            SelectedYear = StationManager.DataStorage.GetCurYear();
            _bigMargin   = new Thickness(26, 0, 26, 0);
            _smallMargin = new Thickness(20, 0, 20, 0);
            Margin       = SmallMargin;

            if (StationManager.CurrentUser.AccessType == "Классный руководитель")
            {
                IsAdmin       = false;
                SelectedClass = Classes.First(c => c.ClassId == StationManager.CurrentClass.ClassId);
            }
            else
            {
                IsAdmin = true;
            }

            StationManager.RefreshYearListEvent += () =>
            {
                Years = StationManager.DataStorage.GetYears();
                OnPropertyChanged("StYears");
            };
        }
Ejemplo n.º 53
0
        private void UpdateMargin(object sender, SizeChangedEventArgs e)
        {
            // Compute margin for the preview bubble,
            // so that it is centered relatively to the node
            //       ------
            //       |node|
            //       ------
            //    ------------
            //    |  bubble  |
            //    ------------
            // and margin for pin icon, so that it is under node's right bottom
            // independently from preview bubble width
            var nodeWidth    = smallContentGrid.MinWidth;
            var previewWidth = Math.Max(centralizedGrid.ActualWidth, nodeWidth);
            var margin       = (previewWidth - nodeWidth) / 2;

            Margin = new System.Windows.Thickness {
                Left = -margin
            };
            bubbleTools.Margin = new System.Windows.Thickness
            {
                Right = margin
            };
        }
Ejemplo n.º 54
0
        void SetMargins(sw.FrameworkElement c, int x, int y)
        {
            c.HorizontalAlignment = sw.HorizontalAlignment.Stretch;
            c.VerticalAlignment   = sw.VerticalAlignment.Stretch;
            var margin = new sw.Thickness();

            if (x > 0)
            {
                margin.Left = Math.Floor(spacing.Width / 2.0);
            }
            if (x < Control.ColumnDefinitions.Count - 1)
            {
                margin.Right = Math.Ceiling(spacing.Width / 2.0);
            }
            if (y > 0)
            {
                margin.Top = Math.Floor(spacing.Height / 2.0);
            }
            if (y < Control.RowDefinitions.Count - 1)
            {
                margin.Bottom = Math.Ceiling(spacing.Height / 2.0);
            }
            c.Margin = margin;
        }
Ejemplo n.º 55
0
 public static Padding ToEto(this sw.Thickness value)
 {
     return(new Padding((int)value.Left, (int)value.Top, (int)value.Right, (int)value.Bottom));
 }
Ejemplo n.º 56
0
 public DynamoNodeButton()
 {
     Style  = (Style)SharedDictionaryManager.DynamoModernDictionary["SNodeTextButton"];
     Margin = new System.Windows.Thickness(1, 0, 1, 0);
 }
Ejemplo n.º 57
0
 public virtual Thickness Parse(System.Windows.Thickness nativeThickness)
 {
     return(new Thickness(nativeThickness.Left, nativeThickness.Top, nativeThickness.Right, nativeThickness.Bottom));
 }
Ejemplo n.º 58
0
 public static double Horizontal(this sw.Thickness thickness)
 {
     return(thickness.Left + thickness.Right);
 }
Ejemplo n.º 59
0
 public static double Vertical(this sw.Thickness thickness)
 {
     return(thickness.Top + thickness.Bottom);
 }
Ejemplo n.º 60
0
 public static sw.Size Size(this sw.Thickness thickness)
 {
     return(new sw.Size(thickness.Horizontal(), thickness.Vertical()));
 }