Exemple #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            base.OnNavigatedTo(e);
            ApplicationViewExtensions.SetTitle(this, "Setup");

            if (e.NavigationMode == NavigationMode.Back)
            {
                //todo handle navigating back from the monitor page
            }
            else if (e.NavigationMode == NavigationMode.New)
            {
                _viewModel.Device = (IBlinkStick)e.Parameter ?? throw new ArgumentNullException(nameof(e.Parameter));

                _viewModel.Host       = App.LocalSettings.Host;
                _viewModel.Brightness = App.LocalSettings.Brightness;
                _viewModel.Builds.Clear();
                foreach (var build in await App.LocalSettings.GetSavedBuilds())
                {
                    _viewModel.Builds.Add(build);
                }

                if (_viewModel.Builds.Count == 0)
                {
                    _viewModel.AddBuild.Execute(null);
                }

                if (App.LocalSettings.AutoRun)
                {
                    _viewModel.Monitor.Execute(null);
                }
            }
        }
Exemple #2
0
 private void HideInfoArea()
 {
     InfoAreaGrid.Visibility             = Visibility.Collapsed;
     RootGrid.ColumnDefinitions[1].Width = GridLength.Auto;
     RootGrid.RowDefinitions[2].Height   = GridLength.Auto;
     HamburgerMenu.CurrentSample         = null;
     Commands.Clear();
     Splitter.Visibility = Visibility.Collapsed;
     HamburgerMenu.Title = string.Empty;
     ApplicationViewExtensions.SetTitle(this, string.Empty);
 }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
     base.OnNavigatedTo(e);
     ApplicationViewExtensions.SetTitle(this, "Monitor");
     
     var setup = (ISetupViewModel)e.Parameter ?? throw new ArgumentNullException(nameof(e.Parameter));
     ViewModel = new MonitorViewModel(setup);
     DataContext = ViewModel;
     ViewModel.Refresh.Execute(null);
     ((App)Application.Current).Button1Pressed += OnManualRefreshHardwareButtonPressed;
     ((App)Application.Current).Button2Pressed += OnManualRefreshHardwareButtonPressed;
 }
Exemple #4
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);

            ApplicationViewExtensions.SetTitle(this, string.Empty);

            var lightGreyBrush = (Color)Application.Current.Resources["Grey-04"];
            var brandColor     = (Color)Application.Current.Resources["Brand-Color"];

            TitleBarExtensions.SetButtonBackgroundColor(this, brandColor);
            TitleBarExtensions.SetButtonForegroundColor(this, lightGreyBrush);
            TitleBarExtensions.SetBackgroundColor(this, brandColor);
            TitleBarExtensions.SetForegroundColor(this, lightGreyBrush);
        }
        public void NavigatingAway()
        {
            // Reset app back to normal.
            StatusBarExtensions.SetIsVisible(this, false);

            ApplicationViewExtensions.SetTitle(this, string.Empty);

            var lightGreyBrush = (Color)Application.Current.Resources["Grey-04"];
            var brandColor     = (Color)Application.Current.Resources["Brand-Color"];

            TitleBarExtensions.SetButtonBackgroundColor(this, brandColor);
            TitleBarExtensions.SetButtonForegroundColor(this, lightGreyBrush);
            TitleBarExtensions.SetBackgroundColor(this, brandColor);
            TitleBarExtensions.SetForegroundColor(this, lightGreyBrush);
        }
        private void Initialize()
        {
            // Reset app back to normal.
            StatusBarExtensions.SetIsVisible(this, false);

            ApplicationViewExtensions.SetTitle(this, string.Empty);

            var lightGreyBrush = (Color)Application.Current.Resources["Status-bar-foreground"];
            var statusBarColor = (Color)Application.Current.Resources["Status-bar-color"];
            var brandColor     = (Color)Application.Current.Resources["BrandColorThemeColor"];

            ApplicationViewExtensions.SetTitle(this, "Spotify Companion");
            StatusBarExtensions.SetBackgroundOpacity(this, 0.8);
            TitleBarExtensions.SetButtonBackgroundColor(this, statusBarColor);
            TitleBarExtensions.SetButtonForegroundColor(this, lightGreyBrush);
            TitleBarExtensions.SetBackgroundColor(this, statusBarColor);
            TitleBarExtensions.SetForegroundColor(this, lightGreyBrush);
            TitleBarExtensions.SetButtonBackgroundColor(this, Colors.Transparent);
            TitleBarExtensions.SetButtonHoverBackgroundColor(this, brandColor);
            TitleBarExtensions.SetButtonHoverForegroundColor(this, Colors.White);
        }
