상속: FrameworkElement, ITextBlock
예제 #1
0
    static public void DisplayData(Windows.UI.Xaml.Controls.TextBlock outputBlock)
    {
        // Get the data from some data source.
        var employees = InitializeData();

        outputBlock.FontFamily = new FontFamily("Courier New");
        // Display application title.
        string title = UILibrary.GetTitle();

        outputBlock.Text += title + Environment.NewLine + Environment.NewLine;

        // Retrieve resources.
        string[] fields    = UILibrary.GetFieldNames();
        int[]    lengths   = UILibrary.GetFieldLengths();
        string   fmtString = String.Empty;

        // Create format string for field headers and data.
        for (int ctr = 0; ctr < fields.Length; ctr++)
        {
            fmtString += String.Format("{{{0},-{1}{2}{3}   ", ctr, lengths[ctr], ctr >= 2 ? ":d" : "", "}");
        }

        // Display the headers.
        outputBlock.Text += String.Format(fmtString, fields) + Environment.NewLine + Environment.NewLine;
        // Display the data.
        foreach (var e in employees)
        {
            outputBlock.Text += String.Format(fmtString, e.Item1, e.Item2, e.Item3, e.Item4) + Environment.NewLine;
        }
    }
        public MainPage()
        {
            this.InitializeComponent();

            initLedMatrixDevice();

            for (int i = 0; i < MATRIX_SIZE; i++)
            {
                TextBlock tb = new TextBlock();
                tb.Text = "0x00";
                tb.HorizontalAlignment = HorizontalAlignment.Center;
                tb.VerticalAlignment = VerticalAlignment.Center;
                tb.SetValue(Grid.RowProperty, i);
                tb.SetValue(Grid.ColumnProperty, MATRIX_SIZE);
                _matrix.Children.Add(tb);

                _matrixRowValue[i] = tb;

                for (int j = 0; j < MATRIX_SIZE; j++)
                {
                    Ellipse led = new Ellipse();
                    led.Width = 40;
                    led.Height = 40;
                    led.HorizontalAlignment = HorizontalAlignment.Center;
                    led.VerticalAlignment = VerticalAlignment.Center;
                    led.Fill = _off;
                    led.SetValue(Grid.RowProperty, i);
                    led.SetValue(Grid.ColumnProperty, j);
                    led.PointerPressed += Led_PointerPressed;
                    _matrix.Children.Add(led);

                    setMatrixData(i, j, 0);
                }
            }
        }
예제 #3
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///HomePage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot = (_8Tracks.Common.LayoutAwarePage) this.FindName("pageRoot");
            groupedItemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("groupedItemsViewSource");
            passwordPrompt         = (Windows.UI.Xaml.Controls.Grid) this.FindName("passwordPrompt");
            itemGridView           = (Windows.UI.Xaml.Controls.GridView) this.FindName("itemGridView");
            itemListView           = (Windows.UI.Xaml.Controls.ListView) this.FindName("itemListView");
            backButton             = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            loginText             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("loginText");
            loginBox              = (Windows.UI.Xaml.Controls.TextBox) this.FindName("loginBox");
            passwordText          = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("passwordText");
            passwordBox           = (Windows.UI.Xaml.Controls.PasswordBox) this.FindName("passwordBox");
            doneButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("doneButton");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
예제 #4
0
 /// <summary>
 /// Helper method to display the device orientation in the specified text box.
 /// </summary>
 /// <param name="tb">
 /// The text box receiving the orientation value.
 /// </param>
 /// <param name="orientation">
 /// The orientation value.
 /// </param>
 private void DisplayOrientation(TextBlock tb, SimpleOrientation orientation)
 {
     switch (orientation)
     {
         case SimpleOrientation.NotRotated:
             tb.Text = "Not Rotated";
             break;
         case SimpleOrientation.Rotated90DegreesCounterclockwise:
             tb.Text = "Rotated 90 Degrees Counterclockwise";
             break;
         case SimpleOrientation.Rotated180DegreesCounterclockwise:
             tb.Text = "Rotated 180 Degrees Counterclockwise";
             break;
         case SimpleOrientation.Rotated270DegreesCounterclockwise:
             tb.Text = "Rotated 270 Degrees Counterclockwise";
             break;
         case SimpleOrientation.Faceup:
             tb.Text = "Faceup";
             break;
         case SimpleOrientation.Facedown:
             tb.Text = "Facedown";
             break;
         default:
             tb.Text = "Unknown orientation";
             break;
     }
 }
예제 #5
0
        public ColorList1Page() {
            this.InitializeComponent();

            IEnumerable<PropertyInfo> properties = typeof(Colors).GetTypeInfo().DeclaredProperties;

            foreach (PropertyInfo property in properties) {
                Color clr = (Color)property.GetValue(null);

                StackPanel vertStackPanel = new StackPanel { VerticalAlignment = VerticalAlignment.Center };
                TextBlock txtblkName = new TextBlock {
                    Text = property.Name,
                    FontSize = 24 };
                TextBlock txtblkRgb = new TextBlock {
                    Text = String.Format("{0:X2}-{1:X2}-{2:X2}-{3:X2}", clr.A, clr.R, clr.G, clr.B),
                    FontSize = 18
                };
                vertStackPanel.Children.Add(txtblkName);
                vertStackPanel.Children.Add(txtblkRgb);

                StackPanel horzStackPanel = new StackPanel { Orientation = Orientation.Horizontal };
                Rectangle rectangle = new Rectangle {
                    Width = 72,
                    Height = 72,
                    Fill = new SolidColorBrush(clr),
                    Margin = new Thickness(6)
                };
                horzStackPanel.Children.Add(rectangle);
                horzStackPanel.Children.Add(vertStackPanel);
                stackPanel.Children.Add(horzStackPanel);

            }

        }
        private void InitDigits()
        {
            var converter = new ObjectSizeConverter();
            var offset = converter.Convert(125);
            for (int i = 1; i <= 12; ++i)
            {
                TextBlock tb = new TextBlock();

                tb.Text = i.ToString();
                tb.TextAlignment = TextAlignment.Center;
                tb.RenderTransformOrigin = new Point(1, 1);
                tb.Foreground = new SolidColorBrush(Colors.White);
                tb.FontSize = converter.Convert(8);

                tb.RenderTransform = new ScaleTransform {ScaleX = 2, ScaleY = 2};

                double r = converter.Convert(85);
                double angle = Math.PI*i*30.0/180.0;
                double x = Math.Sin(angle)*r + offset, y = -Math.Cos(angle)*r + offset;

                Canvas.SetLeft(tb, x);
                Canvas.SetTop(tb, y);

                _markersCanvas.Children.Add(tb);
            }
        }
