Inheritance: FrameworkElement, IViewbox
Ejemplo n.º 1
0
        private void UserControl_Loaded_1(object sender, RoutedEventArgs e)
        {
            gameViewModel = DataContext as GameViewModel;
            var rows = Enumerable.Range(0, RowCount).ToArray();
            var columns = Enumerable.Range(0, ColumnCount).ToArray();
            foreach (var row in rows) BoardGrid.RowDefinitions.Add(new RowDefinition());
            foreach (var column in columns) BoardGrid.ColumnDefinitions.Add(new ColumnDefinition());
            foreach (var row in rows)
            {
                foreach (var column in columns)
                {
                    var boardViewBox = new Viewbox();
                    var boardSpace = new BoardSpace();
                    boardSpace.row = row;
                    boardSpace.column = column;
                    boardSpace.gameViewModel = gameViewModel;
                    boardViewBox.Child = boardSpace;
                    boardViewBox.Stretch = Stretch.Fill;
                    Grid.SetRow(boardViewBox, row);
                    Grid.SetColumn(boardViewBox, column);
                    BoardGrid.Children.Add(boardViewBox);
                    boardSpace.DataContext = gameViewModel.game.m_pMines[row][column];

                }
            }
        }
        public DebugConsoleView()
        {
            this.InitializeComponent();

#if WINDOWS_PHONE_APP
            this.Window.WindowEdgeSnapBehavior = WindowEdgeSnapBehavior.None;
            this.LayoutGrid.Children.Remove(this.Window);
            var vb = new Viewbox();
            var sg = new Grid();
            sg.Children.Add(this.Window);
            vb.Child = sg;
            this.LayoutGrid.Children.Insert(0, vb);

            this.SizeChanged += (s, e) =>
            {
                sg.Width = this.ActualWidth * 2;
                sg.Height = this.ActualHeight * 2;
            };
#endif

            this.DataContext = _viewModel = DebugConsoleViewModel.Instance;
            VisualStateManager.GoToState(this, "Expanded", false);
            this.DefaultStyleKey = typeof(DebugConsoleView);
            DebugTextBox.Text = _unFlushedLines.ToString();
            _unFlushedLines.Length = 0;
        }
        private void Create_Cells()
        {
            _borders = new List<Border>();
            _values = new List<TextBlock>();

            for (int row = 0; row < 9; row++)
            {
                for (int col = 0; col < 9; col++)
                {

                    var cell = new TextBlock();
                    Grid.SetRow(cell, row);
                    Grid.SetColumn(cell, col);

                    var border = new Border { BorderBrush = new SolidColorBrush(Colors.White), BorderThickness = new Thickness(1), Background = new SolidColorBrush(Colors.Black) };

                    border.Tapped += Cell_Tapped;
                    Grid.SetRow(border, row);
                    Grid.SetColumn(border, col);

                    var viewBox = new Viewbox();
                    Grid.SetRow(viewBox, row);
                    Grid.SetColumn(viewBox, col);

                    SudokuSolverGrid.Children.Add(viewBox);
                    SudokuSolverGrid.Children.Add(border);
                    viewBox.Child = cell;
                }
            }

            _values = SudokuSolverGrid.Children.Where(c => c is Viewbox).Select(c => (TextBlock)((Viewbox)c).Child).ToList();
            _borders = SudokuSolverGrid.Children.Where(c => c is Border).Select(c => (Border)c).ToList();
        }
