public long AlbumSelector()
        {
            var albums = this.api.Photo.GetAlbums(new VkNet.Model.RequestParams.PhotoGetAlbumsParams {
            });

            dialogManager.DisplayMessage(albums);
            dialogManager.DisplayMessage("# of desired album: ");

            if (int.TryParse(dialogManager.Ask(), out int id))
            {
                return((id >= 0 && id < albums.Count) ?
                       albums[id].Id :
                       AlbumSelector());
            }
            else
            {
                return(AlbumSelector());
            }
        }
Ejemplo n.º 2
0
        public void OpenCodePage()
        {
            string url = $"https://oauth.vk.com/authorize?client_id={settings.ClientId}&" +
                         $"display=page&scope=photos&redirect_uri={settings.RedirectUri}&response_type=code&v=5.103";

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                url = url.Replace("&", "^&");
                Process.Start(new ProcessStartInfo("cmd", $"/c start {url}")
                {
                    CreateNoWindow = true
                });

                dialogManager.DisplayMessage("code = ");
            }
            else
            {
                throw new NotSupportedException();
            }
        }