public static DropboxStorageProviderUser FromFullAccount(FullAccount fullAccount) { return(CloudStorageProviderUserBase.Create <DropboxStorageProviderUser>(fullAccount.Name.DisplayName, fullAccount.Email, fullAccount.ProfilePhotoUrl)); }
private async void connect(object sender, DoWorkEventArgs e) { dbx = new DropboxClient(token); try { fullAccount = await dbx.Users.GetCurrentAccountAsync(); boxItems.Clear(); this.Invoke((MethodInvoker) delegate() { linfo.Text = "Name:" + fullAccount.Name.DisplayName + " Email:" + fullAccount.Email; listView1.Items.Clear(); }); var list = await dbx.Files.ListFolderAsync(path); foreach (var item in list.Entries.Where(i => i.IsFolder)) { DropBoxItem boxitem = new DropBoxItem(); boxitem.Name = item.Name; boxitem.IsDeleted = item.IsDeleted; boxitem.IsFile = item.IsFile; boxitem.IsFolder = item.IsFolder; boxitem.ParentShareFolderId = item.ParentSharedFolderId; boxitem.PathDisplay = item.PathDisplay; boxitem.PathLower = item.PathLower; boxitem.Tag = item; int imageindex = 0; ListViewItem listItem = new ListViewItem(boxitem.Name, imageindex); listItem.Tag = boxitem; this.Invoke((MethodInvoker) delegate() { listView1.Items.Add(listItem); }); boxItems.Add(boxitem); } foreach (var item in list.Entries.Where(i => i.IsFile)) { DropBoxItem boxitem = new DropBoxItem(); boxitem.Name = item.Name; boxitem.IsDeleted = item.IsDeleted; boxitem.IsFile = item.IsFile; boxitem.IsFolder = item.IsFolder; boxitem.ParentShareFolderId = item.ParentSharedFolderId; boxitem.PathDisplay = item.PathDisplay; boxitem.PathLower = item.PathLower; boxitem.Size = (int)(item.AsFile.Size / 8); boxitem.Tag = item; int imageindex = 1; ListViewItem listItem = new ListViewItem(boxitem.Name, imageindex); listItem.Tag = boxitem; listItem.SubItems.Add(boxitem.Size.ToString()); this.Invoke((MethodInvoker) delegate() { listView1.Items.Add(listItem); }); boxItems.Add(boxitem); } this.UseWaitCursor = false; } catch (Exception ex) { this.UseWaitCursor = false; MessageBox.Show(ex.Message); } }
public override void OnActionExecuting(ActionExecutingContext context) { try { TempData["Messager"] = TempData["Messager"]; var result = context.HttpContext.Session.GetString("userName"); if (!string.IsNullOrEmpty(result)) { //var _adminUserInfoService = CO2NET.SenparcDI.GetService<AdminUserInfoService>(); // this.AdminUser = _adminUserInfoService.GetUserInfo(result); } //var ctoken = context.HttpContext.Session.GetString("session"); //if (!string.IsNullOrEmpty(ctoken)) //{ // var er = _encryptionService.CommonDecrypt(ctoken); // var arr = result.Split("-"); // if (arr.Length == 3) // { // long ticks = 0; // Int64.TryParse(arr[1], out ticks); // this.Session = new SessionInfo // { // ClientKey = arr[2], // ExpireTime =new DateTime(ticks), // UserName = arr[0] // }; // } //} var fullSystemConfigCache = SenparcDI.GetService <FullSystemConfigCache>(); _fullSystemConfig = fullSystemConfigCache.Data; var fullAccountCache = SenparcDI.GetService <FullAccountCache>(); if (this.UserName != null) { FullAccount = fullAccountCache.GetObject(this.UserName); if (FullAccount != null) { //... } else { //用户不存在,发生严重异常 LogUtility.Account.Error($"发生严重错误,用户已登录,但缓存及数据库中不存在:{this.UserName}"); } } FullAccount = FullAccount ?? new FullAccount(); FullAccount.LastActiveTime = DateTime.Now; base.OnActionExecuting(context); } catch (Exception ex) { context.Result = RenderError(ex.Message, ex); } }