Exemplo n.º 1
0
        public RepoPage()
        {
            this.InitializeComponent();
            DataTransferManager.GetForCurrentView().DataRequested += (sender, args) =>
            {
                DataRequest request = args.Request;
                request.Data.SetText(repo.html_url);
                request.Data.Properties.Title = "Github Repo, Shared by GithubX";
            };
            SizeChanged += (sender, args) =>
            {
                FilesList.Height =
                    MarkdownScrollViewer.Height =
                        ActualHeight -
                        92 -
                        buttonPanel.ActualHeight -
                        buttonPanel.Margin.Top -
                        32 -
                        48;
                //48 for expander
                //92 for header
                MarkdownText.Width = MarkdownScrollViewer.ActualWidth;
            };
            Loaded += async(sender, args) =>
            {
                PFix = string.Format("https://github.com/{0}/raw/master", repo.full_name);
                md   = LoadTheme();
                if (md == null)
                {
                    md = new MarkdownSetting();
                }
                try
                {
                    ContentFiles = await ApiHandler.GetContentListAsync(repo);

                    var readme = ContentFiles.Find(o => o.name.ToLower().Equals("readme.md"));
                    Url = readme.download_url;
                    var res = await ApiHandler.GetReadMeMdAsync(repo.id, Url, true);

                    MarkdownText.Text = res.Item2;
                    if (!res.Item1)
                    {
                        MainPage.NotifyElement.Show("There was a problem in loading README properly!", 2000);
                    }
                }
                catch { MarkdownText.Text = "> Nothing 😣"; }
                Bindings.Update();
                if (repo.Color == "#ffffff")
                {
                    MarkdownText.LinkForeground = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.LightBlue);
                }
            };
        }
Exemplo n.º 2
0
        private void SaveTheme(MarkdownSetting setting)
        {
            var wCache = new LocalObjectStorageHelper();

            wCache.Save(CacheKeys.ReadmeTheme, Newtonsoft.Json.JsonConvert.SerializeObject(setting));
        }