コード例 #1
0
ファイル: AlphaInfoPage.cs プロジェクト: b3540/keep.grass
        public AlphaInfoPage()
        {
            AlphaApp Root = AlphaFactory.MakeSureApp();

            Languages.AlphaLanguage L = AlphaFactory.MakeSureLanguage();

            Title   = L["Information"];
            Content = new StackLayout
            {
                Children =
                {
                    new TableView
                    {
                        Root = new TableRoot
                        {
                            new TableSection(L["Version"])
                            {
                                AlphaFactory.MakeCircleImageCell
                                (
                                    ImageSource: Root.GetApplicationImageSource(),
                                    Text: "1.00.000",
                                    Command: new Command
                                    (
                                        o => Device.OpenUri
                                        (
                                            AlphaFactory.MakeSureDomain().GetApplicationStoreUri()
                                        )
                                    ),
                                    OptionImageSource: Root.GetExportImageSource()
                                ),
                            },
                            new TableSection(L["Auther"])
                            {
                                AlphaFactory.MakeCircleImageCell
                                (
                                    ImageSource: Root.GetWraithImageSource(),
                                    Text: "@wraith13",
                                    Command: new Command(o => Device.OpenUri(new Uri("https://twitter.com/wraith13"))),
                                    OptionImageSource: Root.GetExportImageSource()
                                ),
                            },
                            new TableSection(L["Github Repository"])
                            {
                                AlphaFactory.MakeCircleImageCell
                                (
                                    ImageSource: Root.GetGitHubImageSource(),
                                    Text: "wraith13/keep.grass",
                                    Command: new Command(o => Device.OpenUri(new Uri("https://github.com/wraith13/keep.grass"))),
                                    OptionImageSource: Root.GetExportImageSource()
                                ),
                            },
                        }
                    },
                },
            };
        }
コード例 #2
0
 public void UpdateInfoAsync()
 {
     Debug.WriteLine("AlphaDetailPage::UpdateInfoAsync");
     if (!String.IsNullOrWhiteSpace(User))
     {
         if (UserLabel.Text != User)
         {
             AlphaFactory.MakeImageSourceFromUrl(GitHub.GetIconUrl(User))
             .ContinueWith(t => Xamarin.Forms.Device.BeginInvokeOnMainThread(() => UserLabel.ImageSource = t.Result));
             UserLabel.Text      = User;
             UserLabel.TextColor = Theme.ForegroundColor;
             UserLabel.Command   = new Command
                                   (
                 o =>
             {
                 Analytics.TrackEvent(
                     name: "[Clicked] User",
                     properties: new Dictionary <string, string> {
                     { "Category", "ColumnClick" }, { "Screen", "DetailPage" }
                 }
                     );
                 Xamarin.Forms.Device.OpenUri
                 (
                     new Uri(GitHub.GetProfileUrl(User))
                 );
             }
                                   );
             UserLabel.OptionImageSource = Root.GetExportImageSource();
             if (default(DateTime) == Domain.GetLastPublicActivity(User))
             {
                 ClearActiveInfo();
                 Task.Run(() => Domain.ManualUpdateLastPublicActivityAsync());
             }
         }
     }
     else
     {
         UserLabel.ImageSource       = null;
         UserLabel.Text              = L["unspecified"];
         UserLabel.TextColor         = Color.Gray;
         UserLabel.Command           = null;
         UserLabel.OptionImageSource = null;
         ClearActiveInfo();
     }
 }
コード例 #3
0
 public void UpdateInfoAsync()
 {
     Debug.WriteLine("AlphaDetailPage::UpdateInfoAsync");
     if (!String.IsNullOrWhiteSpace(User))
     {
         if (UserLabel.Text != User)
         {
             AlphaFactory.MakeImageSourceFromUrl(GitHub.GetIconUrl(User))
             .ContinueWith(t => Device.BeginInvokeOnMainThread(() => UserLabel.ImageSource = t.Result));
             UserLabel.Text      = User;
             UserLabel.TextColor = Color.Default;
             UserLabel.Command   = new Command
                                   (
                 o => Device.OpenUri
                 (
                     new Uri(GitHub.GetProfileUrl(User))
                 )
                                   );
             UserLabel.OptionImageSource = Root.GetExportImageSource();
             if (!Settings.GetIsValidUserName(User))
             {
                 ClearActiveInfo();
             }
             if (default(DateTime) == Domain.GetLastPublicActivity(User))
             {
                 Task.Run(() => Domain.ManualUpdateLastPublicActivityAsync());
             }
         }
     }
     else
     {
         UserLabel.ImageSource       = null;
         UserLabel.Text              = L["unspecified"];
         UserLabel.TextColor         = Color.Gray;
         UserLabel.Command           = null;
         UserLabel.OptionImageSource = null;
         ClearActiveInfo();
     }
 }
