예제 #1
0
        private void setUpMap()
        {
            for (int i = 0; i < 20; i++)
            {
                RowDefinition rowDef = new RowDefinition();
                rowDef.Height = new GridLength(1, GridUnitType.Star);
                mapGrid.RowDefinitions.Add(rowDef);
            }

            for (int i = 0; i < 15; i++)
            {
                ColumnDefinition colDef = new ColumnDefinition();
                colDef.Width = new GridLength(1, GridUnitType.Star);
                mapGrid.ColumnDefinitions.Add(colDef);
            }
            var bc = new BrushConverter();
            mapGrid.ShowGridLines = true;
            for (int i = 0; i < 9; i++)
            {
                Label label = new Label();
                label.Background = (Brush)bc.ConvertFrom("#FF28701C");
                Grid.SetRow(label, 19 - i / 3);
                Grid.SetColumn(label, i % 3);
                mapGrid.Children.Add(label);
            }

            for (int i = 0; i < 9; i++)
            {
                Label label = new Label();
                label.Background = (Brush)bc.ConvertFrom("#FF28701C");
                Grid.SetRow(label, i / 3);
                Grid.SetColumn(label, 14 - i % 3);
                mapGrid.Children.Add(label);
            }
        }
예제 #2
0
        public override UIElement BuildElement(DisplayBlock.DisplayBlock displayBlock)
        {
            var textBlock = displayBlock as DisplayBlock.TextBlock;
            var bc        = new Media.BrushConverter();
            var label     = new TextBlock
            {
                Height        = textBlock.Height,
                Width         = textBlock.Width,
                Text          = textBlock.Details.Text,
                FontSize      = textBlock.Details.FontSize,
                FontFamily    = new Media.FontFamily(textBlock.Details.FontName),
                FontWeight    = textBlock.Details.Bold ? FontWeights.Bold : FontWeights.Normal,
                FontStyle     = textBlock.Details.Italic ? FontStyles.Italic : FontStyles.Normal,
                LineHeight    = textBlock.Details.FontSize * textBlock.Details.FontIndex,
                TextAlignment = textBlock.Details.Align == DisplayBlock.Align.Left ? TextAlignment.Left :
                                textBlock.Details.Align == DisplayBlock.Align.Center ? TextAlignment.Center :
                                textBlock.Details.Align == DisplayBlock.Align.Right ? TextAlignment.Right : TextAlignment.Left
            };

            if (ColorConverter.TryToParseRGB(textBlock.Details.BackColor, out string colorHex))
            {
                label.Background = (Media.Brush)bc.ConvertFrom(colorHex);
            }
            if (ColorConverter.TryToParseRGB(textBlock.Details.TextColor, out colorHex))
            {
                label.Foreground = (Media.Brush)bc.ConvertFrom(colorHex);
            }
            Canvas.SetTop(label, textBlock.Top);
            Canvas.SetLeft(label, textBlock.Left);
            Panel.SetZIndex(label, textBlock.ZIndex);
            return(label);
        }
        private IEnumerable <Setter> GetRowStyleSetters(DisplayBlock.Details.TableBlockRowDetails rowDetails, double fontSize, string fontName)
        {
            var bc = new Media.BrushConverter();

            if (ColorConverter.TryToParseRGB(rowDetails.TextColor, out string colorHex))
            {
                yield return(new Setter(Control.ForegroundProperty, (Media.Brush)bc.ConvertFrom(colorHex)));
            }
            if (ColorConverter.TryToParseRGB(rowDetails.BackColor, out colorHex))
            {
                yield return(new Setter(Control.BackgroundProperty, (Media.Brush)bc.ConvertFrom(colorHex)));
            }
            yield return(new Setter(Control.FontWeightProperty, rowDetails.Bold ? FontWeights.Bold : FontWeights.Normal));

            yield return(new Setter(Control.FontStyleProperty, rowDetails.Italic ? FontStyles.Italic : FontStyles.Normal));

            yield return(new Setter(Control.HorizontalContentAlignmentProperty,
                                    rowDetails.Align == DisplayBlock.Align.Left ? HorizontalAlignment.Left :
                                    rowDetails.Align == DisplayBlock.Align.Center ? HorizontalAlignment.Center :
                                    rowDetails.Align == DisplayBlock.Align.Right ? HorizontalAlignment.Right : HorizontalAlignment.Left));

            yield return(new Setter(Control.FontSizeProperty, fontSize));

            yield return(new Setter(Control.FontFamilyProperty, new Media.FontFamily(fontName)));
        }
 private static void foregroundOverrideChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     var bc = new BrushConverter();
     HyperLinkStandard input = (HyperLinkStandard)d;
     input.txtLink.Foreground = (Brush)bc.ConvertFrom(e.NewValue as string);
     input.Foreground = (Brush)bc.ConvertFrom(e.NewValue as string);
 }
예제 #5
0
        internal void PingElapsed(object sender, ElapsedEventArgs e)
        {
            if (i++ < 10) //Ping every 10 seconds
                return;
            i = 0;
            if (!Client.IsOnPlayPage)
                return;
            double PingAverage = HighestPingTime(Client.Region.PingAddresses);
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                PingLabel.Content = Math.Round(PingAverage).ToString() + "ms";
                if (PingAverage == 0)
                    PingLabel.Content = "Timeout";
                if (PingAverage == -1)
                    PingLabel.Content = "Ping not enabled for this region";

                BrushConverter bc = new BrushConverter();
                Brush brush = null;
                if (PingAverage > 999 || PingAverage < 1)
                    brush = (Brush)bc.ConvertFrom("#FFFF6767");
                else if (PingAverage > 110 && PingAverage < 999)
                    brush = (Brush)bc.ConvertFrom("#FFFFD667");
                else
                    brush = (Brush)bc.ConvertFrom("#FF67FF67");
                PingRectangle.Fill = brush;
            }));
        }