Ejemplo n.º 4
0
        private static Viewbox CreateImage(HtmlNode node, string src)
        {
            var viewbox = new Viewbox
            {
                StretchDirection = StretchDirection.DownOnly
            };

            var imgHeight = node.Attributes.GetValueInt("height");
            var width = node.Attributes.GetValueInt("width");

            if (imgHeight > 0)
            {
                viewbox.MaxHeight = imgHeight;
            }
            if (width > 0)
            {
                viewbox.MaxWidth = width;
            }

            viewbox.Child = new ImageEx
            {
                Source = src,
                Stretch = Stretch.Uniform,
                Background = new SolidColorBrush(Colors.Transparent),
                Foreground = new SolidColorBrush(Colors.Transparent),
                AnimateGif = true
            };
            return viewbox;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Method initializes and sets view box appearance
 /// </summary>
 private void InitializeContentBox()
 {
     contentBox         = new UIX.Controls.Viewbox();
     contentBox.Stretch = Stretch.Uniform;
     contentBox.Height  = Double.NaN;
     contentBox.Width   = Double.NaN;
     contentBox.Child   = content;
 }
 private void add(ref Grid grid, int column, int type)
 {
     Viewbox viewbox = new Viewbox()
     {
         Height = 100,
         Width = 100,
         Stretch = Stretch.UniformToFill,
         Child = fruit(type)
     };
     viewbox.SetValue(Grid.ColumnProperty, column);
     grid.Children.Add(viewbox);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Open SVG file, convert the SVG paths to XAML path. 
        /// </summary>
        /// <param name="file">SVG file</param>
        /// <param name="specifiedSize">Specify the size, if not, please use Size.Empty</param>
        /// <param name="readSize">read the size defined in the SVG file or not</param>
        /// <returns></returns>
        public static async Task<Viewbox> ConvertFromFileToViewboxAsync(StorageFile file, Size specifiedSize, bool readSize, bool readColor, bool isDefaultBalck)
        {
            try
            {
                Viewbox viewBox = new Viewbox();
                Grid rootGrid = new Grid();

                using (var stream = await OpenFileAsync(file))
                {
                    var datas = ReadStreamAndConvertToPath(stream, isDefaultBalck);

                    if (readSize)
                    {
                        var size = datas.Item1;
                        viewBox.Width = size.Width;
                        viewBox.Height = size.Height;
                    }
                    else if (specifiedSize != Size.Empty)
                    {
                        viewBox.Width = specifiedSize.Width;
                        viewBox.Height = specifiedSize.Height;
                    }
                    else viewBox.Width = 100;

                    var paths = datas.Item2;
                    foreach (var path in paths)
                    {
                        if (!readColor)
                        {
                            if (isDefaultBalck)
                            {
                                path.Fill = new SolidColorBrush(Colors.Black);
                            }
                            else path.Fill = new SolidColorBrush(Colors.White);
                        }
                        rootGrid.Width = viewBox.Width;
                        rootGrid.Height = viewBox.Height;
                        rootGrid.Children.Add(path);
                    }
                    viewBox.Child = rootGrid;
                    return viewBox;
                }
            }
            catch (Exception e)
            {
                return null;
            }
        }
Ejemplo n.º 8
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            Loaded += Clr_Pckr_Loaded;

            clrViewbox = GetTemplateChild("clrViewbox") as Viewbox;
            pointer = GetTemplateChild("pointer") as Grid;
            reference = GetTemplateChild("reference") as Border;
            rtrnsfrm = GetTemplateChild("rtrnsfrm") as CompositeTransform;
            innerCanvas = GetTemplateChild("innerCanvas") as Canvas;
            innerEll = GetTemplateChild("innerEll") as Grid;
            ColorImg = GetTemplateChild("ColorImg") as Image;
           
            thumbInnerEll = GetTemplateChild("thumbInnerEll") as Thumb;
            rectColor = GetTemplateChild("rectColor") as Rectangle;
            gdStop = GetTemplateChild("gdStop") as GradientStop;
            FinalColor = GetTemplateChild("FinalColor") as Ellipse;
            testblock = GetTemplateChild("test") as TextBlock;


            ColorImg.Tapped += ColorImg_Tapped_1;
          
            rectColor.PointerPressed += Rectangle_PointerPressed_1;
            thumbInnerEll.DragDelta += Thumb_DragDelta_1;

            ColorImg.PointerReleased += ColorImg_PointerReleased_1;
            ColorImg.PointerPressed += ColorImg_PointerPressed_1;
            ColorImg.PointerMoved += ColorImg_PointerMoved_1;

            gdStop.Color = SelectedColor;
            FinalColor.Fill = new SolidColorBrush(SelectedColor);



            GeneralTransform gt = pointer.TransformToVisual(reference);

            Point p = new Point();

            p = gt.TransformPoint(p);
            px = p.X;
            py = p.Y;
            loadnew();
        }
Ejemplo n.º 9
0
        public void HorizontalCenterElements(ButtonBase btn, Viewbox symbolView, ContentPresenter contentPresenter, IconPosition iconPos, double iconInterval)
        {
            if (symbolView == null || contentPresenter == null)
                return;

            switch (iconPos)
            {
                case IconPosition.Left:
                    symbolView.Margin = new Thickness(CalculateMarginWidth(btn, symbolView, contentPresenter, iconInterval), 0, 0, 0);
                    break;
                case IconPosition.Right:
                    symbolView.Margin = new Thickness(0, 0, CalculateMarginWidth(btn, symbolView, contentPresenter, iconInterval), 0);
                    break;
                case IconPosition.Top:
                    symbolView.Margin = new Thickness(0, CalculateMarginHeight(btn, symbolView, contentPresenter, iconInterval), 0, 0);
                    break;
                case IconPosition.Bottom:
                    symbolView.Margin = new Thickness(0, 0, 0, CalculateMarginHeight(btn, symbolView, contentPresenter, iconInterval));
                    break;
            }
        }
Ejemplo n.º 10
0
        public Grid InfoTile(int rowNum, int colNum)
        {

            Grid tile = new Grid();
            tile.Background = new SolidColorBrush(Color.FromArgb(255, 50, 50, 50));
            tile.Name = "GPSStatusTile";
            tile.Children.Clear();
            Grid.SetRow(tile, rowNum);
            Grid.SetColumn(tile, colNum);

            tile.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(3, GridUnitType.Star) });
            tile.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(4, GridUnitType.Star) });
            tile.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(2, GridUnitType.Star) });

            //aktualizace
            Viewbox viewUpdate = new Viewbox();
            viewUpdate.HorizontalAlignment = HorizontalAlignment.Stretch;
            viewUpdate.VerticalAlignment = VerticalAlignment.Stretch;

            StackPanel lastUpdateGrid = new StackPanel();

            TextBlock lastLocationTitle = new TextBlock();
            lastLocationTitle.Text = _resourceLoader.GetString("TextUpdateTime");
            lastLocationTitle.FontSize = Data.getFontSize_SmallText();
            lastLocationTitle.TextWrapping = TextWrapping.WrapWholeWords;
            lastLocationTitle.Padding = new Thickness(5, 5, 5, 0);
            lastUpdateGrid.Children.Add(lastLocationTitle);
            TextBlock lastLocationUpdate = new TextBlock();
            lastLocationUpdate.FontSize = Data.getFontSize_SmallText();
            lastLocationUpdate.TextWrapping = TextWrapping.WrapWholeWords;
            lastLocationUpdate.Padding = new Thickness(5, 5, 5, 0);
            Binding locationBinding2 = new Binding();
            locationBinding2.Source = App.ViewModel;
            locationBinding2.Path = new PropertyPath("LastPositionTime");
            lastLocationUpdate.SetBinding(TextBlock.TextProperty, locationBinding2);
            lastUpdateGrid.Children.Add(lastLocationUpdate);

            viewUpdate.Child = lastUpdateGrid;

            //gps
            Viewbox view = new Viewbox();
            view.HorizontalAlignment = HorizontalAlignment.Stretch;
            view.VerticalAlignment = VerticalAlignment.Stretch;
            Grid.SetRow(view, 1);
            Grid.SetRowSpan(view, 1);

            Grid tileGrid = new Grid();
            tileGrid.HorizontalAlignment = HorizontalAlignment.Stretch;
            tileGrid.VerticalAlignment = VerticalAlignment.Stretch;

            tileGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
            tileGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
            tileGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });

            tileGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });
            tileGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });
            tileGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });

            Binding locationBinding = new Binding()
            {
                Source = App.ViewModel,
                Path = new PropertyPath("GPSStatus"),

            };
            locationBinding.Source = App.ViewModel;
            locationBinding.Path = new PropertyPath("GPSStatus");
            /*
            TextBlock text = new TextBlock()
            {
                FontSize = 10,
                Height = 32,
                Width = 80,
                Margin = new Thickness(0, 16, 0, 0),
                TextWrapping = TextWrapping.WrapWholeWords,
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                TextAlignment = TextAlignment.Center,
            };
            text.SetBinding(TextBlock.TextProperty, locationBinding);
            Grid.SetColumn(text, 1);
            Grid.SetRow(text, 1);
            tileGrid.Children.Add(text);*/
            Image image = new Image()
            {
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                Stretch = Stretch.UniformToFill,
            };
            image.SetBinding(Image.SourceProperty, locationBinding);
            
            Grid.SetColumn(image, 1);
            Grid.SetRow(image, 1);
            tileGrid.Children.Add(image);
            view.Child = tileGrid;
            tile.Children.Add(view);
            tile.Children.Add(viewUpdate);
            return tile;

        }
        private void GenerateNumCells(int numCells)
        {
            ClearGrid();
            PageTitle.Text = "Sudoku Generator - " + Enum.GetName(typeof(NumCells), numCells) + " Difficulty";

            var viewBox = new Viewbox();
            SudokuGrid.Children.Add(viewBox);
            Grid.SetRow(viewBox, 3);
            Grid.SetColumn(viewBox, 1);
            Grid.SetRowSpan(viewBox, 3);
            Grid.SetColumnSpan(viewBox, 7);
            viewBox.Child = new TextBlock { Text = "Generating Puzzle..." };

            var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(0.01) };          //Executes on seperate thread, allowing ui to update
            timer.Tick += (sender, args) => { timer.Stop(); Create_Sudoku(numCells); };
            timer.Start();

            timer.Tick += (sender, args) => { timer.Stop(); SudokuGrid.Children.Remove(viewBox); };
            timer.Start();

        }
