예제 #1
0
        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 override void Build()
        {
            base.Build();
            Debug.WriteLine("AlphaSettingsPage.Rebuild();");

            if (Width <= Height)
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new TableView
                        {
                            Root = new TableRoot
                            {
                                new TableSection(L["Github Account"])
                                {
                                    UserNameCell.AsCell(),
                                },
                                new TableSection(L["Notifications"])
                                {
                                    AlphaFactory.MakeCircleImageCell
                                    (
                                        Text: L["Alert by Left Time"],
                                        Command: new Command(o => Root.Navigation.PushAsync(new AlphaLeftTimeSettingsPage()))
                                    ),
                                    AlphaFactory.MakeCircleImageCell
                                    (
                                        Text: L["Daily Alert"],
                                        Command: new Command(o => Root.Navigation.PushAsync(new AlphaDailyAlertSettingsPage()))
                                    )
                                },
                                new TableSection(L["Language"])
                                {
                                    LanguageCell
                                },
                                new TableSection(L["Information"])
                                {
                                    AlphaFactory.MakeCircleImageCell
                                    (
                                        ImageSource: Root.GetApplicationImageSource(),
                                        Text: L["keep.grass"],
                                        Command: new Command(o => Root.Navigation.PushAsync(AlphaFactory.MakeInfoPage()))
                                    ),
                                },
                            },
                        },
                    },
                };
            }
            else
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new StackLayout
                        {
                            Orientation     = StackOrientation.Horizontal,
                            Spacing         = 0.5,
                            BackgroundColor = Color.Gray,
                            Children        =
                            {
                                new TableView
                                {
                                    Root = new TableRoot
                                    {
                                        new TableSection(L["Github Account"])
                                        {
                                            UserNameCell.AsCell(),
                                        },
                                        new TableSection(L["Language"])
                                        {
                                            LanguageCell
                                        },
                                    },
                                },
                                new TableView
                                {
                                    Root = new TableRoot
                                    {
                                        new TableSection(L["Notifications"])
                                        {
                                            AlphaFactory.MakeCircleImageCell
                                            (
                                                Text: L["Alert by Left Time"],
                                                Command: new Command(o => Root.Navigation.PushAsync(new AlphaLeftTimeSettingsPage()))
                                            ),
                                            AlphaFactory.MakeCircleImageCell
                                            (
                                                Text: L["Daily Alert"],
                                                Command: new Command(o => Root.Navigation.PushAsync(new AlphaDailyAlertSettingsPage()))
                                            )
                                        },
                                        new TableSection(L["Information"])
                                        {
                                            AlphaFactory.MakeCircleImageCell
                                            (
                                                ImageSource: Root.GetApplicationImageSource(),
                                                Text: L["keep.grass"],
                                                Command: new Command(o => Root.Navigation.PushAsync(AlphaFactory.MakeInfoPage()))
                                            ),
                                        },
                                    },
                                },
                            },
                        },
                    },
                };
            }
        }
예제 #3
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;
        }
