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


C# LiveConnectClient.UploadAsync方法代码示例

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


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

示例1: btnUploadDirectory_Click

        private void btnUploadDirectory_Click(object sender, RoutedEventArgs e)
        {
            //Show folder picker...
            var dialog = new System.Windows.Forms.FolderBrowserDialog();
            dialog.ShowDialog();
            //END Show folder picker...

            //Get a recusive list of all files...
            if (dialog.SelectedPath == "")
            {
                System.Windows.MessageBox.Show("No folder selected.");
                return;
            }
            string[] files = Directory.GetFiles(dialog.SelectedPath, "*.*", SearchOption.AllDirectories);

            foreach (string file in files)
            {
                txtRaw.Text += file + "\r\n";
                LiveConnectClient client = new LiveConnectClient(Properties.session);

                client.UploadCompleted += this.ConnectClient_UploadCompleted;
                var stream = default(Stream);
                stream = File.OpenRead(file);
                client.UploadAsync(Properties.UltiDriveFolderID + "/files", file, stream, stream);
                stream.Close();
                //System.Windows.MessageBox.Show(file);
            }
            //END Get a recursive list of all files...
        }
开发者ID:shafe123,项目名称:UltiDrive,代码行数:29,代码来源:TestingWindow.xaml.cs

示例2: UploadFile

        public static bool UploadFile(string guid, string filePath)
        {
            validateSession();
            try
            {
                LiveConnectClient client = new LiveConnectClient(Properties.session);

                client.UploadCompleted += UltiDrive.SkyDrive.Utilities.ConnectClient_UploadCompleted;
                var stream = default(Stream);
                stream = File.OpenRead(filePath);
                string directoryName = Path.GetDirectoryName(filePath) + "\\";
                client.UploadAsync(Properties.UltiDriveFolderID + "/files", directoryName + guid, stream, stream);

                //System.Windows.MessageBox.Show(stream.ToString());
                //stream.Close();
                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine("SkyDriveApi.UploadFile() failed. --> " + e.ToString());
                return false;
            }
        }
开发者ID:shafe123,项目名称:UltiDrive,代码行数:23,代码来源:SkyDriveApi.cs

示例3: btnUploadFile_Click

        private void btnUploadFile_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog picker = new Microsoft.Win32.OpenFileDialog();
            picker.Filter = "All Files (*.*)|*.*";
            picker.ShowDialog();

            string filePath = picker.FileName;

            if (filePath != "")
            {
                LiveConnectClient liveClient = new LiveConnectClient(Properties.session);
                liveClient.UploadCompleted += this.ConnectClient_UploadCompleted;
                var stream = default(Stream);
                stream = File.OpenRead(filePath);
                liveClient.UploadAsync("folder.6f717ff8a3b1a691.6F717FF8A3B1A691!192/files", filePath, stream, stream);
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("You didn't select a file.");
            }
        }
开发者ID:shafe123,项目名称:UltiDrive,代码行数:21,代码来源:TestingWindow.xaml.cs


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