示例#1
0
        private ToastText CreateTextblock(string text)
        {
            var textblock = new ToastText(0, _textBlocks.Count * Height / 4 - Height / 1.3f, text, Height / 7, CreateColor(255, 255, 255));

            _textBlocks.Add(textblock);
            return(textblock);
        }
示例#2
0
        private async void menuFlyoutItemMediaFromClipboard_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var image = await Clipboard.GetContent().GetBitmapAsync();

                var stream = await image.OpenReadAsync();

                var    size   = stream.Size;
                byte[] bytes  = new byte[size];
                var    reader = new DataReader(stream.GetInputStreamAt(0));
                await reader.LoadAsync((uint)size);

                reader.ReadBytes(bytes);



                var media = new PostMedia();
                media.Data     = bytes;
                media.FileName = DateTime.Now.ToString("yyyyMMddhhmmss");

                viewModel.SetPostImageCommand.Execute(media);
            }
            catch (Exception)
            {
                ToastText text = new ToastText("クリップボードの取得に失敗しました", ToastTemplateType.ToastText01);
                text.Show();
            }
        }
        public void Toast(string msg)
        {
            ToastText.Text    = msg;
            ToastText.Opacity = 1.0;
            ToastEdge.Opacity = 1.0;
            var anim = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(4)));

            ToastText.BeginAnimation(TextBlock.OpacityProperty, anim);
            var anim2 = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(4)));

            ToastEdge.BeginAnimation(TextBlock.OpacityProperty, anim);
        }
示例#4
0
    private void Awake()
    {
        // Check if instance already exists
        if (Instance == null)
        {
            // if not, set instance to this
            Instance = this;
        }
        else if (Instance != this)
        {
            // Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        // Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);
    }
示例#5
0
        private async void menuFlyoutItemMediaFromCamera_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var         camUI = new CameraCaptureUI();
                StorageFile file  = await camUI.CaptureFileAsync(CameraCaptureUIMode.Photo);

                if (file != null)
                {
                    await SetPostImageAsync(file);
                }
            }
            catch (Exception)
            {
                ToastText text = new ToastText("カメラの起動に失敗しました", ToastTemplateType.ToastText01);
                text.Show();
            }
        }
示例#6
0
        private async void menuFlyoutItemMediaFromLibrary_Click(object sender, RoutedEventArgs e)
        {
            try{
                FileOpenPicker openPicker = new FileOpenPicker();
                openPicker.ViewMode = PickerViewMode.Thumbnail;
                openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                openPicker.FileTypeFilter.Add(".jpg");
                openPicker.FileTypeFilter.Add(".jpeg");
                openPicker.FileTypeFilter.Add(".png");

                StorageFile file = await openPicker.PickSingleFileAsync();

                if (file != null)
                {
                    await SetPostImageAsync(file);
                }
            }
            catch (Exception)
            {
                ToastText text = new ToastText("メディアの取得に失敗しました", ToastTemplateType.ToastText01);
                text.Show();
            }
        }