예제 #7
0
        private static int CreateContactElement(Windows.UI.Xaml.Controls.TextBlock textBlock, Match emailMatch, Match phoneMatch)
        {
            var currentMatch = emailMatch ?? phoneMatch;

            var link = new Hyperlink();

            link.Inlines.Add(new Run {
                Text = currentMatch.Value
            });
            link.Click += (s, a) =>
            {
                var contact = new Contact();
                if (emailMatch != null)
                {
                    contact.Emails.Add(new ContactEmail {
                        Address = emailMatch.Value
                    });
                }
                if (phoneMatch != null)
                {
                    contact.Phones.Add(new ContactPhone {
                        Number = new string(phoneMatch.Value.Where(char.IsDigit).ToArray())
                    });
                }

                ContactManager.ShowFullContactCard(contact, new FullContactCardOptions());
            };

            textBlock.Inlines.Add(link);
            return(currentMatch.Index + currentMatch.Length);
        }
예제 #8
0
        private static int CreateUrlElement(Windows.UI.Xaml.Controls.TextBlock textBlock, Match urlMatch)
        {
            Uri targetUri;

            if (Uri.TryCreate(urlMatch.Value, UriKind.RelativeOrAbsolute, out targetUri))
            {
                var link = new Hyperlink();
                link.Inlines.Add(new Run {
                    Text = urlMatch.Value
                });

                if (targetUri.IsAbsoluteUri)
                {
                    link.NavigateUri = targetUri;
                }
                else
                {
                    link.NavigateUri = new Uri(RelativeUriDefaultPrefix + targetUri.OriginalString);
                }


                textBlock.Inlines.Add(link);
            }
            else
            {
                textBlock.Inlines.Add(new Run {
                    Text = urlMatch.Value
                });
            }

            return(urlMatch.Index + urlMatch.Length);
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/CollectionSummaryPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("CollectionViewSource");
            LayoutRoot           = (Windows.UI.Xaml.Controls.Grid) this.FindName("LayoutRoot");
            OrientationStates    = (Windows.UI.Xaml.VisualStateGroup) this.FindName("OrientationStates");
            Full             = (Windows.UI.Xaml.VisualState) this.FindName("Full");
            Fill             = (Windows.UI.Xaml.VisualState) this.FindName("Fill");
            Portrait         = (Windows.UI.Xaml.VisualState) this.FindName("Portrait");
            Snapped          = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
            ScrollViewer     = (Windows.UI.Xaml.Controls.ScrollViewer) this.FindName("ScrollViewer");
            CategoryPanel    = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("CategoryPanel");
            HeaderTitlePanel = (Windows.UI.Xaml.Controls.Grid) this.FindName("HeaderTitlePanel");
            ItemGridView     = (Windows.UI.Xaml.Controls.GridView) this.FindName("ItemGridView");
            ItemListView     = (Windows.UI.Xaml.Controls.ListView) this.FindName("ItemListView");
            Title            = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("Title");
            Image            = (Windows.UI.Xaml.Controls.Image) this.FindName("Image");
            DescriptionText  = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("DescriptionText");
            BackButton       = (Windows.UI.Xaml.Controls.Button) this.FindName("BackButton");
            PageTitle        = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PageTitle");
        }
예제 #10
0
 private void GetTextBlockControl()
 {
     if (this.favoriteIcon == null)
     {
         this.favoriteIcon = this.GetTemplateChild("FavoriteIcon") as TextBlock;
     }
 }
예제 #11
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///SearchResultsPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot              = (SimpleSearchProvider.Common.LayoutAwarePage) this.FindName("pageRoot");
            resultsViewSource     = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("resultsViewSource");
            filtersViewSource     = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("filtersViewSource");
            resultsPanel          = (Windows.UI.Xaml.Controls.Grid) this.FindName("resultsPanel");
            noResultsTextBlock    = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("noResultsTextBlock");
            typicalPanel          = (Windows.UI.Xaml.Controls.Grid) this.FindName("typicalPanel");
            snappedPanel          = (Windows.UI.Xaml.Controls.Grid) this.FindName("snappedPanel");
            resultsListView       = (Windows.UI.Xaml.Controls.ListView) this.FindName("resultsListView");
            filtersItemsControl   = (Windows.UI.Xaml.Controls.ItemsControl) this.FindName("filtersItemsControl");
            resultsGridView       = (Windows.UI.Xaml.Controls.GridView) this.FindName("resultsGridView");
            backButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            resultText            = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("resultText");
            queryText             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("queryText");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            ResultStates          = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ResultStates");
            ResultsFound          = (Windows.UI.Xaml.VisualState) this.FindName("ResultsFound");
            NoResultsFound        = (Windows.UI.Xaml.VisualState) this.FindName("NoResultsFound");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
예제 #12
0
        private void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e)
        {
            if (e.Action == 1)
            {
                Position item = lstPositions.Items.Last() as Position;
                layers = new MapLayer();
                image = new BitmapImage();
                image.UriSource = (new Uri(SelectedFriend.Picture, UriKind.Absolute));

                grid = new Grid();
                grid.DataContext = item;
                grid.RightTapped += grid_RightTapped;
                textBlock = new TextBlock();
                textBlock.Text = item.Counter.ToString();
                textBlock.VerticalAlignment = VerticalAlignment.Bottom;
                textBlock.HorizontalAlignment = HorizontalAlignment.Center;
                brush = new ImageBrush();
                brush.ImageSource = image;
                ellipse = new Ellipse();
                ellipse.Height = 100;
                ellipse.Width = 100;
                ellipse.Fill = brush;
                grid.Children.Add(ellipse);
                grid.Children.Add(textBlock);
                layers.Children.Add(grid);
                MapLayer.SetPosition(grid, new Location(item.Latitude, item.Longitude));
                myMap.Children.Add(layers);
            }
        }
