コード例 #1
0
        void HandleMasterNavigation(MasterNavigationMessage masterNavigation)
        {
            switch (masterNavigation.NavigationType)
            {
            case MasterNaviationType.ContactList:
                OpenContactList.Execute(null);
                break;

            case MasterNaviationType.QuoteList:
                OpenQuoteList.Execute(null);
                break;

            case MasterNaviationType.Logout:
                LogoutCommand.Execute(null);
                break;

            case MasterNaviationType.Quote:
                QuoteCommand.Execute(masterNavigation.NavigationData);
                break;

            case MasterNaviationType.ContactUs:
                ContactUsCommand.Execute(null);
                break;
            }
        }
コード例 #2
0
        public async void CallRowAction(RowAction action)
        {
            switch (action.ActionType)
            {
            case RowActionType.Favorite:
                FavoriteCommand.Execute(action.Parameter as Tweet);
                break;

            case RowActionType.Retweet:
                RetweetCommand.Execute(action.Parameter as Tweet);
                break;

            case RowActionType.Quote:
                QuoteCommand.Execute(action.Parameter as Tweet);
                break;

            case RowActionType.Reply:
                ReplyCommand.Execute(action.Parameter as Tweet);
                break;

            case RowActionType.TweetDetail:
                var tweetParameter = action.Parameter as TweetDetailParameter;

                TweetDetailCommand.Execute(tweetParameter);
                break;

            case RowActionType.UserDetail:
                var userParameter = action.Parameter as UserDetailParameter;

                UserDetailCommand.Execute(userParameter);
                break;

            case RowActionType.Search:
                var searchParameter = action.Parameter as SearchDetailParameter;
                SearchCommand.Execute(searchParameter);
                break;

            case RowActionType.Browse:
                BrowseCommand.Execute(action.Parameter.ToString());
                break;

            case RowActionType.Description:
                DescriptionDommand.Execute(action.Parameter as Tweet);
                break;

            case RowActionType.Delete:
                var tweet  = action.Parameter as Tweet;
                var client = AccountList.Where(q => q.UserInfomation.screen_name == tweet.user.screen_name).Select(q => q.TwitterClient).Single();
                await client.DestroyStatusAsync(tweet);

                break;

            case RowActionType.DirectMessage:
                var dmParameter = action.Parameter as DirectMessageDetailParameter;

                DirectMessageDetailCommand.Execute(dmParameter);
                break;

            case RowActionType.Share:
                break;

            case RowActionType.SavePreviewImage:
                Uri          uri    = action.Parameter as Uri;
                FolderPicker picker = new FolderPicker();
                picker.FileTypeFilter.Add(".png");
                picker.FileTypeFilter.Add(".jpg");
                picker.FileTypeFilter.Add(".bmp");
                picker.FileTypeFilter.Add(".gif");
                var folder = await picker.PickSingleFolderAsync();

                if (folder != null)
                {
                    HttpClient hClient = new HttpClient();
                    var        bytes   = await hClient.GetByteArrayAsync(uri);

                    var file = await folder.CreateFileAsync(DateTime.Now.ToString("yyyMMhhmmss") + ".png");

                    DataWriter writer = new DataWriter(await file.OpenAsync(FileAccessMode.ReadWrite));
                    writer.WriteBytes(bytes);
                    await writer.StoreAsync();

                    await writer.FlushAsync();

                    writer.DetachStream();

                    await NotificationAsync(new NotificationMessage
                    {
                        Message      = "画像を保存しました",
                        TweetMessage = Tweet.ZeroTweet
                    });
                }


                break;
            }
        }