예제 #6
0
        public DeviceItem(String username, String mac, String userimgurl, long lastupdated)
        {
            var bc = new BrushConverter();

            // IMAGE
            Image imgUser = new Image();
            imgUser.Source = new BitmapImage(new Uri(userimgurl));
            imgUser.Height = 44;
            imgUser.Width = 44;

            StackPanel spInnerImg = new StackPanel();
            spInnerImg.Orientation = System.Windows.Controls.Orientation.Vertical;
            spInnerImg.Height = 46;
            spInnerImg.Width = 44;
            spInnerImg.Children.Add(imgUser);

            Border borderInnerImg = new Border();
            borderInnerImg.Padding = new Thickness(2);
            borderInnerImg.Margin = new Thickness(0, 0, 5, 0);
            borderInnerImg.Background = (Brush)bc.ConvertFrom("#DDDDDD");
            borderInnerImg.Width = 46;
            borderInnerImg.Height = 48;
            borderInnerImg.Child = spInnerImg;

            // TEXT
            TextBlock tbUsername = new TextBlock(); tbUsername.Name = "username"; tbUsername.Text = username;
            TextBlock tbMac = new TextBlock(); tbMac.Name = "mac"; tbMac.Text = mac;
            TextBlock tbLastUpdated = new TextBlock(); tbLastUpdated.Name = "lastupdated";
            //DateTime date = new DateTime(lastupdated)
            DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
            dtDateTime = dtDateTime.AddMilliseconds((double)lastupdated);
            tbLastUpdated.Text = dtDateTime.ToString("yyyy-MM-dd hh:mm:ss");
            //tbLastUpdated.Text = lastupdated.ToString();

            StackPanel spInnerText = new StackPanel();
            spInnerText.Orientation = System.Windows.Controls.Orientation.Vertical;
            spInnerText.Height = 48;
            spInnerText.Children.Add(tbUsername);
            spInnerText.Children.Add(tbMac);
            spInnerText.Children.Add(tbLastUpdated);

            // CONTAINER
            StackPanel spOuter = new StackPanel();
            spOuter.Orientation = System.Windows.Controls.Orientation.Horizontal;
            spOuter.Height = 48;
            spOuter.Children.Add(borderInnerImg);
            spOuter.Children.Add(spInnerText);

            Border borderOuter = new Border();
            borderOuter.Padding = new Thickness(2);
            borderOuter.Width = 198;
            borderOuter.Background = (Brush)bc.ConvertFrom("#BBBBBB");
            borderOuter.Child = spOuter;

            this.BorderThickness = new Thickness(0);
            this.Padding = new Thickness(0);
            this.Margin = new Thickness(0, 0, 0, 2);
            this.Content = borderOuter;
        }
예제 #7
0
        private void Initialize()
        {
            _bc = new BrushConverter();
            _click = (Brush)_bc.ConvertFrom("#007acc");
            _hover = (Brush)_bc.ConvertFrom("#fcfcfc");
            _leave = Brushes.Transparent;

            ControlMin.Source = ImageEditing.GenerateImage(_minIconPath);
            ControlMax.Source = ImageEditing.GenerateImage(_maxIconPath);
            ControlClose.Source = ImageEditing.GenerateImage(_closeIcon);
        }
        public StatusWindow(ServerWindow mainWindow)
        {
            InitializeComponent();
            this.mainWindow = mainWindow;
            var bc = new BrushConverter();
            green = (Brush)bc.ConvertFrom("#FF76FF03");
            yellow = (Brush)bc.ConvertFrom("#FFFFFF00");
            red = (Brush)bc.ConvertFrom("#FFF44336");
            Background = red;
            Deactivated += StatusWindow_Deactivated;

        }
예제 #9
0
 internal void changeColor()
 {
     Brush tmp = null;
     var bc = new BrushConverter();
     switch (col)
     {
         case 0: tmp = (Brush)bc.ConvertFrom("#FFF8b8"); break;
         case 1: tmp = (Brush)bc.ConvertFrom("#C4F5BF"); break;
         case 2: tmp = (Brush)bc.ConvertFrom("#FF9AA4"); break;
         case 3: tmp = (Brush)bc.ConvertFrom("#CBE9F8"); break;
     }
     this.Background = tmp;
     text.Background = tmp;
 }
 /// <summary>
 /// </summary>
 /// <param name="value"> </param>
 /// <returns> </returns>
 public object Convert(object value)
 {
     var brushConverter = new BrushConverter();
     value = (value.ToString()
                   .Substring(0, 1) == "#") ? value : "#" + value;
     var result = (Brush) brushConverter.ConvertFrom("#FFFFFFFF");
     try
     {
         result = (Brush) brushConverter.ConvertFrom(value);
     }
     catch (Exception ex)
     {
     }
     return result;
 }
 /// <summary>
 /// </summary>
 /// <param name="value"> </param>
 /// <param name="targetType"> </param>
 /// <param name="parameter"> </param>
 /// <param name="culture"> </param>
 /// <returns> </returns>
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     var brushConverter = new BrushConverter();
     value = (value.ToString()
                   .StartsWith("#")) ? value : "#" + value;
     var result = (Brush) brushConverter.ConvertFrom("#FFFFFFFF");
     try
     {
         result = (Brush) brushConverter.ConvertFrom(value);
     }
     catch (Exception ex)
     {
     }
     return result;
 }