예제 #13
0
        public async void Scan()
        {
            var access = await WiFiAdapter.RequestAccessAsync();
            var result = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector());
            if (result.Count >= 1)
            {
                 nwAdapter = await WiFiAdapter.FromIdAsync(result[0].Id);
                await nwAdapter.ScanAsync();

                sp.Children.Clear();
                foreach (var item in nwAdapter.NetworkReport.AvailableNetworks)
                {
                    StackPanel s = new StackPanel();
                    s.Orientation = Orientation.Horizontal;
                    Button b = new Button();
                    TextBlock t = new TextBlock();
                    t.Text = $"{item.NetworkRssiInDecibelMilliwatts} {item.ChannelCenterFrequencyInKilohertz} {item.IsWiFiDirect} {item.NetworkKind} {item.SecuritySettings.NetworkAuthenticationType} {item.SecuritySettings.NetworkAuthenticationType} {item.SignalBars} {item.Uptime}";
                    b.Content += item.Ssid;
                    
                    b.Click += B_Click;
                    s.Children.Add(b);
                    s.Children.Add(t);
                    sp.Children.Add(s);

                }
            }
        }
예제 #14
0
 private async void LoadGDChoVay()
 {
     var business = new BusGiaoDich();
     var listChoVay = await business.LoadGiaoDichByLoaiGD(_idChoVay);
     if (listChoVay.Count == 0)
     {
         var status = new TextBlock()
         {
             FontSize = 30,
             FontStyle = FontStyle.Italic,
             Foreground = new SolidColorBrush(Colors.DimGray),
             TextWrapping = TextWrapping.Wrap,
             Text = "Hiện chưa có giao dịch nào trong sổ cho vay"
         };
         ChoVayPanel.Children.Add(status);
     }
     else
     {
         ChoVayPanel.Children.Clear();
         foreach (var giaoDich in listChoVay)
         {
             var giaoDichItem = new ViewData(giaoDich) { Margin = new Thickness(10) };
             ChoVayPanel.Children.Add(giaoDichItem);
         }
     }
 }
예제 #15
0
        public void ChangeButtonsAmount(int amount)
        {
            ButtonsPanel.Children.Clear();

            for (int i = 0; i < amount; i++)
            {
                TextBlock tempTextBlock = new TextBlock();
                Button tempButton = new Button();
                StackPanel tempPanel = new StackPanel();

                tempTextBlock.Text = (i + 1).ToString();
                tempTextBlock.TextAlignment = TextAlignment.Center;
                tempTextBlock.Width = tempButton.Width;

                tempButton.Name = "AdditionalButton";
                tempButton.Template = ButtonTemplate;
                tempButton.Content = i + 1;
                tempButton.Click += ButtonPressed;

                tempPanel.Children.Add(tempTextBlock);
                tempPanel.Children.Add(tempButton);
                tempPanel.Width = tempButton.Width;

                ButtonsPanel.Children.Add(tempPanel);
                ButtonsPanel.Width += tempButton.Width;
            }
        }
예제 #16
0
 private void GetTextBlockControl()
 {
     if (this.notifyBlock == null)
     {
         this.notifyBlock = this.GetTemplateChild("tb_Notify") as TextBlock;
     }
 }
예제 #17
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///HomePage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (_8Tracks.Common.LayoutAwarePage)this.FindName("pageRoot");
            groupedItemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("groupedItemsViewSource");
            passwordPrompt = (Windows.UI.Xaml.Controls.Grid)this.FindName("passwordPrompt");
            itemGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("itemGridView");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            loginText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("loginText");
            loginBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("loginBox");
            passwordText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("passwordText");
            passwordBox = (Windows.UI.Xaml.Controls.PasswordBox)this.FindName("passwordBox");
            doneButton = (Windows.UI.Xaml.Controls.Button)this.FindName("doneButton");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
예제 #18
0
        public FortuneWheel()
        {
            InitializeComponent();

            for (int i = 0; i < 10; i++)
            {
                var line = new Line
                {
                    Stroke = new SolidColorBrush(Colors.White),
                    StrokeThickness = 5,
                };
                _lines.Add(line);
                _wheelCanvas.Children.Add(line);

                var text = new TextBlock
                {
                    RenderTransform = new RotateTransform(),
                    FontWeight = FontWeights.Bold,
                    FontSize = 20,
                };
                _textBlocks.Add(text);
                _wheelCanvas.Children.Add(text);
            }

#if DEBUG
            //_sbDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(1));
#endif
        }
예제 #19
0
        void init()
        {
            Width = 1600.0;
            Height = 900.0;
            _currentHeight = 900.0;

            _contentpanel = new StackPanel() { Orientation = Orientation.Vertical };
            _contentpanel.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Right;
            _contentpanel.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
            _contentpanel.RenderTransform = new CompositeTransform() { TranslateX = -160.0 };
            _contentpanel.Width = 560.0;
            //_contentpanel.Background = new SolidColorBrush(Colors.YellowGreen);
            _contentpanel.SizeChanged += _contentpanel_SizeChanged;
            Children.Add(_contentpanel);

            Grid header = new Grid() { Width = 100.0, Height = 182.0 };
            Grid footer = new Grid() { Width = 100.0, Height = 182.0 };
            Grid separation = new Grid() { Width = 100.0, Height = 66.0 };
            _titleblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 56 , TextAlignment = Windows.UI.Xaml.TextAlignment.Right};
            _titleblock.LayoutUpdated +=_titleblock_LayoutUpdated;
            _contentblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 33, FontWeight = Windows.UI.Text.FontWeights.Light, TextAlignment = Windows.UI.Xaml.TextAlignment.Right };
            _contentblock.LayoutUpdated += _contentblock_LayoutUpdated;

            //childrens of content
            _contentpanel.Children.Add(header);
            _contentpanel.Children.Add(_titleblock);
            _contentpanel.Children.Add(separation);
            _contentpanel.Children.Add(_contentblock);
            _contentpanel.Children.Add(footer);
        }