示例#7
0
        private void MessengerRegister()
        {
            Messenger.Default.Register <string>(this, "GetAuthorizedUrl", str =>
            {
                authenticationBrowser.NavigateUrl(str);
            });

            Messenger.Default.Register <bool>(this, "AuthorizedCompleted", async bln =>
            {
                if (bln)
                {
                    authenticationBrowser.Close();
                }
                else
                {
                    MessageDialog dialog = new MessageDialog("ピンコードが違います", "エラー");
                    await dialog.ShowAsync();
                    authenticationBrowser.Close();
                    Authentication();
                }
            });

            Messenger.Default.Register <string>(this, "BrowsUrl", str =>
            {
                PreviewBrowserFlyout flyout = new PreviewBrowserFlyout();
                flyout.Show(new Uri(str), Window.Current.Bounds.Width * 2 / 3);
            });

            Messenger.Default.Register <SearchDetail>(this, "ShowSearchDetail", sd =>
            {
                SearchDetailFlyout flyout = new SearchDetailFlyout(viewModel);
                flyout.onAddTimeline     += (timelineName, searchWord, account) =>
                {
                    var timeline = new SearchTimeline(account, timelineName, viewModel.GetNowTab().TabTitle, searchWord, viewModel.Setting, viewModel.CallTimelineAction, viewModel.CallRowAction);
                    viewModel.AddTimelineCommand.Execute(timeline);
                };
                flyout.ShowIndependent();
            });

            Messenger.Default.Register <UserDetail>(this, "ShowUserDetail", ud =>
            {
                UserDetailFlyout flyout = new UserDetailFlyout(viewModel, () =>
                {
                    viewModel.DirectMessageDetailCommand.Execute(new DirectMessageDetailParameter(ud.OwnerAccount.UserInfomation.screen_name, new DirectMessage
                    {
                        recipient_screen_name = viewModel.UserDetail.UserInformation.screen_name
                    }));
                    DirectMessageFlyout d_flyout = new DirectMessageFlyout(this.viewModel);
                    d_flyout.ShowIndependent();
                });
                flyout.ShowIndependent();
            });

            Messenger.Default.Register <TweetDetail>(this, "ShowTweetDetail", td =>
            {
                TweetDetailFlyout flyout = new TweetDetailFlyout(viewModel);
                flyout.ShowIndependent();
            });


            Messenger.Default.Register <bool>(this, "InternalNotification", async tweet =>
            {
                notificationBarStoryboard.Begin();
                if (viewModel.Setting.IsSoundEnable)
                {
                    mediaElementNotification.Play();
                }
            });

            Messenger.Default.Register <bool>(this, "ToastNotification", async tweet =>
            {
                ToastText toast = new ToastText(viewModel.NotifyMessage.Message, Windows.UI.Notifications.ToastTemplateType.ToastText01);
                toast.Show();
            });

            Messenger.Default.Register <NotificationState>(this, "ChangeNotificationState", state =>
            {
            });

            Messenger.Default.Register <PostStatusBase>(this, "OnTweetBegin", status =>
            {
            });
            Messenger.Default.Register <PostStatusBase>(this, "OnTweetFailed", status =>
            {
            });
            Messenger.Default.Register <PostStatusBase>(this, "OnTweetCompleted", status =>
            {
            });
            Messenger.Default.Register <HttpRequestException>(this, "OnHttpGetError", e =>
            {
            });
            Messenger.Default.Register <HttpRequestException>(this, "OnHttpPostError", e =>
            {
            });
            Messenger.Default.Register <HttpRequestException>(this, "OnUserStreamHttpError", e =>
            {
            });
            Messenger.Default.Register <HttpRequestException>(this, "OnFollowStreamHttpError", e =>
            {
            });
            Messenger.Default.Register <TimelineBase>(this, "EditTimeline", timeline =>
            {
                EditTimelineFlyout flyout = new EditTimelineFlyout(viewModel);
                flyout.ShowIndependent();
            });
            Messenger.Default.Register <TimelineBase>(this, "DeleteTimeline", timeline =>
            {
                ChangeTimelineSize(new Size(Window.Current.Bounds.Width, Window.Current.Bounds.Height));
            });

            Messenger.Default.Register <TimelineTab>(this, "EditTimelineTab", tab =>
            {
                EditTabFlyout flyout = new EditTabFlyout(viewModel);
                flyout.ShowIndependent();
            });

            Messenger.Default.Register <TimelineTab>(this, "DeleteTimelineTab", tab =>
            {
            });

            Messenger.Default.Register <string>(this, "DeletePostImage", str =>
            {
            });
            Messenger.Default.Register <int>(this, "SetPostTextCursor", pos =>
            {
                if (timelineState == TimelineState.MultiTimeline)
                {
                    textPost.Select(pos, 0);
                }
                else
                {
                    textPostBottom.Select(pos, 0);
                }
            });

            Messenger.Default.Register <TimelineBase>(this, "AddTimeline", timeline =>
            {
                ChangeTimelineSize(new Size(Window.Current.Bounds.Width, Window.Current.Bounds.Height));
            });

            Messenger.Default.Register <DirectMessage>(this, "ShowDirectMessageDetail", dm =>
            {
                DirectMessageFlyout flyout = new DirectMessageFlyout(this.viewModel);
                flyout.ShowIndependent();
            });

            Messenger.Default.Register <TimelineTab>(this, "ChangeTab", tab =>
            {
                ChangeTimelineSize(new Size(Window.Current.Bounds.Width, Window.Current.Bounds.Height));
            });
        }