예제 #12
0
        //Создание пустого поля для игры
        private void CreateField(int[] matr)
        {
            int side = (int)(237 / Math.Sqrt(matr.Length));

            for (int i = 0; i < matr.Length; i++)
            {
                int leftPlace = (((int)(i % Math.Sqrt(matr.Length)))*side);
                int topPlace = ((i / (int)(Math.Sqrt(matr.Length)))*side);
                TextBox textBox = new TextBox();
                textBox.FontSize = 50;
                textBox.TextAlignment = TextAlignment.Center;

                var bc = new BrushConverter();
                textBox.Background = (Brush)bc.ConvertFrom("#FFD6D6D6");

                if (matr[i] != 0)
                    textBox.Text = Convert.ToString(matr[i]);

                textBox.Width = side - 1;
                textBox.Height = side - 1;

                Canvas.SetLeft(textBox, leftPlace);
                Canvas.SetTop(textBox, topPlace);

                Field.Children.Add(textBox);
            }
        }
        /// <remarks>
        /// Handles UI events for room row selection from list
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listRooms_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            RoomBO selectedRoom = (RoomBO)listRooms.SelectedItem;

            // if on plan drawing there is matching room name, paint the room green
            BrushConverter bc = new BrushConverter();
            foreach (Button button in _planButtons)
            {
                if (button.Content.ToString() == selectedRoom.Name)
                {
                    
                    button.Background = (Brush)bc.ConvertFrom("#FF7DBA1D");
                }
                else button.Background = (Brush)bc.ConvertFrom("#FFFFFFFF");
            }
        }
예제 #14
0
        public WinColor(MainWindow in_main)
        {
            InitializeComponent();

            Config = new IniFile("./boby_add_file.ini");

            tb_red.Text = Config.IniReadValue("boby", "red");
            tb_green.Text = Config.IniReadValue("boby", "green");
            tb_blue.Text = Config.IniReadValue("boby", "blue");

            if (tb_red.Text == "")
                tb_red.Text = "255";
            if (tb_green.Text == "")
                tb_green.Text = "0";
            if (tb_blue.Text == "")
                tb_blue.Text = "0";
            if (Convert.ToInt32(tb_red.Text.Trim()) > 255)
                tb_red.Text = "255";
            if (Convert.ToInt32(tb_green.Text.Trim()) > 255)
                tb_green.Text = "255";
            if (Convert.ToInt32(tb_blue.Text.Trim()) > 255)
                tb_blue.Text = "255";

            var bc = new BrushConverter();
            rt_color.Fill = (Brush)bc.ConvertFrom("#FF" + Convert.ToInt32(tb_red.Text.Trim()).ToString("X2") + Convert.ToInt32(tb_green.Text.Trim()).ToString("X2") + Convert.ToInt32(tb_blue.Text.Trim()).ToString("X2"));
            in_main_win = in_main;
        }
예제 #15
0
        /// <summary>
        /// Initialise la grille.
        /// </summary>
        protected void initializeGrid()
        {
            var gridFactory     = new FrameworkElementFactory(typeof(Grid));
            var checkboxFactory = new FrameworkElementFactory(typeof(CheckBox));

            checkboxFactory.SetBinding(CheckBox.IsCheckedProperty, new Binding("IsSelected")
            {
                RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(DataGridRow), 1)
            });
            gridFactory.AppendChild(checkboxFactory);
            DataTemplate template = new DataTemplate();

            template.VisualTree    = gridFactory;
            this.RowHeaderTemplate = template;

            var brushConverter = new System.Windows.Media.BrushConverter();

            System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString());
            this.AlternatingRowBackground         = bruch;
            this.AlternatingRowBackground.Opacity = 0.3;

            for (int i = 0; i < getColumnCount(); i++)
            {
                DataGridColumn column = getColumnAt(i);
                column.Header = getColumnHeaderAt(i);
                column.Width  = getColumnWidthAt(i);
                if (column is DataGridBoundColumn)
                {
                    ((DataGridBoundColumn)column).Binding = getBindingAt(i);
                }
                this.Columns.Add(column);
            }
        }
예제 #16
0
        private void InitializeExcelFilesGrid()
        {
            TableGrid = new BrowserGrid();
            TableGrid.hideContextMenu();

            var gridFactory     = new FrameworkElementFactory(typeof(Grid));
            var checkboxFactory = new FrameworkElementFactory(typeof(CheckBox));

            checkboxFactory.SetBinding(CheckBox.IsCheckedProperty, new Binding("IsSelected")
            {
                RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(DataGridRow), 1)
            });
            gridFactory.AppendChild(checkboxFactory);
            DataTemplate template = new DataTemplate();

            template.VisualTree         = gridFactory;
            TableGrid.RowHeaderTemplate = template;

            DataGridTextColumn column = new DataGridTextColumn();

            column.Header  = "Name";
            column.Width   = new DataGridLength(1, DataGridLengthUnitType.Star);
            column.Binding = new System.Windows.Data.Binding("name");
            TableGrid.Columns.Add(column);

            var brushConverter = new System.Windows.Media.BrushConverter();

            System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString());
            TableGrid.AlternatingRowBackground         = bruch;
            TableGrid.AlternatingRowBackground.Opacity = 0.3;

            this.GridPanel.Content           = TableGrid;
            this.TableGrid.SelectionChanged += TableGrid_SelectionChanged;
        }