예제 #20
0
        void init()
        {
            Width = 1600.0;
            Height = 900.0;
            _currentHeight = 900.0;

            _contentpanel = new StackPanel() { Orientation = Orientation.Vertical };
            _contentpanel.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
            _contentpanel.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
            _contentpanel.RenderTransform = new CompositeTransform() { TranslateX = 320.0 };
            _contentpanel.Width = 560.0;
            _contentpanel.SizeChanged += _contentpanel_SizeChanged;
            Children.Add(_contentpanel);

            Grid header = new Grid() { Width = 100.0, Height = 250.0 };
            Grid footer = new Grid() { Width = 100.0, Height = 250.0 };
            Grid separation = new Grid() { Width = 100.0, Height = 78.0 };
            _titleblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 26, FontWeight = Windows.UI.Text.FontWeights.Light };
            _titleblock.LayoutUpdated += _titleblock_LayoutUpdated;
            _contentblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 33, FontWeight = Windows.UI.Text.FontWeights.Light, FontStyle = Windows.UI.Text.FontStyle.Italic };
            _contentblock.LayoutUpdated += _contentblock_LayoutUpdated;

            //childrens of content
            _contentpanel.Children.Add(header);
            _contentpanel.Children.Add(_contentblock);
            _contentpanel.Children.Add(separation);
            _contentpanel.Children.Add(_titleblock);
            _contentpanel.Children.Add(footer);
        }
예제 #21
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///ItemDetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot              = (ContosoCookbook.Common.LayoutAwarePage) this.FindName("pageRoot");
            itemsViewSource       = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("itemsViewSource");
            PageAppBar            = (Windows.UI.Xaml.Controls.AppBar) this.FindName("PageAppBar");
            LeftCommands          = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("LeftCommands");
            RightCommands         = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("RightCommands");
            BragButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("BragButton");
            PinRecipeButton       = (Windows.UI.Xaml.Controls.Button) this.FindName("PinRecipeButton");
            flipView              = (Windows.UI.Xaml.Controls.FlipView) this.FindName("flipView");
            portraitFlipView      = (Windows.UI.Xaml.Controls.FlipView) this.FindName("portraitFlipView");
            snappedFlipView       = (Windows.UI.Xaml.Controls.FlipView) this.FindName("snappedFlipView");
            backButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
예제 #22
0
 /// <summary>
 /// Constructor for the WP8 chat app.
 /// </summary>
 public ChatAppWinRT(TextBox currentMessageInputBox, TextBlock chatHistory, ScrollViewer chatHistoryScroller)
     : base("WinRT", ConnectionType.TCP)
 {
     this.CurrentMessageInputBox = currentMessageInputBox;
     this.ChatHistory = chatHistory;
     this.ChatHistoryScroller = chatHistoryScroller;
 }
예제 #23
0
        /// <summary>
        /// WARNING!  Calling this will cause a crash IF target version of APP is not set to Windows10 FallCreatorsUpdate (10.0.16299.0) or greater
        /// </summary>
        /// <param name="textBlock"></param>
        /// <param name="color"></param>
        /// <param name="startIndex"></param>
        /// <param name="length"></param>
        public static void ApplyBackgroundColor(this Windows.UI.Xaml.Controls.TextBlock textBlock, Xamarin.Forms.Color color, int startIndex = 0, int length = -1)
        {
            if (TextHeghLighterPresent)
            {
                if (length < 0)
                {
                    if (startIndex != 0)
                    {
                        return;
                    }
                    length  = textBlock.Text.Length;
                    length += textBlock.Inlines.Count;
                }

                var highlighter = new TextHighlighter
                {
                    Background = new Windows.UI.Xaml.Media.SolidColorBrush(color.ToWindowsColor()),
                    //Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(metaFont.TextColor.ToWindowsColor()),
                };
                highlighter.Ranges.Add(new Windows.UI.Xaml.Documents.TextRange
                {
                    StartIndex = startIndex,
                    Length     = length
                });
                textBlock.TextHighlighters.Add(highlighter);
            }
        }
        public TestRunner(UserControl target, StackPanel testsOutput)
        {
            _target = target;

            _status = new TextBlock {
                Name = "TestsStatus"
            };
            testsOutput.Children.Add(_status);

            _tests = target
                     .GetType()
                     .GetMethods(BindingFlags.Instance | BindingFlags.Public)
                     .Where(method => method.Name.StartsWith("When_"))
                     .Select(method => new Test(this, method))
                     .ToDictionary(t => t.Name);

            foreach (var test in _tests.Values)
            {
                Button play;
                testsOutput.Children.Add(new StackPanel
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Orientation         = Orientation.Horizontal,
                    Children            =
                    {
                        (play       = new Button
                        {
                            Content = "▶",
                        }),
                        test.Output
                    }
                });
                play.Click += async(snd, e) => await test.Run();
            }
        }
예제 #25
0
        private void btnLapReset_Click(object sender, RoutedEventArgs e)
        {
            long timeRightNow;
            TextBlock tblLapTime;

            if (btnLapReset.Content.ToString() == "Reset")
            {
                // rezero all timers
                stopWatch.Reset();
                dd = hh = mm = ss = ms = 0;
                tblTimeDisplay.Text = "00:00:00:00:000";

            }
            else     // Text = "Lap"
            {
                // save the current time, add to list
                if (myLapTimes == null)
                {
                    myLapTimes = new List<long>();
                    lastLapTime = 0;
                }
                // get the ellapsed milliseconde
                // subtract the last one and then store the difference
                timeRightNow = stopWatch.ElapsedMilliseconds;
                myLapTimes.Add(timeRightNow - lastLapTime);
                lastLapTime = timeRightNow;

                tblLapTime = new TextBlock();
                tblLapTime.Text = myLapTimes.Last().ToString();
                tblLapTime.HorizontalAlignment = HorizontalAlignment.Center;

                spLapTimes.Children.Add(tblLapTime);
            }
        }
예제 #26
0
        public CheckToolItemHandler()
        {
            Control = new swc.Primitives.ToggleButton {
                IsThreeState = false
            };
            swcImage = new swc.Image {
                MaxHeight = 16, MaxWidth = 16
            };
            label = new swc.TextBlock();
            var panel = new swc.StackPanel {
                Orientation = swc.Orientation.Horizontal
            };

            panel.Children.Add(swcImage);
            panel.Children.Add(label);
            Control.Content = panel;

            Control.Checked += delegate {
                Widget.OnCheckedChanged(EventArgs.Empty);
            };
            Control.Unchecked += delegate {
                Widget.OnCheckedChanged(EventArgs.Empty);
            };
            Control.Click += delegate {
                Widget.OnClick(EventArgs.Empty);
            };
        }
