public async Task <bool> LoadScenes(
            AdnReCapClient reCapClient)
        {
            _reCapClient = reCapClient;

            var rootNode = AddRootNode(
                "Photoscenes");

            var sceneListResponse = await
                                    _reCapClient.GetPhotosceneListAsync();

            if (!sceneListResponse.IsOk())
            {
                // We get Deserialization.Exception
                // if deleted scenes exist as Name
                // is left empty

                if (sceneListResponse.Error.Msg !=
                    "Deserialization.Exception")
                {
                    OnLogReCapError(sceneListResponse.Error);

                    return(false);
                }
            }

            foreach (var scene in sceneListResponse.Photoscenes)
            {
                if (!scene.Deleted)
                {
                    var node = new ReCapTreeItem(
                        scene,
                        Properties.Resources.file);

                    rootNode.AddNode(node);

                    Expand();
                }
            }

            List <Task> taskList = new List <Task>();

            foreach (var node in RootNode.Children)
            {
                taskList.Add(RetrieveSceneInfoAndUpdateNode(
                                 node.Photoscene.PhotosceneId));
            }

            //await Task.WhenAll(taskList);

            return(true);
        }
Exemplo n.º 2
0
        public ReCapSceneProgressNotifier(
            AdnReCapClient client,
            string photosceneId,
            int pollingPeriod = 1000)
        {
            _worker        = null;
            _client        = client;
            _photosceneId  = photosceneId;
            _pollingPeriod = pollingPeriod;

            _syncCtrl = new Control();
            _syncCtrl.CreateControl();
        }
Exemplo n.º 3
0
        private async void bLogin_Click(object sender, EventArgs e)
        {
            bool isNetworkAvailable =
                NetworkInterface.GetIsNetworkAvailable();

            if (!isNetworkAvailable)
            {
                LogError("Network Error \n" +
                         "Check your network connection and try again...");

                return;
            }

            //Already login? -> do a refresh
            if (_isLoggedIn)
            {
                _isLoggedIn = await _connector.DoRefreshAsync();
            }
            else
            {
                _connector = new AdnOAuthConnector(
                    UserSettings.OAUTH_URL,
                    UserSettings.CONSUMER_KEY,
                    UserSettings.CONSUMER_SECRET);

                _connector.LoginViewMode = LoginViewModeEnum.iFrame;

                _connector.OnError += OnLoginError;

                _isLoggedIn = await _connector.DoLoginAsync();
            }

            if (_isLoggedIn)
            {
                bLogout.Enabled = true;

                this.Text = "ADN ReCap Demo - Logged as "
                            + _connector.UserName;

                _tbLog.Text = string.Empty;

                LogMessage("Logged in as " + _connector.UserName, true, string.Empty);

                _reCapClient = new AdnReCapClient(
                    UserSettings.RECAP_URL,
                    UserSettings.RECAP_CLIENTID,
                    _connector.ConsumerKey,
                    _connector.ConsumerSecret,
                    _connector.AccessToken,
                    _connector.AccessTokenSecret);

                var versionResponse = await _reCapClient.GetVersionAsync();

                if (!versionResponse.IsOk())
                {
                    LogReCapError(versionResponse.Error);
                }
                else
                {
                    LogMessage("Service version: " +
                               versionResponse.Version);
                }

                var timeResponse = await _reCapClient.GetServerTimeAsync();

                if (!timeResponse.IsOk())
                {
                    LogReCapError(timeResponse.Error);
                }
                else
                {
                    LogMessage("Server time: " +
                               timeResponse.Date.ToLongDateString() + " - " +
                               timeResponse.Date.ToLongTimeString());
                }

                var res = await LoadScenes();
            }
            else
            {
                LogError("Authentication failed...");
            }
        }