public ShellSectionRenderer()
        {
            Xamarin.Forms.Shell.VerifyShellUWPFlagEnabled(nameof(ShellSectionRenderer));
            MenuItemTemplate    = (Windows.UI.Xaml.DataTemplate)Windows.UI.Xaml.Application.Current.Resources["ShellSectionMenuItemTemplate"];
            IsBackButtonVisible = Microsoft.UI.Xaml.Controls.NavigationViewBackButtonVisible.Collapsed;
            IsSettingsVisible   = false;
            AlwaysShowHeader    = false;
            PaneDisplayMode     = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Top;
            ItemInvoked        += OnMenuItemInvoked;

            AutoSuggestBox = new Windows.UI.Xaml.Controls.AutoSuggestBox()
            {
                Width = 300
            };
            AutoSuggestBox.TextChanged      += OnSearchBoxTextChanged;
            AutoSuggestBox.QuerySubmitted   += OnSearchBoxQuerySubmitted;
            AutoSuggestBox.SuggestionChosen += OnSearchBoxSuggestionChosen;

            Frame             = new Windows.UI.Xaml.Controls.Frame();
            Content           = Frame;
            this.SizeChanged += OnShellSectionRendererSizeChanged;
            Resources["NavigationViewTopPaneBackground"]            = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultBackgroundColor);
            Resources["TopNavigationViewItemForeground"]            = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["TopNavigationViewItemForegroundSelected"]    = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["NavigationViewSelectionIndicatorForeground"] = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
        }
Exemple #2
0
        private void UserControl_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "SolidBorderBrush")
            {
                if (_resultList != null)
                {
                    Windows.UI.Xaml.Media.SolidColorBrush borderBrush = _resultList.SolidBorderBrush as Windows.UI.Xaml.Media.SolidColorBrush;
                    Color           borderColor      = Color.FromArgb(borderBrush.Color.A, borderBrush.Color.R, borderBrush.Color.G, borderBrush.Color.B);
                    SolidColorBrush solidBorderBrush = new SolidColorBrush(borderColor);

                    this.SearchBoxBorder.BorderBrush = solidBorderBrush;
                    this.SearchBoxBorder.Background  = solidBorderBrush;
                    this.ListBoxBorder.BorderBrush   = solidBorderBrush;
                    this.ListBoxBorder.Background    = solidBorderBrush;
                }
            }
            else if (e.PropertyName == "PrimaryTextColor")
            {
                if (_resultList != null)
                {
                    Windows.UI.Xaml.Media.SolidColorBrush primaryTextBrush = _resultList.PrimaryTextColor as Windows.UI.Xaml.Media.SolidColorBrush;
                    Color           primaryTextColor      = Color.FromArgb(primaryTextBrush.Color.A, primaryTextBrush.Color.R, primaryTextBrush.Color.G, primaryTextBrush.Color.B);
                    SolidColorBrush solidPrimaryTextBrush = new SolidColorBrush(primaryTextColor);

                    this.SearchBox.QueryTextBox.Foreground          = solidPrimaryTextBrush;
                    this.SearchBox.QueryTextBox.CaretBrush          = solidPrimaryTextBrush;
                    this.SearchBox.AutoCompleteTextBlock.Foreground = solidPrimaryTextBrush;
                    this.SearchBox.SearchLogo.Foreground            = solidPrimaryTextBrush;
                }
            }
        }
Exemple #3
0
        WBrush GetBarBackgroundBrush()
        {
            object defaultColor = new WSolidColorBrush(Windows.UI.Colors.Transparent);

            if (Element.BarBackgroundColor.IsDefault && defaultColor != null)
            {
                return((WBrush)defaultColor);
            }
            return(Element.BarBackgroundColor.ToBrush());
        }
        void OnControlLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
#if !WINDOWS_UWP
            _resourceBrush     = (Control.Resources["ProgressBarIndeterminateForegroundThemeBrush"] as Windows.UI.Xaml.Media.SolidColorBrush);
            _foregroundDefault = _resourceBrush.Color;
#else
            _foregroundDefault = Control.GetForegroundCache();
#endif
            UpdateColor();
        }
Exemple #5
0
        public Windows.UI.Xaml.Media.Brush toBrush()
        {
            var r = (byte)getRedInt();
            var g = (byte)getGreenInt();
            var b = (byte)getBlueInt();
            var a = (byte)getAlphaInt();

            Windows.UI.Xaml.Media.Brush v = null;
            v = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Color.FromArgb(a, r, g, b));
            return(v);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Editor> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                var transparentBackground = new Windows.UI.Xaml.Media.SolidColorBrush(Colors.Transparent);
                Control.BackgroundFocusBrush = transparentBackground;
                Control.Background           = transparentBackground;
                Control.BorderThickness      = new Windows.UI.Xaml.Thickness(0, 0, 0, 0);
                Control.Margin = new Windows.UI.Xaml.Thickness(15, 5, 15, 5);
            }
        }
 private void UserControl_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "SolidBorderBrush")
     {
         if (_launcher != null)
         {
             Windows.UI.Xaml.Media.SolidColorBrush uwpBrush    = _launcher.SolidBorderBrush as Windows.UI.Xaml.Media.SolidColorBrush;
             System.Windows.Media.Color            borderColor = System.Windows.Media.Color.FromArgb(uwpBrush.Color.A, uwpBrush.Color.R, uwpBrush.Color.G, uwpBrush.Color.B);
             this.SearchBoxBorder.BorderBrush = new SolidColorBrush(borderColor);
             this.ListBoxBorder.BorderBrush   = new SolidColorBrush(borderColor);
         }
     }
 }
        private async void SetHue_Clicked(object sender, RoutedEventArgs e)
        {
            uint colorInt = (uint)hueSlider.Value;

            // Converts the slider value to a brush from a color (via bitshifting) so we can set the background
            // of the windows form app
            var brush = new Windows.UI.Xaml.Media.SolidColorBrush(Color.FromArgb(byte.MaxValue,
                                                                                 (byte)(colorInt >> 16), (byte)(colorInt >> 8), (byte)(colorInt >> 0)));

            if (lampFound)
            {
                await lampHelper.SetHueAsync((uint)hueSlider.Value);
            }
        }