Exemple #7
0
        private async void NavigationFrame_Navigating(object sender, NavigatingCancelEventArgs navigationEventArgs)
        {
            ProcessSampleEditorTime();

            SampleCategory category;

            if (navigationEventArgs.Parameter == null)
            {
                DataContext = null;
                HamburgerMenu.CurrentSample = null;
                category = navigationEventArgs.Parameter as SampleCategory;

                if (category != null)
                {
                    TrackingManager.TrackPage($"{navigationEventArgs.SourcePageType.Name} - {category.Name}");
                }
                else
                {
                    TrackingManager.TrackPage($"{navigationEventArgs.SourcePageType.Name}");
                }

                HideInfoArea();
            }
            else
            {
                TrackingManager.TrackPage(navigationEventArgs.SourcePageType.Name);
                Commands.Clear();
                ShowInfoArea();

                var sampleName = navigationEventArgs.Parameter.ToString();
                HamburgerMenu.CurrentSample = await Samples.GetSampleByName(sampleName);

                DataContext = HamburgerMenu.CurrentSample;

                if (HamburgerMenu.CurrentSample == null)
                {
                    HideInfoArea();
                    return;
                }

                category = await Samples.GetCategoryBySample(HamburgerMenu.CurrentSample);

                await Samples.PushRecentSample(HamburgerMenu.CurrentSample);

                var propertyDesc = HamburgerMenu.CurrentSample.PropertyDescriptor;

                InfoAreaPivot.Items.Clear();

                if (propertyDesc != null)
                {
                    _xamlRenderer.DataContext = propertyDesc.Expando;
                }

                Title.Text = HamburgerMenu.CurrentSample.Name;

                if (propertyDesc != null && propertyDesc.Options.Count > 0)
                {
                    InfoAreaPivot.Items.Add(PropertiesPivotItem);
                }

                if (HamburgerMenu.CurrentSample.HasXAMLCode)
                {
                    if (AnalyticsInfo.VersionInfo.GetDeviceFormFactor() != DeviceFormFactor.Desktop || HamburgerMenu.CurrentSample.DisableXamlEditorRendering)
                    {
                        // Only makes sense (and works) for now to show Live Xaml on Desktop, so fallback to old system here otherwise.
                        XamlReadOnlyCodeRenderer.SetCode(HamburgerMenu.CurrentSample.UpdatedXamlCode, "xaml");

                        InfoAreaPivot.Items.Add(XamlReadOnlyPivotItem);
                    }
                    else
                    {
                        XamlCodeRenderer.Text = HamburgerMenu.CurrentSample.UpdatedXamlCode;

                        InfoAreaPivot.Items.Add(XamlPivotItem);

                        _xamlCodeRendererSupported = true;
                    }

                    InfoAreaPivot.SelectedIndex = 0;
                }

                if (HamburgerMenu.CurrentSample.HasCSharpCode)
                {
                    var code = await HamburgerMenu.CurrentSample.GetCSharpSourceAsync();

                    CSharpCodeRenderer.SetCode(code, "c#");
                    InfoAreaPivot.Items.Add(CSharpPivotItem);
                }

                if (HamburgerMenu.CurrentSample.HasJavaScriptCode)
                {
                    var code = await HamburgerMenu.CurrentSample.GetJavaScriptSourceAsync();

                    JavaScriptCodeRenderer.SetCode(code, "js");
                    InfoAreaPivot.Items.Add(JavaScriptPivotItem);
                }

                if (!string.IsNullOrEmpty(HamburgerMenu.CurrentSample.CodeUrl))
                {
                    GitHub.NavigateUri = new Uri(HamburgerMenu.CurrentSample.CodeUrl);
                    GitHub.Visibility  = Visibility.Visible;
                }
                else
                {
                    GitHub.Visibility = Visibility.Collapsed;
                }

                if (HamburgerMenu.CurrentSample.HasDocumentation)
                {
                    var docs = await this.HamburgerMenu.CurrentSample.GetDocumentationAsync();

                    documentationPath = docs.path;
                    if (!string.IsNullOrWhiteSpace(docs.contents))
                    {
                        DocumentationTextblock.Text = docs.contents;
                        InfoAreaPivot.Items.Add(DocumentationPivotItem);
                    }
                }

                if (InfoAreaPivot.Items.Count == 0)
                {
                    HideInfoArea();
                }

                HamburgerMenu.Title = $"{category.Name} > {HamburgerMenu.CurrentSample?.Name}";
                ApplicationViewExtensions.SetTitle(this, $"{category.Name} > {HamburgerMenu.CurrentSample?.Name}");
            }
        }
Exemple #8
0
 /// <summary>
 /// Set app title
 /// </summary>
 /// <param name="title">Title to set</param>
 public void SetAppTitle(string title)
 {
     ApplicationViewExtensions.SetTitle(this, title);
 }
Exemple #9
0
 public void SetTitles(string title)
 {
     HamburgerMenu.Title = title;
     ApplicationViewExtensions.SetTitle(this, title);
 }
 private void ShellPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     ApplicationViewExtensions.SetExtendViewIntoTitleBar(this, false);
     TitleBarExtensions.SetButtonBackgroundColor(this, Colors.Transparent);
 }
 /// <summary>
 /// Gets the text on the title bar for the current page.
 /// </summary>
 /// <param name="page"></param>
 public static string TitleGet(this Page page)
 {
     return(ApplicationViewExtensions.GetTitle(page));
 }
 /// <summary>
 /// Sets the text on the title bar for the current page.
 /// </summary>
 /// <param name=""></param>
 public static void TitleSet(this Page page, string title)
 {
     ApplicationViewExtensions.SetTitle(page, title);
 }