예제 #17
0
 public void UpdateStatus(Status status)
 {
     var bc = new BrushConverter();
     switch(status)
     {
         case Status.Up:
             StatusEllipse.Fill = (Brush)bc.ConvertFrom("#FF23AA4B");
             break;
         case Status.Lagging:
             StatusEllipse.Fill = (Brush)bc.ConvertFrom("#FFE6912D");
             break;
         case Status.Down:
             StatusEllipse.Fill = (Brush)bc.ConvertFrom("#FFD21414");
             break;
     }
 }
예제 #18
0
 /// <summary>
 /// Highlights UnderButtons
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OverButtonLeft_MouseEnter(object sender, MouseEventArgs e)
 {
     BrushConverter bc = new BrushConverter();
     Brush brush = (Brush)bc.ConvertFrom("#41B1E1");
     UnderButtonLeft.Foreground = brush;
     UnderButtonLeft.Background = brush;
 }
예제 #19
0
        /// <summary>
        /// Initialise la grille level1.
        /// </summary>
        protected void initializeCellsGrid()
        {
            cellsGrid = new BrowserGrid();
            cellsGrid.hideContextMenu();
            var          gridFactory = new FrameworkElementFactory(typeof(Grid));
            DataTemplate template    = new DataTemplate();

            template.VisualTree         = gridFactory;
            cellsGrid.RowHeaderTemplate = template;

            var brushConverter = new System.Windows.Media.BrushConverter();

            System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString());
            cellsGrid.AlternatingRowBackground         = bruch;
            cellsGrid.AlternatingRowBackground.Opacity = 0.3;

            for (int i = 0; i < getColumnCount(); i++)
            {
                DataGridColumn column = getColumnAt(i);
                column.Header = getColumnHeaderAt(i);
                column.Width  = getColumnWidthAt(i);
                if (column is DataGridBoundColumn)
                {
                    ((DataGridBoundColumn)column).Binding = getBindingAt(i);
                }
                cellsGrid.Columns.Add(column);
            }

            this.GridScrollPanel1.Content = cellsGrid;

            cellsGrid.SelectionChanged += OnSelectionChange;
        }
예제 #20
0
        /// <summary>
        /// initialisation grille report level2
        /// </summary>
        private void initializeReportItemsGrid()
        {
            reportOriginalCellsGrid = new BrowserGrid();
            var          gridFactory = new FrameworkElementFactory(typeof(Grid));
            DataTemplate template    = new DataTemplate();

            template.VisualTree = gridFactory;
            reportOriginalCellsGrid.RowHeaderTemplate = template;

            var brushConverter = new System.Windows.Media.BrushConverter();

            System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString());
            reportOriginalCellsGrid.AlternatingRowBackground         = bruch;
            reportOriginalCellsGrid.AlternatingRowBackground.Opacity = 0.3;

            for (int i = 0; i < 11; i++)
            {
                DataGridColumn column = getColumnAt(i);
                column.Header = getColumnHeader3At(i);
                column.Width  = getColumnWidthAt(i);
                if (column is DataGridBoundColumn)
                {
                    ((DataGridBoundColumn)column).Binding = getBinding3At(i);
                }
                reportOriginalCellsGrid.Columns.Add(column);
            }

            this.GridScrollPanel2.Content = reportOriginalCellsGrid;
        }
예제 #21
0
        private async void startClient()
        {
            try
            {
                BrushConverter bc = new BrushConverter();
                Brush brush = (Brush)bc.ConvertFrom(strColor);
                
                udpClient.Client.Bind(new IPEndPoint(IPAddress.Any, 0));
                udpClient.BeginReceive(dataReceived, udpClient);

                gridHeader.Background = brush;
                border.BorderBrush = brush;

                sendInformation(1, strName, string.Empty);
                while (true)
                {
                    sendInformation(3, strName, string.Empty);
                    await Task.Delay(100);
                }
            }
            catch (Exception) 
            {
                MessageBox.Show("Failed to connect to master server!");
                Environment.Exit(0);
            }
        }
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ValidacionesMantenimiento validacion = new ValidacionesMantenimiento();
                bool valido = true;
                foreach (TextBox txb in grdValidar.Children)
                {
                    BrushConverter bc = new BrushConverter();
                    txb.Foreground = (Brush)bc.ConvertFrom("#FF000000");
                    if (validacion.Validar(txb.Text, Convert.ToInt32(txb.Tag)) == false)
                    {
                        valido = false;
                        txb.Foreground = (Brush)bc.ConvertFrom("#FFFF0404");
                    }
                }

                if (valido == true)
                {
                    SIGEEA_Cuota cuota = new SIGEEA_Cuota();
                    AsociadoMantenimiento asociado = new AsociadoMantenimiento();
                    cuota.Nombre_Cuota = txbNombre.Text;
                    cuota.Monto_Cuota = Convert.ToDouble(txbMonto.Text);
                    cuota.FecInicio_Cuota = dtpFecInicio.SelectedDate.Value;
                    cuota.FecFin_Cuota = dtpFecFin.SelectedDate.Value;
                    cuota.FK_Id_Moneda = ucMoneda.getMoneda();
                    if (pk_cuota == 0) asociado.RegistrarCuota(cuota);
                    else
                    {
                        cuota.PK_Id_Cuota = pk_cuota;
                        asociado.EditarCuota(cuota);
                    }
                    MessageBox.Show("La cuota se ha registrado con éxito.", "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Information);
                    this.Close();
                }
                else
                {
                    throw new System.ArgumentException("Los datos ingresados no coinciden con los formatos requeridos.");
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Error);
            }

        }
예제 #23
0
 public void AddSeparator(double width,ToolBar location)
 {
     Separator sp = new Separator();
     sp.Width = width;
     BrushConverter bc = new BrushConverter();
     sp.Background = (Brush)bc.ConvertFrom("Transparent");
     location.Items.Add(sp);
 }
        public BSkyGroupBox()
        {
            this.Header      = "GroupBox";
            IsHitTestVisible = true;
            var converter = new System.Windows.Media.BrushConverter();

            this.BorderBrush = (Brush)converter.ConvertFrom("#FFA9A9A9");
        }
 public SettingWindows(ref string pathDB)
 {
     InitializeComponent();
     pathDBtemp = pathDB;
     TPathDB.Text = MainWindow.pathDB;
     BApplica.IsEnabled = false;
     BrushConverter bc = new BrushConverter();
     BApplica.Background = (Brush)bc.ConvertFrom("#FBFBFA");
 }
 private void applicaClick(object sender, RoutedEventArgs e)
 {
     pathDBtemp = TPathDB.Text;
     MainWindow.pathDB = pathDBtemp;
     BApplica.IsEnabled = false;
     BrushConverter bc = new BrushConverter();
     BApplica.Background = (Brush)bc.ConvertFrom("#FBFBFA");
     
 }
 static RoundSelectorViewModel()
 {
     var bc = new BrushConverter();
     // Note: C68D90 is the color taken from the supplied artwork.
     // I am trying Blue here instead, as that appears as more of a visual highlight
     // - but submit this for approval.
     //_colorForHighlightedArc = (SolidColorBrush)bc.ConvertFrom("#C68D90");
     ColorForHighlightedArc = new SolidColorBrush(Colors.Blue);
     ColorForArc = (SolidColorBrush)bc.ConvertFrom("#502430");
 }
예제 #28
0
 private static Label CreateBasicLabel()
 {
     Label showNameLabel = new Label();
     showNameLabel.FontFamily = new FontFamily("Cambria");
     showNameLabel.FontSize = 14;
     showNameLabel.Margin = new Thickness(0, 0, 0, 0);
     BrushConverter bc = new BrushConverter();
     showNameLabel.Foreground = (Brush)bc.ConvertFrom("#FF4DB3C3");
     showNameLabel.Background = Brushes.Transparent;
     return showNameLabel;
 }
        public BSkyRadioGroup()
        {
            panel            = new StackPanel();
            this.Content     = panel;
            this.Syntax      = "%%VALUE%%";
            this.Header      = "GroupBox";
            IsHitTestVisible = true;
            var converter = new System.Windows.Media.BrushConverter();

            this.BorderBrush = (Brush)converter.ConvertFrom("#FFA9A9A9");
        }
예제 #30
0
        public Board(ModelLevel ml)
        {
            levelModel = ml;

            var bc = new BrushConverter();
            this.Background = (Brush)bc.ConvertFrom("#FF5EC5F5");

            setGrid();
            drawMap();
            setBp();
        }
        public override UIElement BuildElement(DisplayBlock.DisplayBlock displayBlock)
        {
            var datetimeBlock = displayBlock as DisplayBlock.DateTimeBlock;
            var bc            = new Media.BrushConverter();
            var label         = new TextBlock
            {
                Height        = datetimeBlock.Height,
                Width         = datetimeBlock.Width,
                FontSize      = datetimeBlock.Details.FontSize,
                FontFamily    = new Media.FontFamily(datetimeBlock.Details.FontName),
                FontWeight    = datetimeBlock.Details.Bold ? FontWeights.Bold : FontWeights.Normal,
                FontStyle     = datetimeBlock.Details.Italic ? FontStyles.Italic : FontStyles.Normal,
                LineHeight    = datetimeBlock.Details.FontSize * datetimeBlock.Details.FontIndex,
                TextAlignment = datetimeBlock.Details.Align == DisplayBlock.Align.Left ? TextAlignment.Left :
                                datetimeBlock.Details.Align == DisplayBlock.Align.Center ? TextAlignment.Center :
                                datetimeBlock.Details.Align == DisplayBlock.Align.Right ? TextAlignment.Right : TextAlignment.Left
            };
            var dispatcher = Dispatcher.CurrentDispatcher;

            if (datetimeBlock.Details.Format != null)
            {
                var timerManager = new TimerManager();
                timerManager.Subscribe(() =>
                {
                    dispatcher.Invoke(() =>
                                      label.Text = DateTime.Now.ToString(datetimeBlock.Details.Format.ShowtimeFormat));
                });
            }
            if (ColorConverter.TryToParseRGB(datetimeBlock.Details.BackColor, out string colorHex))
            {
                label.Background = (Media.Brush)bc.ConvertFrom(colorHex);
            }
            if (ColorConverter.TryToParseRGB(datetimeBlock.Details.TextColor, out colorHex))
            {
                label.Foreground = (Media.Brush)bc.ConvertFrom(colorHex);
            }
            Canvas.SetTop(label, datetimeBlock.Top);
            Canvas.SetLeft(label, datetimeBlock.Left);
            Panel.SetZIndex(label, datetimeBlock.ZIndex);
            return(label);
        }
예제 #32
0
 private void EmergencyOn(object sender, EventArgs e)
 {
     Dispatcher.Invoke(new Action(() =>
         {
             BrushConverter emergencyBrushConverter = new BrushConverter();
             Brush emergencyBrush = (Brush)emergencyBrushConverter.ConvertFrom("#FFFFCC00");
             emergencyLight.Fill = emergencyBrush;
             BrushConverter studioBrushConverter = new BrushConverter();
             Brush studioBrush = (Brush)studioBrushConverter.ConvertFrom("#FF001D00");
             studioLight.Fill = studioBrush;
         }));
 }
