Esempio n. 1
0
        public MainPage()
        {
            InitializeComponent();
            api = new CoinbaseAPI();

            RequestButton.Click += RequestButton_Click;
            ApplicationView.SetTitle(this, "Ta Certo");
        }
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);

            StatusBar.SetIsVisible(this, false);

            ApplicationView.SetTitle(this, string.Empty);

            var lightGreyBrush = (Color)Application.Current.Resources["Grey-04"];
            var greyBrush03    = (Color)Application.Current.Resources["Grey-03"];
            var greyBrush01    = (Color)Application.Current.Resources["Grey-01"];

            TitleBar.SetButtonBackgroundColor(this, greyBrush03);
            TitleBar.SetButtonForegroundColor(this, lightGreyBrush);
            TitleBar.SetBackgroundColor(this, greyBrush01);
            TitleBar.SetForegroundColor(this, lightGreyBrush);

            if (_expando != null)
            {
                foreach (var prop in _expando)
                {
                    var valueHolder = prop.Value as ValueHolder;
                    switch (prop.Key)
                    {
                    case SBBackgroundColor:
                        valueHolder.PropertyChanged -= SBBackgroundColor_PropertyChanged;
                        break;

                    case SBBackgroundOpacity:
                        valueHolder.PropertyChanged -= SBBackgroundOpacity_PropertyChanged;
                        break;

                    case SBForegroundColor:
                        valueHolder.PropertyChanged -= SBForegroundColor_PropertyChanged;
                        break;

                    case SBIsVisible:
                        valueHolder.PropertyChanged -= SBIsVisible_PropertyChanged;
                        break;

                    case AVTitle:
                        valueHolder.PropertyChanged -= AVTitle_PropertyChanged;
                        break;

                    case TBBackgroundColor:
                        valueHolder.PropertyChanged -= TBBackgroundColor_PropertyChanged;
                        break;

                    case TBForegroundColor:
                        valueHolder.PropertyChanged -= TBForegroundColor_PropertyChanged;
                        break;
                    }
                }
            }
        }
Esempio n. 3
0
 private void HideInfoArea()
 {
     InfoAreaGrid.Visibility             = Visibility.Collapsed;
     RootGrid.ColumnDefinitions[1].Width = GridLength.Auto;
     RootGrid.RowDefinitions[1].Height   = GridLength.Auto;
     _currentSample = null;
     Commands.Clear();
     Splitter.Visibility = Visibility.Collapsed;
     TitleTextBlock.Text = string.Empty;
     ApplicationView.SetTitle(this, string.Empty);
 }
Esempio n. 4
0
 private void HideInfoArea()
 {
     InfoAreaGrid.Visibility             = Visibility.Collapsed;
     RootGrid.ColumnDefinitions[1].Width = GridLength.Auto;
     RootGrid.RowDefinitions[1].Height   = GridLength.Auto;
     HamburgerMenu.CurrentPattern        = null;
     Commands.Clear();
     Splitter.Visibility = Visibility.Collapsed;
     HamburgerMenu.Title = string.Empty;
     ApplicationView.SetTitle(this, string.Empty);
 }
Esempio n. 5
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);

            StatusBar.SetIsVisible(this, false);

            ApplicationView.SetTitle(this, string.Empty);

            var lightGreyBrush = (Color)Application.Current.Resources["Grey-04"];
            var greyBrush03    = (Color)Application.Current.Resources["Grey-03"];
            var greyBrush01    = (Color)Application.Current.Resources["Grey-01"];

            TitleBar.SetButtonBackgroundColor(this, greyBrush03);
            TitleBar.SetButtonForegroundColor(this, lightGreyBrush);
            TitleBar.SetBackgroundColor(this, greyBrush01);
            TitleBar.SetForegroundColor(this, lightGreyBrush);
        }
Esempio n. 6
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);

            // Reset app back to normal.
            StatusBar.SetIsVisible(this, false);

            ApplicationView.SetTitle(this, string.Empty);

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

            TitleBar.SetButtonBackgroundColor(this, brandColor);
            TitleBar.SetButtonForegroundColor(this, lightGreyBrush);
            TitleBar.SetBackgroundColor(this, brandColor);
            TitleBar.SetForegroundColor(this, lightGreyBrush);
        }
Esempio n. 7
0
        private async void NavigationFrame_Navigating(object sender, NavigatingCancelEventArgs navigationEventArgs)
        {
            ProcessSampleEditorTime();

            SampleCategory category;

            if (navigationEventArgs.SourcePageType == typeof(SamplePicker) || navigationEventArgs.Parameter == null)
            {
                DataContext    = null;
                _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();
                _currentSample = await Samples.GetSampleByName(sampleName);

                DataContext = _currentSample;

                if (_currentSample == null)
                {
                    HideInfoArea();
                    return;
                }

                category = await Samples.GetCategoryBySample(_currentSample);

                await Samples.PushRecentSample(_currentSample);

                var propertyDesc = _currentSample.PropertyDescriptor;

                InfoAreaPivot.Items.Clear();

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

                Title.Text = _currentSample.Name;

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

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

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

                        InfoAreaPivot.Items.Add(XamlPivotItem);

                        _xamlCodeRendererSupported = true;
                    }

                    InfoAreaPivot.SelectedIndex = 0;
                }

                if (_currentSample.HasCSharpCode)
                {
                    CSharpCodeRenderer.CSharpSource = await this._currentSample.GetCSharpSourceAsync();

                    InfoAreaPivot.Items.Add(CSharpPivotItem);
                }

                if (_currentSample.HasJavaScriptCode)
                {
                    JavaScriptCodeRenderer.CSharpSource = await this._currentSample.GetJavaScriptSourceAsync();

                    InfoAreaPivot.Items.Add(JavaScriptPivotItem);
                }

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

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

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

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

                TitleTextBlock.Text = $"{category.Name} -> {_currentSample?.Name}";
                ApplicationView.SetTitle(this, $"{category.Name} - {_currentSample?.Name}");
            }

            await SetHamburgerMenuSelection();
        }
        private void AVTitle_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var value = _expando[AVTitle] as ValueHolder;

            ApplicationView.SetTitle(this, (string)value.Value);
        }