예제 #27
0
 public GuiLogger(string log, ref Windows.UI.Xaml.Controls.TextBlock logger, ref ScrollViewer svP)
 {
     loggerText      = logger;
     sv              = svP;
     loggingDisplay  = log;
     loggerText.Text = loggingDisplay;
 }
 private void log(string s)
 {
     TextBlock text = new TextBlock();
     text.Text = s;
     text.TextWrapping = TextWrapping.WrapWholeWords;
     stkOutput.Children.Add(text);
 }
예제 #29
0
        private static int OutputAndRemoveDataPoint(TextBlock target, string toOutput)
        {
            var pattern = @"(¤(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\¤])*¤(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)".Replace('¤', '"');
            var matches = Regex.Matches(toOutput, pattern);
            if (Regex.IsMatch(matches[0].Value, @"^¤".Replace('¤', '"')))
            {
                if (Regex.IsMatch(matches[0].Value, ":$"))
                {
                    // key
                    target.OutputBold(matches[0].Value.Replace('\"', '\0') + "\t");
                }
                else
                {
                    // string
                    target.OutputWithFormat(matches[0].Value + Environment.NewLine, fontColor: Colors.DarkGreen);
                }
            }
            else if (Regex.IsMatch(matches[0].Value, "true|false"))
            {
                // boolean
                target.OutputWithFormat(matches[0].Value.Replace('\"', '\0') + Environment.NewLine, fontColor: Colors.DarkBlue);
            }
            else if (Regex.IsMatch(matches[0].Value, "null"))
            {
                // null
                target.OutputWithFormat(matches[0].Value.Replace('\"', '\0') + Environment.NewLine, fontColor: Colors.DarkBlue);
            }
            else
            {
                // number
                target.OutputWithFormat(matches[0].Value.Replace('\"', '\0') + Environment.NewLine, fontColor: Colors.DarkCyan);
            }

            return matches[0].Length;
        }
예제 #30
0
파일: Tweet.g.i.cs 프로젝트: sagar-sm/Mu
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///Tweet.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
            primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
            titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
            itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
            itemListScrollViewer2 = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer2");
            PeerTweets = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PeerTweets");
            itemListView2 = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView2");
            TweetBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("TweetBox");
            TweetIt = (Windows.UI.Xaml.Controls.Button)this.FindName("TweetIt");
            PinPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("PinPanel");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            PinTb = (Windows.UI.Xaml.Controls.TextBox)this.FindName("PinTb");
            VerifyPinButton = (Windows.UI.Xaml.Controls.Button)this.FindName("VerifyPinButton");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            pageSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageSubtitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
            TwitterConnectBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("TwitterConnectBtn");
            RefreshButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RefreshButton");
        }
예제 #31
0
        private void showPopup_Click(object sender, RoutedEventArgs e)
        {
            // Create some content to show in the popup. Typically you would // create a user control.
            Border border = new Border();
            border.BorderThickness = new Thickness(5.0);

            StackPanel panel1 = new StackPanel();

            Button button1 = new Button();
            button1.Content = "Close";
            button1.Margin = new Thickness(5.0);
            button1.Click += new RoutedEventHandler(button1_Click);
            TextBlock textblock1 = new TextBlock();
            textblock1.Text = "The popup control";
            textblock1.Margin = new Thickness(5.0);
            panel1.Children.Add(textblock1);
            panel1.Children.Add(button1);
            border.Child = panel1;

            MoviePlayer MovieFrame = new MoviePlayer(ref p);

            // Set the Child property of Popup to the border // which contains a stackpanel, textblock and button.
            p.Child = MovieFrame;

            // Set where the popup will show up on the screen.
            p.VerticalOffset = 110;
            p.HorizontalOffset = 0;

            // Open the popup.
            p.IsLightDismissEnabled = true;
            p.IsOpen = true;
        }
예제 #32
0
파일: Constants.cs 프로젝트: mbin/Win81App
 public void HighlightRanges(TextBlock tb, String TextContent, IReadOnlyList<TextSegment> ranges)
 {
     int currentPosition = 0;
     foreach (var range in ranges)
     {
         // Add the next chunk of non-range text
         if (range.StartPosition > currentPosition)
         {
             int length = (int)range.StartPosition - currentPosition;
             var subString = TextContent.Substring(currentPosition, length);
             tb.Inlines.Add(new Run() { Text = subString });
             currentPosition += length;
         }
         // Add the next range
         var boldString = TextContent.Substring((int)range.StartPosition, (int)range.Length);
         tb.Inlines.Add(new Run() { Text = boldString, FontWeight = FontWeights.Bold });
         currentPosition += (int)range.Length;
     }
     // Add the text after the last matching segment
     if (currentPosition < TextContent.Length)
     {
         var subString = TextContent.Substring(currentPosition);
         tb.Inlines.Add(new Run() { Text = subString });
     }
     tb.Inlines.Add(new Run() { Text = "\r\n" });
 }
예제 #33
0
 public CreatingPizza()
 {
     this.InitializeComponent();
     pizzaBox = PizzaBox;
     costBox = CostBox;
     deliveryBox = DeliveryBox;
 }
예제 #34
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///ArtistDetails.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
            primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
            titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
            itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
            itemDetail = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemDetail");
            itemDetailGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("itemDetailGrid");
            itemDetailTitlePanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("itemDetailTitlePanel");
            ArtistContentTb = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("ArtistContentTb");
            itemTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemTitle");
            itemSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemSubtitle");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
        }
예제 #35
0
        private void AddExample(IpaSymbol ipaSymbol)
        {
            TextBlock letterBlock = new TextBlock();
            letterBlock.Style = this.Resources["LetterStyle"] as Style;
            letterBlock.Text = ipaSymbol.Value;

            TextBlock exampleBlock = new TextBlock();
            exampleBlock.Style = this.Resources["ExampleStyle"] as Style;
            IpaSymbol.SetExampleBlock(exampleBlock);

            StackPanel stackPanel = new StackPanel();
            stackPanel.VerticalAlignment = VerticalAlignment.Center;
            stackPanel.Children.Add(letterBlock);
            stackPanel.Children.Add(exampleBlock);

            Grid grid = new Grid();
            grid.Background = ipaSymbol.BackgroundBrush;
            grid.Height = Window.Current.Bounds.Height;
            grid.Children.Add(stackPanel);

            WordsPanel.Children.Add(grid);
            WordsPanel.InvalidateArrange();
            Debug.WriteLine(grid.ActualHeight);
            //Debug.WriteLine(WordsPanel.Children.Count);
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///BlankPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            FullGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("FullGrid");
            SnapGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("SnapGrid");
            PortaitGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("PortaitGrid");
            textBlock = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("textBlock");
            ContentView2 = (Windows.UI.Xaml.Controls.WebView)this.FindName("ContentView2");
            ItemListView1 = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView1");
            ContentView1 = (Windows.UI.Xaml.Controls.WebView)this.FindName("ContentView1");
            TitleText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("TitleText");
            grid = (Windows.UI.Xaml.Controls.Grid)this.FindName("grid");
            ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView");
            PostTitleText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PostTitleText");
            ContentView = (Windows.UI.Xaml.Controls.WebView)this.FindName("ContentView");
        }
예제 #37
0
 //ApplicationDataContainer.mytest
 private void back_Click(object sender, RoutedEventArgs e)
 {
     TextBlock d = new TextBlock();
     d.Text = "hello";
     if(Frame.CanGoBack)
     Frame.GoBack();
 }
        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();
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/DetailPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("CollectionViewSource");
            LayoutRoot           = (Windows.UI.Xaml.Controls.Grid) this.FindName("LayoutRoot");
            OrientationStates    = (Windows.UI.Xaml.VisualStateGroup) this.FindName("OrientationStates");
            Full           = (Windows.UI.Xaml.VisualState) this.FindName("Full");
            Fill           = (Windows.UI.Xaml.VisualState) this.FindName("Fill");
            Portrait       = (Windows.UI.Xaml.VisualState) this.FindName("Portrait");
            Snapped        = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
            FlipView       = (Windows.UI.Xaml.Controls.FlipView) this.FindName("FlipView");
            ApplicationBar = (Windows.UI.Xaml.Controls.ApplicationBar) this.FindName("ApplicationBar");
            NextPanel      = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("NextPanel");
            NextButton     = (Windows.UI.Xaml.Controls.Button) this.FindName("NextButton");
            PreviousButton = (Windows.UI.Xaml.Controls.Button) this.FindName("PreviousButton");
            HomeButton     = (Windows.UI.Xaml.Controls.Button) this.FindName("HomeButton");
            BackButton     = (Windows.UI.Xaml.Controls.Button) this.FindName("BackButton");
            PageTitle      = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PageTitle");
        }
예제 #40
0
 protected override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     textBlockStatus = GetTemplateChild("textBlockStatus") as TextBlock;
     LayoutRoot = GetTemplateChild("LayoutRoot") as Grid;
     InitializeProgressType();
 }
예제 #41
0
        public void Populate(IEnumerable<ILayer> layers)
        {
            Children.Clear();
            foreach (var layer in layers)
            {
                if (string.IsNullOrEmpty(layer.Attribution.Text)) continue;
                var attribution = new StackPanel { Orientation = Orientation.Horizontal };
                var textBlock = new TextBlock();
                if (string.IsNullOrEmpty(layer.Attribution.Url))
                {
                    textBlock.Text = layer.Attribution.Text;
                }
                else
                {
                    var hyperlink = new Hyperlink();
                    hyperlink.Inlines.Add(new Run{ Text = layer.Attribution.Text});
                    hyperlink.NavigateUri = new Uri(layer.Attribution.Url);
                    textBlock.Inlines.Add(hyperlink);
                    textBlock.Padding = new Thickness(6, 2, 6, 2);
                    attribution.Children.Add(textBlock);
                }

                Children.Add(attribution);
            }
        }
예제 #42
0
        /// <summary>
        /// Builds the visual tree for the ColorPicker control when the template is applied. 
        /// </summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_rootElement = GetTemplateChild("RootElement") as Panel;
            m_hueMonitor = GetTemplateChild("HueMonitor") as Rectangle;
            m_sampleSelector = GetTemplateChild("SampleSelector") as Canvas;
            m_hueSelector = GetTemplateChild("HueSelector") as Canvas;
            m_selectedColorView = GetTemplateChild("SelectedColorView") as Rectangle;
            m_colorSample = GetTemplateChild("ColorSample") as Rectangle;
            m_hexValue = GetTemplateChild("HexValue") as TextBlock;


            m_rootElement.RenderTransform = m_scale = new ScaleTransform();

            m_hueMonitor.PointerPressed += m_hueMonitor_PointerPressed;
            m_hueMonitor.PointerReleased += m_hueMonitor_PointerReleased;
            m_hueMonitor.PointerMoved += m_hueMonitor_PointerMoved;

            m_colorSample.PointerPressed += m_colorSample_PointerPressed;
            m_colorSample.PointerReleased += m_colorSample_PointerReleased;
            m_colorSample.PointerMoved += m_colorSample_PointerMoved;

            m_sampleX = m_colorSample.Width;
            m_sampleY = 0;
            m_huePos = 0;

            UpdateVisuals();
        }
예제 #43
0
 /// <summary>
 /// Method initializes and sets text block appearance
 /// </summary>
 private void InitializeTextBlock()
 {
     content = new UIX.Controls.TextBlock();
     content.TextAlignment       = UIX.TextAlignment.Center;
     content.VerticalAlignment   = UIX.VerticalAlignment.Center;
     content.HorizontalAlignment = UIX.HorizontalAlignment.Center;
     content.Foreground          = new SolidColorBrush(Colors.White);
 }
예제 #44
0
        private static void CreateRunElement(Windows.UI.Xaml.Controls.TextBlock textBlock, string rawText, int startPosition, int endPosition)
        {
            var fragment = rawText.Substring(startPosition, endPosition - startPosition);

            textBlock.Inlines.Add(new Run {
                Text = fragment
            });
        }