Ejemplo n.º 12
0
        /// <summary>
        /// Adds to pre request courses panel.
        /// </summary>
        /// <param name="courseName">Name of the course.</param>
        private void AddToPreRequestCoursesPanel(string courseName)
        {






            numPrerequisite++;
            Grid newGrid = new Grid();
            Viewbox courseViewbox = new Viewbox()
            {
                Stretch = Stretch.Uniform,
                Width = 380,
                HorizontalAlignment = HorizontalAlignment.Left,
                Height = 30
            };
            TextBlock courseTextBlock = new TextBlock()
            {
                Text = courseName,
                FontSize = 20
            };
            Border overBorder = new Border();
            TextBlock overviewText = new TextBlock()
            {
                Text = "Overview >",
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Center,
                FontSize = 15
            };
            overviewText.Tapped += OverPreRequest_Clicked;

            courseViewbox.Child = courseTextBlock;
            overBorder.Child = overviewText;
            newGrid.Children.Add(courseViewbox);
            newGrid.Children.Add(overBorder);

            prerequestCoursesPanel.Children.Add(newGrid);
        }
Ejemplo n.º 13
0
        private static Viewbox GetImageControl(Action<ImageEx> setSource)
        {
            var viewbox = new Viewbox
            {
                StretchDirection = StretchDirection.DownOnly
            };

            var image = new ImageEx
            {
                Stretch = Stretch.Uniform,
                Background = new SolidColorBrush(Colors.Transparent),
                Foreground = new SolidColorBrush(Colors.Transparent)
            };
            setSource(image);
            viewbox.Child = image;

            return viewbox;
        }
