コード例 #1
0
        protected IResultCache <FWSord> GetChildren(bool inclFolders, bool inclDocs)
        {
            IResultCache <FWSord> myObjects = null;
            IResultCache <FWSord> mySords   = sordsValue;

            if (inclFolders && inclDocs)
            {
                myObjects = mySords;
            }
            else
            {
                myObjects = inclFolders ? foldersValue : documentsValue;
                if (myObjects == null)
                {
                    myObjects = FilterObjects(mySords, inclFolders, inclDocs);
                }
            }

            if (myObjects == null)
            {
                if (this.Id >= 1)
                {
                    myObjects = ClassFactory.NewFindChildrenCache <FWSord>(this, inclFolders, inclDocs);
                }
                else
                {
                    // new folder does not have children
                    myObjects = new FWResultCacheList <FWSord>();
                }
            }

            return(myObjects);
        }
コード例 #2
0
        /// <summary>
        /// This function shows how to list sub items of a given folder.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnSubItems_Click(object sender, EventArgs e)
        {
            // get parent folder
            FWFolder parentFolder = conn.Content.GetFolder(edObjId.Text);

            // get sub folders
            IResultCache <FWSord> subFolders = parentFolder.Folders;

            FormListbox.ShowList("Sub Folders", subFolders);

            // list documents
            IResultCache <FWSord> docs = parentFolder.Documents;

            FormListbox.ShowList("Documents", docs);

            // list all sub items (folders + documents)
            IResultCache <FWSord> sords = parentFolder.Sords;

            FormListbox.ShowList("Sub Items", sords);
        }
コード例 #3
0
        protected IResultCache <FWSord> FilterObjects(IResultCache <FWSord> mySords, bool inclFolders, bool inclDocs)
        {
            IResultCache <FWSord> ret = null;

            if (mySords != null)
            {
                List <FWSord> myList = new List <FWSord>(mySords.CountEstimated);
                foreach (FWSord s in mySords)
                {
                    if (
                        (inclDocs && (s is FWDocument)) ||
                        (inclFolders && (s is FWFolder))
                        )
                    {
                        myList.Add(s);
                    }
                }
                ret = new FWResultCacheList <FWSord>(myList);
            }
            return(ret);
        }
コード例 #4
0
ファイル: SelectUser.cs プロジェクト: ThomasEcherer/elo
        private void timer1_Tick(object sender, EventArgs e)
        {
            // put the current search string and the cache object provided
            // by the onThreadingTimer into a local variable to
            // avoid synchronization
            String       currentNameFilter = nameFilter;
            IResultCache currentUserNames  = userNames;

            // Reset the handover variable, so nothing will be done,
            // if onThreadingTimer has no new cache object and this function is
            // called the next time.
            userNames = null;

            // If onThreadingTimer provides a new cache object...
            if (currentUserNames != null)
            {
                // ... compare it with the current cache object
                IResultCache oldUserNames = userListView1.ObjectsCache;
                bool         eq           = oldUserNames.Count == currentUserNames.Count;
                for (int i = 0; eq && i < oldUserNames.Count; i++)
                {
                    UserName un1 = (UserName)oldUserNames[i];
                    UserName un2 = (UserName)currentUserNames[i];
                    eq = un1.id == un2.id;
                }

                // if the cache content has changed ...
                if (!eq)
                {
                    // ... update the controls
                    userListView1.SelectAll(false);
                    userListView1.ObjectsCache = currentUserNames;

                    // select all entries, if the search string is not empty
                    userListView1.SelectAll(currentNameFilter != null && currentNameFilter.Length != 0);
                }
            }
        }
コード例 #5
0
ファイル: SelectUser.cs プロジェクト: ThomasEcherer/elo
        /// <summary>
        /// This function refreshes the dialog contents, if the
        /// search string was changed.
        /// </summary>
        /// <param name="stateInfo">ignored</param>
        /// <remarks>This function is called by the System.Threading.Timer object
        /// and is executed in a background thread. Thus, it cannot access the
        /// user interface directly.</remarks>
        protected virtual void onThreadingTimer(object stateInfo)
        {
            // If there is already a thread executing this function,
            // skip this block.
            if (System.Threading.Monitor.TryEnter(syncTimerMonitor))
            {
                try
                {
                    // put the current search string into a local variable to
                    // avoid synchronization
                    String currentNameFilter = nameFilter;
                    if (currentNameFilter == null)
                    {
                        currentNameFilter = "";
                    }

                    // if search string has changed
                    if (!currentNameFilter.Equals(lastNameFilter))
                    {
                        // evaluate a new cache object and assign it to a variable
                        // that will be read in the timer1_Tick function
                        userNames = Conn.MasterData.UserNames.Find(currentNameFilter + "*", ckUsers.Checked, ckGroups.Checked, hiddenUserIdsVal);

                        // memorize the current search string for the next call
                        lastNameFilter = currentNameFilter;
                        if (lastNameFilter == null)
                        {
                            lastNameFilter = "";
                        }
                    }
                }
                finally
                {
                    System.Threading.Monitor.Exit(syncTimerMonitor);
                }
            }
        }
コード例 #6
0
 public void ResetChildren()
 {
     foldersValue = documentsValue = sordsValue = null;
 }
コード例 #7
0
 public InventoryDialogService(IUserDataStorage storage, IInputParserService parser, IResultCache resultCache, IInventoryEmailService emailService)
 {
     _services = new Services
     {
         Storage      = storage,
         Parser       = parser,
         ResultCache  = resultCache,
         EmailService = emailService
     };
 }