예제 #33
0
        public PatcherPage()
        {
            InitializeComponent();
            UpdateRegionComboBox.SelectedValue = Settings.Default.updateRegion != string.Empty ? Settings.Default.updateRegion : "Live";
            Client.UpdateRegion = (string)UpdateRegionComboBox.SelectedValue;

            bool x = Settings.Default.DarkTheme;
            if (!x)
            {
                var bc = new BrushConverter();
                PatchTextBox.Background = (Brush)bc.ConvertFrom("#FFECECEC");
                DevKey.Background = (Brush)bc.ConvertFrom("#FFECECEC");
                PatchTextBox.Foreground = (Brush)bc.ConvertFrom("#FF1B1919");
                ExtractingProgressRing.Foreground = (Brush)bc.ConvertFrom("#FFFFFFFF");
            }

            autoPlayCheckBox.IsChecked = Settings.Default.AutoPlay;

            StartPatcher();
            Client.Log("LegendaryClient Started Up Successfully");
        }
 private void RestoreFile_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
 {
     if (RestoreFile.IsEnabled)
     {
         BrushConverter bc = new BrushConverter();
         RestoreFile.Background = (Brush)bc.ConvertFrom("#99FFFF");
     }
     else
     {
         RestoreFile.Background = Brushes.LightGray;
     }
 }
예제 #35
0
        public MainWindow()
        {
            InitializeComponent();

            dp_date.SelectedDate = DateTime.Today;
            // фон блока новой записи
            grid_newRec.BorderBrush = Brushes.Blue;
            BrushConverter bc = new BrushConverter();
            grid_newRec.Background = (Brush)bc.ConvertFrom("#EFEFFF");

            refreshInfoFromDB();
        }
예제 #36
0
        BSkyCanvas fe = null;//Anil 04Mar2013. To store sub-dialogs in session. Each option button should have only one sub-dialog
        protected override void OnClick()
        {
            base.OnClick();
            //Anil 04Mar2013 if (baseWindow == null)
            {
                BSkyCanvas parent = UIHelper.FindVisualParent <BSkyCanvas>(this);

                // Aaron fe is not the parent
                if (fe == null)//Anil 04Mar2013. Very first time sub-dialog will be null and so will be created. next time it will hold the object from first run.
                {
                    fe = this.Resources["dlg"] as BSkyCanvas;
                }
                // 01/20/2013
                //Added this code to address a defect when resources are empty
                if (fe == null)
                {
                    MessageBox.Show(BSky.GlobalResources.Properties.Resources.SubDialogNotCreated);
                    return;
                }
                //Aaron 05/05/2014
                //Commented the line below
                //We don't want users to be able to click syntax on a sub-dialog
                //I hence removed syntax on a sub-dialog
                //  baseWindow = new BaseOptionWindow();
                subDlgWindow = new SubDialogWindow();
                //Added the line below

                //Added by Aaron 10/22/2013
                //Added the code below to disable the syntax button on subdialogs

                // baseWindow.Paste.IsEnabled = false;
                subDlgWindow.Template = fe;
                var converter = new System.Windows.Media.BrushConverter();
                //Added 08/10/2014
                //This is so that the canvas dialog in sub dialog matches color of canvas
                fe.Background  = (Brush)converter.ConvertFrom("#FFEEefFf");
                fe.DataContext = this.DataContext;

                //Added aaron 05/05/2015
                //   subDlgWindow.Closing += new CancelEventHandler(Window_Closing);
                subDlgWindow.Owner = UIHelper.FindVisualParent <BaseOptionWindow>(this);
            }

            if (fe.GetType().Name == "BSkyCanvas")
            {
                subDlgWindow.ResizeMode = ResizeMode.NoResize;                                   //Aaron's
            }
            subDlgWindow.ShowDialog();
            //Added by Aaron 05/05/2015
            subDlgWindow.DetachCanvas();
            subDlgWindow.Template = null; //Anil 04Mar2013 Parent Child relation is un-set.
        }
예제 #37
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Color?c = (Color?)value as Color?;

            System.Windows.Media.BrushConverter converter = new System.Windows.Media.BrushConverter();
            object x = null;

            if (converter.CanConvertFrom(typeof(Color?)))
            {
                x = converter.ConvertFrom(c);
            }
            return(x);
        }
 private void File_MouseEnter(object sender, MouseEventArgs e)
 {
     if (!downloading)
     {
         BrushConverter bc = new BrushConverter();
         Start.Background = (Brush)bc.ConvertFrom("#F5FFFA");
     }
     else
     {
         BrushConverter bc = new BrushConverter();
         Start.Background = (Brush)bc.ConvertFrom("#F6CECE");
     }
 }
 private void File_MouseLeave(object sender, MouseEventArgs e)
 {
     if (!downloading)
     {
         BrushConverter bc = new BrushConverter();
         Start.Background = (Brush)bc.ConvertFrom("#FF44E572");
     }
     else
     {
         BrushConverter bc = new BrushConverter();
         Start.Background = (Brush)bc.ConvertFrom("#FA5858");
     }
 }
예제 #40
0
        public void CheckValue()
        {
            var bc = new BrushConverter();

            if (!CheckCellValidity() && tableController.ShowBadValues)
            {
                resultBorder.BorderBrush = Brushes.Red;
            }
            else
            {
                resultBorder.BorderBrush = (Brush)bc.ConvertFrom("#91aa9d");
            }
        }