Ejemplo n.º 14
0
 protected override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     _visualPanel = (RelativePanel)GetTemplateChild("VisualPanel");
     _symbol = (ContentControl)GetTemplateChild("Symbol");
     _symbolView = (Viewbox)GetTemplateChild("SymbolView");
     _contentPresenter = (ContentPresenter)GetTemplateChild("ContentPresenter");
 }
Ejemplo n.º 15
0
        public Grid statusTile_SO2(int rowNum, int colNum)
        {
            //pro pripad nemoznosti nacist stav
            string status = "error";

            Grid tile = new Grid();
            Grid.SetRow(tile, rowNum);
            Grid.SetColumn(tile, colNum);
            try
            {
                Binding colorBinding = new Binding();
                colorBinding.Source = App.ViewModel;
                colorBinding.Path = new PropertyPath("CurrentStation.So2.State");
                colorBinding.Converter = new ColorQualityConverter();
                tile.SetBinding(Grid.BackgroundProperty, colorBinding);
            }
            catch (Exception)            {            }

            RowDefinition rowdef1 = new RowDefinition();
            rowdef1.Height = new GridLength(2, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef1);
            RowDefinition rowdef2 = new RowDefinition();
            rowdef2.Height = new GridLength(4, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef2);
            RowDefinition rowdef3 = new RowDefinition();
            rowdef3.Height = new GridLength(2, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef3);
            RowDefinition rowdef4 = new RowDefinition();
            rowdef4.Height = new GridLength(1, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef4);
            RowDefinition rowdef5 = new RowDefinition();
            rowdef5.Height = new GridLength(2, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef5); 
            RowDefinition rowdef6 = new RowDefinition();
            rowdef6.Height = new GridLength(1, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef6);

            ColumnDefinition coldef1 = new ColumnDefinition();
            coldef1.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef1);
            ColumnDefinition coldef2 = new ColumnDefinition();
            coldef2.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef2);
            ColumnDefinition coldef3 = new ColumnDefinition();
            coldef3.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef3);
            ColumnDefinition coldef4 = new ColumnDefinition();
            coldef4.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef4);
            ColumnDefinition coldef5 = new ColumnDefinition();
            coldef5.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef5);

            //nabindování
            TextBlock ratingString = new TextBlock();
            ratingString.Text = "SO2";
            Binding valueBinding = new Binding();
            valueBinding.Source = App.ViewModel;
            valueBinding.Path = new PropertyPath("CurrentStation.So2.Value");
            valueBinding.Converter = new NegativeValueConverter();
            ratingString.SetBinding(TextBlock.TextProperty, valueBinding);    

            ratingString.Foreground = new SolidColorBrush(Colors.White);
            ratingString.FontSize = Data.getFontSize_StatuValue();
            ratingString.TextAlignment = TextAlignment.Center;
            ratingString.HorizontalAlignment = HorizontalAlignment.Center;
            ratingString.VerticalAlignment = VerticalAlignment.Center;

            ratingString.FontSize = 150;
            Viewbox view = new Viewbox();
            view.Child = ratingString;
            view.HorizontalAlignment = HorizontalAlignment.Center;
            view.VerticalAlignment = VerticalAlignment.Center;
            Grid.SetColumn(view, 0);
            Grid.SetColumnSpan(view, 5);
            Grid.SetRow(view, 1);

            tile.Children.Add(view);
            
            TextBlock stationString = new TextBlock();
            try
            {
                Binding statusBinding = new Binding();
                statusBinding.Source = App.ViewModel;
                statusBinding.Path = new PropertyPath("CurrentStation.So2.State");
                statusBinding.Converter = new ColorQualityConverter();
                stationString.SetBinding(TextBlock.TextProperty, statusBinding);
            }
            catch (Exception)
            {
            } stationString.Foreground = new SolidColorBrush(Colors.White);
            stationString.TextAlignment = TextAlignment.Center;
            stationString.HorizontalAlignment = HorizontalAlignment.Center;
            stationString.VerticalAlignment = VerticalAlignment.Center;
            stationString.FontWeight = FontWeights.Bold;

            stationString.FontSize = 50;
            Viewbox view3 = new Viewbox();
            view3.Child = stationString;
            view3.HorizontalAlignment = HorizontalAlignment.Center;
            view3.VerticalAlignment = VerticalAlignment.Center;
            view3.Margin = new Thickness(3);
            Grid.SetColumnSpan(view3, 5);
            Grid.SetRow(view3, 2);

            tile.Children.Add(view3);


            TextBlock nameString = new TextBlock();
            nameString.Text = "SO\x2082";
            nameString.Foreground = new SolidColorBrush(Colors.White);
            nameString.TextAlignment = TextAlignment.Center;
            nameString.HorizontalAlignment = HorizontalAlignment.Center;
            nameString.FontWeight = FontWeights.Bold;
            nameString.VerticalAlignment = VerticalAlignment.Center;


            nameString.FontSize = 20;
            Viewbox view2 = new Viewbox();
            view2.Child = nameString;
            view2.HorizontalAlignment = HorizontalAlignment.Left;
            view2.VerticalAlignment = VerticalAlignment.Center;
            view2.Margin = new Thickness(10, 0, 0, 0);
            Grid.SetRow(view2, 4);
            Grid.SetColumnSpan(view2, 3);

            tile.Children.Add(view2);

            

            tile.Name = "statusTile";

            return tile;
        }