예제 #45
0
 public static TextBlock Copy(this Windows.UI.Xaml.Controls.TextBlock textBlock)
 {
     if (textBlock is TextBlock source)
     {
         var result = new TextBlock
         {
             FontSize               = source.FontSize,
             LineStackingStrategy   = source.LineStackingStrategy,
             LineHeight             = source.LineHeight,
             CharacterSpacing       = source.CharacterSpacing,
             IsTextSelectionEnabled = source.IsTextSelectionEnabled,
             FontWeight             = source.FontWeight,
             Padding                       = source.Padding,
             Foreground                    = source.Foreground,
             FontStyle                     = source.FontStyle,
             FontStretch                   = source.FontStretch,
             FontFamily                    = source.FontFamily,
             TextWrapping                  = source.TextWrapping,
             TextTrimming                  = source.TextTrimming,
             TextAlignment                 = source.TextAlignment,
             Text                          = source.Text,
             OpticalMarginAlignment        = source.OpticalMarginAlignment,
             TextReadingOrder              = source.TextReadingOrder,
             TextLineBounds                = source.TextLineBounds,
             SelectionHighlightColor       = source.SelectionHighlightColor,
             MaxLines                      = source.MaxLines,
             IsColorFontEnabled            = source.IsColorFontEnabled,
             IsTextScaleFactorEnabled      = source.IsTextScaleFactorEnabled,
             TextDecorations               = source.TextDecorations,
             HorizontalTextAlignment       = source.HorizontalTextAlignment,
             FlowDirection                 = source.FlowDirection,
             DataContext                   = source.DataContext,
             Name                          = source.Name + ".Copy",
             MinWidth                      = source.MinWidth,
             MinHeight                     = source.MinHeight,
             MaxWidth                      = source.MaxWidth,
             MaxHeight                     = source.MaxHeight,
             Margin                        = source.Margin,
             Language                      = source.Language,
             HorizontalAlignment           = source.HorizontalAlignment,
             VerticalAlignment             = source.VerticalAlignment,
             Width                         = source.Width,
             Height                        = source.Height,
             Style                         = source.Style,
             RequestedTheme                = source.RequestedTheme,
             FocusVisualSecondaryThickness = source.FocusVisualSecondaryThickness,
             FocusVisualSecondaryBrush     = source.FocusVisualSecondaryBrush,
             FocusVisualPrimaryThickness   = source.FocusVisualPrimaryThickness,
             FocusVisualPrimaryBrush       = source.FocusVisualPrimaryBrush,
             FocusVisualMargin             = source.FocusVisualMargin,
             AllowFocusWhenDisabled        = source.AllowFocusWhenDisabled,
             AllowFocusOnInteraction       = source.AllowFocusOnInteraction,
             Clip                          = source.Clip
         };
         return(result);
     }
     return(null);
 }
예제 #46
0
        public async Task Display(string message, ImageSource imageSource)
        {
            var handler            = GetHandler(imageSource);
            var windowsImageSource = await handler.LoadImageAsync(imageSource);

            var image = new Windows.UI.Xaml.Controls.Image()
            {
                Source = windowsImageSource
            };

            if (image != null)
            {
                Popup popup = new Popup();

                StackPanel stackPanel = new StackPanel();
                stackPanel.Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Color.FromArgb(255, 244, 244, 244));
                stackPanel.Width      = Application.Current.MainPage.Width;

                var button = new Windows.UI.Xaml.Controls.Button();
                button.Content     = "X";
                button.Foreground  = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black);
                button.BorderBrush = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black);
                button.Click      += (sender, e) =>
                {
                    popup.IsOpen = false;
                };

                if (!string.IsNullOrEmpty(message))
                {
                    var label = new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text     = message,
                        FontSize = 48,
                        Padding  = new Windows.UI.Xaml.Thickness(8),
                    };
                    stackPanel.Children.Add(label);
                }

                stackPanel.Children.Add(image);
                stackPanel.Children.Add(button);

                popup = new Popup()
                {
                    Child          = stackPanel,
                    IsOpen         = true,
                    VerticalOffset = 30
                };
                popup.DragLeave += (sender, e) =>
                {
                    ((Popup)sender).IsOpen = false;
                };
            }
            else
            {
                throw new ArgumentNullException("Image is null");
            }
        }
        public ReportsPage()
        {
            Content = new UIControls.TextBlock()
            {
                Text                = "Reports",
                FontSize            = 100,
                Foreground          = new Media.SolidColorBrush(Windows.UI.Colors.White),
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Center,
            };

            this.Background = new Media.SolidColorBrush(Windows.UI.Colors.Maroon);
        }
        public ProfileSettingsPage()
        {
            Content = new UIControls.TextBlock()
            {
                Text                = "Profile Settings",
                FontSize            = 100,
                Foreground          = new Media.SolidColorBrush(Windows.UI.Colors.White),
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Center,
            };

            this.Background = new Media.SolidColorBrush(Windows.UI.Colors.Fuchsia);
        }
        public ShopPage()
        {
            Content = new UIControls.TextBlock()
            {
                Text                = "Shop",
                FontSize            = 100,
                Foreground          = new Media.SolidColorBrush(Windows.UI.Colors.White),
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Center,
            };

            this.Background = new Media.SolidColorBrush(Windows.UI.Colors.DeepSkyBlue);
        }
        public BranchPage()
        {
            Content = new UIControls.TextBlock()
            {
                Text                = "Locate Branch",
                FontSize            = 100,
                Foreground          = new Media.SolidColorBrush(Windows.UI.Colors.White),
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Center,
            };

            this.Background = new Media.SolidColorBrush(Windows.UI.Colors.Navy);
        }
            public Test(TestRunner owner, MethodInfo testMethod)
            {
                _owner      = owner;
                _testMethod = testMethod;

                Name   = testMethod.Name;
                Output = new TextBlock
                {
                    Name              = Name + "_Result",
                    Text              = "🟨 " + Name,
                    TextWrapping      = TextWrapping.Wrap,
                    VerticalAlignment = VerticalAlignment.Center
                };
            }