コード例 #4
0
        public override void Build()
        {
            base.Build();
            Debug.WriteLine("AlphaInfoPage.Rebuild();");

            var Version = new TableSection(L["Version"])
            {
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: Root.GetApplicationImageSource(),
                    Text: "1.00.002",
                    Command: new Command
                    (
                        o => Device.OpenUri
                        (
                            AlphaFactory.MakeSureDomain().GetApplicationStoreUri()
                        )
                    ),
                    OptionImageSource: Root.GetExportImageSource()
                ),
            };
            var Auther = new TableSection(L["Auther"])
            {
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: Root.GetWraithImageSource(),
                    Text: "@wraith13",
                    Command: new Command(o => Device.OpenUri(new Uri("https://twitter.com/wraith13"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
            };
            var Repository = new TableSection(L["Github Repository"])
            {
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: Root.GetGitHubImageSource(),
                    Text: "wraith13/keep.grass",
                    Command: new Command(o => Device.OpenUri(new Uri("https://github.com/wraith13/keep.grass"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
            };
            var BuiltWith = new TableSection(L["Built with"])
            {
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "Xamarin",
                    Command: new Command(o => Device.OpenUri(new Uri("https://www.xamarin.com"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "Visual Studio",
                    Command: new Command(o => Device.OpenUri(new Uri("https://www.visualstudio.com/vs/"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "Visual Studio Code",
                    Command: new Command(o => Device.OpenUri(new Uri("https://code.visualstudio.com/"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "GIMP",
                    Command: new Command(o => Device.OpenUri(new Uri("https://www.gimp.org"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "Microsoft HTTP Client Lib.",
                    Command: new Command(o => Device.OpenUri(new Uri("https://www.nuget.org/packages/Microsoft.Net.Http/"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "Settings Plugin",
                    Command: new Command(o => Device.OpenUri(new Uri("https://github.com/jamesmontemagno/SettingsPlugin"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "Circle Image Control Plugin",
                    Command: new Command(o => Device.OpenUri(new Uri("https://github.com/jamesmontemagno/ImageCirclePlugin"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "NotificationsExtensions",
                    Command: new Command(o => Device.OpenUri(new Uri("https://github.com/WindowsNotifications/NotificationsExtensions"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "SkiaSharp(.Views.Forms)",
                    Command: new Command(o => Device.OpenUri(new Uri("https://github.com/mono/SkiaSharp"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
                AlphaFactory.MakeCircleImageCell
                (
                    ImageSource: null,
                    Text: "Noto Sans CJK jp Regular",
                    Command: new Command(o => Device.OpenUri(new Uri("https://www.google.com/get/noto/help/cjk/"))),
                    OptionImageSource: Root.GetExportImageSource()
                ),
            };

            var StackContent = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Spacing         = 1.0,
                BackgroundColor = Color.Gray,
            };

            if (Width <= Height)
            {
                StackContent.Children.Add
                (
                    new TableView
                {
                    BackgroundColor = Color.White,
                    Root            = new TableRoot
                    {
                        Version,
                        Auther,
                        Repository,
                        BuiltWith,
                    }
                }
                );
            }
            else
            {
                StackContent.Children.Add
                (
                    new TableView
                {
                    BackgroundColor = Color.White,
                    Root            = new TableRoot
                    {
                        Version,
                        Auther,
                        Repository,
                    }
                }
                );
                StackContent.Children.Add
                (
                    new TableView
                {
                    BackgroundColor = Color.White,
                    Root            = new TableRoot
                    {
                        BuiltWith,
                    }
                }
                );
            }
            Content = StackContent;
        }