예제 #4
0
        public override void Build()
        {
            base.Build();
            Debug.WriteLine("AlphaSettingsPage.Rebuild();");

            var Friends = AlphaFactory.MakeCircleImageCell
                          (
                Text: L["Rivals"] /*+string.Format("({0})", Settings.GetFriendCount())*/,
                Command: new Command(o => Root.Navigation.PushAsync(new AlphaFriendsPage()))
                          );

            var ThemeCell = AlphaFactory.MakePickerCell();

            //ThemeCell.Items.Clear(); 2回目でこける。 Xamarin.Forms さん、もっと頑張って。。。
            foreach (var i in AlphaTheme.All.Keys)
            {
                if (!ThemeCell.Items.Where(j => j == i).Any())
                {
                    ThemeCell.Items.Add(L[i]);
                }
            }
            OldTheme = AlphaTheme.Get();
            ThemeCell.SelectedIndex = AlphaTheme.All.Values
                                      .IndexOf(OldTheme);
            ThemeCell.Picker.Unfocused += (sender, e) =>
            {
                var ThemeName = AlphaTheme.All.Keys.ElementAt(ThemeCell.SelectedIndex);
                AlphaTheme.Set(ThemeName);
                var NewTheme = AlphaTheme.Get();
                if (OldTheme != AlphaTheme.Get())
                {
                    OldTheme = NewTheme;
                    AlphaTheme.Apply(Root.Navigation);
                    AlphaTheme.Apply(Root.Main);
                    Build();
                    Analytics.TrackEvent(
                        name: "[Changed] Theme",
                        properties: new Dictionary <string, string> {
                        { "Category", "Settings" }, { "Theme", ThemeName }
                    }
                        );
                }
            };

            var LanguageCell = AlphaFactory.MakePickerCell();
            var Language     = Settings.Language ?? "";

            //LanguageCell.Items.Clear(); 2回目でこける。 Xamarin.Forms さん、もっと頑張って。。。
            foreach (var i in L.DisplayNames.Select(i => i.Value))
            {
                if (!LanguageCell.Items.Where(j => j == L[i]).Any())
                {
                    LanguageCell.Items.Add(L[i]);
                }
            }
            LanguageCell.SelectedIndex = L.DisplayNames
                                         .Select(i => i.Key)
                                         .IndexOf(Language);
            LanguageCell.Picker.Unfocused += (sender, e) =>
            {
                var OldLanguage = L.Get();
                Settings.Language = L.DisplayNames.Keys.ElementAt(LanguageCell.SelectedIndex);
                if (OldLanguage != L.Get())
                {
                    L.Update();
                    Root.OnChangeSettings();
                    Root.RebuildMainPage();
                    Build();
                    Analytics.TrackEvent(
                        name: "[Changed] Language",
                        properties: new Dictionary <string, string>
                    {
                        { "Category", "Settings" },
                        { "Language", string.IsNullOrEmpty(Settings.Language) ? "default": Settings.Language }
                    }
                        );
                }
            };

            if (Width <= Height)
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new TableView
                        {
                            Root = new TableRoot
                            {
                                new TableSection(L["Github Account"])
                                {
                                    UserLabel,
                                    Friends,
                                },
                                new TableSection(L["Notifications"])
                                {
                                    AlphaFactory.MakeCircleImageCell
                                    (
                                        Text: L["Alert by Left Time"],
                                        Command: new Command(o => Root.Navigation.PushAsync(new AlphaLeftTimeSettingsPage()))
                                    ),
                                    AlphaFactory.MakeCircleImageCell
                                    (
                                        Text: L["Daily Alert"],
                                        Command: new Command(o => Root.Navigation.PushAsync(new AlphaDailyAlertSettingsPage()))
                                    )
                                },
                                new TableSection(L["Theme"])
                                {
                                    ThemeCell
                                },
                                new TableSection(L["Language"])
                                {
                                    LanguageCell
                                },
                                new TableSection(L["Information"])
                                {
                                    AlphaFactory.MakeCircleImageCell
                                    (
                                        ImageSource: Root.GetApplicationImageSource(),
                                        Text: L["keep.grass"],
                                        Command: new Command(o => Root.Navigation.PushAsync(AlphaFactory.MakeInfoPage()))
                                    ),
                                },
                            },
                        },
                    },
                };
            }
            else
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new StackLayout
                        {
                            Orientation     = StackOrientation.Horizontal,
                            Spacing         = 1.0,
                            BackgroundColor = Color.Gray,
                            Children        =
                            {
                                new TableView
                                {
                                    BackgroundColor = Color.White,
                                    Root            = new TableRoot
                                    {
                                        new TableSection(L["Github Account"])
                                        {
                                            UserLabel,
                                            Friends,
                                        },
                                        new TableSection(L["Theme"])
                                        {
                                            ThemeCell
                                        },
                                        new TableSection(L["Language"])
                                        {
                                            LanguageCell
                                        },
                                    },
                                },
                                new TableView
                                {
                                    BackgroundColor = Color.White,
                                    Root            = new TableRoot
                                    {
                                        new TableSection(L["Notifications"])
                                        {
                                            AlphaFactory.MakeCircleImageCell
                                            (
                                                Text: L["Alert by Left Time"],
                                                Command: new Command(o => Root.Navigation.PushAsync(new AlphaLeftTimeSettingsPage()))
                                            ),
                                            AlphaFactory.MakeCircleImageCell
                                            (
                                                Text: L["Daily Alert"],
                                                Command: new Command(o => Root.Navigation.PushAsync(new AlphaDailyAlertSettingsPage()))
                                            )
                                        },
                                        new TableSection(L["Information"])
                                        {
                                            AlphaFactory.MakeCircleImageCell
                                            (
                                                ImageSource: Root.GetApplicationImageSource(),
                                                Text: L["keep.grass"],
                                                Command: new Command(o => Root.Navigation.PushAsync(AlphaFactory.MakeInfoPage()))
                                            ),
                                        },
                                    },
                                },
                            },
                        },
                    },
                };
            }
            AlphaTheme.Apply(this);
            ApplyUser(Settings.UserName);
        }