예제 #41
0
        private void VerifyType()
        {
            var converter = new System.Windows.Media.BrushConverter();

            if (this.Transaction.Type == Type.Dépot)
            {
                IconType              = "../Ressources/LeftTranfert.png";
                BackgroundColor       = (Brushes)converter.ConvertFromString("#3a56d1");
                DestinationVisibility = Visibility.Hidden;
            }
            else if (this.Transaction.Type == Type.Transfert)
            {
                IconType              = "../Ressources/Down.png";
                BackgroundColor       = (Brushes)converter.ConvertFrom(Brushes.BlueViolet);
                DestinationVisibility = Visibility.Visible;
            }
        }
예제 #42
0
        private void initializeMetricsGrid()
        {
            grid1 = new DataGrid(); grid2 = new DataGrid(); grid3 = new DataGrid(); grid4 = new DataGrid();

            var gridFactory = new FrameworkElementFactory(typeof(Grid));

            var brushConverter = new System.Windows.Media.BrushConverter();

            System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString());
            grid1.AlternatingRowBackground         = bruch; grid2.AlternatingRowBackground = bruch; grid3.AlternatingRowBackground = bruch; grid4.AlternatingRowBackground = bruch;
            grid1.AlternatingRowBackground.Opacity = 0.3; grid2.AlternatingRowBackground.Opacity = 0.3; grid3.AlternatingRowBackground.Opacity = 0.3; grid4.AlternatingRowBackground.Opacity = 0.3;


            bindColumnGrid1();
            bindColumnGrid2();
            bindColumnGrid3();
            bindColumnGrid4();
        }
예제 #43
0
        protected void InitializeGrid()
        {
            Grid        = new BrowserGrid();
            contextMenu = new BrowserGridContextMenu();
            contextMenu.NewMenuItem.Visibility    = System.Windows.Visibility.Collapsed;
            contextMenu.DeleteMenuItem.Visibility = System.Windows.Visibility.Collapsed;
            contextMenu.SaveAsMenuItem.Visibility = System.Windows.Visibility.Collapsed;
            contextMenu.RenameMenuItem.Visibility = System.Windows.Visibility.Collapsed;
            contextMenu.MenuSeparator.Visibility  = System.Windows.Visibility.Collapsed;
            Grid.ContextMenu = contextMenu;
            var gridFactory     = new FrameworkElementFactory(typeof(Grid));
            var checkboxFactory = new FrameworkElementFactory(typeof(CheckBox));

            checkboxFactory.SetBinding(CheckBox.IsCheckedProperty, new Binding("IsSelected")
            {
                RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(DataGridRow), 1)
            });
            gridFactory.AppendChild(checkboxFactory);
            DataTemplate template = new DataTemplate();

            template.VisualTree    = gridFactory;
            Grid.RowHeaderTemplate = template;

            var brushConverter = new System.Windows.Media.BrushConverter();

            System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString());
            Grid.AlternatingRowBackground         = bruch;
            Grid.AlternatingRowBackground.Opacity = 0.3;

            for (int i = 0; i < getColumnCount(); i++)
            {
                DataGridColumn column = getColumnAt(i);
                column.Header        = getColumnHeaderAt(i);
                column.Width         = getColumnWidthAt(i);
                column.CanUserResize = true;
                if (column is DataGridBoundColumn)
                {
                    ((DataGridBoundColumn)column).Binding = getBindingAt(i);
                }
                Grid.Columns.Add(column);
            }
            this.Content = Grid;
        }
예제 #44
0
        /// <summary>
        /// Initialise la grille.
        /// </summary>
        protected void initializeGrid()
        {
            grid = new BrowserGrid();
            grid.hideContextMenu();

            grid.Sorting += OnSort;

            var          gridFactory = new FrameworkElementFactory(typeof(Grid));
            DataTemplate template    = new DataTemplate();

            template.VisualTree    = gridFactory;
            grid.RowHeaderTemplate = template;

            var brushConverter = new System.Windows.Media.BrushConverter();

            System.Windows.Media.Brush bruch = (System.Windows.Media.Brush)brushConverter.ConvertFrom(System.Windows.Media.Brushes.LightBlue.Color.ToString());
            grid.AlternatingRowBackground         = bruch;
            grid.AlternatingRowBackground.Opacity = 0.3;

            for (int i = 0; i < getColumnCount(); i++)
            {
                DataGridColumn column = getColumnAt(i);
                column.Header = getColumnHeaderAt(i);
                column.Width  = getColumnWidthAt(i);
                if (column is DataGridBoundColumn)
                {
                    ((DataGridBoundColumn)column).Binding = getBindingAt(i);
                }
                grid.Columns.Add(column);
            }

            this.GridScrollPanel.Content = grid;

            this.grid.PreviewMouseLeftButtonDown += OnSelectionChange;

            this.PaginationPanel.GotoFirstPageButton.Click    += OnGotoFirstPage;
            this.PaginationPanel.GotoPreviousPageButton.Click += OnGotoPreviousPage;
            this.PaginationPanel.GotoNextPageButton.Click     += OnGotoNextPage;
            this.PaginationPanel.GotoLastPageButton.Click     += OnGotoLastPage;
        }