Ejemplo n.º 16
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            this.snappedMode = GetTemplateChild("snappedMode") as Grid;
            this.fullMode = GetTemplateChild("fullMode") as Viewbox;
            if (Header != null)
            {
                var headerContent = GetTemplateChild("headerContentPresenter") as ContentPresenter;
                headerContent.Visibility = Visibility.Visible;
            }

            if (Footer != null)
            {
                var footerContentPresenter = GetTemplateChild("footerContentPresenter") as ContentPresenter;
                footerContentPresenter.Visibility = Visibility.Visible;
            }
        }
Ejemplo n.º 17
0
 double CalculateMarginWidth(ButtonBase btn, Viewbox symbolView, ContentPresenter contentPresenter, double iconInterval)
 {
     var buttonPaddingWidth = btn.Padding.Left + btn.Padding.Right;
     var marginWidth = (btn.ActualWidth - iconInterval - symbolView.DesiredSize.Width - contentPresenter.DesiredSize.Width - buttonPaddingWidth) / 2;
     return Math.Max(0, marginWidth);
 }
Ejemplo n.º 18
0
 double CalculateMarginHeight(ButtonBase btn, Viewbox symbolView, ContentPresenter contentPresenter, double iconInterval)
 {
     var buttonPaddingHeight = btn.Padding.Top + btn.Padding.Bottom;
     var marginHeight = (btn.ActualHeight - iconInterval - symbolView.DesiredSize.Height - contentPresenter.DesiredSize.Height - buttonPaddingHeight) / 2;
     return Math.Max(0, marginHeight);
 }
