当前位置: 首页>>代码示例>>C#>>正文


C# LiveConnectClient.CopyAsync方法代码示例

本文整理汇总了C#中Microsoft.Live.LiveConnectClient.CopyAsync方法的典型用法代码示例。如果您正苦于以下问题:C# LiveConnectClient.CopyAsync方法的具体用法?C# LiveConnectClient.CopyAsync怎么用?C# LiveConnectClient.CopyAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Live.LiveConnectClient的用法示例。


在下文中一共展示了LiveConnectClient.CopyAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenameLiveFolder

            public async Task<Boolean> RenameLiveFolder(String OldName, String NewName)
            {

                try
                {
                    LiveConnectClient uploadClient = new LiveConnectClient(meClient.Session);
                    LiveOperationResult result = await uploadClient.GetAsync("/me/skydrive/files");
        
                    dynamic files = result.Result;
                    List<object> data = (List<object>)files.data;
                    foreach (dynamic item in data)
                    {
                     
                        if (item.name == OldName)
                        {

                            try
                            {

                                LoadProfile(NewName);
                                
                                await uploadClient.CopyAsync(OldName, NewName);
                                await uploadClient.DeleteAsync(OldName);
                                
                                return true;
                            }
                            catch (NullReferenceException)
                            {
                                return false;
                            }
                            catch (FileNotFoundException)
                            {
                                return false;
                            }
                            catch (ArgumentOutOfRangeException)
                            {
                                return false;
                            }
                        }
                    }
                }
                catch (NullReferenceException)
                {
                }
                catch (LiveConnectException)
                {
                }

                return false;
            }
开发者ID:Naox305,项目名称:Framework786,代码行数:50,代码来源:CloudMethods.cs

示例2: RunButton_Click

        private async void RunButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Validate parameters
                string path = pathTextBox.Text;
                string destination = destinationTextBox.Text;
                string requestBody = requestBodyTextBox.Text;
                var scope = (authScopesComboBox.SelectedValue as ComboBoxItem).Content as string;
                var method = (methodsComboBox.SelectedValue as ComboBoxItem).Content as string;

                // acquire auth permissions
                var authClient = new LiveAuthClient();
                var authResult = await authClient.LoginAsync(new string[] { scope });
                if (authResult.Session == null)
                {
                    throw new InvalidOperationException("You need to login and give permission to the app.");
                }

                var liveConnectClient = new LiveConnectClient(authResult.Session);
                LiveOperationResult operationResult = null;
                switch (method)
                {
                    case "GET":
                        operationResult = await liveConnectClient.GetAsync(path);
                        break;
                    case "POST":
                        operationResult = await liveConnectClient.PostAsync(path, requestBody);
                        break;
                    case "PUT":
                        operationResult = await liveConnectClient.PutAsync(path, requestBody);
                        break;
                    case "DELETE":
                        operationResult = await liveConnectClient.DeleteAsync(path);
                        break;
                    case "COPY":
                        operationResult = await liveConnectClient.CopyAsync(path, destination);
                        break;
                    case "MOVE":
                        operationResult = await liveConnectClient.MoveAsync(path, destination);
                        break;
                }

                if (operationResult != null)
                {
                    Log("Operation succeeded: \r\n" + operationResult.RawResult);
                }
            }
            catch (Exception ex)
            {
                Log("Got error: " + ex.Message);
            }
        }
开发者ID:d20021,项目名称:LiveSDK-for-Windows,代码行数:53,代码来源:ApiLab.xaml.cs


注:本文中的Microsoft.Live.LiveConnectClient.CopyAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。