コード例 #1
0
        private async Task ExecuteAsync(AuthorizeNotification authorizeNotification)
        {
            var authorizePopup = new AuthorizePopup();
            var account        = await authorizePopup.ShowAsync();

            authorizeNotification.Result = account;
        }
コード例 #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            Frame.BackStack.Clear();
            Frame.ForwardStack.Clear();

            var applicationView = ApplicationView.GetForCurrentView();

            applicationView.TitleBar.BackgroundColor =
                ((SolidColorBrush)Application.Current.Resources["TitleBarBackgroundBrush"]).Color;
            applicationView.TitleBar.ButtonBackgroundColor =
                ((SolidColorBrush)Application.Current.Resources["TitleBarButtonBackgroundBrush"]).Color;
            applicationView.TitleBar.ButtonForegroundColor =
                ((SolidColorBrush)Application.Current.Resources["TitleBarButtonForegroundBrush"]).Color;
            applicationView.TitleBar.ButtonInactiveBackgroundColor =
                ((SolidColorBrush)Application.Current.Resources["TitleBarButtonInactiveBackgroundBrush"]).Color;
            applicationView.TitleBar.ButtonInactiveForegroundColor =
                ((SolidColorBrush)Application.Current.Resources["TitleBarButtonInactiveForegroundBrush"]).Color;

            await(Resources["InitialAnimation"] as Storyboard).BeginAsync();

            var authorizePopup = new AuthorizePopup();

            while (true)
            {
                await Task.Delay(500);

                var account = await authorizePopup.ShowAsync();

                if (account == null)
                {
                    continue;
                }

                AdvancedSettingService.AdvancedSetting.MuteClients = new ObservableCollection <string>();
                AdvancedSettingService.AdvancedSetting.MuteUsers   = new ObservableCollection <string>();
                AdvancedSettingService.AdvancedSetting.MuteWords   = new ObservableCollection <string>();

                AdvancedSettingService.AdvancedSetting.Accounts = new ObservableCollection <AccountSetting>();
                var accountSetting = new AccountSetting
                {
                    AccessToken       = account.AccessToken,
                    AccessTokenSecret = account.AccessTokenSecret,
                    ConsumerKey       = account.ConsumerKey,
                    ConsumerSecret    = account.ConsumerSecret,
                    ScreenName        = account.ScreenName,
                    UserId            = account.UserId,
                    Platform          = account.Service == "Twitter"
                        ? SettingSupport.PlatformEnum.Twitter
                        : SettingSupport.PlatformEnum.Mastodon,
                    Instance = account.Instance,

                    Column = new ObservableCollection <ColumnSetting>
                    {
                        new ColumnSetting
                        {
                            Action      = SettingSupport.ColumnTypeEnum.Home,
                            AutoRefresh = false,
                            AutoRefreshTimerInterval = 60.0,
                            Filter                = "()",
                            Name                  = "Home",
                            Parameter             = string.Empty,
                            Streaming             = true,
                            Index                 = 0,
                            DisableStartupRefresh = false,
                            FetchingNumberOfTweet = 100,
                            Identifier            = DateTime.Now.Ticks
                        },
                        new ColumnSetting
                        {
                            Action      = SettingSupport.ColumnTypeEnum.Mentions,
                            AutoRefresh = false,
                            AutoRefreshTimerInterval = 180.0,
                            Filter                = "()",
                            Name                  = "Mentions",
                            Parameter             = string.Empty,
                            Streaming             = false,
                            Index                 = 1,
                            DisableStartupRefresh = false,
                            FetchingNumberOfTweet = 40,
                            Identifier            = DateTime.Now.Ticks + 1
                        },
                        new ColumnSetting
                        {
                            Action      = SettingSupport.ColumnTypeEnum.DirectMessages,
                            AutoRefresh = false,
                            AutoRefreshTimerInterval = 180.0,
                            Filter                = "()",
                            Name                  = "DirectMessages",
                            Parameter             = string.Empty,
                            Streaming             = false,
                            Index                 = 2,
                            DisableStartupRefresh = false,
                            FetchingNumberOfTweet = 40,
                            Identifier            = DateTime.Now.Ticks + 2
                        },
                        new ColumnSetting
                        {
                            Action      = SettingSupport.ColumnTypeEnum.Events,
                            AutoRefresh = false,
                            AutoRefreshTimerInterval = 180.0,
                            Filter                = "()",
                            Name                  = "Events",
                            Parameter             = string.Empty,
                            Streaming             = false,
                            Index                 = 3,
                            DisableStartupRefresh = false,
                            FetchingNumberOfTweet = 100,
                            Identifier            = DateTime.Now.Ticks + 3
                        },
                        new ColumnSetting
                        {
                            Action      = SettingSupport.ColumnTypeEnum.Favorites,
                            AutoRefresh = false,
                            AutoRefreshTimerInterval = 180.0,
                            Filter                = "()",
                            Name                  = "Favorites",
                            Parameter             = string.Empty,
                            Streaming             = false,
                            Index                 = 4,
                            DisableStartupRefresh = false,
                            FetchingNumberOfTweet = 40,
                            Identifier            = DateTime.Now.Ticks + 4
                        }
                    },
                    IsEnabled = true
                };
                if (accountSetting.Platform == SettingSupport.PlatformEnum.Mastodon)
                {
                    accountSetting.Column.Add(new ColumnSetting
                    {
                        Action      = SettingSupport.ColumnTypeEnum.Federated,
                        AutoRefresh = false,
                        AutoRefreshTimerInterval = 180.0,
                        Filter                = "()",
                        Name                  = "Federated",
                        Parameter             = string.Empty,
                        Streaming             = true,
                        Index                 = 5,
                        DisableStartupRefresh = false,
                        FetchingNumberOfTweet = 40,
                        Identifier            = DateTime.Now.Ticks + 5
                    });
                }

                AdvancedSettingService.AdvancedSetting.Accounts.Add(accountSetting);

                try
                {
                    await AdvancedSettingService.AdvancedSetting.SaveToAppSettings();
                }
                catch
                {
                }

                break;
            }

            Frame.Navigate(typeof(MainPage), "");
        }