Ejemplo n.º 19
0
        public Grid buttonTile_DataPanel(int rowNum, int colNum)
        {
            Grid dataPanelButton = new Grid();
            Grid.SetRow(dataPanelButton, rowNum);
            Grid.SetColumn(dataPanelButton, colNum);
            dataPanelButton.Background = new SolidColorBrush(Color.FromArgb(255, 50, 50, 50));
            TextBlock title = new TextBlock();
            title.TextWrapping = TextWrapping.WrapWholeWords;
            //bude třeba nabindovat prop změnu jazyka
            title.Text = _resourceLoader.GetString("DataPanelButton");
            title.TextAlignment = TextAlignment.Center;
            title.HorizontalAlignment = HorizontalAlignment.Center;
            title.VerticalAlignment = VerticalAlignment.Center;
            title.Foreground = new SolidColorBrush(Colors.White);

            title.FontSize = 15;
            title.Height = 32;
            title.Width = 80;
            Viewbox view = new Viewbox();
            view.Child = title;

            dataPanelButton.Children.Add(view);

            dataPanelButton.Tapped += mainPage.dataPanelService;

            return dataPanelButton;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Hlavní dlaždice pro zobrazení jména stanice a smajlíka.
        /// </summary>
        /// <param name="rowNum"></param>
        /// <param name="colNum"></param>
        /// <returns></returns>
        public Grid mainStatusTile(int rowNum, int colNum)
        {
            Grid tile = new Grid();
            tile.Opacity = 1;
            try
            {
                Binding colorBinding = new Binding();
                colorBinding.Source = App.ViewModel;
                colorBinding.Path = new PropertyPath("CurrentStation.Quality");
                colorBinding.Converter = new ColorQualityConverter();
                tile.SetBinding(Grid.BackgroundProperty, colorBinding);
            }
            catch (Exception)
            {
            } Grid.SetRow(tile, rowNum);
            Grid.SetColumn(tile, colNum);
            Grid.SetRowSpan(tile, 2);
            Grid.SetColumnSpan(tile, 2);


            RowDefinition rowdef1 = new RowDefinition();
            rowdef1.Height = new GridLength(1, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef1);
            RowDefinition rowdef2 = new RowDefinition();
            rowdef2.Height = new GridLength(2, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef2);
            RowDefinition rowdef3 = new RowDefinition();
            rowdef3.Height = new GridLength(1, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef3);

            ColumnDefinition coldef1 = new ColumnDefinition();
            coldef1.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef1);
            ColumnDefinition coldef2 = new ColumnDefinition();
            coldef2.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef2);
            ColumnDefinition coldef3 = new ColumnDefinition();
            coldef3.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef3);
            ColumnDefinition coldef4 = new ColumnDefinition();
            coldef4.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef4);
            ColumnDefinition coldef5 = new ColumnDefinition();
            coldef5.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef5);

            /*
            TextBlock statusTitle = new TextBlock();
            //bude pravděpodobně třeba změnit pro plynulé přepínání jazyka
            statusTitle.Text = _resourceLoader.GetString("StatusTitle");
            statusTitle.FontSize = Data.getFontSize_LargeText();
            statusTitle.VerticalAlignment = VerticalAlignment.Center;
            statusTitle.HorizontalAlignment = HorizontalAlignment.Center;
            Grid.SetColumnSpan(statusTitle, 2);
            tile.Children.Add(statusTitle);
            */

            Image img = new Image();
            //bude třeba změnit por plynulou změnu obrázku
            Binding imageBinding = new Binding();
            imageBinding.Source = App.ViewModel;
            imageBinding.Path = new PropertyPath("CurrentStation.Quality");
            imageBinding.Converter = new ImageQualityConverter();
            img.SetBinding(Image.SourceProperty, imageBinding);
            Grid.SetRow(img, 1);
            Grid.SetColumn(img, 1);
            Grid.SetColumnSpan(img, 3);
            img.Stretch = Stretch.Uniform;
            tile.Children.Add(img);

            Viewbox view = new Viewbox();
            TextBlock stationName = new TextBlock();
            Binding b = new Binding();
            try
            {
                Binding nameBinding = new Binding();
                nameBinding.Source = App.ViewModel;
                nameBinding.Path = new PropertyPath("CurrentStation.Name");
                stationName.SetBinding(TextBlock.TextProperty, nameBinding);
            }
            catch (Exception)
            {
            } 
            
            stationName.FontSize = Data.getFontSize_LargeText();
            stationName.TextAlignment = TextAlignment.Center;
            stationName.VerticalAlignment = VerticalAlignment.Center;
            stationName.FontWeight = FontWeights.Bold;
            stationName.FontSize = 20;
            stationName.Height = 20;
            stationName.Margin = new Thickness(5, 0, 5, 0);

            Grid.SetColumnSpan(view, 5);
            Grid.SetRow(view, 2);
            view.Child = stationName;
            view.Height = 40;
            //view.Margin = new Thickness(5, 0, 5, 0);
            tile.Children.Add(view);


            tile.Name = "mainStatusTile";

            return tile;
        }
Ejemplo n.º 21
0
        public Grid buttonTile_MenuPanel(int rowNum, int colNum)
        {
            Grid menuPanelButton = new Grid();
            Grid.SetRow(menuPanelButton, rowNum);
            Grid.SetColumn(menuPanelButton, colNum);
            menuPanelButton.Background = new SolidColorBrush(Color.FromArgb(255, 50, 50, 50));
            TextBlock title = new TextBlock() 
            {
                TextWrapping = TextWrapping.WrapWholeWords,
                //bude třeba nabindovat por změnu jazyka
                Text = _resourceLoader.GetString("MenuPanelButton"),
                TextAlignment = TextAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Foreground = new SolidColorBrush(Colors.White)
            };

            title.FontSize = 15;
            title.Height = 32;
            title.Width = 80;
            title.Margin = new Thickness(0, 16, 0, 0);
            Viewbox view = new Viewbox();
            view.Child = title;

            menuPanelButton.Children.Add(view);

            menuPanelButton.Tapped += mainPage.menuPanelService;

            return menuPanelButton;
        }