예제 #1
0
        /// <summary>
        ///  Update Source By ID
        /// </summary>
        /// <param name="vestorlyAuth">Vestorly Auth Token</param>
        /// <param name="id">ID of source to fetch</param>
        /// <param name="source">Source</param>
        /// <returns>Sourceresponse</returns>
        public Sourceresponse UpdateSourceByID(string vestorlyAuth, string id, SourceInput source)
        {
            String myPath = "/sources/{id}";

            if ("vestorlyAuth" == "vestorlyAuth")
            {
                if (("PUT" == "POST" || "PUT" == "PUT") && "SourcesApi" != "SessionsApi")
                {
                    myPath += "?vestorly_auth=" + vestorlyAuth;
                }
            }

            var _request = new RestRequest(myPath, Method.PUT);



            // verify the required parameter 'vestorlyAuth' is set
            if (vestorlyAuth == null)
            {
                throw new ApiException(400, "Missing required parameter 'vestorlyAuth' when calling UpdateSourceByID");
            }

            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling UpdateSourceByID");
            }

            // verify the required parameter 'source' is set
            if (source == null)
            {
                throw new ApiException(400, "Missing required parameter 'source' when calling UpdateSourceByID");
            }


            // add default header, if any
            foreach (KeyValuePair <string, string> defaultHeader in ApiInvoker.GetDefaultHeader())
            {
                _request.AddHeader(defaultHeader.Key, defaultHeader.Value);
            }

            _request.AddUrlSegment("format", "json");                       // set format to json by default
            _request.AddUrlSegment("id", ApiInvoker.ParameterToString(id)); // path (url segment) parameter

            if (vestorlyAuth != null && ("PUT" == "GET" || "PUT" == "DELETE" || "SourcesApi" == "SessionsApi"))
            {
                _request.AddParameter("vestorly_auth", ApiInvoker.ParameterToString(vestorlyAuth));             // query parameter
            }
            _request.AddParameter("application/json", ApiInvoker.Serialize(source), ParameterType.RequestBody); // http body (model) parameter


            // make the HTTP request
            IRestResponse response = restClient.Execute(_request);

            if (((int)response.StatusCode) >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UpdateSourceByID: " + response.Content);
            }
            return((Sourceresponse)ApiInvoker.Deserialize(response.Content, typeof(Sourceresponse)));
        }
예제 #2
0
        private async void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(SourceInput.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(TranslateInput.Text))
            {
                return;
            }

            var item = new Item(SourceInput.Text.Trim().ToLowerInvariant(), TranslateInput.Text.Trim().ToLowerInvariant());
            await _loader.AddAsync(new List <Item> {
                item
            });

            SourceInput.Text    = string.Empty;
            TranslateInput.Text = string.Empty;
            Count.Text          = $"{_loader.Count} item(s)";

            SourceInput.Focus();
        }
예제 #3
0
 private void SourceInput_GotFocus(object sender, RoutedEventArgs e)
 {
     SourceInput.Focus();
     SourceInput.SelectAll();
     e.Handled = true;
 }