예제 #1
0
        public void ShareOnFacebook(InkCanvas canvas)
        {
            Canvas = canvas;
            var imageStream = new MemoryStream();

            ExportService.ExportWithoutSaving(canvas, ImageFormat.Jpeg, imageStream);

            if (string.IsNullOrWhiteSpace(AuthService.FacebookAccessToken))
            {
                if (BrowserWindow?.IsVisible ?? false)
                {
                    return;
                }

                BrowserWindow = new BrowserView(FacebookAPI.FacebookAuthenticationUri);
                BrowserWindow.FacebookConnected += (s, e) =>
                {
                    var args = e as ConnectedEventArgs;
                    AuthService.FacebookAccessToken = args.ConnectionToken;
                    BrowserWindow.Close();
                    GetFacebookCaption(imageStream);
                };

                BrowserWindow.Show();
                return;
            }

            GetFacebookCaption(imageStream);
        }