Exemple #9
0
        protected override void OnElementChanged(ElementChangedEventArgs <IndicatorView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                if (Control == null)
                {
                    UpdateControl();
                }

                _fillColor = new WSolidColorBrush(Element.IndicatorColor.ToWindowsColor());

                _selectedColor = new WSolidColorBrush(Element.SelectedIndicatorColor.ToWindowsColor());

                CreateIndicators();
            }
        }
Exemple #10
0
        void UpdateIndicatorsColor()
        {
            if (!(Control is ItemsControl))
            {
                return;
            }

            _fillColor     = new WSolidColorBrush(Element.IndicatorColor.ToWindowsColor());
            _selectedColor = new WSolidColorBrush(Element.SelectedIndicatorColor.ToWindowsColor());
            var position = Element.Position;
            int i        = 0;

            foreach (var item in (Control as ItemsControl).Items)
            {
                ((WShape)item).Fill = i == position ? _selectedColor : _fillColor;
                i++;
            }
        }
Exemple #11
0
        public object Convert(object value, Type targetType,
                          object parameter, string culture)
        {
            var backcolor = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black);

            ListViewItem item = value as ListViewItem;

            if (item != null)
            {
                ListView lv = ItemsControl.ItemsControlFromItemContainer(item) as ListView;

                int index = lv.ItemContainerGenerator.IndexFromContainer(item);

                if (index % 2 > 0)
                    backcolor = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.White);
            }

            backcolor.Opacity = 0.25;

            return backcolor;
        }
Exemple #12
0
        private async void _waveGesture_ReverseWaveDetected(object sender, EventArgs e)
        {
            Debug.WriteLine("Moving to prev Slide");

            var httpClient = new HttpClient();
            var response   = await httpClient.PostAsync("http://powerpointremoteproxy.azurewebsites.net/powerpoint/prevslide/1234", new StringContent(""));

            //var response = await httpClient.PostAsync("http://localhost:3283/powerpoint/prevslide/1234", new StringContent(""));

            Debug.WriteLine("Send signal to move to prev Slide. Response: " + response.StatusCode);

            try
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Blue);
                });
            }
            catch (Exception ex)
            {
            }
        }
Exemple #13
0
        public void When_SolidColorBrush_DataBound_Setters()
        {
            var grid = new Grid();

            var brush = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Red);

            object brushDataContextValue = null;

            brush.DataContextChanged += (_, e) => {
                brushDataContextValue = e.NewValue;
            };

            grid.Background = brush;

            grid.DataContext = new { a = "#FF00ff00" };

            brush.SetBinding(Windows.UI.Xaml.Media.SolidColorBrush.ColorProperty, new Binding {
                Path = "a"
            });

            Assert.IsNotNull(brushDataContextValue);
            Assert.AreEqual(Windows.UI.Colors.Lime, brush.Color);
        }
 public static Windows.UI.Color Convert(Windows.UI.Xaml.Media.SolidColorBrush solidColorBrush)
 {
     return(solidColorBrush.Color);
 }
 private void ColorPicker_ColorChanged(Windows.UI.Color Color, Windows.UI.Xaml.Media.SolidColorBrush Brush)
 {
     App.Setting.LightColor = Color;
     Render();
 }
Exemple #16
0
 public static Color ToFormsColor(this WSolidColorBrush solidColorBrush)
 {
     return(solidColorBrush.Color.ToFormsColor());
 }
Exemple #17
0
        private async Task <int> StartBandMonitor()
        {
            _waveGesture.WaveDetected        += _waveGesture_WaveDetected;
            _waveGesture.ReverseWaveDetected += _waveGesture_ReverseWaveDetected;

            // Get the list of Microsoft Bands paired to the phone.
            var pairedBands = await BandClientManager.Instance.GetBandsAsync();

            if (pairedBands.Length < 1)
            {
                throw new Exception("Can't find a band");
            }

            // Connect to Microsoft Band.
            var connected = false;

            while (!connected)
            {
                try
                {
                    _bandClient = await BandClientManager.Instance.ConnectAsync(pairedBands[0]);

                    connected = true;
                }
                catch (Exception connectEx)
                {
                    await Task.Delay(2000);
                }
            }

            var sensors = _bandClient.SensorManager;

            sensors.Gyroscope.ReportingInterval = sensors.Gyroscope.SupportedReportingIntervals.Min();

            sensors.Gyroscope.ReadingChanged += (s, args) =>
            {
                _waveGesture.AddAccelerometerReading(args.SensorReading);
            };

            //if (await sensors.HeartRate.RequestUserConsentAsync())
            //{
            //    sensors.HeartRate.ReadingChanged += (s, args) =>
            //    {
            //        this.SendHeartRate(args.SensorReading);
            //    };
            //}

            SensorStatusTextBlock.Text = "Initialized!";
            Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Green);

            connected = false;
            while (!connected)
            {
                try
                {
                    await sensors.Gyroscope.StartReadingsAsync();

                    await sensors.HeartRate.StartReadingsAsync();

                    connected = true;
                }
                catch (Exception)
                {
                    connected = false;
                }
            }

            return(0);
        }