예제 #45
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var converter = new System.Windows.Media.BrushConverter();

            if (value == null)
            {
                return(Brushes.Transparent);
            }

            var             job   = (JobEnum)EnumExtension.GetEnumByDescription(typeof(JobEnum), (string)value);
            SolidColorBrush brush = Brushes.Transparent;

            switch (job)
            {
            case JobEnum.Directeur:
                brush = (SolidColorBrush)converter.ConvertFrom("#FFA726");
                break;

            case JobEnum.ChefDeService:
                brush = (SolidColorBrush)converter.ConvertFrom("#e91e63");
                break;

            case JobEnum.MedecinSpecialiste:
                brush = (SolidColorBrush)converter.ConvertFrom("#EEFF41");
                break;

            case JobEnum.MedecinGeneraliste:
                brush = (SolidColorBrush)converter.ConvertFrom("#BCAAA4");
                break;

            case JobEnum.SageFemme:
                brush = (SolidColorBrush)converter.ConvertFrom("#FF7043");
                break;

            case JobEnum.Infirmier:
                brush = (SolidColorBrush)converter.ConvertFrom("#ff5722");
                break;

            case JobEnum.TechnicienDeSurface:
                brush = (SolidColorBrush)converter.ConvertFrom("#689F38");
                break;

            case JobEnum.AgentDeSecurite:
                brush = (SolidColorBrush)converter.ConvertFrom("#5d4037");
                break;

            case JobEnum.Secretaire:
                brush = (SolidColorBrush)converter.ConvertFrom("#827717");
                break;

            case JobEnum.Administrateur:
                brush = (SolidColorBrush)converter.ConvertFrom("#004d40");
                break;

            case JobEnum.AgentTechnique:
                brush = (SolidColorBrush)converter.ConvertFrom("#01579b");
                break;

            case JobEnum.AgentAdministratif:
                brush = (SolidColorBrush)converter.ConvertFrom("#c62828");
                break;

            case JobEnum.AgentHygiene:
                brush = (SolidColorBrush)converter.ConvertFrom("#00ACC1");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(brush);
        }
예제 #46
0
        private void RegisterHandlers()
        {
            var broker = Broker.GetBroker();

            broker.RegisterHandler <GetScreenSizeRequest>(request =>
            {
                var screens  = System.Windows.Forms.Screen.AllScreens;
                var responce = new GetScreenSizeResponce
                {
                    Height  = (int)SystemParameters.VirtualScreenHeight,
                    Width   = (int)SystemParameters.VirtualScreenWidth,
                    Screens = screens.Select(s => new ScreenSize
                    {
                        Left   = s.Bounds.X,
                        Top    = s.Bounds.Y,
                        Width  = s.Bounds.Width,
                        Height = s.Bounds.Height
                    })
                };
                return(responce);
            });
            broker.RegisterHandler <GetFontsRequest>(request =>
            {
                return(new GetFontsResponce
                {
                    Fonts = System.Drawing.FontFamily.Families.Select(f => f.Name)
                });
            });
            broker.RegisterHandler <StartShowRequest>(request =>
            {
                var requestData = request as StartShowRequest;
                Dispatcher.Invoke(() =>
                {
                    _window.Height = requestData.Screens.Displays.Max(d => d.Top + d.Height) - requestData.Screens.Displays.Min(d => d.Top);
                    _window.Width  = requestData.Screens.Displays.Max(d => d.Left + d.Width) - requestData.Screens.Displays.Min(d => d.Left);
                    _window.Left   = requestData.Screens.Displays.Min(d => d.Left);
                    _window.Top    = requestData.Screens.Displays.Min(d => d.Top);
                    var bc         = new Media.BrushConverter();
                    var border     = new Border();
                    if (ColorConverter.TryToParseRGB(requestData.Background, out string colorHex))
                    {
                        border.Background = (Media.Brush)bc.ConvertFrom(colorHex);
                    }
                    var canvas = new Canvas();


                    var blockBuilder = new BlockBuilder();
                    foreach (var block in requestData.Blocks)
                    {
                        var element = blockBuilder.BuildElement(block);
                        if (element != null)
                        {
                            canvas.Children.Add(element);
                        }
                    }

                    border.Child    = canvas;
                    _window.Content = border;
                    _window.Show();
                });
                return(null);
            });
            broker.RegisterHandler <StopShowRequest>(request =>
            {
                Dispatcher.Invoke(() =>
                {
                    _window.Visibility = Visibility.Hidden;
                });
                return(null);
            });
            broker.RegisterHandler <GetVersionRequest>(request =>
            {
                var version = Assembly.GetExecutingAssembly().GetName().Version;
                return(new GetVersionResponce
                {
                    Major = version.Major,
                    Minor = version.Minor,
                    Build = version.Build
                });
            });
        }
 private void SetValuesOnDeserialized(StreamingContext context)
 {
     _colorConverter = new WindowsMedia.BrushConverter();
     _color          = (WindowsMedia.Brush)_colorConverter.ConvertFrom(ColorString);
 }
예제 #48
-3
        public WatchViewFullscreen()
        {
            InitializeComponent();

            MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(view_MouseButtonIgnore);
            MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(view_MouseButtonIgnore);
            MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(view_MouseRightButtonUp);
            PreviewMouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(view_PreviewMouseRightButtonDown);

            MenuItem mi = new MenuItem();
            mi.Header = "Zoom to Fit";
            mi.Click += new RoutedEventHandler(mi_Click);

            MainContextMenu.Items.Add(mi);

            System.Windows.Shapes.Rectangle backgroundRect = new System.Windows.Shapes.Rectangle();
            Canvas.SetZIndex(backgroundRect, -10);
            backgroundRect.IsHitTestVisible = false;
            BrushConverter bc = new BrushConverter();
            Brush strokeBrush = (Brush)bc.ConvertFrom("#313131");
            backgroundRect.Stroke = strokeBrush;
            backgroundRect.StrokeThickness = 1;
            SolidColorBrush backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb(250, 250, 216));
            backgroundRect.Fill = backgroundBrush;

            inputGrid.Children.Add(backgroundRect);
        }