private void SyncShares(ZPushAccount account) { using (SharedFoldersManager manager = Manage(account)) { Logger.Instance.Debug(this, "Starting sync for account {0}", account); if (account.IsShare) { Logger.Instance.Debug(this, "Account {0} is a share", account); manager.UpdateSharedStore(); } else { // Fetch the current shares ICollection <SharedFolder> shares = manager.GetCurrentShares(null); Logger.Instance.Trace(this, "AdditionalFolders_Sync: {0}", shares.Count); // Convert to dictionary Dictionary <SyncId, SharedFolder> dict = shares.ToDictionary(x => x.SyncId); Logger.Instance.Trace(this, "AdditionalFolders_Sync2: {0}", shares.Count); // Store any send-as properties FeatureSendAs sendAs = ThisAddIn.Instance.GetFeature <FeatureSendAs>(); sendAs?.UpdateSendAsAddresses(account, shares); // Store with the account account.SetFeatureData(this, KEY_SHARES, dict); } } }
public StoreTreeNode(SharedFoldersManager folders, GABHandler gab, GABUser user, string text, Dictionary <BackendId, SharedFolder> currentFolders) : base(text) { this._initialShares = currentFolders; this._feature = folders.Feature; this._gab = gab; this._user = user; // Create an empty current state. When loading the nodes, the shares will be added. This has the benefit of // cleaning up automatically any obsolote shares. this._currentShares = new Dictionary <BackendId, SharedFolder>(); ChildLoader = new UserFolderLoader(this, folders, user); ChildLoader.ReloadOnCloseOpen = true; HasCheckBox = false; // TODO: better icons, better way of handling this ImageIndex = user == GABUser.USER_PUBLIC ? 0 : 11; // Reloader _reloader = new KAnimator(); _reloader.Animation = Properties.Resources.TreeLoading; _reloader.Visible = false; _reloader.Click += (s, e) => { ChildLoader.Reload(); }; Control = _reloader; }
public SharedFoldersDialog(FeatureSharedFolders feature, ZPushAccount account, SyncId initial = null) { this._account = account; this._folders = feature.Manage(account); this._initialSyncId = initial; InitializeComponent(); // TODO: make a specialised class out of this this.kTreeFolders.Images = new OutlookImageList( "NewFolder", // Other "JunkEmailMarkAsNotJunk", // Inbox "GoDrafts", // Drafts "RecycleBin", // WasteBasket "ReceiveMenu", // SentMail "NewFolder", // Outbox "ShowTaskPage", // Task "ShowAppointmentPage", // Appointment "ShowContactPage", // Contact "NewNote", // Note "ShowJournalPage", // Journal "LastModifiedBy" // Store ).Images; // Add the email address to the title Text = string.Format(Text, account.Account.SmtpAddress); // Set up options ShowOptions(new KTreeNode[0]); // Set up user selector gabLookup.GAB = FeatureGAB.FindGABForAccount(account); }
public StoreTreeNode(SharedFoldersManager folders, GABHandler gab, GABUser user, string sendAsAddress, string text, Dictionary <BackendId, SharedFolder> currentFolders, bool isShared, bool showRemindersWholeStore) : base(text) { this._initialShares = currentFolders; // Patch in send as address foreach (SharedFolder share in _initialShares.Values) { if (string.IsNullOrWhiteSpace(share.SendAsAddress)) { share.SendAsAddress = sendAsAddress; } } this._feature = folders.Feature; this._featureSendAs = ThisAddIn.Instance.GetFeature <FeatureSendAs>(); this._account = folders.Account; this._gab = gab; this._user = user; this._sendAsAddress = sendAsAddress; this.IsReadOnly = false; this._isShared = isShared; // Create an empty current state. When loading the nodes, the shares will be added. This has the benefit of // cleaning up automatically any obsolote shares. this._currentShares = new Dictionary <BackendId, SharedFolder>(); ChildLoader = new UserFolderLoader(this, folders, user); ChildLoader.ReloadOnCloseOpen = true; // Can only open the whole store if it's supported and there's an email address, as that's needed to open it // However, if it's already opened, we can remove it without the email address HasCheckBox = folders.SupportsWholeStore && (!string.IsNullOrWhiteSpace(user.EmailAddress) || isShared); ApplyReadOnly(this, IsReadOnly); // TODO: better icons, better way of handling this ImageIndex = user == GABUser.USER_PUBLIC ? 0 : 11; // Reloader _reloader = new KAnimator(); _reloader.Animation = Properties.Resources.TreeLoading; _reloader.Visible = false; _reloader.Click += (s, e) => { ChildLoader.Reload(); }; Control = _reloader; // Set up sharing WantShare = isShared; ShowRemindersInitial = showRemindersWholeStore; ShowReminders = ShowRemindersInitial; }
private void AdditionalFolders_Sync(ZPushConnection connection) { using (SharedFoldersManager manager = Manage(connection.Account)) { Logger.Instance.Debug(this, "Starting sync for account {0}", connection.Account); // Fetch the current shares ICollection <SharedFolder> shares = manager.GetCurrentShares(null); Logger.Instance.Trace(this, "AdditionalFolders_Sync: {0}", shares.Count); // Convert to dictionary Dictionary <SyncId, SharedFolder> dict = shares.ToDictionary(x => x.SyncId); Logger.Instance.Trace(this, "AdditionalFolders_Sync2: {0}", shares.Count); // Store with the account connection.Account.SetFeatureData(this, KEY_SHARES, dict); } }
public UserFolderLoader(StoreTreeNode parent, SharedFoldersManager folders, GABUser user) : base(parent) { this._folders = folders; this.User = user; }