예제 #52
0
        public ButtonHandler()
        {
            Control        = new swc.Button();
            Control.Click += (sender, e) => Callback.OnClick(Widget, EventArgs.Empty);
            label          = new swc.TextBlock
            {
                VerticalAlignment   = sw.VerticalAlignment.Center,
                HorizontalAlignment = sw.HorizontalAlignment.Center,
                Padding             = new sw.Thickness(3, 0, 3, 0),
                Visibility          = sw.Visibility.Collapsed
            };
            swc.Grid.SetColumn(label, 1);
            swc.Grid.SetRow(label, 1);

            swcimage = new swc.Image();
            SetImagePosition();
            grid = new swc.Grid();
            grid.ColumnDefinitions.Add(new swc.ColumnDefinition {
                Width = sw.GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new swc.ColumnDefinition {
                Width = new sw.GridLength(1, sw.GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new swc.ColumnDefinition {
                Width = sw.GridLength.Auto
            });
            grid.RowDefinitions.Add(new swc.RowDefinition {
                Height = sw.GridLength.Auto
            });
            grid.RowDefinitions.Add(new swc.RowDefinition {
                Height = new sw.GridLength(1, sw.GridUnitType.Star)
            });
            grid.RowDefinitions.Add(new swc.RowDefinition {
                Height = sw.GridLength.Auto
            });
            grid.Children.Add(swcimage);
            grid.Children.Add(label);

            /*
             * var panel = new swc.Control { IsTabStop = false };
             * panel.HorizontalAlignment = sw.HorizontalAlignment.Stretch;
             * panel.VerticalAlignment = sw.VerticalAlignment.Stretch;
             * swc.Grid.SetColumn (panel, 1);
             * swc.Grid.SetRow (panel, 1);
             * grid.Children.Add (panel);
             * */
            Control.Content = grid;
        }
예제 #53
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///MainPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            txtRssUrl     = (Windows.UI.Xaml.Controls.TextBox) this.FindName("txtRssUrl");
            TitleText     = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("TitleText");
            ItemListView  = (Windows.UI.Xaml.Controls.ListView) this.FindName("ItemListView");
            PostTitleText = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PostTitleText");
            ContentView   = (Windows.UI.Xaml.Controls.WebView) this.FindName("ContentView");
        }
예제 #54
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _textBlock = GetTemplateChild("TextBlock") as Windows.UI.Xaml.Controls.TextBlock;
            _proress   = GetTemplateChild("Progress") as Windows.UI.Xaml.Controls.ProgressRing;

            if (_textBlock != null)
            {
                _textBlock.Visibility = Visibility.Visible;
                _textBlock.Text       = Text;
            }

            if (_proress != null)
            {
                _proress.Visibility = Visibility.Collapsed;
            }
        }
예제 #55
0
        public GameController(ref Windows.UI.Xaml.Controls.Grid mainBoard,
                              ref Windows.UI.Xaml.Controls.TextBlock bestScore,
                              ref Windows.UI.Xaml.Controls.TextBlock actualScore)
        {
            LoadBoardSize();

            gameStatistic     = new Model.GameScoreModel();
            gameStatisticView = new View.GameScoreView(ref bestScore, ref actualScore);

            mainBoardGrid = mainBoard;
            gameModel     = new Model.GameBoardModel(this.boardSize, this.numberOfLayers);
            gameModelView = new View.GameBoardView(gameModel);

            gameModelView.InsertGameBoardIntoMainGrid(ref mainBoardGrid, 0, 1);

            StartGame();
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///Copy of RegisterPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot            = (StreetFoo.Client.UI.Common.LayoutAwarePage) this.FindName("pageRoot");
            backButton          = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle           = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
예제 #57
0
        public ButtonToolItemHandler()
        {
            Control  = new swc.Button();
            swcImage = new swc.Image {
                MaxHeight = 16, MaxWidth = 16
            };
            label = new swc.TextBlock();
            var panel = new swc.StackPanel {
                Orientation = swc.Orientation.Horizontal
            };

            panel.Children.Add(swcImage);
            panel.Children.Add(label);
            Control.Content = panel;
            Control.Click  += delegate {
                Widget.OnClick(EventArgs.Empty);
            };
        }
예제 #58
0
파일: ButtonHandler.cs 프로젝트: yaram/Eto
        public ButtonHandler()
        {
            Control        = new swc.Button();
            Control.Click += (sender, e) => Callback.OnClick(Widget, EventArgs.Empty);
            label          = new WpfLabel
            {
                VerticalAlignment   = sw.VerticalAlignment.Center,
                HorizontalAlignment = sw.HorizontalAlignment.Center,
                Padding             = new sw.Thickness(3, 0, 3, 0),
                Visibility          = sw.Visibility.Collapsed
            };
            swc.Grid.SetColumn(label, 1);
            swc.Grid.SetRow(label, 1);
#if WINRT
            swcimage = new EtoImage();
#else
            swcimage = new EtoImage {
                Handler = this
            };
#endif
            var grid = new swc.Grid();
            grid.ColumnDefinitions.Add(new swc.ColumnDefinition {
                Width = sw.GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new swc.ColumnDefinition {
                Width = new sw.GridLength(1, sw.GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new swc.ColumnDefinition {
                Width = sw.GridLength.Auto
            });
            grid.RowDefinitions.Add(new swc.RowDefinition {
                Height = sw.GridLength.Auto
            });
            grid.RowDefinitions.Add(new swc.RowDefinition {
                Height = new sw.GridLength(1, sw.GridUnitType.Star)
            });
            grid.RowDefinitions.Add(new swc.RowDefinition {
                Height = sw.GridLength.Auto
            });
            grid.Children.Add(swcimage);
            grid.Children.Add(label);

            Control.Content = grid;
        }
예제 #59
0
        public TabPageHandler()
        {
            Control = new swc.TabItem();
            var header = new swc.StackPanel {
                Orientation = swc.Orientation.Horizontal
            };

            headerImage = new swc.Image {
                MaxHeight = 16, MaxWidth = 16
            };
            headerText = new swc.TextBlock();
            header.Children.Add(headerImage);
            header.Children.Add(headerText);
            Control.Header = header;

            Control.Content = content = new swc.DockPanel {
                LastChildFill = true
            };
        }
예제 #60
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///ItemDetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot              = (_8Tracks.Common.LayoutAwarePage) this.FindName("pageRoot");
            itemsViewSource       = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("itemsViewSource");
            flipView              = (Windows.UI.Xaml.Controls.FlipView) this.FindName("flipView");
            backButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }