Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }